
fetch-genome
by katalyzeAI
AI-powered tool for designing species-specific dsRNA sequences for agricultural pest control
SKILL.md
name: fetch-genome description: Download CDS sequences from NCBI RefSeq for a target species
Fetch Genome Skill
When to Use This Skill
Use at the start of dsRNA design workflow when you need coding sequences (CDS) for a pest species from NCBI.
Data Storage Structure
Input data (cached, reusable) goes in data/{assembly}/:
genome.fasta- Downloaded CDS sequencesgenome_metadata.json- Assembly info, download date
Analysis outputs go in output/{run}/ where {run} is created by the
full-workflow skill as YYYYMMDD-HHMMSS-{species_slug}.
IMPORTANT: Check Cache First
Before downloading, always check if the genome data already exists:
ls data/*/genome_metadata.json 2>/dev/null | head -5
If you find a matching assembly for your species, skip the download and use the existing data. Read the metadata to confirm it's the right species:
cat data/{assembly}/genome_metadata.json
Instructions
Step 1: Resolve Species to TaxID
Use fetch_url to query NCBI Taxonomy:
https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=taxonomy&term={species}&retmode=json
Parse JSON response: esearchresult.idlist[0] is the TaxID
Step 2: Find RefSeq Assembly
Use fetch_url:
https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=assembly&term=txid{TAXID}[Organism:exp]+AND+latest_refseq[filter]&retmode=json
Get assembly ID from esearchresult.idlist[0]
Step 3: Get Assembly Accession and FTP Path
Use fetch_url:
https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=assembly&id={ASSEMBLY_ID}&retmode=json
Extract from response:
- Assembly accession:
result[assembly_id].assemblyaccession(e.g., "GCF_000001215.4") - FTP path:
result[assembly_id].ftppath_refseq
Step 4: Check if Already Downloaded
CRITICAL: Check if this assembly is already cached:
if [ -f "data/{ASSEMBLY_ACCESSION}/genome.fasta" ]; then
echo "CACHED: Genome already exists"
else
echo "NOT CACHED: Need to download"
fi
If cached, skip to Step 8 (literature search).
Step 5: Create Data Directory
mkdir -p data/{ASSEMBLY_ACCESSION}
mkdir -p data/{ASSEMBLY_ACCESSION}/figures
Use the assembly accession (e.g., "GCF_000001215.4") as the folder name.
Step 6: Download CDS FASTA
Use execute to download:
FTP_PATH="https://ftp.ncbi.nlm.nih.gov/..." # from step 3
ASSEMBLY_NAME=$(basename $FTP_PATH)
curl -L -o data/{ASSEMBLY_ACCESSION}/genome.fasta.gz \
"${FTP_PATH}/${ASSEMBLY_NAME}_cds_from_genomic.fna.gz"
gunzip data/{ASSEMBLY_ACCESSION}/genome.fasta.gz
If _cds_from_genomic.fna.gz returns 404, try _rna.fna.gz instead.
Step 7: Verify Download
Use execute:
grep -c "^>" data/{ASSEMBLY_ACCESSION}/genome.fasta
Should show thousands of sequences (typically 10,000-20,000 for insects)
Step 8: Save Metadata
Use write_file to save data/{ASSEMBLY_ACCESSION}/genome_metadata.json:
{
"species": "{species_name}",
"taxid": "{TAXID}",
"assembly_id": "{ASSEMBLY_ID}",
"assembly_accession": "{ASSEMBLY_ACCESSION}",
"ftp_path": "{FTP_PATH}",
"download_date": "{ISO_DATE}",
"sequence_count": {COUNT},
"total_length": {LENGTH}
}
Step 9: Search Literature (Automatic)
NOTE: Literature search results are analysis outputs, NOT cached input data.
Save them to output/{run}/literature_search.json, not in data/.
Automatically search PubMed for RNAi studies on this species:
pubmed_search_articles
query: "{species}" AND (RNAi OR dsRNA OR "RNA interference" OR "gene silencing")
max_results: 50
IMPORTANT: When saving results, you MUST extract gene names from each paper's
title and abstract. See dsrna_agent/skills/literature-search/SKILL.md for the
list of gene patterns to look for (vATPase, chitin synthase, acetylcholinesterase, etc.)
Save to output/{run}/literature_search.json in this format:
[
{
"pmid": "12345678",
"title": "...",
"gene_names": ["vATPase", "chitin synthase"],
...
}
]
The gene_names field is REQUIRED for downstream scripts to give literature
support scores to candidate genes.
This step does NOT require user confirmation - literature search is automatic.
Step 10: Present Results
Output this summary to the user:
## Fetch Genome Complete
**Species:** {species_name} (TaxID: {taxid})
**Assembly:** {assembly_accession}
**Status:** {DOWNLOADED or CACHED}
**Summary:**
- {sequence_count} CDS sequences
- Total length: {total_length} bp
**Literature:** Found {paper_count} RNAi papers, top genes: {gene_list}
**Cached Input Data:**
- `data/{assembly_accession}/genome.fasta`
- `data/{assembly_accession}/genome_metadata.json`
**Analysis Output:**
- `output/{run}/literature_search.json`
---
Proceed to identify-genes? (yes/no)
Expected Output
Cached input data (in data/{assembly}/):
genome.fasta- Downloaded CDS sequencesgenome_metadata.json- TaxID, assembly ID, stats
Analysis outputs (in output/{run}/):
literature_search.json- PubMed search results with extracted gene names
Available Tools
fetch_url- Query NCBI APIsexecute- Run curl/gunzip commandswrite_file- Save metadatapubmed_search_articles- Search literature
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です