This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to retrieve fastq files from NCBI using SRA accessions?

Hello I need to retrieve several fastq files (paired end reads) from NCBI: First I retrieved all the SRA accessions IDs of the needed sequencing files so I have a SraAccList.txt file. The content of the file is the following

cat SraAccList.txt

ERR4234198

ERR4234199

ERR4234200

So I want to retrieve them on my local machine using fastq-dump

This is what I tried:

#! /bin/bash

accs=$(cat SraAccList.txt)

for i in $accs
do
fastq-dump -v --gzip $i
done

But I have the following error message:

2022-04-18T18:38:51 fastq-dump.3.0.0 err: error unexpected while resolving query within virtual file system module - No accession to process ( 500 ) Failed to call external services.

what am I doing wrong?

Thanks for your time :)

sra fastq-dump

2 answers

It doesn't seem like you are doing anything wrong, at least when it comes to issuing a command. To me this looks like a firewall issue, or some other problem with connection or authentication.

I don't think everything needs to be scripted, especially if you truly have only 3 entries.

cat SraAccList.txt | xargs -i fastq-dump -v --gzip {}

I had the sam problem exactly as yours. And it turns out to be the '\r' at the end of each lines of the accession number in the list when it is produces by Win instead of Linux. That's why fastq-dump can't get the correct accession name. Just delete using the command 'sed'. Hope this finds you well. Cause I have been stuch on this for 2 hours...

sed -i 's/\r$//' your.listname.txt

An easier way to do this is dos2unix <filename>, which converts line-endings in-place.

Log in to answer this question.