[Biopython] NCBIWWW genbank files

Ara Kooser akooser at unm.edu
Mon Jul 18 15:15:39 UTC 2011


Good morning all,


   I am in the process of writing some code for pulling down files from NCBI. I wrote this based on the Biopython manual:

from Bio.Blast import NCBIWWW

def query():
    file_query = raw_input("Please enter the name of your sequence file: ")
    fasta_seq = open(file_query).read()
    result_handle = NCBIWWW.qblast("blastn","nr", fasta_seq, expect=1e-30, hitlist_size=20000)
    save_file = open("blast_results.xml","w")
    save_file.write(result_handle.read())
    save_file.close()
    result_handle.close()


query()

Everything works fine. But I was wondering is there a way to pull down the Genbank files using this method. I used the help(NCBIWWW.qblast) to look at all the options but didn't see the Genbank file format. Downstream in the program I use information extracted from both the .xml and genbank files since they contain different information to we need. I was hoping to combine everything into one program. Currently we use the web interface to pull down the xml and genbank files.

Thanks!
Ara







More information about the Biopython mailing list