Added to perldoc instructions about the use of the environment variables.
[cxgn-corelibs.git] / lib / CXGN / Cview / Map_overviews / Physical.pm
blob14e02bb9ff96676c84ac231e8dd00b4839b2a0a4
3 =head1 NAME
5 CXGN::Cview::Map_overviews::Physical - a class to draw physical map representations.
7 =head1 SYNOPSYS
9 see L<CXGN::Cview::Map_overviews>.
11 =head1 DESCRIPTION
14 =head1 AUTHOR(S)
16 Lukas Mueller (lam87@cornell.edu)
18 =head1 VERSION
21 =head1 LICENSE
24 =head1 FUNCTIONS
26 This class implements/overrides the following functions:
28 =cut
32 =head1 CXGN::Cview::Map_overviews::physical_overview
34 A class to display a genetic map with the overgo results next to it.
35 Inherits from CXGN::Cview::Map_overviews.
37 =cut
39 use strict;
41 package CXGN::Cview::Map_overviews::Physical;
43 use base qw( CXGN::Cview::Map_overviews::Generic );
45 sub hilite_marker {
46 my $self = shift;
47 my $marker_name = shift;
48 push @{$self->{hilite_markers}}, $marker_name;
51 sub render_map {
52 my $self = shift;
54 if ($self->has_cache()) { return; }
57 $self->{map_image}=CXGN::Cview::MapImage->new("", 13*$self->get_horizontal_spacing(), 150);
58 my @c = ();
60 my $cM_eq = 0.4; # 1 cM corresponds to 0.4 pixels.
61 my $max_chr_len_cM = 0;
62 my $max_chr_len_pixels = 0;
64 # draw chromosomes
66 for (my $i=1; $i<=@{$self->get_map()->linkage_groups()}; $i++) {
67 $c[$i]= CXGN::Cview::Chromosome -> new(1, 100, $self->get_horizontal_spacing()*$i, 40);
68 CXGN::Cview::Cview_data_adapter::fetch_chromosome($self, $c[$i], $self->get_map(), $i);
69 my @markers = $c[$i]->get_markers();
70 #$self->set_marker_count($i, scalar(@markers));
71 my $chr_len = 0;
72 foreach my $m (@markers) {
73 $m -> hide_label();
74 $m -> set_color(200, 100, 100);
75 if ($m->get_offset() > $chr_len) { $chr_len = $m->get_offset(); }
77 $c[$i]->set_caption($i);
78 $c[$i]->set_width(12);
79 #$c[$i]->set_url("/cview/view_chromosome.pl?map_id=$self->{map_id}&amp;chr_nr=$i");
80 my $chr_len_pixels = $chr_len*$cM_eq;
81 $c[$i]->set_height($chr_len_pixels);
82 if ($chr_len > $max_chr_len_cM) {
83 $max_chr_len_cM = $chr_len;
84 $max_chr_len_pixels = $chr_len_pixels;
86 $c[$i]->set_length($chr_len);
87 $c[$i]->layout();
88 $c[$i]->rasterize(5);
89 $c[$i]->set_rasterize_link("/cview/view_chromosome.pl?map_version_id=".$self->get_map()->map_version_id()."&amp;chr_nr=$i&amp;show_ruler=1&amp;show_zoomed=1&amp;show_physical=1&amp;cM=");
91 $self->{map_image}->add_chromosome($c[$i]);
93 my @p; # the physical maps
94 # draw physical maps
96 for (my $i=1; $i<=@{$self->get_map()->linkage_groups()}; $i++) {
97 $p[$i]= CXGN::Cview::Physical -> new(1, 100, $self->get_horizontal_spacing()*$i+22, 40);
98 CXGN::Cview::Cview_data_adapter::fetch_chromosome($self, $p[$i], $self->get_map(), $i);
99 CXGN::Cview::Cview_data_adapter::fetch_physical($self, $p[$i], $self->get_map(), $i);
100 $p[$i]->set_box_height(2);
101 my @markers = $p[$i]->get_markers();
102 # $self->{marker_count}[$i] = scalar(@markers);
103 my $chr_len = 0;
104 foreach my $m (@markers) {
105 $m -> hide_label();
106 if ($m->get_offset() > $chr_len) { $chr_len = $m->get_offset(); }
109 my $chr_len_pixels = $chr_len*$cM_eq;
110 $p[$i]->set_height($chr_len_pixels);
111 if ($chr_len > $max_chr_len_cM) {
112 $max_chr_len_cM = $chr_len;
113 $max_chr_len_pixels = $chr_len_pixels;
115 #$c[$i]->rasterize(5);
116 #$c[$i]->set_rasterize_link("/cview/view_chromosome.pl?map_id=$self->{map_id}&amp;chr_nr=$i&amp;show_zoomed=1&amp;cM=");
118 $self->{map_image}->add_physical($p[$i]);
120 # print STDERR "mac chr len pixels: $max_chr_len_pixels, max chr len: $max_chr_len_cM\n";
121 $self->{map_image}->add_ruler(CXGN::Cview::Ruler->new(20, 40, $max_chr_len_pixels, 0, $max_chr_len_cM));
123 $self->set_image_map( $self->{map_image}->get_image_map("#mapmap") );
126 package CXGN::Cview::Map_overviews::physical_overview;
128 use base qw | CXGN::Cview::Map_overviews::Physical | ;
130 sub new {
131 my $class = shift;
132 my $self = $class->SUPER::new(@_);
133 return $self;
137 return 1;