Hello I'm trying to write a python program that will perform blastn search on a selected file and will output that result to an xml file as part of my undergraduate research. This is the code that I am using to perform the blast searches
root = tk.Tk()
root.withdraw()
#prompts user for files to blast
file = filedialog.askopenfilenames(parent=root,title ="Select Sequence Files")
mf = ""
with open(file) as handle:
mf = handle.read()
#performs blast search
result_handle = NCBIWWW.qblast("blastn", "nt",mf,hitlist_size=20)
blast_results = result_handle.read()
#saves results as xml
with open("myBlast.xml", "w") as saveTo:
saveTo.write(blast_results)
print(blast_results)
result_handle.close()
For my dataset I have a set of .seq files that look like this:
>AM0101_16F Sample_Name=AM0101_16F Chromat_id=17806416 Read_id=17636038 Version=1 Length=1186
GGGCACCNNGAACCCAATAGGAANGGGTGCCTTCCTAAGGGTTACCTACCCACTTCCTGTGGANCACACCTCTCGG
GGCCGTTAGGGGCGGTGTGCAAAGGCCCGGAANCATTCTCCGCGGGATTGTGAATCCGATAACTATACGATTCCCAC
TTCTCGCGAGTCCAATTGGCAAATCGCAACCCGACTAGAAAACACATTTGGGGGATCGCTTGATCCCCCCAGGTCCC
TTGTCCTTGGATGTGCCATTGGAACACCGGGGGAACCCCAGGCCAAAAGGGGATGAAGAATTGAACGCCTCCCCCC
CCTCCCCCCGGTTAGCACCGGGAGGCCCCTTTAAATTGCCCACCTGAATGCTGGCAACTAAGAGAAAGGGTTGCGCT
CGTTGCGGGACTTAACCCAACATTTCACGACACGAGCTGACGACAACCATGCACCACCTGTCACTCTGCCCCCGAAG
GGGACGTCCTATCTCTAGGATTGTCAGAGGATGTCAAGACCTGGTAAGGGTCTTCGCGTTGCTTCGAATTAAACCACA
TGCTCCACCGCTTGTGCGGGCCCCCGTCAATTCCTTTGAGTTTCAGTCTTGCGACCGTACTCCCCAGGCGGAGTGCT
TAATGCGTTAGCTGCAGCACTAAGGGGCGGAAGCCCCCTAACACTTAGCACTCATCGTTTACGGCGTGGACTACCAG
GGTATCTAATCCTGTTCGCTCCCCACGCTTTCGCTCCTCAGCGTCAGTTACAGACCAGAGAGCCGCCTTCGCCACTG
GTGTTCCTCCACATCTCTACGCATTTCACCGCTACACGTGGAATTCCACTCTCCTCTTCTGCACTCAAGTTGCCCAGTT
TCCAATGACCCTCCACGGTTGAGCCGGGGATTTCACATCGAATTAACAAACCGCCTGCNAGCCTTTAGCCCAAAATTC
CANACACGTTGCCCCTANGATTACCGCGCTGCTGGACGAAGTAGCCGTGCTTTTNGGCNGGTACGTCATGGAACGGC
TATACAACGCACTGCTCTCCCTAAAAGTATTTTACCTCAGGACNTTCATACTCCGGATGGTGCTCGAGGATGTCCACTT
GGCAAAAATCCATGTGCTCCCCAGAGATGAGGCGGTCATTCCCGGGGGGGCATCCCCCAANGGGGGACCCGCCCG
NNNCATNCNNCCACNAAATTCCGCNNNGT
When I run it with the file above it gives me an Error CPU usage limit exceeded, however I am able to run it on a different file that looks like this:
> Acph-1-PB type=CDS
ATGTTTTCCCGCAGTCGCTGTGGTTCACTTGTAACAAGTGTGGCTCGCAA
AATGTGGAACCACCCAAGCCAGCGCTGGCTCATCTTGATCTGCGTTATAT
GTTTGCTGTCTTTTGCGCTGGCCAATTCGCTTCATGGCTATGCTAATGCT
GAAGGTCATCCAGTGGAGATTTCGGCCACATTGCCAGGCCAGCTGAAGTT
TGTGCATGTCATATATCGCCACGGCGACAGAACGCCCGTGGATCCCTATC
CCACGGACCCCTGGGGCGACAGGAAGTTCTGGCCCACCGGCTGGGGAGAT
TTGACCAATTTGGGCAAGCAAGAGCACTACGACCTGGGAAAATGGCTGCG
GAATCGCTATTCAAACCTCCTACCGCCTATATACTCCAACGAGAACATCT
ACGTTCAGTCCACCGACGTGGATCGCACATTGATGAGTGCCCAGTCGAAT
CTGGCTGGTCTCTACGAGCCGCAAGGGGAAGACATCTGGAACACGGACAT
CAACTGGCAACCCATACCCATTCACACCTCGCCCGAGAGGGAGGATCCCA
TACTGGCCGCTAAGGCACCTTGTCCTGCCTATGACTATGAGCTGGCCAGC
CTGGAATCATCGCCAGAATTCAAGGCCTTGACCGAAAAACACCGAAATCT
GTTTGCTTATTTGAGCGAAAAAGGCGGACGCCCCGTGAAGACCTTCATTG
ATGCCCAGTATTTGAATAACACCTTGTTCATTGAGAATCTGTACAACATG
ACACTGCCAAAATGGACTAAAATGGTTTATGGGAGAGAGGAGCTCACGTA
TGTATCGAATTTCGCTTTCGCCATCAGCTCTTATACGCGAAAGCTGGCGA
GACTGAAGGCGGGGCCTTTGCTAAAGGACATATTCCAGCGGTTTAAAGAG
AAATCCTCCGGGAGCCTAAAACCAGATCGTTCGATGTGGGTCTACAGTGC
TCATGACACCACGGTAGCCAGCGTTTTGAATGCGCTGAAATTATTTGAGC
TGCACAGTCCTCCCTACACGGCGTGCATAATGATGGAGTTGCGTGTGGAT
GAGACCAACACCCCGTTGGTCTCTATTTTCTACAAGAACACCACAGCTGA
ACCCCTGCCTCTGGACATACCTGGTTGTGGGCCTTCCTGTCCGCTGACCA
AACTTATGAACATCTACGAGGACGTTTTGCCCGTAGATTGGGAGCGCGAG
TGCAAGCTATCCACGATGATGATGACTTATGAGGAAGCCAATCTTGGAAC
TGCGACGGGCATTCTCATTTTAATCGTAATTGCGCTGCTGTTCGCCAGCT
ATGGCCTCATGATCTACTACCGACGTCGCAACTACAAGCTGTATTCCTCG
TACTCTCAAATGGCTTAG
I have also tried running both of these files through the blast web page and it works there, and both files are similar in size so I am not sure why the first file is giving me that error.