Download public sequence data from SRA

· 3 min read · Analysis Notes

Download public sequence data from SRA

Download public sequence data from SRA

Download Public Sequence Data from SRA

TL;DR: Use sra-toolkit (specifically prefetch + fasterq-dump) to download raw sequencing data. For 10x single-cell data, ensure you split files correctly or download original BAMs if available.


What is SRA?

The Sequence Read Archive (SRA) is the largest public repository of raw sequencing data, hosted by NCBI. To reproduce a study or reanalyze data, you often need to start here.

Key Tools:

  • SRA Toolkit: Official CLI suite (prefetch, fasterq-dump, fastq-dump).
  • SRA Explorer: Third-party web tool for finding direct download links.
  • Kingfisher: Fast, multi-source downloader.

Method 1: Official SRA Toolkit (Recommended)

1. Installation

Conda (Easiest):

conda install -c bioconda sra-tools

Verify:

fastq-dump --version

2. Configuration (One-time)

Before starting, configure the download path to a drive with plenty of space (FASTQ files are huge!).

vdb-config -i

Navigate to the "Cache" tab and set the directory (e.g., /data/sra_cache).

3. Get Accession List

Find your study on SRA Website. You need the SRR (Run) accessions (e.g., SRR13644607).

Create a file SRR_Acc_List.txt:

SRR13644607
SRR13644608
SRR13644609

Tip: Use SRA Run Selector on the NCBI website to download this list automatically.

4. The 2-Step Download Process

Step A: Prefetch (Download .sra files)
This is more robust than downloading FASTQs directly.

# Download a single run
prefetch SRR13644607

# Batch download from list
prefetch --option-file SRR_Acc_List.txt

Step B: Convert to FASTQ
Use fasterq-dump (multi-threaded, faster replacement for fastq-dump).

# Basic usage (standard RNA-seq)
fasterq-dump --split-files --progress SRR13644607.sra

# Loop over all downloaded files
for sra in */*.sra; do
    fasterq-dump --split-files --progress "$sra"
done
Flag Purpose
--split-files Splits paired-end reads into _1.fastq and _2.fastq
--include-technical Keeps index reads (essential for single-cell)
--progress Shows a progress bar
--threads 8 Use 8 CPU cores (default is 6)

Special Case: 10x Single-Cell Data

10x Genomics data is complex. A single "run" often contains:

  • R1: Cell barcode + UMI (26-28bp)
  • R2: cDNA insert (90bp+)
  • I1/I2: Sample indices (8-10bp)

Crucial: You must include technical reads to get the barcodes!

fasterq-dump --split-files --include-technical SRR13644607.sra

Expected Output

If successful, you get 3 or 4 files:

  • SRR..._1.fastq: I1 (Index)
  • SRR..._2.fastq: R1 (Barcode/UMI)
  • SRR..._3.fastq: R2 (cDNA)

Verification: Check the first few lines to identify which file is which based on length.

# Check length of first read
head -n 2 SRR*_1.fastq | tail -n 1 | wc -c
Read Length Identity
8-10 bp Sample Index (I1/I2)
26-28 bp Cell Barcode + UMI (R1)
90+ bp cDNA / Transcript (R2)

Troubleshooting & Alternatives

Issue: "fasterq-dump fails on 10x data"

Sometimes fasterq-dump messes up the file splitting for 10x data.

Solution 1: Download Original BAM
Submitters often upload the original 10x BAM file. Check the SRA metadata for "10x Genomics bam file".

# Download BAM directly
prefetch --type bam --max-size u SRR13644617 -O ./outs/

# Convert BAM back to FASTQ (using cellranger bamtofastq)
bamtofastq SRR13644617.bam ./fastqs

Solution 2: Use Kingfisher
Kingfisher tries multiple sources (ENA, AWS, SRA) to find the fastest download.

# Install
conda install -c bioconda kingfisher

# Run
kingfisher get -r SRR13644607 -m separate

Solution 3: SRA Explorer
Use sra-explorer.info to generate direct FTP/curl links for the FASTQ files (often hosted by ENA), bypassing the SRA toolkit entirely.


Understanding FASTQ Format

Each read consists of 4 lines:

@SRR13644607.1 unique_instrument_id length=91     <-- Header (ID)
NCCCATCCCCCCTTATTTATGGGGCTTTCTGTGTAGCTTT...       <-- Sequence
+SRR13644607.1 unique_instrument_id length=91     <-- Separator
#-----CCC--;-;C--;--;CC-;-CCCC;CC-CC;C;;...       <-- Quality Scores

Header Breakdown: @Instrument:Run:Flowcell:Lane:Tile:X:Y
This tells you exactly where on the physical flowcell this cluster was located.


See also:


Originally posted on WeChat Official Account: bioinfo_studyroom

SRA Troubleshooting