This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Download fastq files from SRA database using biosample identifier

Hi All,

I have a list of biosample identifiers like SAMN01096167, SAMN01096168 and SAMN01096169. Is there anyway I can download FASTQ files from SRA database using these identifiers? Usually, I use fastq-dump with SRR identifiers to download files like this:

fastq-dump -A SRR1642913 --split-files

But fastq-dump doesn't works for biosample identifiers. I would appreciate your suggestions.

Bade

sra fastq

1 answer

This should work. Utilizes Entrez direct. ftp://ftp.ncbi.nlm.nih.gov/entrez/entrezdirect/

while read row; do sra_id=$(esearch -db sra -query $row </dev/null | efetch -format docsum | xtract -pattern Runs -element Run@acc); fastq-dump -A $sra_id --split-files; done < file_with_ids.txt

The /dev/null is necessary because esearch eats the stdin otherwise which causes the loop to only run once.

Log in to answer this question.