$npx -y skills add ai4protein/VenusFactory2 --skill ncbi_geneQuery NCBI Gene via E-utilities/Datasets API. Search by symbol/ID, retrieve gene info (RefSeqs, GO, locations, phenotypes), batch lookups, for gene annotation and functional analysis.
| 1 | # NCBI Gene Database |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | NCBI Gene is a comprehensive database integrating gene information from diverse species. It provides nomenclature, reference sequences (RefSeqs), chromosomal maps, biological pathways, genetic variations, phenotypes, and cross-references to global genomic resources. **In this project the agent exposes 3 download tools**: fetch gene data by ID or symbol (Datasets API), and batch lookup by symbols. For finer control, `ncbi_operations.py` also provides E-utilities download/query functions (esearch, esummary, efetch) and additional batch operations. 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 | This skill should be used when working with gene data including searching by gene symbol or ID, retrieving gene sequences and metadata, analyzing gene functions and pathways, or performing batch gene lookups. |
| 10 | |
| 11 | ## Quick Start |
| 12 | |
| 13 | The skill provides: |
| 14 | 1. **Project modules** in `src/tools/database/ncbi/`: `fetch_gene_data.py` (Datasets API), `query_gene.py` (E-utilities), `batch_gene_lookup.py` (batch operations), `ncbi_operations.py` (query/download operations); gene download functions re-exported via package. |
| 15 | 2. References: `references/api_reference.md`, `references/common_workflows.md` |
| 16 | |
| 17 | NCBI provides two main APIs: |
| 18 | - **Datasets API** — Optimized for gene data retrieval; used by `download_ncbi_gene_by_id` and `download_ncbi_gene_by_symbol` tools |
| 19 | - **E-utilities** — Full-featured API for complex queries; used by the esearch/esummary/efetch programmatic functions |
| 20 | |
| 21 | ### Agent Tools (Download Only) |
| 22 | |
| 23 | | Tool name | Arguments | Purpose | |
| 24 | |-----------|-----------|---------| |
| 25 | | `download_ncbi_gene_by_id` | `gene_id`, `out_path` | Download gene data by NCBI Gene ID (Datasets API) to JSON | |
| 26 | | `download_ncbi_gene_by_symbol` | `symbol`, `taxon`, `out_path` | Download gene data by symbol and organism (Datasets API) to JSON | |
| 27 | | `download_ncbi_batch_lookup_by_symbols` | `gene_symbols`, `organism`, `out_path` | Batch lookup multiple genes by symbols to JSON | |
| 28 | |
| 29 | Also available as general NCBI tools (useful in gene workflows): |
| 30 | |
| 31 | | Tool name | Arguments | Purpose | |
| 32 | |-----------|-----------|---------| |
| 33 | | `download_ncbi_sequence` | `ncbi_id`, `out_path`, `db` (optional) | Download NCBI sequence by accession (FASTA) | |
| 34 | | `download_ncbi_metadata` | `ncbi_id`, `out_path`, `db`, `rettype` (optional) | Download NCBI metadata (GenBank/XML) | |
| 35 | | `download_ncbi_blast` | `sequence`, `out_path`, `program`, `database`, etc. | Submit BLAST search and download XML | |
| 36 | |
| 37 | ### Project Modules (Programmatic Use) |
| 38 | |
| 39 | | Capability | Function | Module | Purpose | |
| 40 | |------------|----------|--------|---------| |
| 41 | | Fetch by ID | `fetch_gene_by_id(gene_id, api_key)` | fetch_gene_data.py | Datasets API: gene data as dict | |
| 42 | | Fetch by symbol | `fetch_gene_by_symbol(symbol, taxon, api_key)` | fetch_gene_data.py | Datasets API: gene data as dict | |
| 43 | | Fetch multiple | `fetch_multiple_genes(gene_ids, api_key)` | fetch_gene_data.py | Datasets API: multiple genes at once | |
| 44 | | Taxon lookup | `get_taxon_id(taxon_name)` | fetch_gene_data.py | Convert name to NCBI taxon ID | |
| 45 | | E-util search | `esearch(query, retmax, api_key)` | query_gene.py | Search Gene DB, returns Gene IDs | |
| 46 | | E-util summary | `esummary(gene_ids, api_key)` | query_gene.py | Get document summaries by Gene IDs | |
| 47 | | E-util fetch | `efetch(gene_ids, retmode, api_key)` | query_gene.py | Fetch full gene records (XML/text) | |
| 48 | | Search+summarize | `search_and_summarize(query, organism, max_results, api_key)` | query_gene.py | Convenience: search + display | |
| 49 | | Batch search | `batch_esearch(queries, organism, api_key)` | batch_gene_lookup.py | Search multiple symbols → ID map | |
| 50 | | Batch summary | `batch_esummary(gene_ids, api_key, chunk_size)` | batch_gene_lookup.py | Summaries in chunks | |
| 51 | | Batch by IDs | `batch_lookup_by_ids(gene_ids, api_key)` | batch_gene_lookup.py | Structured gene data by IDs | |
| 52 | | Batch by symbols | `batch_lookup_by_symbols(gene_symbols, organism, api_key)` | batch_gene_lookup.py | Structured gene data by symbols | |
| 53 | | Query: by ID | `query_ncbi_gene_by_id(gene_id)` | ncbi_operations.py | Returns rich JSON in memory | |
| 54 | | Query: by symbol | `query_ncbi_gene_by_symbol(symbol, taxon)` | ncbi_operations.py | Returns rich JSON in memory | |
| 55 | | Query: esearch | `query_ncbi_gene_esearch(query, retmax)` | ncbi_operations.py | Returns rich JSON in memory | |
| 56 | | Query: esummary | `query_ncbi_gene_esummary(gene_ids)` | ncbi_operations.py | Returns rich JSON in memory | |
| 57 | | Query: efetch | `query_ncbi_gene_efetch(gene_ids, retmode)` | ncbi_operations.py | Returns rich JSON in memory | |
| 58 | | Query: batch search | `query_ncbi |