I am trying to build a workflow that gets data automatically from databases of sequencing reads (SRA - sequence read archive, ENA - european nucleotide archive). Till now I was pulling everything from SRA and my script have worked, but now I encountered a first entry that is only in ENA (ERR2135453), not in SRA. And I found that my download script has its limitations.
My bash script looks like this (requires aspera ascp
and fastq-dump
) and I wanted to make changes that are commented now
#!/bin/bash
ACCESION=$1
OPENSSH=/my/part/to/key/asperaweb_id_dsa.openssh
# if [ ${ACCESION:0:3} == SRA ]; then
[email protected]:/sra/sra-instant/reads/ByRun/sra/${ACCESION::3}/${ACCESION::6}/"$ACCESION"/"$ACCESION".sra data/
# else
# URL=ena_url
# fi
ascp -QT -i $OPENSSH $URL
fastq-dump data/"$ACCESION".sra --outdir data/ --split-files --gzip
rm data/"$ACCESION".sra
The problem is in getting ENA url. Unlike SRA url that I can easily get from the accession ([email protected]:/sra/sra-instant/reads/ByRun/sra/${ACCESION::3}/${ACCESION::6}/"$ACCESION"/"$ACCESION".sra data/
), the ftp server of ENA is bit more confusing. The url corresponding to ERR2135453 accession is ftp://ftp.sra.ebi.ac.uk//vol1/err/ERR213/003/ERR2135453
. Where 003
there comes from? Also not all reads are in err
subdirectory.
Is there an easy way how to download reads from ENA knowing just the accession number?
--- edit ---
I found on the relevant ENA site about downloading data using aspera that ftp urls should be possible to derive only from accession also in ENA.
Submitted read data files are organised by submission accession number under vol1/ directory in ftp.sra.ebi.ac.uk:
ftp://ftp.sra.ebi.ac.uk/vol1//
where contains the first 6 letters and numbers of the SRA Submission accession.
For example, the files submitted in the SRA Submission ERA007448 are available at: ftp://ftp.sra.ebi.ac.uk/vol1/ERA007/ERA007448/.
The reason why there is this strange 003
will probably be that it's quite recent submission and it has not been properly categorized yet (other accessions I tried were on "expected" urls).
However, the problem still persist. Is there a way how to fetch data of new submissions using accessions only?