From 04bb67f945f0a4358c711f7748a0d2a4379555a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?= <ak4@sanger.ac.uk> Date: Fri, 13 Aug 2010 14:32:00 +0000 Subject: [PATCH] Get some of the logic right. --- modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm | 53 ++++++++++++------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm index b67a1d38e3..652ce687b8 100644 --- a/modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm @@ -672,40 +672,39 @@ FEATURE: while ( $sth->fetch() ) { } else { # On the negative strand. - if ( $dest_slice->is_circular() ) { + if ( $dest_slice->is_circular() + && $seq_region_start > $seq_region_end ) + { # Handle circular chromosomes. - if ( $seq_region_start > $seq_region_end ) { - if ( $dest_slice_start > $dest_slice_end ) { - my $tmp_seq_region_start = $seq_region_start; + if ( $dest_slice_start > $dest_slice_end ) { + my $tmp_seq_region_start = $seq_region_start; + $seq_region_start = $dest_slice_end - $seq_region_end + 1; + $seq_region_end = + $dest_slice_end + + $dest_slice->seq_region_length() - + $tmp_seq_region_start + 1; + } else { + + if ( $seq_region_end > $dest_slice_start ) { + # Looking at the region in the beginning of the + # chromosome. $seq_region_start = $dest_slice_end - $seq_region_end + 1; $seq_region_end = - $dest_slice_end + + $seq_region_end - $dest_slice->seq_region_length() - - $tmp_seq_region_start + 1; + $dest_slice_start + 1; } else { - - if ( $seq_region_end > $dest_slice_start ) { - # Looking at the region in the beginning of the - # chromosome. - $seq_region_start = - $dest_slice_end - $seq_region_end + 1; - $seq_region_end = - $seq_region_end - - $dest_slice->seq_region_length() - - $dest_slice_start + 1; - } else { - my $tmp_seq_region_start = $seq_region_start; - $seq_region_start = - $dest_slice_end - - $seq_region_end - - $dest_slice->seq_region_length() + 1; - $seq_region_end = - $dest_slice_end - $tmp_seq_region_start + 1; - } - + my $tmp_seq_region_start = $seq_region_start; + $seq_region_start = + $dest_slice_end - + $seq_region_end - + $dest_slice->seq_region_length() + 1; + $seq_region_end = + $dest_slice_end - $tmp_seq_region_start + 1; } - } ## end if ( $seq_region_start...) + + } } else { # Non-circular chromosome. -- GitLab