bumsfeld 413 Nearly a Posting Virtuoso
#Blast workbench using biopython

from Bio.Blast import NCBIWWW
##result_handle = NCBIWWW.qblast("blastn", "nr", "8332116")
fasta_string = "AATTCAGTGGCAAAAAAAAAACTCAAATTTTAGGGAAGGCCCTAATATTATCAAATAATTAGAGGGGGGG"

result_handle = NCBIWWW.qblast("blastn", "nt", fasta_string)


save_file = open("my_blast.xml", "w")

save_file.write(result_handle.read())
save_file.close()
result_handle.close()

result_handle = open("my_blast.xml")

from Bio.Blast import NCBIXML
for record in NCBIXML.parse(open("my_blast.xml")) :
    #We want to ignore any queries with no search results:
    if record.alignments :
        print "QUERY: %s..." % record.query[:60]
        for align in record.alignments :
            for hsp in align.hsps :
                print " %s HSP, e=%f, from position %i to %i" \
                % (align.hit_id, hsp.expect, hsp.query_start, hsp.query_end)
print "Done"
#Blast workbench using biopython

from Bio.Blast import NCBIWWW
##result_handle = NCBIWWW.qblast("blastn", "nr", "8332116")
fasta_string = "AATTCAGTGGCAAAAAAAAAACTCAAATTTTAGGGAAGGCCCTAATATTATCAAATAATTAGAGGGGGGG"

result_handle = NCBIWWW.qblast("blastn", "nt", fasta_string)


save_file = open("my_blast.xml", "w")

save_file.write(result_handle.read())
save_file.close()
result_handle.close()

result_handle = open("my_blast.xml")

from Bio.Blast import NCBIXML
for record in NCBIXML.parse(open("my_blast.xml")) :
    #We want to ignore any queries with no search results:
    if record.alignments :
        print "QUERY: %s..." % record.query[:60]
        for align in record.alignments :
            for hsp in align.hsps :
                print " %s HSP, e=%f, from position %i to %i" \
                % (align.hit_id, hsp.expect, hsp.query_start, hsp.query_end)
print "Done"