3 # Copyright (C) 2007 Martin A. Hansen.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # http://www.gnu.org/copyleft/gpl.html
22 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
25 # Routines to plot stuff with Gnuplot and SVG.
28 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
38 use vars qw ( @ISA @EXPORT );
46 @ISA = qw( Exporter );
49 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
52 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> LINEPLOTS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
57 # Martin A. Hansen, January 2008.
59 # Plots a simple lineplot using Gnuplot.
61 my ( $data, # data table - each column will be plottet as one line.
62 $options, # options hash
63 $tmp_dir, # temporary directory
68 my ( $tmp_file, $pid, $fh_in, $fh_out, $cmd, $i, $line, @lines, $xtic_space, @plot_cmd );
70 $tmp_dir ||= $ENV{ 'BP_TMP' };
72 $tmp_file = "$tmp_dir/lineplot_simple.tab";
74 $fh_out = Maasha::Filesys::file_write_open( $tmp_file );
76 map { print $fh_out join( "\t", @{ $_ } ), "\n" } @{ $data };
80 $options->{ "terminal" } ||= "dumb";
84 $pid = open2( $fh_out, $fh_in, $cmd );
88 print $fh_in "set terminal $options->{ 'terminal' }\n";
89 print $fh_in "set title \"$options->{ 'title' }\"\n" if $options->{ "title" };
90 print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
91 print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
92 print $fh_in "set grid\n" if not $options->{ "terminal" } eq "dumb";
93 print $fh_in "set autoscale\n";
94 print $fh_in "unset key\n";
95 print $fh_in "set xtics border in scale 0 nomirror rotate by 90 offset character 0, 0, 0\n";
97 for ( $i = 1; $i < scalar @{ $data->[ 0 ] } + 1; $i++ ) {
98 push @plot_cmd, qq("$tmp_file" using $i with lines ls 1);
101 print $fh_in "plot " . join( ", ", @plot_cmd ) . "\n";
105 while ( $line = <$fh_out> )
118 return wantarray ? @lines : \@lines;
122 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> HISTOGRAMS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
127 # Martin A. Hansen, August 2007.
129 # Plots a simple histogram using Gnuplot.
131 my ( $data, # list of [ xlabel, data value ] tuples
132 $options, # options hash
137 my ( $pid, $fh_in, $fh_out, $cmd, $i, $line, @lines );
139 $options->{ "terminal" } ||= "dumb";
143 $pid = open2( $fh_out, $fh_in, $cmd );
147 # print $fh_in "set terminal $options->{ 'terminal' } 10 \n"; # adsjust fontsize to 10 - find some other way to do this, because it don't work with SVG.
148 print $fh_in "set terminal $options->{ 'terminal' }\n";
149 print $fh_in "set title \"$options->{ 'title' }\"\n" if $options->{ "title" };
150 print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
151 print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
152 print $fh_in "set autoscale\n";
153 print $fh_in "unset key\n";
154 print $fh_in "set style fill solid\n";
155 print $fh_in "set style histogram title offset character 0, 0, 0\n";
156 print $fh_in "set style data histograms\n";
157 print $fh_in "set xtics border in scale 0 nomirror rotate by 90 offset character 0, 0, 0\n";
159 print $fh_in "plot '-' using 2:xticlabels(1)\n";
161 for ( $i = 0; $i < @{ $data }; $i++ )
163 print $fh_in join( "\t", "\"$data->[ $i ]->[ 0 ]\"", $data->[ $i ]->[ 1 ] ), "\n";
168 while ( $line = <$fh_out> )
179 return wantarray ? @lines : \@lines;
183 sub histogram_lendist
185 # Martin A. Hansen, August 2007.
187 # Plots a histogram using Gnuplot.
189 my ( $data, # list of [ xlabel, data value ] tuples
190 $options, # options hash
195 my ( $pid, $fh_in, $fh_out, $cmd, $i, $line, @lines, $xtic_space );
197 $options->{ "terminal" } ||= "dumb";
199 if ( $data->[ -1 ]->[ 0 ] <= 10 ) {
201 } elsif ( $data->[ -1 ]->[ 0 ] <= 100 ) {
203 } elsif ( $data->[ -1 ]->[ 0 ] <= 250 ) {
205 } elsif ( $data->[ -1 ]->[ 0 ] <= 500 ) {
207 } elsif ( $data->[ -1 ]->[ 0 ] <= 1000 ) {
209 } elsif ( $data->[ -1 ]->[ 0 ] <= 2500 ) {
211 } elsif ( $data->[ -1 ]->[ 0 ] <= 5000 ) {
213 } elsif ( $data->[ -1 ]->[ 0 ] <= 10000 ) {
215 } elsif ( $data->[ -1 ]->[ 0 ] <= 50000 ) {
217 } elsif ( $data->[ -1 ]->[ 0 ] <= 100000 ) {
223 $pid = open2( $fh_out, $fh_in, $cmd );
225 print $fh_in "set terminal $options->{ 'terminal' }\n";
226 print $fh_in "set title \"$options->{ 'title' }\"\n" if $options->{ "title" };
227 print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
228 print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
229 print $fh_in "set autoscale\n";
230 print $fh_in "unset key\n";
231 print $fh_in "set style fill solid\n";
232 print $fh_in "set style histogram clustered gap 1 title offset character 0, 0, 0\n";
233 print $fh_in "set style data histograms\n";
234 print $fh_in "set xtics 0,$xtic_space border out nomirror\n";
236 print $fh_in "plot '-' using 1\n";
238 for ( $i = 0; $i < @{ $data }; $i++ )
240 $data->[ $i ]->[ 0 ] = "." if $data->[ $i ]->[ 0 ] % 10 != 0;
242 print $fh_in join( "\t", $data->[ $i ]->[ 1 ] ), "\n";
247 while ( $line = <$fh_out> )
258 return wantarray ? @lines : \@lines;
262 sub histogram_chrdist
264 # Martin A. Hansen, August 2007.
266 # Plots a histogram using Gnuplot.
268 my ( $data, # list of [ xlabel, data value ] tuples
269 $options, # options hash
274 my ( $pid, $fh_in, $fh_out, $cmd, $i, $line, @lines );
276 $options->{ "terminal" } ||= "dumb";
280 $pid = open2( $fh_out, $fh_in, $cmd );
282 print $fh_in "set terminal $options->{ 'terminal' }\n";
283 print $fh_in "set title \"$options->{ 'title' }\"\n" if $options->{ "title" };
284 print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
285 print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
286 print $fh_in "set autoscale\n";
287 print $fh_in "unset key\n";
288 print $fh_in "set style fill solid\n";
289 print $fh_in "set style histogram title offset character 0, 0, 0\n";
290 print $fh_in "set style data histograms\n";
291 print $fh_in "set xtics border in scale 0 nomirror rotate by 90 offset character 0, 0, 0\n";
293 print $fh_in "plot '-' using 2:xticlabels(1)\n";
295 for ( $i = 0; $i < @{ $data }; $i++ ) {
296 print $fh_in join( "\t", "\"$data->[ $i ]->[ 0 ]\"", $data->[ $i ]->[ 1 ] ), "\n";
301 while ( $line = <$fh_out> )
312 return wantarray ? @lines : \@lines;
316 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DOTPLOT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
321 # Martin A. Hansen, August 2007.
323 # Generates a dotplot from a list of matches using Gnuplot.
325 my ( $matches, # list of hashrefs.
326 $options, # options hash
327 $tmp_dir, # temporary directory
332 my ( $forward_file, $backward_file, $pid, $fh_forward, $fh_backward,
333 $fh_in, $fh_out, $cmd, $match, $line, @lines, $q_max, $s_max );
335 $tmp_dir ||= $ENV{ 'BP_TMP' };
337 $forward_file = "$tmp_dir/match_f.tab";
338 $backward_file = "$tmp_dir/match_r.tab";
340 $fh_forward = Maasha::Filesys::file_write_open( $forward_file );
341 $fh_backward = Maasha::Filesys::file_write_open( $backward_file );
346 foreach $match ( @{ $matches } )
348 if ( $match->{ "DIR" } =~ /^f/ )
350 print $fh_forward join( "\t", $match->{ "Q_BEG" } + 1, $match->{ "S_BEG" } + 1 ), "\n";
351 print $fh_forward join( "\t", $match->{ "Q_END" } + 1, $match->{ "S_END" } + 1 ), "\n";
352 print $fh_forward "\n\n";
356 print $fh_backward join( "\t", $match->{ "Q_BEG" } + 1, $match->{ "S_END" } + 1 ), "\n";
357 print $fh_backward join( "\t", $match->{ "Q_END" } + 1, $match->{ "S_BEG" } + 1 ), "\n";
358 print $fh_backward "\n\n";
361 $q_max = $match->{ "Q_END" } if $match->{ "Q_END" } > $q_max;
362 $s_max = $match->{ "S_END" } if $match->{ "S_END" } > $s_max;
371 $options->{ "terminal" } ||= "dumb";
375 $pid = open2( $fh_out, $fh_in, $cmd );
377 print $fh_in "set terminal $options->{ 'terminal' }\n";
378 print $fh_in "set xrange [1:$q_max]\n";
379 print $fh_in "set yrange [1:$s_max]\n";
380 print $fh_in "set title \"$options->{ 'title' }\"\n" if $options->{ "title" };
381 print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
382 print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
383 print $fh_in "unset key\n";
385 if ( $options->{ "terminal" } ne "dumb" )
387 print $fh_in "set style line 1 linetype 1 linecolor rgb \"green\" linewidth 2 pointtype 6 pointsize default\n";
388 print $fh_in "set style line 2 linetype 1 linecolor rgb \"red\" linewidth 2 pointtype 6 pointsize default\n";
391 print $fh_in "set xtics border out\n";
392 print $fh_in "set ytics border out\n";
393 print $fh_in "set grid\n";
395 if ( $options->{ "direction" } =~ /^b/ ) {
396 print $fh_in qq(plot "$forward_file" with lines ls 1, "$backward_file" with lines ls 2\n);
397 } elsif ( $options->{ "direction" } =~ /^f/ ) {
398 print $fh_in qq(plot "$forward_file" with lines ls 1\n);
399 } elsif ( $options->{ "direction" } =~ /^r/ ) {
400 print $fh_in qq(plot "$backward_file" with lines ls 2\n);
405 while ( $line = <$fh_out> )
416 unlink $forward_file;
417 unlink $backward_file;
419 return wantarray ? @lines : \@lines;
423 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> KARYOGRAM <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
428 # Martin A. Hansen, August 2007.
430 # Plot hits on a karyogram for a given genome.
432 my ( $data, # list of [ chr, beg, end ] triples
433 $options, # hashref with options
438 my ( $karyo_file, $svg, $features, $karyo );
440 if ( $options->{ "genome" } eq "human" )
442 $karyo_file = "/Users/m.hansen/maasha/perl_scripts/biopieces/karyo_data/human_cytobands.txt";
443 # $karyo_file = "/home/m.hansen/maasha/perl_scripts/biopieces/karyo_data/human_cytobands.txt";
447 $karyo_file = "/Users/m.hansen/maasha/perl_scripts/biopieces/karyo_data/mouse_cytobands.txt";
448 # $karyo_file = "/home/m.hansen/maasha/perl_scripts/biopieces/karyo_data/mouse_cytobands.txt";
451 $karyo = parse_karyo_data( $karyo_file );
455 chromosome_layout( $svg, $karyo, $data );
463 # X q26.1 129700001 130200000 gneg
465 # color: /etc/X11/rgb.txt
470 my ( $fh, $chr, $line, $name, $beg, $end, $color, %features, %color_hash );
476 gpos75 => "DarkGrey",
477 gpos66 => "DarkGrey",
479 gpos33 => "LightGrey",
480 gpos25 => "LightGrey",
483 # gpos75 => "rgb(169,169,169)",
484 # gpos66 => "gray66",
485 # gpos66 => "#8e8e8e",
486 # gpos50 => "gray50",
487 # gpos33 => "#e3e3e3",
488 # gpos33 => "gray33",
489 # gpos25 => "gray25",
490 # stalk => "rgb(169,169,169)",
494 $fh = Maasha::Filesys::file_read_open( $file );
496 while ( $line = <$fh> )
500 next if $line =~ /^#/;
502 # ( $chr, $name, $beg, $end, $color ) = split "\t", $line;
503 ( $chr, $beg, $end, $name, $color ) = split "\t", $line;
505 # if ( $color =~ /^gpos(\d+)/ ) {
506 # $color = color_intensity( $1 );
507 # } elsif ( exists $color_hash{ $color } ) {
508 $color = $color_hash{ $color };
510 # die qq(ERROR: Unknown color->$color\n);
513 if ( exists $features{ $chr } )
515 push @{ $features{ $chr } }, [ $name, $beg, $end, $color ];
519 $features{ $chr } = [ [ $name, $beg, $end, $color ] ];
525 return wantarray ? %features : \%features;
531 # Martin A. Hansen, September 2007.
533 # Converts a gray scale intensity in percent to rgb.
535 my ( $percent, # color intensity
542 $num = int( $percent * 256 / 100 );
546 $hex = sprintf "%x", $num;
548 return "#$hex$hex$hex";
550 # return "rgb($num,$num,$num)";
556 # Martin A. Hansen, September 2005.
558 # initializes svg image.
560 # returns an image object
576 sub chromosome_layout
578 # Martin A. Hansen, January 2004 - August 2007.
580 # Plots all chromosomes in a single
582 my ( $svg, # image object
583 $karyo_list, # hashref with karyo data
584 $feat_list, # hashref with features
587 # returns an image object
589 my ( $layout_obj, $i, $x, $y, $max, $factor, $chr_len, $chr_width, $chr_cent, $chr, $feat, $karyo, @list, $A, $B );
591 $layout_obj = $svg->group(
595 $max = $karyo_list->{ "chr1" }->[ -1 ]->[ 2 ];
596 $factor = ( HEIGHT / 2 ) / $max;
597 $chr_width = ( HEIGHT / 4 ) / 13;
599 foreach $karyo ( keys %{ $karyo_list } ) {
600 map { $_->[ 1 ] *= $factor; $_->[ 2 ] *= $factor } @{ $karyo_list->{ $karyo } };
603 foreach $feat ( keys %{ $feat_list } ) {
604 map { $_->[ 0 ] *= $factor; $_->[ 1 ] *= $factor } @{ $feat_list->{ $feat } };
607 @list = sort { $A = $a; $B = $b; $A =~ s/chr//; $B =~ s/chr//; $A <=> $B } keys %{ $karyo_list };
610 push @list, "chrX", "chrY";
617 $chr_len = $karyo_list->{ $chr }->[ -1 ]->[ 2 ];
618 $chr_cent = find_cent( $karyo_list->{ $list[ $i ] } );
620 $y = HEIGHT / 2 - $chr_len;
621 $x = ( WIDTH / ( @list + 2 ) ) * ( $i + 1 );
623 draw_chr( $layout_obj, $x, $y, $chr_len, $chr_width, $chr_cent, $chr, $karyo_list, $feat_list );
632 # Martin A. Hansen, December 2003.
634 # Finds the centromeric region in the karyo data.
638 my ( $acen, @nums, $cent );
640 @{ $acen } = grep { grep { /^DarkGrey$/ } @{ $_ } } @{ $list };
642 push @nums, $acen->[ 0 ]->[ 1 ];
643 push @nums, $acen->[ 0 ]->[ 2 ];
644 push @nums, $acen->[ 1 ]->[ 1 ];
645 push @nums, $acen->[ 1 ]->[ 2 ];
647 @nums = sort { $a <=> $b } @nums;
649 $cent = ( $nums[ 1 ] + $nums[ 2 ] ) / 2;
657 # Martin A. Hansen, December 2003.
659 # draws a whole cromosome with or without centromeric region
661 my ( $svg, # image object
664 $chr_len, # lenght of chromosome
665 $chr_width, # width of chromosome
666 $chr_cent, # position of centromeric region
668 $karyo_list, # hashref with karyo data
669 $feat_list, # hashref with features
672 # returns image object
674 my ( $chr_obj, $clip_obj, $gr_obj );
676 $chr_obj = $svg->group(
680 if ( exists $feat_list->{ $chr } ) {
681 draw_chr_feat( $chr_obj, $x, $y, $chr_width, $feat_list->{ $chr } );
684 $clip_obj = $chr_obj->clipPath(
685 id => $chr . "_clipPath",
688 $clip_obj->rectangle(
689 x => sprintf( "%.3f", $x ),
690 y => sprintf( "%.3f", $y ),
691 width => sprintf( "%.3f", $chr_width ),
692 height => sprintf( "%.3f", $chr_cent ),
697 $clip_obj->rectangle(
698 x => sprintf( "%.3f", $x ),
699 y => sprintf( "%.3f", $y + $chr_cent ),
700 width => sprintf( "%.3f", $chr_width ),
701 height => sprintf( "%.3f", $chr_len - $chr_cent ),
706 $gr_obj = $chr_obj->group(
707 "clip-path" => "url(#$chr" . "_clipPath)",
710 if ( exists $karyo_list->{ $chr } ) {
711 draw_karyo_data( $gr_obj, $x, $y, $chr_width, $karyo_list->{ $chr } );
715 x => sprintf( "%.3f", $x ),
716 y => sprintf( "%.3f", $y ),
717 width => sprintf( "%.3f", $chr_width ),
718 height => sprintf( "%.3f", $chr_cent ),
725 x => sprintf( "%.3f", $x ),
726 y => sprintf( "%.3f", $y + $chr_cent ),
727 width => sprintf( "%.3f", $chr_width ),
728 height => sprintf( "%.3f", $chr_len - $chr_cent ),
734 draw_chr_num( $chr_obj, $x, $y, $chr_len, $chr_width, $chr );
740 # Martin A. Hansen, December 2003.
742 # draws a cromosome number
744 my ( $svg, # image object
747 $chr_len, # lenght of chromosome
748 $chr_width, # width of chromosome
749 $chr, # chromosome number
752 # returns image object
754 my ( $chr_num, $chars, @a, $word_width );
759 $chars = @a = split "", $chr_num;
761 $word_width = ( $chars * 8 ) / 2;
764 x => sprintf("%.3f", $x + ( $chr_width / 2 ) - $word_width ),
765 y => sprintf("%.3f", $y + $chr_len + 15 ),
766 )->cdata( $chr_num );
772 # Martin A. Hansen, February 2004.
774 # Plots chromosome features
783 # returns an image object
785 my ( $feat_beg, $feat_end, $feat_height, $i, $color, $label );
787 for ( $i = 0; $i < @{ $list }; $i++ )
789 ( $label, $feat_beg, $feat_end, $color ) = @{ $list->[ $i ] };
791 $feat_height = $feat_end - $feat_beg;
794 x => sprintf("%.3f", $x ),
795 y => sprintf("%.3f", $y + $feat_beg ),
796 width => sprintf("%.3f", $chr_width ),
797 height => sprintf("%.3f", $feat_height ),
807 # Martin A. Hansen, February 2004.
809 # Plots chromosome features
818 # returns an image object
820 my ( $feat_beg, $feat_end, $feat_height, $i, $color, $height, $width, $x1, $y1, %lookup );
822 for ( $i = 0; $i < @{ $list }; $i++ )
824 ( $feat_beg, $feat_end, $color ) = @{ $list->[ $i ] };
826 $feat_height = $feat_end - $feat_beg;
828 $x1 = sprintf("%.0f", $x + ( $chr_width / 2 ) ),
829 $y1 = sprintf("%.0f", $y + $feat_beg ),
830 $width = sprintf("%.0f", ( $chr_width / 2 ) + 5 ),
831 $height = sprintf("%.0f", $feat_height );
837 if ( exists $lookup{ $x1 . $y1 } ) {
840 $lookup{ $x1 . $y1 } = 1;
856 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SEQUENCE LOGO <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
861 # Martin A. Hansen, August 2007.
863 # Calculates and renders a sequence logo in SVG format.
865 my ( $entries, # aligned sequence entries - list of tuples
870 my ( $type, $bit_max, $logo_data, $svg );
872 $type = Maasha::Seq::seq_guess_type( $entries->[ 0 ]->[ 1 ] );
874 if ( $type =~ /^p/i ) {
880 $logo_data = Maasha::Seq::seqlogo_calc( $bit_max, $entries );
882 $svg = Maasha::Plot::svg_init();
884 svg_draw_logo( $svg, $logo_data, $bit_max, $type );
885 svg_draw_logo_scale( $svg, $bit_max );
893 # Martin A. Hansen, October 2005.
895 # inititalizes SVG object, which is returned.
901 'font-weight' => 'normal',
902 'font-family' => 'Courier New',
913 # Martin A. Hansen, January 2007.
915 # Renders a sequence logo in SVG using a
916 # given data structure with logo details.
918 my ( $svg, # SVG object,
919 $logo_data, # data structure
920 $bit_max, # maximum bit height
921 $type, # sequence type
922 $nocolor, # render black and white - OPTIONAL
925 my ( $pos, $elem, $char, $char_height_bit, $char_height_px, $block, $x, $y, $scale_factor, $color );
929 foreach $pos ( @{ $logo_data } )
933 foreach $elem ( @{ $pos } )
935 ( $char, $char_height_bit ) = @{ $elem };
937 $char_height_px = $char_height_bit * ( 30 / $bit_max );
939 $block = $svg->group(
940 transform => "translate($x,$y)",
943 $scale_factor = $char_height_px / 7;
947 } elsif ( $type eq "dna" or $type eq "rna" ) {
948 $color = Maasha::Seq::color_nuc( $char );
950 $color = Maasha::Seq::color_pep( $char );
954 transform => "scale(1,$scale_factor)",
958 'font-weight' => 'bold',
959 fill => Maasha::Seq::color_palette( $color ),
963 $y -= $char_height_px;
971 sub svg_draw_logo_scale
973 # Martin A. Hansen, January 2007.
975 # draws the bit scale for the sequence logo
977 my ( $svg, # SVG object,
978 $bit_max, # maximum bit height
983 $scale = $svg->group(
984 transform => "translate(-10)",
987 'font-size' => '8px',
992 # transform => "translate(0,$logo_y)",
993 transform => "rotate(-90)",
1008 for ( $i = 0; $i <= $bit_max; $i++ )
1013 y1 => ( 30 / $bit_max ) * $i,
1014 y2 => ( 30 / $bit_max ) * $i,
1019 y => ( 30 / $bit_max ) * $i + 2,
1023 )->cdata( $bit_max - $i );
1028 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<