How to retrieve fastq files from NCBI using SRA accessions?
2
0
Entering edit mode
2.6 years ago

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.0k views
ADD COMMENT
2
Entering edit mode
2.6 years ago
Mensur Dlakic ★ 28k

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 {}
ADD COMMENT
1
Entering edit mode
19 months ago
Haoxin Tan ▴ 10

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
ADD COMMENT
1
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 1707 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6