blast with python don't run
1
0
Entering edit mode
22 months 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?

python blast • 670 views
ADD COMMENT
3
Entering edit mode
22 months ago
gb ★ 2.0k

have you tried:

stdout, stderr = cline()
ADD COMMENT
0
Entering edit mode

It's works, thanks gb, I'm gonna study this structure 'stdout, stderr = cline()'.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 1945 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