Skip to content

Commit

Permalink
Merge pull request sanger-pathogens#31 from andrewjpage/master
Browse files Browse the repository at this point in the history
use new st
  • Loading branch information
andrewjpage committed Mar 8, 2013
2 parents 3e885a0 + eeb7754 commit c42c5ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/Bio/MLST/CompareAlleles.pm
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ sub _build_matching_sequences
# more than 1 allele has 100% match
if(defined($top_blast_hit{contamination}))
{
$self->contamination(1);
$self->contamination_sequence_names($top_blast_hit{contamination});
$self->contamination(1);
$self->_translate_contamination_names_into_sequence_types($top_blast_hit{contamination},$top_blast_hit{allele_name});
}

$top_blast_hit{allele_name} =~ s![-_]+!-!g;
Expand Down Expand Up @@ -195,7 +195,7 @@ sub _build_matching_sequences

sub _translate_contamination_names_into_sequence_types
{
my ($self, $contamination_names) = @_;
my ($self, $contamination_names, $main_allele_name) = @_;
my @contamination_sequence_types;

for my $allele_number (@{ $contamination_names})
Expand All @@ -205,7 +205,7 @@ sub _translate_contamination_names_into_sequence_types
sequence_names => [$allele_number]
);

if(defined($st->sequence_type()))
if(defined($st->sequence_type()) && $main_allele_name ne $st->sequence_type())
{
push(@contamination_sequence_types, $st->sequence_type());
}
Expand Down
1 change: 0 additions & 1 deletion t/SequenceTypes/CompareAlleles.t
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ ok(($compare_alleles = Bio::MLST::CompareAlleles->new(
is_deeply( $compare_alleles->found_sequence_names,sort(['adk-3']), 'last top hit returned if more than 1 is 100%');
is($compare_alleles->new_st, 0, 'existing ST found');
is($compare_alleles->contamination, 1, 'contamination found');
is_deeply($compare_alleles->contamination_sequence_names, ['adk-3','adk-2'], 'Names of other contamination sequences');


ok(($compare_alleles = Bio::MLST::CompareAlleles->new(
Expand Down

0 comments on commit c42c5ae

Please sign in to comment.