This is a test version of Biostars. For the public version, visit https://www.biostars.org.
I can't make NcbiblastnCommandline work. Creates the outfile but it's empty.

def blast():

from Bio.Blast import NCBIXML
from Bio.Blast.Applications import NcbiblastnCommandline
cline = NcbiblastnCommandline(query="sequence.fasta", db="nt", outfmt=6, out="blast.tbl")
outfile = open("blast.tbl", "w")
outfile.write(cline.parse())
outfile.close()
cline.close()
blast biopython

1 answer

After defining your command line, you should just "run" it:

cline = NcbiblastnCommandline(query="sequence.fasta", db="nt", outfmt=6, out="blast.tbl")
cline()

This will generate your file blast.tbl

Log in to answer this question.