From d2ff72222452026a870603db3d2cbfcee9f0f5b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?= <ak4@sanger.ac.uk> Date: Thu, 17 Jan 2008 16:05:41 +0000 Subject: [PATCH] Fix 'coverage' method: Was not masking correctly. --- modules/Bio/EnsEMBL/Collection.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/Bio/EnsEMBL/Collection.pm b/modules/Bio/EnsEMBL/Collection.pm index 20d773a084..d3763bf23a 100644 --- a/modules/Bio/EnsEMBL/Collection.pm +++ b/modules/Bio/EnsEMBL/Collection.pm @@ -816,12 +816,13 @@ sub get_bins { || ( defined( $bin_masks[$start_bin] ) && $bin_masks[$start_bin] != 1 ) ) { + my $bin_start = int( $start_bin*$bin_length ); for ( my $pos = $feature_start ; $pos <= $feature_end && $pos <= int( ( $start_bin + 1 )*$bin_length - 1 ) ; ++$pos ) { - $bin_masks[$start_bin][$pos] = 1; + $bin_masks[$start_bin][ $pos - $bin_start ] = 1; } } @@ -836,12 +837,13 @@ sub get_bins { || ( defined( $bin_masks[$end_bin] ) && $bin_masks[$end_bin] != 1 ) ) { - for ( my $pos = int( $end_bin*$bin_length ) ; + my $bin_start = int( $end_bin*$bin_length ); + for ( my $pos = $bin_start ; $pos <= $feature_end && $pos <= int( ( $end_bin + 1 )*$bin_length - 1 ) ; ++$pos ) { - $bin_masks[$end_bin][$pos] = 1; + $bin_masks[$end_bin][ $pos - $bin_start ] = 1; } } -- GitLab