From fad16e64d6c44ea41c16b0afa7b543bfad04f5f2 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Tue, 1 Dec 2009 13:38:12 +0000 Subject: [PATCH] set bbrowser and GFF to 0-base git-svn-id: http://biopieces.googlecode.com/svn/trunk@789 74ccb610-7750-0410-82ae-013aeee3265d --- code_perl/Maasha/BBrowser/Track.pm | 8 ++++---- code_perl/Maasha/GFF.pm | 6 +++--- www/index.cgi | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code_perl/Maasha/BBrowser/Track.pm b/code_perl/Maasha/BBrowser/Track.pm index d572854..e24bde8 100644 --- a/code_perl/Maasha/BBrowser/Track.pm +++ b/code_perl/Maasha/BBrowser/Track.pm @@ -61,7 +61,7 @@ sub track_ruler $beg = $cookie->{ 'NAV_START' }; $end = $cookie->{ 'NAV_END' }; - $factor = $cookie->{ 'IMG_WIDTH' } / ( $end - $beg ); + $factor = $cookie->{ 'IMG_WIDTH' } / ( $end - $beg + 1 ); $step = 10; @@ -73,8 +73,8 @@ sub track_ruler { if ( ( $i % $step ) == 0 ) { - $txt = Maasha::Calc::commify( $i ) . "|"; # TODO reverse this so |123 instead of 123| - $x = sprintf( "%.0f", ( $i - $beg - length $txt ) * $factor ); + $txt = "|" . Maasha::Calc::commify( $i ); + $x = sprintf( "%.0f", ( ( $i - $beg ) * $factor ) + 2 ); if ( $x > 0 and $x + ( $cookie->{ 'RULER_FONT_SIZE' } * length $txt ) < $cookie->{ 'IMG_WIDTH' } ) { @@ -213,7 +213,7 @@ sub track_feature_linear @{ $entries } = sort { $a->{ 'S_BEG' } <=> $b->{ 'S_BEG' } or $a->{ 'S_END' } <=> $b->{ 'S_END' } } @{ $entries }; - $factor = $cookie->{ 'IMG_WIDTH' } / ( $end - $beg ); + $factor = $cookie->{ 'IMG_WIDTH' } / ( $end - $beg + 1 ); $y_step = 0; $y_max = 0; diff --git a/code_perl/Maasha/GFF.pm b/code_perl/Maasha/GFF.pm index 407a326..6201b09 100644 --- a/code_perl/Maasha/GFF.pm +++ b/code_perl/Maasha/GFF.pm @@ -145,9 +145,9 @@ sub gff2biopiece 'S_ID' => $entry->[ seqid ], 'SOURCE' => $entry->[ source ], 'TYPE' => $entry->[ type ], - 'S_BEG' => $entry->[ start ], - 'S_END' => $entry->[ end ], - 'S_LEN' => $entry->[ end ] - $entry->[ start ] + 1, + 'S_BEG' => $entry->[ start ] - 1, + 'S_END' => $entry->[ end ] - 1, + 'S_LEN' => $entry->[ end ] - $entry->[ start ] + 1, 'SCORE' => $entry->[ score ], 'STRAND' => $entry->[ strand ], 'PHASE' => $entry->[ phase ], diff --git a/www/index.cgi b/www/index.cgi index 038d311..21d0f9e 100755 --- a/www/index.cgi +++ b/www/index.cgi @@ -175,11 +175,11 @@ sub cookie_start if ( defined $cookie->{ 'NAV_START' } ) { $cookie->{ 'NAV_START' } =~ tr/,//d; - $cookie->{ 'NAV_START' } = 1 if $cookie->{ 'NAV_START' } <= 0; + $cookie->{ 'NAV_START' } = 0 if $cookie->{ 'NAV_START' } < 0; } else { - $cookie->{ 'NAV_START' } = 1; + $cookie->{ 'NAV_START' } = 0; } } @@ -252,7 +252,7 @@ sub cookie_zoom $cookie->{ 'NAV_START' } = int( $cookie->{ 'NAV_START' } + ( $dist_diff / 2 ) ); $cookie->{ 'NAV_END' } = int( $cookie->{ 'NAV_END' } - ( $dist_diff / 2 ) ); - $cookie->{ 'NAV_START' } = 1 if $cookie->{ 'NAV_START' } <= 0; + $cookie->{ 'NAV_START' } = 0 if $cookie->{ 'NAV_START' } < 0; $cookie->{ 'NAV_END' } = $max if $cookie->{ 'NAV_END' } > $max; } } @@ -623,8 +623,8 @@ sub section_browse $surface = Cairo::ImageSurface->create( 'argb32', $cookie->{ 'IMG_WIDTH' }, $cookie->{ 'TRACK_OFFSET' } ); $cr = Cairo::Context->create( $surface ); - $cr->rectangle (0, 0, $cookie->{ 'IMG_WIDTH' }, $cookie->{ 'TRACK_OFFSET' } ); - $cr->set_source_rgb (1, 1, 1); + $cr->rectangle ( 0, 0, $cookie->{ 'IMG_WIDTH' }, $cookie->{ 'TRACK_OFFSET' } ); + $cr->set_source_rgb ( 1, 1, 1 ); $cr->fill; foreach $feat ( @features ) { -- 2.39.5