fix AGP map and upgrade to new, WGS-based AGPs.
[cview.git] / lib / CXGN / Cview / LocusChr.pm
blob71e328bc89ad1fb332e8cbd423d126dff3ec8e9b
1 package CXGN::Cview::LocusChr;
2 use strict;
3 use warnings;
5 use CXGN::Cview;
6 use CXGN::Cview::Chromosome;
7 use CXGN::Cview::Cview_data_adapter;
8 use CXGN::Configuration;
9 use CXGN::Cview::MapImage;
12 use base qw/ CXGN::Cview::MapImage /;
14 =head2 new
16 Usage:
17 Desc:
18 Ret:
19 Args:
20 Side Effects:
21 Example:
23 =cut
25 sub new {
26 my $class=shift;
27 my $name = shift;
28 my $width = shift;
29 my $height = shift;
30 my $self= $class->SUPER::new($name, $width, $height);
31 my $dbh=shift;
32 my $lg_name= shift;
33 my $map = shift;
34 my $marker_name= shift;
35 $self->set_dbh($dbh);
36 $self->set_lg_name($lg_name);
37 $self->set_map($map);
38 $self->set_marker_name($marker_name);
39 return $self;
43 =head2 get_image_filename
45 Usage:
46 Desc:
47 Ret:
48 Args:
49 Side Effects:
50 Example:
52 =cut
54 sub get_image_filename {
55 my $self=shift;
57 my $filename = time().".$$.png";
58 my $vhost_conf=CXGN::CView::Config->new();
59 my $image_path = $vhost_conf->get_conf('basepath').$vhost_conf->get_conf('tempfiles_subdir')."/cview/$filename";
60 my $image_url = $vhost_conf->get_conf('tempfiles_subdir')."/cview/$filename";
62 my $chromosome= CXGN::Cview::Chromosome->new($self->get_lg_name(), 100,50, 25 );
63 CXGN::Cview::Cview_data_adapter::fetch_chromosome($self->get_dbh(), $chromosome, $self->get_map(), $self->get_lg_name());
64 $chromosome->set_caption($self->get_lg_name);
65 $chromosome->set_width(12);
66 my $map_id= $self->get_map()->map_id();
67 my $marker_name= $self->get_marker_name();
68 my $lg_name=$self->get_lg_name();
69 $chromosome->set_url("/cview/view_chromosome.pl?map_id=$map_id&chr_nr=$lg_name&hilite=$marker_name");
71 my @markers= $chromosome->get_markers();
73 foreach my $m(@markers) {
74 if ($m->get_name() eq $self->get_marker_name()) {
75 $m->hilite();
76 $m->set_label_spacer(20);
78 else { $m->hide_label(); }
79 $m->set_color(150, 80, 50);
82 $self->add_chromosome($chromosome);
84 $self -> render_png_file($image_path);
85 return ($image_path, $image_url);
89 =head2 get_dbh
91 Usage:
92 Desc:
93 Ret:
94 Args:
95 Side Effects:
96 Example:
98 =cut
100 sub get_dbh {
101 my $self=shift;
102 return $self->{dbh};
106 =head2 set_dbh
108 Usage:
109 Desc:
110 Ret:
111 Args:
112 Side Effects:
113 Example:
115 =cut
117 sub set_dbh {
118 my $self=shift;
119 $self->{dbh}=shift;
124 =head2 get_lg_name
126 Usage:
127 Desc:
128 Ret:
129 Args:
130 Side Effects:
131 Example:
133 =cut
135 sub get_lg_name {
136 my $self=shift;
137 return $self->{lg_name};
141 =head2 set_lg_name
143 Usage:
144 Desc:
145 Ret:
146 Args:
147 Side Effects:
148 Example:
150 =cut
152 sub set_lg_name {
153 my $self=shift;
154 $self->{lg_name}=shift;
157 =head2 get_map
159 Usage:
160 Desc:
161 Ret:
162 Args:
163 Side Effects:
164 Example:
166 =cut
168 sub get_map {
169 my $self=shift;
170 return $self->{map};
174 =head2 set_map
176 Usage:
177 Desc:
178 Ret:
179 Args:
180 Side Effects:
181 Example:
183 =cut
185 sub set_map {
186 my $self=shift;
187 $self->{map}=shift;
191 =head2 get_marker_name
193 Usage:
194 Desc:
195 Ret:
196 Args:
197 Side Effects:
198 Example:
200 =cut
202 sub get_marker_name {
203 my $self=shift;
204 return $self->{marker_name};
208 =head2 set_marker_name
210 Usage:
211 Desc:
212 Ret:
213 Args:
214 Side Effects:
215 Example:
217 =cut
219 sub set_marker_name {
220 my $self=shift;
221 $self->{marker_name}=shift;
226 return 1;