This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How do I download CRAM/BAM data from EGA using HTSGET

I would like to use htsget to download portions of bam files on EGA. I have access to the data, and can download whole files:

pyega3 -d -cf ~/.ega2 fetch EGAF0000xxxxxxxxx

However when I try to use htsget, the system fails:

pyega3 -d -cf ~/.ega2 fetch EGAF0000xxxxxxxxx --reference-name 1 --start 100000 --end 200000

The error code is:

500 Server Error:  for url: https://ega.ebi.ac.uk:8051/elixir/data/files/byid/file?accession=EGAF0000xxxxxxxx&format=BAM&start=100000&end=200000&chr=1

I have been emailing the EGA helpdesk for 4 months (!) on this issue without resolution. Is anyone else able to use htsget with this service?

There is no documentation for the EGA htsget implementation (thought the pyega3 code is open source), is there a way I can use samtools view to access the EGA data instead?

ega htsget

1 answer

Use argument --format

pyega3 fetch -cf </Path/To/CREDENTIALS_FILE> --start 0 --end 1000000 --reference-name 1 --format BAM --saveto </Path/To/Output> EGAF<NUM>

Log in to answer this question.