# How can I obtain FTP links to studies in ENA?

How can I programmatically obtain ftp links to RNA seq fastq files in ENA? Here's an example of a link that I would be interested in obtaining:

ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR824/000/SRR8240860/SRR8240860_1.fastq.gz

In particular, is there some tool that, given the BioProject ID (here, PRJNA506829), would be able give me all ftp links for the runs in the project, or would I need to write a web scraper to do it?

• This seems to be a duplicate of this question.
– gringer
Jul 12 '20 at 23:08
• In that case, you should change the question / title. The titles indicate they're related, and my casual look at the questions suggests that the queries are similar.
– gringer
Jul 12 '20 at 23:16

Here are some command lines I used for that purpose in bash. Simply prepare a text file containing each accession number (SRR/ERR) you want and create a for loop. Here I used prozilla to speed up downloads but you may use wget either.

for index in $(cat list_of_accessions) ; do if [ $${#index} -eq 9 ]; then proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$${index:0:6}/$${index}/$${index}_1.fastq.gz proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$${index:0:6}/$${index}/$${index}_2.fastq.gz else if [$${#index} -eq 10 ]; then proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$${index:0:6}/00$${index:9:9}/$${index}/$${index}_1.fastq.gz proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$${index:0:6}/00$${index:9:9}/$${index}/$${index}_2.fastq.gz else if [ $${#index} -eq 11 ]; then proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$${index:0:6}/0$${index:9:10}/$${index}/$${index}_1.fastq.gz proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$${index:0:6}/0$${index:9:10}/$${index}/$${index}_2.fastq.gz else proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$${index:0:6}/$${index:9:11}/$${index}/$${index}_1.fastq.gz proz -k=6 --no-curses ftp.sra.ebi.ac.uk/vol1/fastq/$${index:0:6}/$${index:9:11}/$${index}/${index}_2.fastq.gz
fi
fi

fi
done
$$$$


They have an API you can interact with.

If you need to get files for only a few different projects: Search for your accession ID in the browser (leading to https://www.ebi.ac.uk/ena/browser/view/PRJNA506829). Filter the show selected columns to only fastq_ftp, click download tsv to get the list of ftp links.

\$ pysradb metadata SRR8240860 --detailed
`