This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Tools similar to entrez-direct for ENA?

Hi all,

I was wondering if there are tools similar to entrez-direct from NCBI, that can be applied to ENA?

What I have is, say, a list of 50 ERR or ERX IDs. When looking through the browser, I can see that each one is linked to a bam file, which I'd like to download. E.g. this link should give an idea: https://www.ebi.ac.uk/ena/browser/view/ERX4126872?show=reads

As you can see the file is named in a way that's completely unrelated to the ENA ID. How can I avoid doing this manually?

Thank you in advance, as always.

sra entrez-direct ena entrez

1 answer

On the page, look at the JSON link at the bottom.

You could use this as part of a REST API (which it indeed is) to automate the task in a simple script:

https://www.ebi.ac.uk/ena/portal/api/filereport?accession=ERX4126872&result=read_run&fields=fastq_ftp,submitted_ftp,sra_ftp&format=json&download=true&limit=0

The result is a JSON file you can parse to retrieve the FTP URL. Note, not all download options are available here.

{
 "run_accession":"ERR4161442",
 "fastq_ftp":"",
 "submitted_ftp":"ftp.sra.ebi.ac.uk/vol1/run/ERR416/ERR4161442/5dc932bd71fe4a0008e5699d.bam",
 "sra_ftp":""
}

You can also refer to the documentation of programmatic access to ENA:

For further simplicity, enaBrowserTools can be downloaded and run locally on the command line to fetch files associated with records by accession. It can also be used to bulk download records related to a specified Sample or Study.

This is as close to e-utils as you can get.

Thank you! I just realized that you can retrieve not only JSON but also TSV, which is easier to parse afterwards.

Log in to answer this question.