This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Blast multiple sequences with Biopython qblast

Is there a way to blast multiple sequences with biopython qblast at same time instead of just using for loop?

Thanks,

blast

You can probably look into the multiprocessing module to parallelize some things.

1 answer

I know it is an old question, but for the people looking for an answer and finding this question here is the answer.

So, the answer is really simple, but it just not clear from the documentation: qblast will accept fasta or a single sequence. And as you might know fasta can have more than one sequence. So just don't parse your fasta file and put the string right into qblast.

from Bio.Blast import NCBIWWW

fastafile = open('sequence.fna')
result_handle = NCBIWWW.qblast('blastn', 'nt', fastafile.read())
fastafile.close()

Log in to answer this question.