From db65301fb494625cfc5883a782929c2a3014009a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?= <ak4@sanger.ac.uk> Date: Thu, 27 Oct 2011 23:05:14 +0000 Subject: [PATCH] Make code do what its comments say. --- modules/Bio/EnsEMBL/IdMapping/ScoreBuilder.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/Bio/EnsEMBL/IdMapping/ScoreBuilder.pm b/modules/Bio/EnsEMBL/IdMapping/ScoreBuilder.pm index e556f04987..6c6ca90e76 100644 --- a/modules/Bio/EnsEMBL/IdMapping/ScoreBuilder.pm +++ b/modules/Bio/EnsEMBL/IdMapping/ScoreBuilder.pm @@ -180,10 +180,10 @@ sub internal_id_rescore { sort { $b <=> $a } @{ $matrix->get_Entries_for_source($source) }; # nothing to do if we only have one mapping - next unless ( scalar(@entries) > 1 ); + if ( scalar(@entries) == 1 ) { next } # only penalise if mappings are ambiguous - next unless ( $entries[0]->score == $entries[1]->score ); + if ( $entries[0]->score != $entries[1]->score ) { next } # only penalise if one source id == target id where score == best # score @@ -197,15 +197,15 @@ sub internal_id_rescore { } } - next unless ($ambiguous); + if ( !$ambiguous ) { next } # now penalise those where source id != target id and score == best # score foreach my $e (@entries) { if ( $e->target != $source and $e->score == $entries[0]->score() ) { - # PENALTY: This stable ID is not any longer on the same object. - $matrix->set_score( $source, $e->target(), 0.8*$e->score() ); + # PENALTY: Reduce score for ambiguous mappings. + $matrix->set_score( $source, $e->target(), 0.9*$e->score() ); $i++; } } -- GitLab