This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is there a way to download FASTq files from SRR IDs?

I have a bunch of SRR IDs and need to download Fastq files for the same.

I tried downloading SRAtoolkit for the same by doing

apt-get install sra-toolkit
export PATH=$PATH:$PWD/sratoolkit.2.8.2-1-ubuntu64/bin
which fastq-dump
/User/sratoolkit.2.8.2-1-ubuntu64/bin/fastq-dump
fastq-dump --stdout SRR390728 | head -n 8

Shows an error like

 fastq-dump.2.8.2 sys: connection failed while opening file within cryptographic module - mbedtls_ssl_handshake returned -29184 ( SSL - An invalid SSL record was received )
 fastq-dump.2.8.2 err: item not found while constructing within virtual database module - the path 'SRR390728' cannot be opened as database or table

What should I do? Is there any other way to download read files rather than using fastq-dump?

Since I have multiple SRR IDs, is there any other method I can download all the Fastq files in a go?

eutility fastq sra

Save yourself the trouble and get the fastq's from EBI-ENA.

In case it is not mirrored there, use the prefetch tool to download SRAs via Aspera (100Mb/s) and then run fastq-dump on that file. Fastq-dump as a download tool is unusably slow, error prone and a hugh PITA ( like the entire SRA format ).

You are installing sra-toolkit system-wide with apt, but are using a downloaded binary. I guess your system is missing some shared library, or with an incompatible version. What is your OS, which version? Try using your system-installed fastq-dump:

/usr/bin/fastq-dump --stdout SRR390728 | head -n 8

I just tested my apt-get installed fastq-dump and it works:

$ fastq-dump  --version

fastq-dump : 2.8.1

$ which fastq-dump 
/usr/bin/fastq-dump

$ fastq-dump --stdout SRR390728 | head -n 8
@SRR390728.1 1 length=72
CATTCTTCACGTAGTTCTCGAGCCTTGGTTTTCAGCGATGGAGAATGACTTTGACAAGCTGAGAGAAGNTNC
+SRR390728.1 1 length=72
;;;;;;;;;;;;;;;;;;;;;;;;;;;9;;665142;;;;;;;;;;;;;;;;;;;;;;;;;;;;;96&&&&(
@SRR390728.2 2 length=72
AAGTAGGTCTCGTCTGTGTTTTCTACGAGCTTGTGTTCCAGCTGACCCACTCCCTGGGTGGGGGGACTGGGT
+SRR390728.2 2 length=72
;;;;;;;;;;;;;;;;;4;;;;3;393.1+4&&5&&;;;;;;;;;;;;;;;;;;;;;<9;<;;;;;464262

1 answer

Why don't you try this one? It will automatically download all FASTQ files if you have multiple SRR IDs

#!/bin/bash

sra_ids="SRR390727 SRR390728 SRR390729 SRR390730"

for sra_id in ${sra_ids}; do
    fastq-dump ${sra_id}
done

Or it can also download all FASTQ files which belongs to the SRX accession.

#!/bin/bash

srx_id=SRX079566

sra_ids=$(wget -qO- "http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?save=efetch&db=sra&rettype=runinfo&term=${srx_id}" | grep ${srx_id} | cut -f1 -d",")

for sra_id in "${sra_ids[@]}"; do
    fastq-dump ${sra_id}
done

For the sake of reference, I am not sure the speed of fastq-dump. I think, I saw people saying it is slower than using aspera on the post below.

Check this out: [Deprecated] Fast download of FASTQ files from the European Nucleotide Archive (ENA)

I do realize it says it is Deprecated, but I use Step 1 and Step 2, used recently, and the download was pretty fast.

If you do Step 1 (installing aspera - fast downloading) and Step 2 (use https://sra-explorer.info/ to create aspera download links that you just run through your terminal) on that tutorial.

Yes, I think so. If you can use aspera, it would be great option rather than fastq-dump.

Log in to answer this question.