This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Microbial protein BLAST

I am trying to run BLAST online using Biopython: from Bio.Blast import NCBIWWW result_handle = NCBIWWW.qblast("blastp", "nr", consensus_seq)

How can I search only Microbial proteins, as I would if I used the web-interface at https://blast.ncbi.nlm.nih.gov/Blast.cgi?PROGRAM=blastp&PAGE_TYPE=BlastSearch&BLAST_SPEC=MicrobialGenomes&LINK_LOC=blasttab&LAST_PAGE=blastn

What should I type in place of 'nr'?

blast microbial proteins biopython databases

This may not be possible to replicate via Biopython. NCBI does many things differently via their WWW page that are not easy to replicate via command line blast.

Edit: Answer posted below seems to indicate that this may be feasible. OP will need to confirm.

Look to see if you can pass the option -taxids 2 via your command line. This would limit the search to bacteria.

1 answer

I think this works, please check for false positives:

from Bio.Blast import NCBIWWW
# https://www.uniprot.org/uniprot/P21515
consensus_seq = "MNFLAHLHLAHLAESSLSGNLLADFVRGNPEESFPPDVVAGIHMHRRIDVLTDNLPEVREAREWFRSETRRVAPITLDVMWDHFLSRHWSQLSPDFPLQEFVCYAREQVMTILPDSPPRFINLNNYLWSEQWLVRYRDMDFIQNVLNGMASRRPRLDALRDSWYDLDAHYDALETRFWQFYPRMMAQASRKAL"
url = "https://blast.ncbi.nlm.nih.gov/Blast.cgi?PROGRAM=blastp&BLAST_SPEC=MicrobialGenomes"
result_handle = NCBIWWW.qblast("blastp", "nr", consensus_seq, url_base=url)
print(result_handle.read())

Log in to answer this question.