Entering edit mode
4.9 years ago
flogin
▴
280
Hello guys, I'm studying how run a blast analysis with python, and I found the Bio.Blast.Applications my blast version is: Package: blast 2.6.0, build Jan 15 2017 17:12:27, and I write this code:
import argparse
from Bio.Blast.Applications import NcbiblastnCommandline
from Bio.Blast.Applications import NcbimakeblastdbCommandline
parser = argparse.ArgumentParser()
parser.add_argument("-in", "--input", help="fasta file to use as query", required=True)
parser.add_argument("-db", "--database", help="fasta file to use as database",required=True)
args = parser.parse_args()
read_file = args.input
database = args.database
clinedb = NcbimakeblastdbCommandline(dbtype="nucl", input_file = database)
clinedb
cline = NcbiblastnCommandline(query = read_file, db =database, out = read_file+'.blastn', outfmt = 6, evalue = 0.001)
cline
When I run python test.py -in genome_1.fasta.fmt.kmers -db genome_2.fasta
nothing happens.
If I print the variables clinedb and cline:
makeblastdb -dbtype nucl -in genome_2.fasta
blastn -out genome_1.fasta.fmt.kmers.blastn -outfmt 6 -query genome_1.fasta.fmt.kmers -db genome_2.fasta -evalue 0.001
How can I solve this?
It's works, thanks gb, I'm gonna study this structure 'stdout, stderr = cline()'.
Think this can help to understand it in detail https://biopython.org/DIST/docs/api/Bio.Blast.Applications-pysrc.html https://biopython.org/DIST/docs/api/Bio.Blast.Applications.NcbiblastnCommandline-class.html
stdout, stderr = cline()
is capturing the output of the command, else it runs entirely silently.AFAIK, it should still have generated the output files, just silently, but perhaps there's some quirk that means it wont.