A high-performance, concurrent downloader for GenBank and RefSeq genome assemblies from NCBI FTP servers. Written in Rust.
- Fast concurrent downloads: Uses multi-threading to download multiple genomes simultaneously.
- Resumable downloads: Supports resume on interruption with retry logic.
- NCBI directory structure: Organizes downloaded genomes in the same directory layout as NCBI FTP (
GCA/XXX/XXX/XXX/). - Map file generation: Creates
.mapfiles mapping sequence accessions to taxonomy IDs and metadata. - Flexible filtering: Accepts a pre-filtered
assembly_summary.txtfile (NCBI assembly summary format). - Configurable sequence types: Download genomic, RNA, CDS, etc. (default:
genomic). - Verbose mode with progress bars: Detailed output with real-time progress bars for each download and overall progress (
-vflag). - Automatic chunked downloads for large genomes: Files larger than 100 MB are automatically split into chunks and downloaded in parallel for faster transfer.
- MD5 checksum verification: Downloads are verified against NCBI's
md5checksums.txtto ensure data integrity.
- Rust toolchain (stable, ≥ 1.70). Install via rustup.
git clone <repository-url>
cd genbankGenomeDownload
cargo build --releaseThe executable will be placed at target/release/genbankGenomeDownload.
genbankGenomeDownload -i assembly_summary.txt -o ./ -vgenbankGenomeDownload [OPTIONS] -i <FILE>
OPTIONS:
-i, --input <FILE> Input assembly_summary.txt file (pre‑filtered genbank assembly format)
-o, --output <DIR> Output directory for downloaded genomes [default: .]
--threads <NUM> Number of concurrent download threads [default: 8]
--fna <TYPES> Comma‑separated sequence types to download
(e.g., genomic,rna,cds_from_genomic) [default: genomic]
--overwrite Overwrite existing files instead of skipping them
-v, --verbose Verbose output
-h, --help Print help
-V, --version Print version
- Obtain an
assembly_summary.txtfile from NCBI (e.g., fromftp://ftp.ncbi.nlm.nih.gov/genomes/genbank/assembly_summary_genbank.txt). - Filter it to keep only the assemblies you need (by taxid, assembly level, etc.).
- Run the downloader:
genbankGenomeDownload -i select_assembly_summary.txt -o ./ -vThe tool will:
- Parse the input file,
- Create the NCBI‑style directory tree under
./, - Download the
.fna.gzfiles, - Decompress them to
.fna, - Generate a
.mapfile for each FASTA with accession‑to‑taxid mappings.
genbankGenomeDownload/
├── Cargo.toml # Project metadata and dependencies
├── src/
│ ├── main.rs # CLI entry point, argument parsing
│ ├── assembly.rs # Assembly record parsing (assembly_summary.txt)
│ └── downloader.rs # Core download logic, threading, retry, map generation
├── GCA/ # Example/downloaded genome directories (NCBI layout)
└── test/
└── test.genbank # Test data
reqwest(blocking) – HTTP client for downloadingclap– command‑line argument parsingflate2– gzip decompressionregex– regular expressions for parsing FASTA headersindicatif– progress bars and spinners
- Concurrency: Default 8 threads, adjustable with
--threads. - Retry logic: Up to 10 retries with exponential backoff.
- Resume support: If a
.gzfile exists partially, the download resumes from the last byte.
- Input file must follow the NCBI
assembly_summary.txttab‑delimited format (GenBank or RefSeq). - Output directory structure mirrors the NCBI FTP path after
/all/(e.g.,GCA/022/175/585/GCA_022175585.2_ASM2217558v2).
This project is provided under the terms of the GPL-3.0 license (same as the original Perl script).
Xiangzhi Liang (xiang_zhi_@126.com)
Date: 2026‑04‑04
- Based on
centrifuge‑downloadby Florian Breitwieser. - Uses NCBI’s public FTP servers for genome data.