Audience: Omics Data Scientists, Bioinformaticians, and Research Teams
Theme: From Download Manifests to Verified FASTQ Assets
Once studies have been identified, accession systems understood, and metadata evaluated, the next step is acquiring the sequencing data.
Data download transforms study selection and metadata assets into locally accessible sequencing files that can be validated, organized, transferred, and assembled into downstream reference datasets. A reproducible acquisition workflow requires more than simply downloading files. Researchers must understand where files reside, how they are accessed, how downloads can be resumed, and how file integrity can be verified.
Learning Objectives
By the end of this chapter, you will be able to:
Select appropriate repositories for sequencing data download.
Reuse the CDI data acquisition Conda environment.
Install and verify SRA Toolkit commands.
Build download manifests from metadata assets.
Retrieve sequencing files through ENA and NCBI workflows.
Organize downloaded files into a reproducible project structure.
Verify file presence, file size, checksums, and sample counts.
Generate FASTQ inventories for downstream validation.
Why a Data Download System Matters
Metadata acquisition tells us what data exist.
The Data Download System retrieves the actual sequencing files required for downstream analysis.
flowchart TD
A[Metadata Assets]
--> B[Download Manifest]
B --> C[Repository Selection]
C --> D[Download Execution]
D --> E[Integrity Verification]
E --> F[FASTQ Inventory]
F --> G[Data Validation System]
The Data Download System begins with metadata assets generated in Chapter 04 and ends with a documented inventory of downloaded files.
Environment Reuse
The CDI Data Acquisition System uses a single Conda environment throughout the workflow.
conda activate cdi-data-acquisition
This avoids unnecessary environment switching and ensures that metadata acquisition, data download, validation, and dataset assembly operate within a consistent software environment.
CDI Data Acquisition Environment
The environment used throughout this book is defined as:
Successful execution confirms that the shared CDI data acquisition environment is ready for metadata acquisition, data download, and data validation workflows.
Common Sources of Downloadable Data
Public repositories provide access to a variety of downloadable file types.
Repository
Typical Data
Common Role in This System
SRA
Raw sequencing reads
Run accession source and SRA Toolkit download
ENA
Raw sequencing reads and FASTQ URLs
Direct FASTQ retrieval and checksum validation
GEO
Processed and supplementary data
Study-level context and supplementary files
MGnify
Processed microbiome outputs
Processed microbiome reference outputs
GWAS Catalog
Summary statistics and study information
Association study discovery and summary statistics
For large public sequencing datasets, the two most important download sources are usually ENA and NCBI SRA.
Common Download Formats
Researchers frequently encounter:
FASTQ
FASTA
BAM
CRAM
TSV
CSV
Metadata spreadsheets
For raw sequencing acquisition, the most common target output is FASTQ. In microbiome, RNA-seq, metagenomics, and many other NGS workflows, FASTQ files serve as the starting point for downstream quality control and analysis.
Download Manifest
A download manifest represents the authoritative list of files to retrieve from a public repository.
The manifest is generated from metadata assets acquired in Chapter 04 and serves as the primary input to the Data Download System.
A simple accession manifest may contain only run identifiers:
SRR3725378
SRR3725379
SRR3725382
However, download workflows are often more reliable when manifests contain file-level information.
The manifest defines what should be downloaded, where files are located, and how completeness and integrity will later be verified.
Download Strategy
The CDI Data Acquisition System uses a staged download strategy that validates repository workflows before initiating large-scale data retrieval.
Metadata Assets
↓
Download Manifest
↓
Create Test Manifest
↓
Repository Validation
├── ENA
└── NCBI/SRA
↓
Production Download
This approach reduces risk by ensuring that:
Metadata have been translated correctly into download manifests.
Repository access is functioning as expected.
Download scripts operate correctly.
Retrieved files can be validated before large-scale acquisition.
Bandwidth and storage resources are used efficiently.
Rather than immediately downloading an entire dataset, a small representative subset is first used to validate repository access and download workflows.
download-manifest.tsv
↓
test-manifest.tsv
↓
Repository Validation
↓
Production Download
Successful test downloads provide confidence that the acquisition workflow is functioning correctly before scaling to the complete dataset.
This strategy is particularly valuable for large studies containing hundreds or thousands of sequencing runs, where failed downloads can consume substantial time, storage, and bandwidth resources.
Only after successful repository validation should production downloads be initiated.
Download Tools
Several tools are commonly used to retrieve public omics datasets.
Different repositories expose data through different interfaces, and no single tool is optimal for every situation. The CDI Data Acquisition System therefore supports both ENA-based FASTQ retrieval and NCBI SRA workflows.
SRA Toolkit
The SRA Toolkit is commonly used for retrieving sequencing data from the NCBI Sequence Read Archive.
Tool
Purpose
prefetch
Download SRA files
fasterq-dump
Convert SRA files to FASTQ
vdb-validate
Validate downloaded SRA files
The SRA Toolkit is particularly useful when direct FASTQ files are unavailable or when repository-specific SRA formats are preferred.
FTP and HTTPS Utilities
ENA and other repositories often expose direct file links that can be retrieved with common command-line tools.
Tool
Purpose
wget
Download files from HTTP, HTTPS, or FTP links
curl
Retrieve files and web resources
md5sum
Verify MD5 checksums on Linux
md5
Verify MD5 checksums on macOS
Within this guide, ENA serves as the preferred FASTQ download source because it provides direct access to sequencing files together with file-level metadata such as checksums.
Cloud-Based Access
Some repositories also provide access through cloud infrastructure and object storage systems.
Cloud-based acquisition can reduce transfer times for large datasets and may simplify integration with downstream analysis environments.
Cloud transfer workflows are introduced later in the book after local download, validation, and inventory-generation concepts have been established.
Local Download
↓
Data Validation
↓
Cloud Storage and Transfer
↓
Reference Dataset Assembly
Installing SRA Toolkit
Activate the shared CDI data acquisition environment:
conda activate cdi-data-acquisition
Install SRA Toolkit if it is not already available:
If the commands return version information, the toolkit is available in the active environment and ready for use.
Checking Download Utilities
The Data Download System relies on several command-line utilities for file retrieval and validation.
Verify that curl and wget are available:
curl--versionwget--version
If wget is missing, install it within the shared environment:
conda install -c conda-forge wget
Verify checksum utilities.
Linux:
md5sum--version
macOS:
which md5
The exact checksum command differs across operating systems, but the purpose remains the same: verify that downloaded files match the expected repository checksums.
Recommended Directory Structure
Downloaded files should be organized systematically to support validation, inventory generation, cloud transfer, and dataset assembly.
A consistent directory structure improves reproducibility, simplifies validation, and creates a clear handoff between components of the CDI Data Acquisition System.
The accession count becomes one of the first validation checks performed during data download and validation workflows.
A smaller test manifest can then be generated from the production manifest for repository validation.
download-manifest.tsv
↓
test-manifest.tsv
↓
Repository Validation
↓
Production Download
System Scripts
The CDI Data Download System is implemented through a set of reusable Bash scripts.
scripts/bash/
├── 05a-build-download-manifest.sh
│ └── Create production and test manifests
│
├── 05b-download-ena-fastq.sh
│ └── Download FASTQ files from ENA
│
├── 05c-download-ncbi-sra.sh
│ └── Download and convert SRA accessions
│
├── 05d-verify-downloads.sh
│ └── Verify downloaded FASTQ assets
│
└── 05e-build-fastq-inventory.sh
└── Generate FASTQ inventory reports
These scripts operate on the metadata assets, manifests, and directory structure established in the previous sections and provide a reproducible implementation of the Data Download System.
Before executing large-scale downloads, it is good practice to validate the environment, repository access, and download workflow using a small test manifest. The following sections demonstrate this validation process before scaling to production acquisition.
Testing and Verifying the Download System
Before initiating production downloads, validate the workflow using a small test manifest derived from the full download manifest.
The CDI Data Acquisition System uses test downloads to verify:
Repository access
Download manifests
Download scripts
Directory structure
File validation procedures
Inventory generation workflows
download-manifest.tsv
↓
test-manifest.tsv
↓
Repository Validation
↓
Production Download
Preview the test manifest:
head data/manifests/test-manifest.tsv
Count test records:
wc-l data/manifests/test-manifest.tsv
Example output:
6
The test manifest should contain a small representative subset of the full dataset.
ENA Validation Workflow
Execute the ENA download workflow:
bash scripts/bash/05b-download-ena-fastq.sh
Example output:
Production URL count:
188
Creating test URL list...
Test URL count:
6
Downloading test files...
Successful execution retrieves a small collection of FASTQ files and validates repository access before large-scale acquisition.
This preliminary verification provides confidence that the acquisition workflow is functioning correctly.
Rather than immediately downloading hundreds of sequencing runs, validating the workflow on a small representative subset helps confirm that repository access, directory structure, software installation, and validation procedures are functioning as expected.
Once the workflow has been verified, the same approach can be scaled to the complete download manifest through the CDI Data Download System scripts.
The following sections describe two common strategies for large-scale data acquisition: direct FASTQ retrieval from ENA and SRA-based retrieval using the NCBI SRA Toolkit.
Repository Selection Strategy
The recommended strategy is to use NCBI for study discovery and metadata acquisition, then use ENA for direct FASTQ retrieval whenever suitable file URLs and checksums are available.
Study Discovery
↓
NCBI
↓
Metadata Acquisition
↓
ENA
↓
Download Planning
↓
Data Download
Scenario
Preferred Repository
Metadata discovery
NCBI
FASTQ download with direct URLs
ENA
Checksum validation
ENA
Missing FASTQ URLs
NCBI SRA Toolkit
SRA-native retrieval
NCBI SRA Toolkit
Controlled-access data
Repository-specific process
Supplementary processed files
GEO, ENA, project archive, or journal supplement
This strategy avoids treating all repositories as interchangeable. Each repository contributes differently to the overall acquisition system.
Throughout this guide, ENA serves as the preferred FASTQ download source, while NCBI provides study discovery, metadata retrieval, accession relationships, and alternative download pathways when direct FASTQ access is unavailable.
Download Workflow 1: ENA Direct FASTQ Download
ENA is often the preferred source for sequencing data acquisition because it provides direct FASTQ download links together with file-level metadata and checksums.
which allows interrupted downloads to resume when supported by the repository.
Because ENA provides direct FASTQ files and associated checksums, it serves as the preferred download pathway throughout this guide whenever suitable metadata are available.
Download Workflow 2: NCBI SRA Retrieval
When direct FASTQ files are unavailable or SRA-native retrieval is preferred, the NCBI SRA Toolkit workflow can be used.
This test-first strategy helps prevent accidental large-scale downloads before repository access, storage locations, and software installation have been validated.
For large datasets, FASTQ compression can require substantial time and storage resources. Utilities such as pigz can accelerate compression through parallel processing.
Regardless of repository source, downloaded files should be validated before entering downstream workflows.
Common post-download checks include:
Expected file counts
Checksum validation
Metadata consistency
Sample completeness
FASTQ readability
The next section focuses on checksum verification, one of the most important safeguards against incomplete or corrupted downloads.
Checksum Verification
Whenever repositories provide checksums, downloaded files should be verified before proceeding to downstream analyses.
ENA commonly distributes MD5 checksums alongside FASTQ download links.
cd data/raw/fastqmd5sum-c\../../manifests/ena-md5.txt \|tee ../../logs/checksum.logcd-
macOS:
md5 SRR3725378.fastq.gz
The exact command varies by operating system, but the underlying principle remains the same:
Repository Checksum
↓
Local Checksum
↓
Match
↓
Validated File
Checksum verification helps detect:
Incomplete downloads
Corrupted files
Interrupted transfers
Unexpected file modifications
A file should only proceed to downstream validation and analysis if its checksum matches the value reported by the repository.
FASTQ Inventory Generation
A FASTQ inventory provides a reproducible record of sequencing assets acquired during the download process.
The inventory serves as the bridge between data acquisition and data validation by documenting the files that were successfully retrieved from public repositories.
Recommended output:
data/
└── inventory/
└── fastq-inventory.tsv
The inventory workflow is implemented through:
bash scripts/bash/05e-build-fastq-inventory.sh
The script scans the FASTQ directory and generates a tabular inventory containing file names and file sizes.
The expected number of FASTQ files, total storage requirements, and sample coverage can all be assessed from the inventory before formal validation begins.
This illustrates why inventory generation is important: expected file counts depend on sequencing layout and must be verified before downstream analysis.
The FASTQ inventory becomes a key input to the Data Validation System introduced in Chapter 06.
End-to-End Download Example
Suppose a healthy reference microbiome project identifies hundreds of eligible samples across multiple public studies.
The acquisition workflow proceeds as follows:
Candidate Studies
↓
Metadata Acquisition
↓
Download Manifest
↓
Test Manifest
↓
Repository Validation
↓
Production Download
↓
Download Verification
↓
FASTQ Inventory
↓
Data Validation System
At this stage, the objective is not biological analysis. The objective is to acquire a complete, validated, and reproducible sequencing dataset suitable for downstream validation and reference dataset assembly.
Common Challenges
Researchers frequently encounter:
Interrupted downloads
Missing files
Incomplete metadata
Repository-specific formats
Storage limitations
Slow transfer speeds
Inconsistent file naming
Paired-end files distributed across multiple URLs
Checksum mismatches
Unexpected differences between metadata and downloaded files
Planning for these challenges improves acquisition reliability and reduces the likelihood of downstream data quality issues.
Reproducible Download Workflows
Every download process should be documented.
Important records include:
Repository source
Accessions used
Download manifests
Download date
Commands executed
File counts
Checksum results
Validation results
Inventory reports
The goal is not only to download files, but also to make the acquisition process auditable, reproducible, and repeatable.
Summary
The Data Download System transforms metadata assets into validated sequencing files ready for downstream quality assessment.
Metadata Assets
↓
Download Manifest
↓
Test Manifest
↓
Repository Validation
↓
Production Download
↓
Download Verification
↓
FASTQ Inventory
↓
Data Validation System
A reliable download system should answer five questions:
What should be downloaded?
Where should it be downloaded from?
Has the download workflow been validated?
How can downloaded files be verified?
What inventory records the acquired sequencing assets?
System Validation
The CDI Data Download System was validated using both ENA and NCBI acquisition workflows.
Validation included:
Metadata-driven manifest generation
Production and test manifest creation
ENA direct FASTQ retrieval
NCBI SRA retrieval and FASTQ conversion
Download verification
FASTQ inspection using SeqKit
FASTQ inventory generation
Validation was performed using representative human gut microbiome studies spanning both single-end and paired-end sequencing designs:
PRJNA322554 (single-end amplicon sequencing)
PRJNA802976 (paired-end amplicon sequencing)
The validation workflow successfully generated sequencing files, verification reports, and inventory records from publicly available microbiome datasets.
Looking Ahead
After sequencing files have been downloaded, verified, and inventoried, the next challenge is determining whether the acquired dataset is complete, internally consistent, and suitable for downstream analysis.
In the next chapter, we implement the Data Validation System to evaluate:
File integrity
Sample completeness
Metadata consistency
Expected file counts
Dataset readiness
before proceeding to cloud transfer, reference dataset assembly, and downstream analysis.
Data Download
↓
FASTQ Inventory
↓
Data Validation
↓
Cloud Storage and Transfer
↓
Reference Dataset Assembly