Skip to content

Commit

Permalink
WIP: Use length of alelle match
Browse files Browse the repository at this point in the history
Rather than using the length of the match on the sample which may include indels, use the length of the match on the allele
  • Loading branch information
bewt85 committed Sep 4, 2015
1 parent 1c9a6cf commit b6c510f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Bio/MLST/Blast/BlastN.pm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ sub _build_hit
'allele_name' => $row[0],
'source_name' => $row[1],
'percentage_identity' => $row[2],
'alignment_length' => $row[3],
'alignment_length' => $row[7],
'source_start' => $start,
'source_end' => $end,
'reverse' => $reverse,
Expand Down Expand Up @@ -184,9 +184,9 @@ sub _best_hit_in_group
# maximum length, return the one with the best percentage_identity
###
my($self, $hits) = @_;
my @lengths = map { $_->{'source_end'} - $_->{'source_start'} + 1 } @$hits;
my @lengths = map { $_->{'allignment_length'} } @$hits;
my $max_length = max @lengths;
my @longest_hits = grep { $_->{'source_end'} - $_->{'source_start'} + 1 >= $max_length } @$hits;
my @longest_hits = grep { $_->{'allignment_length'} == $max_length } @$hits;
my $best_hit = reduce { $a->{'percentage_identity'} > $b->{'percentage_identity'} ? $a : $b } @longest_hits;
return $best_hit;
}
Expand Down

0 comments on commit b6c510f

Please sign in to comment.