Biopython Blastn Error: CPU usage limit was exceeded appears for certain files
1
0
Entering edit mode
7 months ago
Phi • 0

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.

Sequences Python Blast • 412 views
ADD COMMENT
0
Entering edit mode
7 months ago

The code runs the query on the remote server.

You will get an error if the task exceeds the allowable CPU resources.

Different rules apply when running code from the command line and when running blast alignments from the website.

Probably because it is far easier to automate command-line BLAST searches, so they are more limited when run so.

Thus the solution is what you already do, and run the query via the web interface.

ADD COMMENT

Login before adding your answer.

Traffic: 1641 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6