3 CXGN::Cview::ChrMarkerImage - a class for drawing small chromosome image wit a specific marker hilited.
7 Inherits from L<CXGN::Cview::MapImage>.
11 Lukas Mueller (lam87@cornell.edu)
12 Naama Menda (nm249@cornell.edu)
22 use CXGN
::Cview
::Chromosome
;
23 #use CXGN::Cview::Cview_data_adapter;
24 use CXGN
::Cview
::MapImage
;
26 use File
::Temp qw
/ tempfile /;
27 use File
::Basename qw
/ basename /;
30 package CXGN
::Cview
::ChrMarkerImage
;
32 use base
"CXGN::Cview::MapImage";
36 Usage: my $chromosome= CXGN::Cview::ChrmarkerImage->new("map name", width,height,$dbh, $lg_name, $map, $marker_name);
39 Args: name of a map, width and height of the image in pixles, linkage group name, map object (my $map=CXGN::Map->new($dbh,$map_version_id);), $marker_name.
51 my $self= $class->SUPER::new
($name, $width, $height);
56 my $marker_name= shift;
61 $self->set_lg_name($lg_name);
63 $self->set_marker_name($marker_name);
64 $self->{basedir
} = $basedir;
65 $self->{tempdir
} = $tempdir;
67 my $chromosome = $map->get_chromosome($lg_name);
69 $chromosome->set_horizontal_offset(50);
70 $chromosome->set_vertical_offset(25);
71 $chromosome->set_height(100);
72 $chromosome->set_caption($self->get_lg_name);
73 $chromosome->set_width(12);
74 my $map_version_id= $self->get_map()->get_id();
75 my $marker_name= $self->get_marker_name();
76 my $lg_name=$self->get_lg_name();
77 $chromosome->set_url("/cview/view_chromosome.pl?map_version_id=$map_version_id&chr_nr=$lg_name&hilite=$marker_name");
79 my @markers= $chromosome->get_markers();
81 foreach my $m(@markers) {
82 if ($m->get_name() eq $self->get_marker_name()) {
84 $m->set_label_spacer(20);
86 else { $m->hide_label(); }
87 $m->set_color(150, 80, 50);
90 $self->add_chromosome($chromosome);
96 =head2 get_image_filename
98 Usage: my ($image_path, $image_url)=$chromosome->get_image_filename();
99 Desc: returns a tmp .png file of the chromosome image object
100 Ret: $image_path, $image_url
107 sub get_image_filename
{
110 my $dir = File
::Spec
->catfile($self->{basedir
}, $self->{tempdir
});
111 my $template = 'tempXXXX'; #not needed. The function tempfile seems to generate a default TEMPLATE 'XXXXXXXXXX$suffix'
113 my ($fh, $image_path) = File
::Temp
::tempfile
( DIR
=> $dir,
117 #my $filename = time().".$$.png";
119 my $filename = File
::Basename
::basename
($image_path);
121 #print STDERR "IMAGE PATH: $image_path\n";
122 my $image_url = File
::Spec
->catfile($self->{tempdir
}, $filename);
124 $self -> render_png_file
($image_path);
125 return ($image_path, $image_url);
177 return $self->{lg_name
};
194 $self->{lg_name
}=shift;
231 =head2 get_marker_name
242 sub get_marker_name
{
244 return $self->{marker_name
};
248 =head2 set_marker_name
259 sub set_marker_name
{
261 $self->{marker_name
}=shift;