Body: <p>I'm trying to programmatically download files from SRA (with prefetch in sra-tools) starting from a GSE number, using Python.</p>
  <p>There is an explanation for using entrez-direct on the CLI, using <a href="https://www.biostars.org/p/97782/" rel="nofollow noreferrer">esearch and the efetch</a>. But I want to use Python. This is what I have now:</p>
  <pre class="lang-py prettyprint-override"><code>from Bio import Entrez
  Entrez.email = 'my_name@email.me'
  handle = Entrez.esearch(db='gds', query='GSE134195', term=&quot;biopython&quot;)
  record = Entrez.read(handle)
  </code></pre>
  <p>which gives:</p>
  <pre class="lang-json prettyprint-override"><code>record = Entrez.read(handle)
  record
  
  {'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]'}
  </code></pre>
  <p>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: <a href="https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE134195" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE134195</a>, click on SRA run selector (at the bottom), this bring you here: <a href="https://www.ncbi.nlm.nih.gov/Traces/study/?acc=PRJNA554267" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/Traces/study/?acc=PRJNA554267</a>, there I can download the Accession list that I want. But I'd like to automate that process.</p>
  <p>Thank you in advance.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-17T14:05:15.570Z
Comments.Text: I think thats easy, if I get chance I'll put together a bit of code.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-17T18:09:23.410Z
Comments.Text: That would be very nice of you, thank you.
Comments.UserDisplayName: Freek
Tags: <entrez><ncbi><biopython><sra>
Title: Get SRR numbers from a GSE number
ThreadText: # Get SRR numbers from a GSE number
  
  (Asked by: username_0 on 2023-08-17)
  
  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](https://www.biostars.org/p/97782/). But I want to use Python. This is what I have now:
  
  ```py
  from Bio import Entrez
  Entrez.email = 'my_name@email.me'
  handle = Entrez.esearch(db='gds', query='GSE134195', term="biopython")
  record = Entrez.read(handle)
  
  ```
  
  which gives:
  
  ```json
  record = Entrez.read(handle)
  record
  
  {'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.
  
  **Tags:** entrez, ncbi, biopython, sra
  
  > **Comments:**
  > **username_1**: I think thats easy, if I get chance I'll put together a bit of code.  
  > **username_0**: That would be very nice of you, thank you.  
  
  ---
  
  ## 0 answers
  
  