text: user292: I'm trying to make a Biopython script that reproduces a manual search on the NCBI website.
  My manual search gives me the following URL:
  https://www.ncbi.nlm.nih.gov/nuccore?term=ANOS1[gene%20name]%20AND%20refseq[filter]
  And the "Search details" box indicates:ANOS1[gene name] AND refseq[filter].
  I get 338 results that I "Send to" "File" as "GI List", save as ANOS1_orthologs_manual.txt.
  How can I do the same using Biopython?
  
  user292: This can be done by using the "Search details" as a search term in Entrez.esearch:
  import os
  OPJ = os.path.join
  base_dir = os.getcwd()
  
  from Bio import Entrez
  Entrez.email = "my_email_here"
  query = "ANOS1[gene name] AND refseq[filter]"
  handle = Entrez.esearch(term=query, db="nuccore", retmax=400)
  ids = Entrez.read(handle)["IdList"]
  with open(OPJ(base_dir, "ANOS1_orthologs_max400_ids.txt"), "w") as ids_file:
      ids_file.write("\n".join(ids))
      ids_file.write("\n")
  
  
original_text: 292: <p>I'm trying to make a Biopython script that reproduces a manual search on the NCBI website.</p>
  
  <p>My manual search gives me the following URL:</p>
  
  <p><a href="https://www.ncbi.nlm.nih.gov/nuccore?term=ANOS1[gene%20name]%20AND%20refseq[filter]" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/nuccore?term=ANOS1[gene%20name]%20AND%20refseq[filter]</a></p>
  
  <p>And the "Search details" box indicates:<code>ANOS1[gene name] AND refseq[filter]</code>.</p>
  
  <p>I get 338 results that I "Send to" "File" as "GI List", save as <code>ANOS1_orthologs_manual.txt</code>.</p>
  
  <p><strong>How can I do the same using Biopython?</strong></p>
   292: <p>This can be done by using the "Search details" as a search term in <code>Entrez.esearch</code>:</p>
  
  <pre class="lang-python prettyprint-override"><code>import os
  OPJ = os.path.join
  base_dir = os.getcwd()
  
  from Bio import Entrez
  Entrez.email = "my_email_here"
  query = "ANOS1[gene name] AND refseq[filter]"
  handle = Entrez.esearch(term=query, db="nuccore", retmax=400)
  ids = Entrez.read(handle)["IdList"]
  with open(OPJ(base_dir, "ANOS1_orthologs_max400_ids.txt"), "w") as ids_file:
      ids_file.write("\n".join(ids))
      ids_file.write("\n")
  </code></pre>
  