Download a reference genome with NCBI datasets
Pull any reference genome assembly from NCBI by accession or taxon with the datasets CLI, then unzip it to a ready-to-use FASTA.
Prerequisites
- NCBI datasets CLI installed (`conda install -c conda-forge ncbi-datasets-cli`)
- An assembly accession or taxon name
1Download the assembly package
Ask datasets for a single assembly by its accession and restrict the package to the genome sequence with --include genome. The tool bundles everything into ncbi_dataset.zip in the current directory.
datasets download genome accession GCF_000005845.2 --include genomeExpected output
Collecting 1 genome record[s] [================================================] 100% 1/1
Downloading: ncbi_dataset.zip 1.35MB done2Unzip and locate the FASTA
Extract the archive into a named directory so multiple downloads never collide, then find the genomic FASTA nested under ncbi_dataset/data. The .fna file is the reference sequence you feed to downstream tools.
unzip ncbi_dataset.zip -d ecoli
find ecoli -name '*.fna'Expected output
Archive: ncbi_dataset.zip
inflating: ecoli/README.md
inflating: ecoli/ncbi_dataset/data/assembly_data_report.jsonl
inflating: ecoli/ncbi_dataset/data/GCF_000005845.2/GCF_000005845.2_ASM584v2_genomic.fna
inflating: ecoli/ncbi_dataset/data/dataset_catalog.json
ecoli/ncbi_dataset/data/GCF_000005845.2/GCF_000005845.2_ASM584v2_genomic.fnaTroubleshooting
datasets: command not found
The CLI is not installed or not on your PATH. Install it from the conda-forge channel: `conda install -c conda-forge ncbi-datasets-cli`.
You have a species name, not an accession
Query by taxon and let NCBI pick the reference assembly: `datasets download genome taxon "Escherichia coli" --reference --include genome`.