4 CXGN::Cview::Chromosome::LineGraph - a class for displaying numeric quanity information alongside a genetic map
8 Inherits from L<CXGN::Cview::Chromosome::Graph>.
12 See also the documentation in L<CXGN::Cview>.
16 Lukas Mueller (lam87@cornell.edu) and Isaak Tecle (iyt2@cornell.edu)
25 use CXGN
::Cview
::Chromosome
;
27 package CXGN
::Cview
::Chromosome
::LineGraph
;
29 use base
qw(CXGN::Cview::Chromosome::Graph);
35 Returns: a pointer to the CXGN::Cview::Chromosme::LineGraph object
43 my $self = $class->SUPER::new
(@_);
44 $self->set_types("LOD");
45 $self->set_color(100,100,100);
49 =head2 function render()
51 Synopsis: $lg -> render($image)
52 Arguments: a GD::Image object
55 Description: renders the graph on the image
63 $self->_calculate_chromosome_length();
64 $self->_calculate_scaling_factor();
66 #print STDERR "rendering physical...\n";
68 my $color = $image -> colorResolve
($self->get_color());
70 # draw coordinate system lines
72 my $halfwidth = $self->get_width()/2;
74 if (defined($self->get_maximum())) {
75 $self->{largest
} = $self->get_maximum();
78 $self->{largest
} = $self->_get_largest_group();
81 $image -> line
($self->get_horizontal_offset()-$halfwidth, $self->get_vertical_offset(), $self->get_horizontal_offset()-$halfwidth, $self->get_vertical_offset()+$self->{height
}, $color);
83 $image -> stringUp
($self->{font
}, $self->get_horizontal_offset()-$halfwidth-$self->{font
}->height()/2, $self->get_vertical_offset()-4, $self->get_caption(), $color);
87 my $x = $self->get_horizontal_offset()-$halfwidth+10/($self->{largest
})*$self->get_width();
88 $image -> dashedLine
($x, $self->get_vertical_offset(), $x, $self->get_vertical_offset()+$self->{height
}, $color);
89 $image -> stringUp
($self->{font
}, $x - $self->{font
}->height()/2, $self->get_vertical_offset()-4,"10", $color);
93 #if ($self->{largest}>100) {
94 my $red_color = $image->colorResolve(255, 0, 0);
95 $x = $self->get_horizontal_offset()-$halfwidth+2/($self->{largest
}*$self->get_width());
96 $image -> dashedLine
($x, $self->get_vertical_offset(), $x, $self->get_vertical_offset()+$self->{height
}, $red_color);
97 $image -> stringUp
($self->{font
}, $x - $self->{font
}->height()/2, $self->get_vertical_offset()-4,"2", $color);
101 print STDERR
"Largest = $self->{largest} WIDTH= ".$self->get_width()."\n";
102 #print STDERR "Physical connections: ".@{$self->{offset}}."\n";
103 foreach my $type ($self->get_types()) {
104 if (exists($self->{offset
}{$type})) {
105 my $last_position = $self->get_vertical_offset();
106 my $last_value = $self->get_horizontal_offset() - $halfwidth;
107 for (my $i=0; $i<(@
{$self->{offset
}{$type}}); $i++) {
108 #print STDERR "offset = $i, $self->{offset}[$i]\n";
109 if (exists($self->{offset
}{$type}[$i])) {
110 my $y = $self->get_vertical_offset()+$self->mapunits2pixels($i);
111 #print STDERR "Drawing box...y = $y scaling: $self->{scaling_factor}\n";
112 my $x = ($self->get_horizontal_offset()-$halfwidth) + ($self->{offset
}{$type}[$i]/($self->{largest
})*$self->get_width());
113 #if ($box_width<1) { $box_width=2; }
122 print STDERR
"x $last_value, y $last_position, x $x, y $y\n";
135 # sub draw_chromosome {
138 # $self->render($image);
143 # my $offset = shift;
145 # my $y = $self->get_vertical_offset()+$offset;
146 # if ($self->{offset}{$type}[$offset] > 0 && $self->{largest}>0) {
147 # print STDERR "LARGEST: $self->{largest}\n";
148 # print STDERR "WIDTH ". $self->get_width()."\n";
149 # my $box_width = log($self->{offset}{$type}[$offset])/log($self->{largest})*$self->get_width();
150 # if ($box_width<1) { $box_width=2; }
151 # return ($self->get_horizontal_offset() - $self->get_width()/2, $y-$self->{box_height}/2, ($self->get_horizontal_offset()-$self->get_width()/2)+$box_width, $y + $self->{box_height}/2);
155 # sub get_image_map {
158 # my ($x, $y, $a, $b) = $self->get_enclosing_rect();
159 # my $url = $self->get_url();
160 # $string .= qq{ <area shape="rect" coords="$x, $y, $a, $b" href="$url" alt="" /> };
161 # # #print STDERR "get_image_map physical\n";
162 # # if ($self->get_url()) {
163 # # foreach my $type ($self->get_types()) {
164 # # for (my $i; $i<(@{$self->{offset}{$type}}); $i++) {
165 # # my ($x, $y, $v, $w) = $self -> get_box_rect($i, $type);
166 # # $string .="<area shape=\"rect\" coords=\"$x, $y, ".($self->get_horizontal_offset()+$self->get_width()/2).", $w \" href=\"".$self->get_url()."\" alt=\"\" />";