Skip to content

Commit

Permalink
Improved BLAST parameters and mini-map output
Browse files Browse the repository at this point in the history
  • Loading branch information
Torsten Seemann committed Feb 7, 2015
1 parent cf69620 commit 1fb2a59
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions bin/abricate
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ my @BLAST_FIELDS = qw(
);

my @COLUMNS = qw(
FILE SEQUENCE START END GENE COVERAGE COVERAGE_MAP %COVERAGE %IDENTITY
FILE SEQUENCE START END GENE COVERAGE COVERAGE_MAP GAPS %COVERAGE %IDENTITY
);
$COLUMNS[0] = '#'.$COLUMNS[0];

Expand Down Expand Up @@ -65,10 +65,10 @@ for my $fasta (@ARGV) {
my %seen;
my @hit;
print STDERR "Processing: $fasta\n";
my $cmd = "blastn -ungapped -query \Q$fasta\E -db $datadir/resfinder "
. " -evalue 1E-99 -dust no -outfmt '$format'"
# . " -culling_limit 1"
. " -best_hit_overhang 0.49 -best_hit_score_edge 0.0001"
my $cmd = "blastn -query \Q$fasta\E -db $datadir/resfinder "
. " -task blastn -evalue 1E-99 -dust no -outfmt '$format'"
. " -culling_limit 1"
# . " -best_hit_overhang 0.49 -best_hit_score_edge 0.0001"
;
print STDERR "Running: $cmd\n" if $verbose;

Expand All @@ -82,14 +82,16 @@ for my $fasta (@ARGV) {
next if $seen{ join('~', @hit{qw(qseqid qstart qend)}) }++;
$hit{sseqid} =~ s/_.*$//;
# print STDERR Dumper(\%hit);
my $minimap = minimap(@hit{qw(sstart send slen)});
my $minimap = minimap( @hit{qw(sstart send slen gaps)} );
# $minimap .= '!-'.$hit{gaps} if $hit{gaps} > 0;
push @hit, [
$fasta,
$hit{qseqid}, $hit{qstart}, $hit{qend},
$hit{sseqid},
$hit{sstart}.'-'.$hit{send}.'/'.$hit{slen},
$minimap,
sprintf("%.2f", 100 * $hit{length} / $hit{slen}),
$hit{gaps},
sprintf("%.2f", 100 * ($hit{length}-$hit{gaps}) / $hit{slen}),
$hit{pident},
];
}
Expand All @@ -106,8 +108,9 @@ for my $fasta (@ARGV) {
#----------------------------------------------------------------------

sub minimap {
my($x, $y, $L, $scale, $on, $off) = @_;
my $WIDTH = 10;
my($x, $y, $L, $broken, $scale, $on, $off) = @_;
my $WIDTH = 15 - ($broken ? 1 : 0);
$broken ||= 0;
$scale ||= ($L/$WIDTH);
$on ||= '=';
$off ||= '.';
Expand All @@ -118,6 +121,7 @@ sub minimap {
for my $i (0 .. $WIDTH-1) {
# print STDERR "$i $x $y $L $scale\n";
$map .= ($i >= $x and $i <= $y) ? $on : $off;
$map .= '/' if $broken and $i==int($WIDTH/2);
}
return $map;
}
Expand Down

0 comments on commit 1fb2a59

Please sign in to comment.