I'm trying to programmatically download files from SRA (with prefetch in sra-tools) starting from a GSE number, using Python.

There is an explanation for using entrez-direct on the CLI, using esearch and the efetch. But I want to use Python. This is what I have now:

from Bio import Entrez
Entrez.email = '[email protected]'
handle = Entrez.esearch(db='gds', query='GSE134195', term="biopython")
record = Entrez.read(handle)

which gives:

record = Entrez.read(handle)

{'Count': '17', 'RetMax': '17', 'RetStart': '0', 'IdList': ['200066260', '200045602', '200037064', '200030751', '100013939', '300762998', '300762997', '300762996', '300762995', '300762994', '300762993', '300762992', '300762991', '300762990', '300762989', '300762988', '300762987'], 'TranslationSet': [], 'TranslationStack': [{'Term': 'biopython[All Fields]', 'Field': 'All Fields', 'Count': '17', 'Explode': 'N'}, 'GROUP'], 'QueryTranslation': 'biopython[All Fields]'}

But what are these numbers? IdList looks useful, but there are 17 numbers where I expect 14. How do I get to SRR (SRA) files? The files I want can be found manually here: https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE134195, click on SRA run selector (at the bottom), this bring you here: https://www.ncbi.nlm.nih.gov/Traces/study/?acc=PRJNA554267, there I can download the Accession list that I want. But I'd like to automate that process.

Thank you in advance.

  • $\begingroup$ I think thats easy, if I get chance I'll put together a bit of code. $\endgroup$
    – M__
    Aug 17 at 14:05
  • $\begingroup$ That would be very nice of you, thank you. $\endgroup$
    – Freek
    Aug 17 at 18:09


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.