NCBI SRA downloading



# make a temporary folder and work in it
mkdir sra_download && cd sra_download

# load aspera module
module load aspera/2.4.5

# find the url for the sra file you need to download. 
# ForSRR446981, it is ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR446/SRR446981/SRR446981.sra
# Remove the protocol part (ftp://), and add the highlighted red parts to the address above and submit ascp command:
ascp -TQ -k1 anonftp@ftp-trace.ncbi.nlm.nih.gov:/sra/sra-instant/reads/ByRun/sra/SRR/SRR446/SRR446981/SRR446981.sra .

# the run is a paired-end run, and by default, read1 and 2 are joined together in sra format. We need sra tool to split them
module load sra/2.1.4

fastq-dump --split-files SRR446981.sra &

# now take a look at the read files:
head SRR446981_1.fastq 
head SRR446981_2.fastq 

# make sure you get the correct number of reads by checking how many rows the files have. Each read is four rows.
wc -l SRR446981_1.fastq 
wc -l SRR446981_2.fastq 

Please let me know if you have any question or have better way to do it.

Comments