Mercurial > repos > cpt > cpt_psm_plotter
annotate lib/CPT/Plot/Base.pm @ 1:8691c1c61a8e draft default tip
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
| author | cpt | 
|---|---|
| date | Mon, 05 Jun 2023 02:48:47 +0000 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 1 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 1 package CPT::Plot::Base; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 2 use Data::Dumper; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 3 use CPT::Plot::Label; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 4 use CPT::Plot::Class; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 5 use CPT::Plot::Gene; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 6 use CPT::Plot::Colours; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 7 use Bio::SeqIO; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 8 use SVG; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 9 use Moose; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 10 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 11 # ABSTRACT: Main plotting class for genome mapper | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 12 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 13 has 'svg' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 14 has 'line_count' => ( is => 'rw', isa => 'Num', default => 1 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 15 has '_ft_count' => ( is => 'rw', isa => 'Num', default => 0 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 16 has 'classes' => ( is => 'rw', isa => 'HashRef' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 17 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 18 # Labels | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 19 has 'label' => ( is => 'rw', isa => 'Bool' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 20 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 21 has 'label_pos' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 22 has 'label_shrink_mode' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 23 has 'label_callouts' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 24 has 'label_from' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 25 has 'label_text_source' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 26 has 'label_numeric_features' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 27 has 'label_query' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 28 has 'label_numbering_count' => ( is => 'rw', isa => 'Any', default => 1 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 29 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 30 has 'justified' => ( is => 'rw', isa => 'Str' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 31 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 32 # CHanged to any b/c unpassed = undef | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 33 has 'separate_strands' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 34 has 'double_line_for_overlap' => ( is => 'rw', isa => 'Any' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 35 has 'opacity' => ( is => 'rw', isa => 'Str' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 36 has 'view' => ( is => 'rw', isa => 'Str' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 37 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 38 has 'color_scheme' => ( is => 'rw', isa => 'HashRef' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 39 has 'wanted_tags' => ( is => 'rw', isa => 'HashRef' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 40 has 'genome_length' => ( is => 'rw', isa => 'Int' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 41 has 'features' => ( is => 'rw', isa => 'ArrayRef' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 42 has 'start' => ( is => 'rw', isa => 'Int' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 43 has 'end' => ( is => 'rw', isa => 'Int' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 44 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 45 has 'avgRowLength' => ( is => 'rw', isa => 'Int' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 46 has 'calc_height' => ( is => 'rw', isa => 'Int' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 47 has 'calc_width' => ( is => 'rw', isa => 'Int' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 48 has 'x_offset' => ( is => 'rw', isa => 'Num' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 49 has 'y_offset' => ( is => 'rw', isa => 'Num' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 50 has 'ils' => ( is => 'rw', isa => 'Num' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 51 has 'width_mode' => ( is => 'rw', isa => 'Str' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 52 has 'width_value' => ( is => 'rw', isa => 'Num' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 53 has 'rows' => ( is => 'rw', isa => 'Num' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 54 has 'split_factor' => ( is => 'rw', isa => 'Num' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 55 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 56 has 'rowdata' => ( is => 'rw', isa => 'HashRef' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 57 has '_internal_maxrowlength' => ( is => 'rw', isa => 'Num' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 58 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 59 my $color_spec = CPT::Plot::Colours->new( 'default' => '#000000' ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 60 our ( $parser, $tree, $cb ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 61 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 62 sub init { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 63 my ($self) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 64 my %classes; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 65 my %cs = %{ $self->color_scheme() }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 66 foreach my $key ( keys %cs ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 67 $classes{$key} = CPT::Plot::Class->new( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 68 'key' => $key, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 69 'color' => $cs{$key}{color}, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 70 'border' => $cs{$key}{border}, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 71 'plot' => $cs{$key}{plot}, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 72 'included' => 1, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 73 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 74 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 75 $self->classes( \%classes ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 76 $self->init_label_stuff(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 77 $self->filterFeatues(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 78 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 79 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 80 sub init_label_stuff { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 81 my ($self) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 82 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 83 if ( $self->{'label_from'} eq 'custom' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 84 use Parse::BooleanLogic; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 85 $parser = new Parse::BooleanLogic( operators => [ '', 'OR' ] ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 86 $tree = $parser->as_array( $self->label_query ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 87 print $parser; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 88 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 89 #foreach bio feature, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 90 #if solve == 1, then add to our return, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 91 #else doesn't match | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 92 #endforeach | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 93 #my $new_tree = $parser->solve($tree,$filter); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 94 $cb = sub { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 95 my $query = $_[0]->{'operand'}; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 96 my $feature = $_[1]; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 97 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 98 my $negate = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 99 if ( substr( $query, 0, 1 ) eq '!' ) { #negate | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 100 $negate = 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 101 $query = substr( $query, 1 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 102 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 103 if ( $query =~ m/([^:]+):["']{0,1}([^'"]*)["']{0,1}/ ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 104 my ( $k, $v ) = ( $1, $2 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 105 my $result; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 106 if ( $k eq 'contains' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 107 my $values = join( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 108 "\t", | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 109 map { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 110 if ( $_ ne | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 111 "translation" ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 112 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 113 join( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 114 '', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 115 $feature | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 116 ->get_tag_values | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 117 ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 118 $_ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 119 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 120 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 121 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 122 } $feature->get_all_tags() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 123 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 124 if ( $values =~ m/$v/i ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 125 $result = 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 126 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 127 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 128 $result = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 129 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 130 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 131 elsif ( $k eq 'key' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 132 if ( $v =~ m/,/ ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 133 $result = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 134 foreach ( split( /,/, $v ) ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 135 if ( $feature | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 136 ->primary_tag | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 137 eq $_ ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 138 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 139 $result = 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 140 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 141 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 142 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 143 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 144 $result = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 145 $feature->primary_tag eq $v; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 146 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 147 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 148 elsif ( $k eq 'tag' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 149 if ( $v =~ m/([^=]+)=(.*)/ ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 150 my ( $tag_name, $tag_match ) = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 151 ( $1, $2 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 152 if ( $feature->has_tag($1) ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 153 if ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 154 join( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 155 '', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 156 $feature | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 157 ->get_tag_values | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 158 ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 159 $1 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 160 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 161 ) =~ /$2/i | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 162 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 163 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 164 $result = 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 165 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 166 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 167 $result = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 168 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 169 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 170 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 171 $result = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 172 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 173 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 174 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 175 $result = $feature->has_tag($v); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 176 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 177 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 178 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 179 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 180 #error | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 181 $result = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 182 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 183 return ( $negate xor $result ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 184 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 185 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 186 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 187 #error | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 188 return 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 189 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 190 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 191 #error | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 192 return 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 193 }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 194 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 195 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 196 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 197 sub filterFeatues { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 198 my ($self) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 199 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 200 #$self->{'wanted_tags'} = map { $_ => 1 } split(/,/,$self->{'q'}); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 201 my %tags = map { $_ => 1 } split( /,/, "tRNA,CDS" ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 202 $self->wanted_tags( \%tags ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 203 my @feats = @{ $self->features() }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 204 for my $feat_object (@feats) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 205 my $should_add = 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 206 if ( $feat_object->primary_tag eq 'source' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 207 $should_add = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 208 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 209 if ( $feat_object->primary_tag eq 'gene' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 210 $should_add = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 211 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 212 if ( defined $self->start() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 213 && $feat_object->start < $self->start() ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 214 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 215 $should_add = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 216 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 217 if ( defined $self->end() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 218 && $feat_object->end > $self->end() ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 219 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 220 $should_add = 0; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 221 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 222 if ($should_add) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 223 $self->addGene($feat_object); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 224 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 225 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 226 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 227 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 228 sub addGene { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 229 my ( $self, $feat_object ) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 230 my $tag = $feat_object->primary_tag; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 231 my $label = ""; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 232 if ( $self->label() ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 233 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 234 #If it meets the criteria specified for labelling an object, set the label, else don't set a label | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 235 if ( $self->label_from() eq 'custom' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 236 if ( $parser->solve( $tree, $cb, $feat_object ) ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 237 if ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 238 $feat_object->has_tag( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 239 $self->label_text_source() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 240 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 241 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 242 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 243 $label = join( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 244 ' ', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 245 $feat_object->get_tag_values( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 246 $self | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 247 ->label_text_source( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 248 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 249 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 250 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 251 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 252 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 253 $label = '[]'; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 254 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 255 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 256 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 257 #if($feat_object->has_tag($self->label_text_source())){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 258 #$label = ' '.join(' ', $feat_object->get_tag_values($self->label_text_source())); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 259 #} | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 260 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 261 elsif ( $self->label_from() eq 'numeric' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 262 if ( ${ $self->wanted_tags() }{$tag} ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 263 $label = $self->label_numbering_count(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 264 $self->label_numbering_count( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 265 $self->label_numbering_count() + 1 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 266 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 267 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 268 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 269 die $self->label_from(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 270 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 271 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 272 my @color_arr; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 273 my $color; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 274 if ( $feat_object->has_tag('color') ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 275 push( @color_arr, $feat_object->get_tag_values('color') ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 276 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 277 if ( $feat_object->has_tag('color') ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 278 push( @color_arr, $feat_object->get_tag_values('color') ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 279 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 280 if ( scalar @color_arr ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 281 $color = $color_arr[0]; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 282 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 283 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 284 my $gene = CPT::Plot::Gene->new( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 285 'tag' => $tag, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 286 'label' => $label, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 287 'start' => $feat_object->start, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 288 'end' => $feat_object->end, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 289 'strand' => $feat_object->strand, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 290 'color' => $color, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 291 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 292 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 293 #This is a "failsafe" addition of classes, in case the user didn't specify a color | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 294 if ( !defined ${ $self->classes() }{$tag} ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 295 ${ $self->classes() }{$tag} = CPT::Plot::Class->new( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 296 'key' => $tag, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 297 'color' => '#000000', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 298 'border' => 1, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 299 'plot' => 1, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 300 'included' => 1, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 301 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 302 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 303 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 304 ${ $self->classes() }{$tag}->addObject($gene); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 305 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 306 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 307 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 308 sub partitionLines { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 309 my ($self) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 310 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 311 # To use when I finally get partitioning.pm working | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 312 #sub partitionLines{ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 313 # my ($self) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 314 # | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 315 # my $partioner = Partitioning->new( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 316 # genome_length => $self->genome_length(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 317 # rows => $self->rows(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 318 # justified => $self->justified(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 319 # ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 320 # | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 321 # # Add data to it | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 322 # foreach(keys %classes){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 323 # if($classes{$_}->isIncludedInPartioning()){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 324 # $partioner->add($classes{$_}->getItemList()); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 325 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 326 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 327 # # Run && get Results | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 328 # my %result = %{$partioner->run()}; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 329 # # . . . | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 330 # print Dupmer %results; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 331 # # Profit | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 332 # exit 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 333 # # This is supposed to merge two hashes. [http://perldoc.perl.org/perlfaq4.html#How-do-I-merge-two-hashes%3f] | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 334 # @self{keys %result} = values %result; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 335 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 336 my @items; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 337 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 338 $self->avgRowLength( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 339 int( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 340 $self->genome_length() / | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 341 $self->rows() * | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 342 $self->split_factor() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 343 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 344 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 345 ; #TODO, allow adjusting or just re-calc? need to benchmark first I guess. | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 346 $self->calc_height( int( ( 1 + $self->rows() ) * $self->ils() ) ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 347 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 348 if ( $self->width_mode() eq 'dynamic' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 349 $self->calc_width( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 350 int( $self->avgRowLength() / $self->width_value() ) ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 351 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 352 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 353 $self->calc_width( $self->width_value() ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 354 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 355 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 356 my $fake_count = 100; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 357 if ($fake_count) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 358 for ( my $i = 0 ; $i <= $fake_count ; $i++ ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 359 my $key = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 360 int( $self->genome_length() * $i / $fake_count ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 361 push( @items, [ $key, $key, 1 ] ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 362 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 363 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 364 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 365 my %classes = %{ $self->classes() }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 366 foreach ( keys %classes ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 367 if ( $classes{$_}->included() ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 368 push( @items, @{ $classes{$_}->getItemList() } ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 369 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 370 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 371 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 372 #Sort based on where each item starts | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 373 @items = sort { ${$a}[0] <=> ${$b}[0] } @items; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 374 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 375 #my $z = '(' . join('),(',map { "${$_}[0],${$_}[1]" } @items ) . ')'; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 376 #print join("\n",split(/(.{1,120})/msxog, $z)) . "\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 377 my %rowdata; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 378 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 379 my ( $longest_last_object, $thisRowEnd, $currentRow ) = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 380 ( 1, 1 + $self->avgRowLength(), 1 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 381 $rowdata{1}{start} = 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 382 foreach my $item_ref (@items) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 383 my ( $item_start, $item_end ) = @{$item_ref}; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 384 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 385 #print "\t$item_start\t$item_end\t$thisRowEnd\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 386 if ( $item_start >= $thisRowEnd || $item_end > $thisRowEnd ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 387 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 388 # This was just cleaned up from the following commented out piece of code | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 389 if ( $self->justified() eq 'justify' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 390 || $item_start >= $rowdata{$currentRow}{end} ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 391 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 392 $rowdata{$currentRow}{end} = $thisRowEnd; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 393 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 394 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 395 $rowdata{$currentRow}{end} = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 396 max( $longest_last_object, $item_start ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 397 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 398 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 399 # There was a corner case here: | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 400 # O represents the end of a gene, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 401 # --- represents a gene | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 402 # | represents $thisRowEnd | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 403 # | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 404 # | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 405 # ------O | O--------- | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 406 # In this case, the second end would be chosen as | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 407 # max($longest_last_object,$item_start), which is NOT what we | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 408 # want. You want | to be chosen, not O, so in the case that | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 409 # item_start is >= current row end (or should that be >?), we | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 410 # use this. | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 411 # | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 412 # ------O | | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 413 # O--+-------- | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 414 # This case works fine | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 415 # | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 416 # | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 417 # ------O | | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 418 # O--------+-------- | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 419 # This case also works fine | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 420 # | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 421 # | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 422 # if($self->justified()){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 423 # $rowdata{$currentRow}end() = $thisRowEnd; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 424 # }else{ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 425 # if($item_start <= $rowdata{$currentRow}end()){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 426 # $rowdata{$currentRow}end() = max($longest_last_object,$item_start); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 427 # }else{ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 428 # $rowdata{$currentRow}end() = $thisRowEnd; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 429 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 430 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 431 $self->_internal_maxrowlength( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 432 max( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 433 $self->_internal_maxrowlength(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 434 $rowdata{$currentRow}{end} - | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 435 $rowdata{$currentRow}{start} | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 436 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 437 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 438 $currentRow++; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 439 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 440 #print "$item_start $rowdata{$currentRow-1}{end}\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 441 if ( $item_start <= $rowdata{ $currentRow - 1 }{end} ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 442 $rowdata{$currentRow}{start} = $item_start; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 443 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 444 else { #nonjustified never encounters the following line | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 445 $rowdata{$currentRow}{start} = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 446 $rowdata{ $currentRow - 1 }{end} + 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 447 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 448 $thisRowEnd = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 449 $self->avgRowLength() + $rowdata{$currentRow}{start}; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 450 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 451 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 452 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 453 # if($self->justified()){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 454 # foreach my $item_ref(@items){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 455 # my ($item_start, $item_end) = @{$item_ref}; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 456 # # If the item starts OR ends after this row is supposed to end | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 457 # # print "\t$item_start\t$item_end\t$thisrowend\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 458 # if($item_start >= $thisRowEnd || $item_end > $thisRowEnd){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 459 # $rowdata{$currentRow}end() = $thisRowEnd; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 460 # #Internal max row length is the length of the longest row | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 461 # $self->_internal_maxrowlength'} = max($self->{'_internal_maxrowlength'},$rowdata{$currentRow}{'end'}-$rowdata{$currentRow}{'start()); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 462 # #Update which row we're on (so we aren't using +1s everywhere) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 463 # $currentRow++; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 464 # if($item_start <= $rowdata{$currentRow-1}end()){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 465 # $rowdata{$currentRow}start() = $item_start; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 466 # }else{ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 467 # $rowdata{$currentRow}start'} = $rowdata{$currentRow-1}{'end() + 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 468 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 469 # #tracks where the current row ends | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 470 # #print Dumper $rowdata; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 471 # #print ">>$thisRowEnd\t".$self->avgRowLength'}." + ".$rowdata{$currentRow}{'start()."\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 472 # $thisRowEnd = $self->avgRowLength'} + $rowdata{$currentRow}{'start(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 473 # #print ">>$thisRowEnd\t".$self->avgRowLength'}." + ".$rowdata{$currentRow}{'start()."\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 474 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 475 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 476 # }else{#Non justified, raggedright | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 477 # foreach my $item_ref(@items){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 478 # my ($item_start, $item_end) = @{$item_ref}; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 479 # #print "\t$item_start\t$item_end\t$thisrowend\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 480 # if($item_start >= $thisRowEnd || $item_end > $thisRowEnd){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 481 ## print "\t> $item_start\t$item_end\t$thisRowEnd\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 482 ## print "Candidate for ending [" . ($item_start >= $thisRowEnd) ."]\t[" .($item_end >= $thisRowEnd) . "]\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 483 ## # If we have ``justified'' rulers, they all need to the be the SAME length (until the last) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 484 ## print " -- $rowdata{$currentRow}end()$thisRowEnd\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 485 # $rowdata{$currentRow}end() = max($longest_last_object,$item_start); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 486 # #Internal max row length is the length of the longest row | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 487 # $self->_internal_maxrowlength'} = max($self->{'_internal_maxrowlength'},$rowdata{$currentRow}{'end'}-$rowdata{$currentRow}{'start()); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 488 # #Update which row we're on (so we aren't using +1s everywhere) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 489 # $currentRow++; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 490 # #if($item_start <= $rowdata{$currentRow-1}end()){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 491 # $rowdata{$currentRow}start() = $item_start; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 492 # #} | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 493 # #tracks where the current row ends | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 494 # $thisRowEnd = $self->avgRowLength'} + $rowdata{$currentRow}{'start(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 495 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 496 # $longest_last_object = max($longest_last_object,$item_end); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 497 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 498 # } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 499 #make sure the final row length is set, in addition to the _int_max_rowlength | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 500 $thisRowEnd = $rowdata{$currentRow}{end} = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 501 $self->genome_length() + 1; #Putative | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 502 $self->_internal_maxrowlength( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 503 max( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 504 $self->_internal_maxrowlength(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 505 $rowdata{$currentRow}{end} - | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 506 $rowdata{$currentRow}{start} | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 507 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 508 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 509 $rowdata{max} = $currentRow; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 510 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 511 if ( defined $self->{start} && defined $self->{end} ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 512 %rowdata = ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 513 '1' => | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 514 { 'end' => $self->{end}, 'start' => $self->{start} }, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 515 'max' => 1, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 516 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 517 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 518 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 519 $self->rowdata( \%rowdata ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 520 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 521 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 522 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 523 sub getSVG { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 524 my ($self) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 525 return $self->svg(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 526 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 527 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 528 # SVG | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 529 sub createSVG { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 530 my ($self) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 531 my %rowdata = %{ $self->rowdata() }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 532 $self->calc_height( int( ( 1 + $rowdata{max} ) * $self->ils() ) ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 533 if ( $self->width_mode() eq 'dynamic' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 534 $self->calc_width( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 535 int( $self->avgRowLength() / $self->width_value() ) ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 536 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 537 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 538 $self->calc_width( $self->width_value() ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 539 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 540 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 541 $self->svg( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 542 SVG->new( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 543 width => $self->calc_width() + 2 * $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 544 height => $self->calc_height() + 2 * $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 545 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 546 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 547 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 548 #$self->svg()->title( id => 'documenfeatures from t-title' )->cdata("Genome Map of [$file_name]"); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 549 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 550 my $ui_group = $self->svg()->tag( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 551 'g', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 552 id => 'group_ui', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 553 style => { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 554 stroke => '#000000', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 555 fill => '#000000', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 556 'fill-opacity' => 1, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 557 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 558 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 559 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 560 foreach ( my $i = 1 ; $i <= $rowdata{max} ; $i++ ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 561 $self->_addRuler( $i, $ui_group ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 562 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 563 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 564 my %classes = %{ $self->classes() }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 565 foreach my $class_key ( keys %classes ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 566 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 567 #print "Adding features from $class_key\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 568 my $class = $classes{$class_key}; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 569 if ( !$class->plot() ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 570 next; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 571 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 572 my $group = $self->svg()->tag( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 573 'g', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 574 id => 'group_' . $class->key(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 575 style => { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 576 stroke => ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 577 $class->plot() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 578 ? ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 579 $class->border() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 580 ? "black" | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 581 : "none" | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 582 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 583 : 'none' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 584 ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 585 fill => $class->color(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 586 'fill-opacity' => $self->opacity(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 587 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 588 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 589 my @data = @{ $class->getObjects() }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 590 foreach my $gene (@data) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 591 my ( $start, $end ) = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 592 ( $gene->start(), $gene->end() ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 593 my $row = calculateRow( $self, $start, $end ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 594 addFeature( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 595 $self, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 596 group => $group, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 597 row => $row, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 598 start => $start, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 599 end => $end, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 600 key => $gene->tag(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 601 strand => $gene->strand(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 602 label => $gene->label(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 603 ui_group => $ui_group, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 604 color => $gene->color(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 605 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 606 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 607 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 608 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 609 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 610 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 611 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 612 sub calculateRow { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 613 my ( $self, $start, $end ) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 614 my %rowdata = %{ $self->rowdata() }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 615 for ( my $i = 1 ; $i <= $rowdata{max} ; $i++ ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 616 if ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 617 $start > $rowdata{$i}{start} - 1 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 618 && $start < $rowdata{$i}{end} + 1 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 619 && $end > $rowdata{$i}{start} - 1 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 620 && $end < $rowdata{$i}{end} + 1 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 621 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 622 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 623 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 624 return $i; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 625 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 626 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 627 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 628 #print "<b>$start,$end,".$self->rowdata'}{$i}{'start'}.",".$self->{'rowdata'}{$i}{'end()."<\/b>\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 629 return 1.5; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 630 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 631 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 632 sub _addRuler { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 633 my ( $self, $row, $ui_group ) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 634 my $y_fix = $self->ils() * ( $row - 1 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 635 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 636 # my @d = ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 637 # $self->calc_width(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 638 # $self->rowdata'}{$row}{'end(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 639 # $self->rowdata'}{$row}{'start(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 640 # ($self->rowdata'}{$row}{'end'}-$self->{'rowdata'}{$row}{'start()), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 641 # $self->_internal_maxrowlength(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 642 # ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 643 # print join("\t",@d),"\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 644 my %rowdata = %{ $self->rowdata() }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 645 my $line_width = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 646 $self->calc_width() * | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 647 ( $rowdata{$row}{end} - $rowdata{$row}{start} ) / | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 648 $self->_internal_maxrowlength(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 649 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 650 #print "Adding ruler\t".$self->rowdata'}{$row}{'start'}."\t".$self->{'rowdata'}{$row}{'end'}."\t" . ($self->{'rowdata'}{$row}{'end'} - $self->{'rowdata'}{$row}{'start()) . "\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 651 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 652 $ui_group->line( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 653 id => 'ui_element_' . ( $self->line_count() + rand() ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 654 x1 => 0 + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 655 x2 => $line_width + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 656 y1 => $y_fix + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 657 y2 => $y_fix + $self->y_offset() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 658 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 659 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 660 # print "Ruler is being plotted from $y_fix to $line_width\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 661 if ( $self->separate_strands() ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 662 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 663 #$ui_group->rectangle( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 664 #id => 'ui_element_' . ( $self->line_count() + rand() ) . "_" . rand(1), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 665 #x => 0 + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 666 #y => $y_fix - 2.5 + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 667 #width => $line_width, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 668 #height => 5 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 669 #); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 670 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 671 #$y_fix += 100; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 672 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 673 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 674 if ( $self->double_line_for_overlap() && $row > 1 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 675 { #This shows any duplicated part of the scale | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 676 if ( $rowdata{ $row - 1 }{end} - $rowdata{$row}{start} >= 0 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 677 { #Equal to zero indicates ONE base of overlap | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 678 $ui_group->line( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 679 id => 'ui_element_' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 680 . ( $self->line_count() + rand() ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 681 y1 => $y_fix - 5 + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 682 y2 => $y_fix - 5 + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 683 x1 => 0 + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 684 x2 => $self->calc_width() * ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 685 $rowdata{ $row - 1 }{end} - | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 686 $rowdata{$row}{start} | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 687 ) / $self->_internal_maxrowlength() + | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 688 $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 689 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 690 #$calc_width*($rowdata{$row-1}end'}-$rowdata{$row}{'start'})/$self->{'_internal_maxrowlength'} + $self->{'x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 691 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 692 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 693 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 694 $ui_group->line( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 695 id => 'ui_element_' . ( $self->line_count() + rand() ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 696 x1 => 0 + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 697 x2 => $line_width + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 698 y1 => $y_fix + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 699 y2 => $y_fix + $self->y_offset() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 700 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 701 foreach ( $rowdata{$row}{start} - 1 .. $rowdata{$row}{end} ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 702 if ( $_ % 1000 == 0 && $_ % 10000 != 0 ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 703 my $current_location = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 704 $self->calc_width() * | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 705 ( $_ - $rowdata{$row}{start} ) / | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 706 $self->_internal_maxrowlength(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 707 $ui_group->line( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 708 id => 'ui_element_' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 709 . ( $self->line_count() + rand() ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 710 x1 => $current_location + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 711 x2 => $current_location + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 712 y1 => $y_fix + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 713 y2 => $y_fix + 5 + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 714 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 715 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 716 if ( $_ % 10000 == 0 ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 717 my $current_location = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 718 $self->calc_width() * | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 719 ( $_ - $rowdata{$row}{start} ) / | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 720 $self->_internal_maxrowlength(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 721 $ui_group->line( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 722 id => 'ui_element_' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 723 . ( $self->line_count() + rand() ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 724 x1 => $current_location + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 725 x2 => $current_location + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 726 y1 => $y_fix + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 727 y2 => $y_fix + 10 + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 728 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 729 $ui_group->text( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 730 id => 'ui_text' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 731 . ( $self->line_count() + rand() ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 732 x => $current_location + 10 + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 733 y => $y_fix + 20 + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 734 -cdata => ( $_ / 1000 ) . " kb", | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 735 'fill' => '#000000', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 736 'fill-opacity' => 1, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 737 'font-family' => 'mono', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 738 'stroke' => 'none' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 739 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 740 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 741 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 742 if ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 743 ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 744 $_ == $rowdata{$row}{start} - 1 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 745 || $_ == $rowdata{$row}{end} | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 746 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 747 && ( $_ % 10000 != 0 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 748 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 749 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 750 my $current_location = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 751 $self->calc_width() * | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 752 ( $_ - $rowdata{$row}{start} ) / | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 753 $self->_internal_maxrowlength(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 754 $ui_group->line( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 755 id => 'ui_element_' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 756 . ( $self->line_count() + rand() ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 757 x1 => $current_location + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 758 x2 => $current_location + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 759 y1 => $y_fix + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 760 y2 => $y_fix + 10 + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 761 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 762 $ui_group->text( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 763 id => 'ui_text' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 764 . ( $self->line_count() + rand() ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 765 x => $current_location + $self->x_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 766 y => $y_fix + 20 + $self->y_offset(), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 767 -cdata => sprintf( '%d kb', ( $_ / 1000 ) ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 768 'fill' => '#000000', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 769 'fill-opacity' => 1, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 770 'font-family' => 'mono', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 771 'stroke' => 'none' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 772 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 773 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 774 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 775 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 776 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 777 sub addFeature { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 778 my ( $self, %data ) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 779 my %rowdata = %{ $self->rowdata() }; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 780 my $x = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 781 $self->calc_width() * | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 782 ( $data{'start'} - $rowdata{ $data{'row'} }{'start'} ) / | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 783 $self->_internal_maxrowlength() + $self->x_offset(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 784 my $w = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 785 $self->calc_width() * | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 786 ( $data{'end'} - $data{'start'} ) / | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 787 $self->_internal_maxrowlength(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 788 my $h = 15; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 789 my $y = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 790 ( $data{'row'} - 1 ) * $self->ils() + $self->y_offset() - $h / 2; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 791 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 792 my $id = "$x$y$w$h" . rand(); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 793 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 794 #print "Item(".$data{'start'}.",".$data{'end'}.",".$data{'row'}.") =\t($x,$y,$w,$h)\n"; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 795 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 796 if ( $self->separate_strands() ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 797 $y += -$data{'strand'} * 30; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 798 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 799 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 800 if ( $self->view() eq 'alt_random' ) { # Max add = 20 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 801 $y += 4 * ( $x % 5 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 802 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 803 elsif ( $self->view() eq 'alt_every' ) { # Max add = 10 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 804 # We (Sort of like a convolution?) multiply by strand This has | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 805 # the following effect; when on the top strand, we will only | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 806 # ever add a positive to the height of the item (moving it | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 807 # downward and closer to the ruler). On the bottom strand | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 808 # however, we only ever add a negative to the height of the | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 809 # item (moving it upwards towards the ruler). This allows the | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 810 # items on the top and bottom to stay balanced. | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 811 $y += | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 812 $data{'strand'} * 10 * | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 813 ( ( $self->_ft_count( $self->_ft_count() + 1 ) ) % 2 ) - | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 814 10 * $data{'strand'}; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 815 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 816 # However, This is imperfect, since we add items based on class, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 817 # not from left to right | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 818 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 819 elsif ( $self->view() eq 'alt_artemis' ) { # Max add = 20? | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 820 # Muwahahahaha. Sorry. Determined coefficient and constant by | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 821 # trial and error, but this matches up with the artemis view | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 822 # without an if/else based on which strand. :D | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 823 $y += | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 824 10 * ( ( $data{'start'} - 2 * $data{'strand'} + 1 ) % 3 ) - | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 825 10 * $data{'strand'}; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 826 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 827 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 828 my $item_color = $color_spec->getColour( $data{'color'} ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 829 if ($item_color) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 830 $data{'group'}->rectangle( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 831 x => ($x), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 832 y => $y, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 833 width => $w, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 834 height => $h, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 835 id => $id, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 836 fill => $color_spec->getColour( $data{'color'} ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 837 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 838 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 839 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 840 $data{'group'}->rectangle( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 841 x => ($x), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 842 y => $y, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 843 width => $w, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 844 height => $h, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 845 id => $id, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 846 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 847 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 848 if ( $self->label() && $data{'label'} ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 849 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 850 my ( $lx, $ly ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 851 my @char_data = split( //, $data{label} ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 852 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 853 #Exit early if we don't even want to plot. | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 854 my $is_too_small = ( scalar(@char_data) * 2 > $w ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 855 if ( $self->label_shrink_mode() eq 'cutoff' && $is_too_small ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 856 return; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 857 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 858 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 859 #Font Scaling | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 860 my $font_scaling = 100; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 861 if ( $self->label_shrink_mode() eq 'shrink' ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 862 $font_scaling *= $w / ( 8 * scalar(@char_data) ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 863 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 864 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 865 # Horizontal positioning | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 866 $lx = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 867 $x + | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 868 $w / 2 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 869 ; #Horizontally center it, but this is by the leading edge of the text | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 870 if ( scalar(@char_data) * 8 > $w | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 871 && $self->label_shrink_mode() eq 'shrink' ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 872 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 873 $lx -= | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 874 scalar(@char_data) * 4 * | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 875 $font_scaling / 100 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 876 ; #Adjustment for scaled text. Determined by experiment | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 877 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 878 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 879 $lx -= | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 880 scalar(@char_data) * 4 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 881 ; #Move four pixels left for every character in the label | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 882 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 883 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 884 # Vertical positioning | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 885 if ( $self->label_pos() eq "above" ) { #Label is ABOVE | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 886 if ( $self->separate_strands() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 887 && $data{'strand'} == -1 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 888 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 889 $ly = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 890 $y + | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 891 $h / 2 + 10 + 30 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 892 ; #Need to consider below strand, only one strand. | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 893 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 894 else { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 895 $ly = | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 896 $y + | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 897 $h / 2 - 30 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 898 ; #Need to consider below strand, only one strand. | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 899 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 900 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 901 else { #Label is ON | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 902 $ly = $y + $h / 2 + 5; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 903 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 904 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 905 if ( $data{'label'} !~ /^gene_[0-9]+$/ ){ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 906 $self->plot_label( $lx, $ly, $font_scaling, $data{'label'}, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 907 $data{'ui_group'} ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 908 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 909 if ( $self->label_callouts() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 910 && $self->label_pos() eq "above" ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 911 { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 912 $data{'ui_group'}->line( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 913 id => 'l' . "_" . rand(1), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 914 x1 => $x + ( $w / 2 ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 915 x2 => $x + ( $w / 2 ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 916 y1 => ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 917 $self->separate_strands() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 918 && $data{'strand'} eq '-1' ? $y + $h | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 919 : $y | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 920 ), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 921 y2 => ( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 922 $self->separate_strands() | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 923 && $data{'strand'} eq '-1' ? $ly - 12 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 924 : $ly | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 925 ) | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 926 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 927 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 928 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 929 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 930 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 931 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 932 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 933 sub plot_label { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 934 my ( $self, $x, $y, $font_size, $label, $ui_group ) = @_; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 935 if ( $font_size < 80 ) { | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 936 $font_size = 80; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 937 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 938 $ui_group->text( | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 939 id => 'text' . rand(1), | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 940 x => $x, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 941 y => $y, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 942 -cdata => $label, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 943 'fill' => '#000000', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 944 'fill-opacity' => 1, | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 945 'font-family' => 'mono', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 946 'font-size' => $font_size . '%', | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 947 'stroke' => 'none' | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 948 ); | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 949 } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 950 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 951 sub max ($$) { $_[ $_[0] < $_[1] ] } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 952 sub min ($$) { $_[ $_[0] > $_[1] ] } | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 953 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 954 no Moose; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 955 1; | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 956 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 957 __END__ | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 958 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 959 =pod | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 960 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 961 =encoding UTF-8 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 962 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 963 =head1 NAME | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 964 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 965 CPT::Plot::Base - Main plotting class for genome mapper | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 966 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 967 =head1 VERSION | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 968 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 969 version 1.96 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 970 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 971 =head1 AUTHOR | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 972 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 973 Eric Rasche <rasche.eric@yandex.ru> | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 974 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 975 =head1 COPYRIGHT AND LICENSE | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 976 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 977 This software is Copyright (c) 2014 by Eric Rasche. | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 978 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 979 This is free software, licensed under: | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 980 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 981 The GNU General Public License, Version 3, June 2007 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 982 | 
| 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 cpt parents: diff
changeset | 983 =cut | 
