update 2018: consider using the new version → fasterq-dump
fastq-dump can be used for local .sra files or for direct download from NCBI
# local use (path to .sra file)
fastq-dump --split-spot path/to/local/file/SRR649944.sra
SRR649944.fastq
# direct download from NCBI/SRA (only accession number, no path)
fastq-dump --split-3 SRR649944
SRR649944_1.fastq
SRR649944_2.fastq
A .sra file copy will be saved to a local cache/archive folder, used for repeated fastq-dump calls without re-download
$HOME/ncbi/public/sra/SRR649944.sra
Download only
A) fasterq-dump
B) prefetch
Alternatively, prefetch can be used for only downloading the .sra file for later use by fastq-dump
prefetch SRR649944 # stores .sra file in $HOME/ncbi/public/sra/
fastq-dump --split-3 SRR649944 # takes file from $HOME/ncbi/public/sra/ (without download again)
SRR649944_1.fastq
SRR649944_2.fastq
C) wget (not recommended)
Download error
In case of download error, a cache and/or lock file may need to be removed, before trying again
rm $HOME/ncbi/public/sra/SRR649944.sra.cache
rm $HOME/ncbi/public/sra/SRR649944.sra.cache.lock
rm $HOME/ncbi/public/sra/SRR649944.sra.tmp.23569.tmp # prefetch
http://www.ncbi.nlm.nih.gov/books/NBK158899/#SRA_download.downloading_sra_data_using
fastq-dump options
Extracting fastq files from SRA files, for paired-end reads
fastq-dump --split-3 SAMPLE
results:
SAMPLE_1.fastq
SAMPLE_2.fastq
SAMPLE.fastq (only if .sra contains single reads / single-end sequencing)
--split-3 splits paired reads into files *_1.fastq and *_2.fastq; single read (if any) into *.fastq
SAMPLE can be a SRA-id (download from NCBI or local ncbi/public/sra/ archive) or direct path to local .sra file
fastq-dump --split-3 SRR649944
fastq-dump --split-3 path/to/local/file/SRR649944.sra
Converting SRA files into a single fastq file
fastq-dump --split-spot SAMPLE
results:
SAMPLE.fastq
options:
--split-spot split paired-end reads, but writes all to a single fastq file
To use in a pipe
fastq-dump -Z --split-spot SAMPLE | bowtie2 ...
options:
-Z writes sequences to standard output
Filter read length of SRA samples
fastq-dump --minReadLen 80 --split-3 SAMPLE
fastq-dump --minReadLen 80 --split-spot -Z SAMPLE | bowtie2 ...
options:
--minReadLen 80 extracts only reads >= 80bp from SRA file
read more
http://ncbi.github.io/sra-tools/fastq-dump.html
https://github.com/ncbi/sra-tools/wiki/HowTo:-Access-SRA-Data
http://www.ncbi.nlm.nih.gov/books/NBK47528/
http://www.ncbi.nlm.nih.gov/books/NBK242621/#_SRA_Download_Guid_BK_The_SRA_Toolkit_
http://www.ncbi.nlm.nih.gov/books/NBK158899/#SRA_download.downloading_sra_data_using