$npx -y skills add ai4protein/VenusFactory2 --skill ncbi_clinvarQuery NCBI ClinVar for variant clinical significance. Search by gene/condition/CLNSIG, interpret pathogenicity, use E-utilities or FTP; annotate VCFs. Use project tools in src.tools.database.ncbi.
| 1 | # ClinVar Database (NCBI) |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | ClinVar is NCBI's archive of relationships between human genetic variants and phenotypes, with supporting evidence. **In this project the agent exposes one compound download tool** (`download_ncbi_clinvar_variants`) that searches by term, retrieves variant IDs, and saves results to JSON. For finer control, `ncbi_operations.py` also provides atomic ClinVar E-utilities download/query functions (esearch, esummary, efetch), and the low-level module `ncbi_clinvar.py` provides term builders and FTP helpers. All download/query functions return rich JSON `{status, file_info/content, content_preview, biological_metadata, execution_context}`. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | - Searching for variants by gene, condition, or clinical significance |
| 10 | - Interpreting clinical significance (pathogenic, benign, VUS); see `references/clinical_significance.md` |
| 11 | - Accessing ClinVar via E-utilities (esearch, esummary, efetch) or FTP |
| 12 | - Understanding review status (star ratings) and conflicting interpretations |
| 13 | - Annotating variant call sets with clinical significance; see `references/data_formats.md` for VCF/XML/tab formats |
| 14 | |
| 15 | ## Quick Start |
| 16 | |
| 17 | The skill provides: |
| 18 | 1. **Project modules** in `src/tools/database/ncbi/`: `ncbi_clinvar.py` (atomic E-utilities, term builder, FTP), `ncbi_operations.py` (query/download operations); ClinVar download functions re-exported via package. |
| 19 | 2. References: `references/api_reference.md`, `references/clinical_significance.md`, `references/data_formats.md` |
| 20 | |
| 21 | ### Agent Tools (Download Only) |
| 22 | |
| 23 | | Tool name | Arguments | Purpose | |
| 24 | |-----------|-----------|---------| |
| 25 | | `download_ncbi_clinvar_variants` | `term`, `out_path`, `retmax` (optional, default 20) | Search ClinVar variants by term and save results to JSON | |
| 26 | |
| 27 | Also available as general NCBI tools (not ClinVar-specific but useful in ClinVar workflows): |
| 28 | |
| 29 | | Tool name | Arguments | Purpose | |
| 30 | |-----------|-----------|---------| |
| 31 | | `download_ncbi_sequence` | `ncbi_id`, `out_path`, `db` (optional) | Download NCBI sequence by accession (FASTA) | |
| 32 | | `download_ncbi_metadata` | `ncbi_id`, `out_path`, `db`, `rettype` (optional) | Download NCBI metadata (GenBank/XML) | |
| 33 | | `download_ncbi_blast` | `sequence`, `out_path`, `program`, `database`, etc. | Submit BLAST search and download XML | |
| 34 | |
| 35 | ### Project Modules (Programmatic Use) |
| 36 | |
| 37 | | Capability | Function | Module | Purpose | |
| 38 | |------------|----------|--------|---------| |
| 39 | | Build search term | `build_clinvar_term(gene, clinical_significance, condition, chr, variant_name, exclude_conflicting, raw_term)` | ncbi_clinvar.py | Build E-utilities query string | |
| 40 | | High-level search | `query_clinvar(term, retmax, retstart, retmode, api_key)` | ncbi_clinvar.py | Search ClinVar, return esearch response text | |
| 41 | | Get summaries | `get_clinvar_summary(variation_ids, retmode, api_key)` | ncbi_clinvar.py | Get variant summaries by IDs | |
| 42 | | Full records | `fetch_clinvar_records(variation_ids, rettype, retmode, api_key)` | ncbi_clinvar.py | Fetch full XML/VCV records | |
| 43 | | Parse IDs | `parse_esearch_ids(esearch_response_text)` | ncbi_clinvar.py | Extract Variation IDs from esearch JSON | |
| 44 | | Parse count | `parse_esearch_count(esearch_response_text)` | ncbi_clinvar.py | Extract total count from esearch JSON | |
| 45 | | FTP URL | `get_clinvar_ftp_url(key)` | ncbi_clinvar.py | Get FTP URL by key (variant_summary, vcf_grch38, xml_latest, etc.) | |
| 46 | | FTP download | `download_clinvar_ftp(url_or_key, out_dir, filename)` | ncbi_clinvar.py | Download file from ClinVar FTP | |
| 47 | | Atomic esearch | `clinvar_esearch(term, retmax, retstart, retmode, api_key, sort)` | ncbi_clinvar.py | Raw esearch response text | |
| 48 | | Atomic esummary | `clinvar_esummary(id_list, retmode, api_key)` | ncbi_clinvar.py | Raw esummary response text | |
| 49 | | Atomic efetch | `clinvar_efetch(id_list, rettype, retmode, api_key)` | ncbi_clinvar.py | Raw efetch response text | |
| 50 | | Query: esearch | `query_ncbi_clinvar_esearch(term, retmax, retstart, retmode)` | ncbi_operations.py | Returns rich JSON in memory | |
| 51 | | Query: esummary | `query_ncbi_clinvar_esummary(id_list, retmode)` | ncbi_operations.py | Returns rich JSON in memory | |
| 52 | | Query: efetch | `query_ncbi_clinvar_efetch(id_list, rettype, retmode)` | ncbi_operations.py | Returns rich JSON in memory | |
| 53 | | Query: variants | `query_ncbi_clinvar_variants(term, retmax)` | ncbi_operations.py | Compound: esearch → returns rich JSON | |
| 54 | | Download: esearch | `download_ncbi_clinvar_esearch(term, out_path, retmax, retstart, retmode)` | ncbi_operations.py | Save esearch results to file | |
| 55 | | Download: esummary | `download_ncbi_clinvar_esummary(id_list, out_path, retmode)` | ncbi_operations.py | Save esummary results to file | |
| 56 | | Download: efetch | `download_ncb |