Retrieving whole genome genbank files for some organism using Biojava or Biopython
Question: does anyone have an idea how to automatically search and parse gbk files from
FTP ncbi using either BIopython or BioJAVA. I have searched for the utilities
in BIojava and have not found any. I have also tried BioPython and here is my
Code:

    
    
    from Bio import Entrez
    Entrez.email = "test@yahoo.com"
    Entrez.tool = "MyLocalScript"
    handle = Entrez.esearch(db="nucleotide", term="Mycobacterium avium[Orgn]")
    record = Entrez.read(handle)
    print record
    print record["Count"]
    id_L = record["IdList"]
    print id_L
    print len(id_L)
    

However, there are only 3 mycobacterium avium species (whole genome sequences
and fully annotated) the result I am getting is 59897.

Can anyone tell me how to perform the search either in BioJava or BioPython.
Otherwise I will have to automate this process form scratch.

Thank you.


Answer: The way we do it is by specifying the id specifically using the efetch
interface:

    
    
    Entrez.efetch(db="nucleotide", id=<ACCESSION ID HERE>, rettype="gb", retmode="text")
    

Using a search term such as the one you used returns too many matches, all of
which you are downloading. See 48 different bioprojects with your search term
here:

<http://www.ncbi.nlm.nih.gov/bioproject/?term=Mycobacterium+avium>

From experience, the most accurate way to get what you want is to use the
ACCESSION ID.

