Question: blast with python don't run
0
gravatar for flogin
5 months ago by
flogin250
Brazil
flogin250 wrote:

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?

blast python • 226 views
ADD COMMENTlink modified 5 months ago by gb1.8k • written 5 months ago by flogin250
3
gravatar for gb
5 months ago by
gb1.8k
gb1.8k wrote:

have you tried:

stdout, stderr = cline()
ADD COMMENTlink modified 5 months ago • written 5 months ago by gb1.8k

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

ADD REPLYlink written 5 months ago by flogin250

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 REPLYlink written 5 months ago by Joe17k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1305 users visited in the last hour