Blast - How to get the no hits result on table output?
0
0
Entering edit mode
3.4 years ago
tyasird ▴ 10

Hi,

I use BLASTN with python.

I prefer -outfmt 6 parameter (table output) because its easy to read on python but the problem is, this output format doesn't gives result if there is no match.

for example:

blastn -query genes.fasta -db genome.fasta -outfmt 6

this command gives me 3 result with matches

gene1   NC_000913.3     100.000 2030    0       0       1       2030    1       
gene2   NC_000913.3     99.444  1260    7       0       1       1260    2101    
gene3   NC_000913.3     100.000 1190    0       0       1       1190    3431   

blastn -query genes.fasta -db genome.fasta -outfmt 7

this command gives me 4 result with 3 match and 1 zero match.

# BLASTN 2.11.0+
# Query: nogene
# Database: genome1.fasta
# 0 hits found
# BLASTN 2.11.0+
# Query: gene1
# Database: genome1.fasta
# Fields: query acc.ver, subject acc.ver, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score
# 1 hits found
gene1   NC_000913.3     100.000 2030    0       0       1       2030    1       2030    0.0     3749
# BLASTN 2.11.0+
# Query: gene2
# Database: genome1.fasta
# Fields: query acc.ver, subject acc.ver, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score
# 1 hits found
gene2   NC_000913.3     99.444  1260    7       0       1       1260    2101    3360    0.0     2289
# BLASTN 2.11.0+
# Query: gene3
# Database: genome1.fasta
# Fields: query acc.ver, subject acc.ver, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score
# 1 hits found
gene3   NC_000913.3     100.000 1190    0       0       1       1190    3431    4620    0.0     2198
# BLAST processed 4 queries
blast blastn python • 1.5k views
ADD COMMENT
2
Entering edit mode

As you discovered you have to use -outfmt 7 if you want to get queries with no hits listed in output.

ADD REPLY
0
Entering edit mode

If there isn't any easiest way to do it, I will try to parse -outfmt 7.

ADD REPLY
1
Entering edit mode

Either you parse the -outfmt 7 output or then you parse the headers (up until first space I think) from your query file and comm -3 with the first column of your -outfmt 6 output. IMO the latter is "easier"

ADD REPLY

Login before adding your answer.

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