4 package CXGN
::Cview
::Chromosome_viewer
;
7 use CXGN
::DB
::Connection
;
9 use CXGN
::Tools
::WebImageCache
;
10 use CXGN
::Cview
::Map
::Tools
;
12 use CXGN
::Cview
::Utils qw
| set_marker_color get_maps_select get_chromosome_links
|;
13 use CXGN
::Cview
::MapImage
;
14 use CXGN
::Cview
::Chromosome
;
15 use CXGN
::Cview
::Chromosome
::Physical
;
16 use CXGN
::Cview
::Chromosome
::PachyteneIdiogram
;
18 use CXGN
::Cview
::ChrLink
;
19 use CXGN
::Cview
::MapFactory
;
22 use base qw
| CXGN
::DB
::Object
|;
28 CXGN::Cview::Chromosome_viewer -- a module to display comparative chromosome maps
32 my $viewer = chromosome_viewer -> new();
33 $viewer -> set_map_id($map_id);
34 $viewer -> set_map_version_id($map_version_id);
35 $viewer -> set_ref_chr($chr_nr);
36 $viewer -> set_cM($cM);
37 $viewer -> set_zoom($zoom);
38 $viewer -> set_show_physical($show_physical);
39 $viewer -> set_show_ruler($show_ruler);
40 $viewer -> set_show_IL($show_IL);
41 $viewer -> set_comp_map_id($comp_map_id);
42 $viewer -> set_comp_map_version_id($comp_map_version_id);
43 $viewer -> set_comp_chr($comp_chr);
44 $viewer -> set_color_model($color_model);
45 if ($map_chr_select) {
46 my ($comp_map_id, $comp_chr) = split / /, $map_chr_select;
47 $viewer->set_comp_map_id($comp_map_id);
48 $viewer->set_comp_chr($comp_chr);
50 $viewer -> set_cM_start($cM_start);
51 $viewer -> set_cM_end($cM_end);
52 $viewer -> set_confidence($confidence);
53 $viewer -> set_show_zoomed($show_zoomed);
54 $viewer -> set_hilite_zoomed($zoomed_hilite_start, $zoomed_hilite_end);
55 $viewer -> set_force($force);
57 $viewer -> generate_page();
63 Chromosome_viewer caches the images it produces using CXGN::Tools::WebImageCache. The expiration time is set to a day or so.
65 The cache for the image generated by any given URL can be reset by setting the force parameter to 1.
70 Lukas Mueller (lam87@cornell.edu)
74 The following functions are defined in the class:
81 Synopsis: generates a new chromosome_viewer object
82 Parameters: $dbh - a database handle
83 Returns: an object handle
84 Side effects: sets some useful default values, creates an SGN page object and
85 establishes a connection to the database through the page object.
96 if (! $dbh) { die "Chromosome_viewer now takes a dbh parameter."; }
97 my $self = $class->SUPER::new
($dbh, @_);
99 $self -> {unzoomedheight
} = 20; # how many cM are seen at zoom level 1
100 # $self -> {raster_size} = 5; # the default raster size for genetic maps
101 # for sequence-based maps this will be changed to 1
103 $self->set_temp_dir("/tmp"); # set some default for the temp_dir. However, this
104 # should be visible by apache (which tmp isn't).
108 =head2 function _adjust_parameters()
110 Synopsis: adjusts parameters; needs to be called before calling generate_image
113 Side effects: adjusts parameters to make program more robust against out-of-range
117 Notes: this function is only used internally
121 sub _adjust_parameters
{
124 # initialize some variables to prevent undefined blabla errors
125 $self->{fatal_errors
}="";
126 if (!$self->get_ref_chr()) { $self->set_ref_chr(1); }
127 if (!$self->get_hilite()) { $self->set_hilite(""); }
128 if (!($self->get_cM_start())) { $self->set_cM_start(0); }
130 # print STDERR "\n *** Map ID is : ".($self->get_map_id())." ***\n";
132 # It's possible for our objects to have empty strings for map_id attributes.
133 # The following weirdness preserves the interface invariant that get_map_id sets
134 # a desirable default map_id.
136 my $map_id = $self->get_map_id();
138 if ($self->get_map_version_id()) {
139 $self->set_map_id(0);
142 if ($self->get_comp_map_version_id()) {
143 $self->set_comp_map_id(0);
146 if (!$self->get_map_version_id() && $map_id eq '') {
147 $self->set_map_id(undef);
148 $map_id = $self->get_map_id();
151 # generate the map objects
153 my $map_factory = CXGN
::Cview
::MapFactory
->new($self->get_dbh(), $self->get_db_backend());
154 # print STDERR "Generating MapFactory with id ".$self->get_map_version_id()."\n";
155 # print STDERR "IS A ".ref($map_factory)."\n";
157 $self->set_ref_map( $map_factory->create( {map_version_id
=> $self->get_map_version_id(), map_id
=> $self->get_map_id()} ));
159 if (!$self->get_ref_map()) {
160 # if an illegal map id was supplied, create a default map.
161 $self->set_ref_map( $map_factory->create({map_id
=> CXGN
::Cview
::Map
::Tools
::current_tomato_map_id
()}) );
162 $self->append_error("Note: Displaying default map, F2-2000.");
165 $self->{ref_map_name
}=$self->get_ref_map()->get_short_name();
166 $self->set_map_version_id($self->get_ref_map()->get_id());
167 $self->{ref_map_type
}=$self->get_ref_map()->get_type();
169 if ($self->get_comp_map_id() || $self->get_comp_map_version_id()) {
170 $self->set_comp_map( $map_factory->create( { map_version_id
=>$self->get_comp_map_version_id(), map_id
=> $self->get_comp_map_id() } ) );
171 # { map_id => $self->get_comp_map_id(),
172 # map_version_id => $self->get_comp_map_version_id(),
178 # define the comparison map
180 if ($self->get_comp_map()) {
181 $self->{comp_map_name
} = $self->get_comp_map()->get_short_name();
182 $self->set_comp_map_version_id($self->get_comp_map()->get_id());
183 $self->{comp_map_type
} = $self->get_comp_map()->get_type();
184 # @{$self->{comp_chromo_names}} = $self->get_chr_names($self->get_comp_map_id());
185 @
{$self->{comp_chromo_names
}} = $self->get_comp_map()->get_chromosome_names();
186 #$self->{comp_max_chr} = $self->get_chr_count($self->get_comp_map_id());
187 $self->{comp_max_chr
} = scalar(@
{$self->{comp_chromo_names
}});
190 # test if the supplied chromosome is a legal chromosome on the specific map.
191 # if not, try to find a close match.
193 #if (!$self->is_ok_chr($self->get_map_id(), $self->get_ref_chr())) {
194 if (!$self->get_ref_map()->has_linkage_group($self->get_ref_chr())) {
195 # print STDERR "chr ".$self->get_ref_chr()." is not a valid chromosome\n";
196 my $old_chr = $self->get_ref_chr();
198 $chr =~ s/.*(\d{1,2}.*)/$1/;
199 #if (!$self->is_ok_chr($self->get_map_id(), $chr)) {
200 if (!$self->get_ref_map()->has_linkage_group($chr)) {
201 $chr =~ s/.*(\d).*/$1/;
203 if (!$self->get_ref_map()->has_linkage_group($chr)) {
204 #$self->append_errors("The specified chromosome ($old_chr) was not found on map $self->{ref_map_name}!<br /><br />");
205 $self->set_ref_chr(1);
208 $self->set_ref_chr($chr);
209 $self->append_error("The chromosome/linkage group $old_chr does not seem to exist on map ".$self->get_ref_map()->get_short_name().". The closest we could find was $chr, displayed below.<br /><br />");
214 # if no map_id was supplied, we show the F2.2000 as default
216 if (!$self->get_map_id()) { $self->set_map_id(CXGN
::Cview
::Map
::Tools
::current_tomato_map_id
()); }
218 # @{$self->{chromo_names}} = $self->get_chr_names($self->{map_id});
219 @
{$self->{chromo_names
}} = $self->get_ref_map()->get_chromosome_names();
221 #$self->{max_chr} = $self->get_chr_count($self->get_map_id());;
222 # get the number of chromosomes of the map.
224 $self->{max_chr
} = scalar($self->get_ref_map()->get_chromosome_count());
226 if ($self->get_ref_chr()<0) { $self->set_ref_chr(abs($self->get_ref_chr())); }
228 # set the default zoom size in MB for sequence maps
230 $self->{unzoomedheight
}=$self->get_ref_map()->initial_zoom_height();
231 # $self->{unzoomedheight}=4;
235 # adjust cM_start and cM_end if the chromosome was clicked.
237 # if ((($self->get_cM_start()==0) && ($self->get_cM_end()==0)) || ($self->get_cM_end()-$self->get_cM_start()==0)) {
239 $self->set_ref_chr_len($self->get_ref_map()->get_chr_len_by_name($self->get_ref_chr()));
240 if ($self->get_cM_start() > $self->get_cM_end()) {
241 $self->set_cM_start($self->get_cM_end());
242 $self->set_cM_end($self->get_cM_start() + $self->get_ref_map()->initial_zoom_height());
245 $self->{zoom_length
} = $self->get_cM_end() - $self->get_cM_start();
247 if ($self->{zoom_length
} == 0) {
248 $self->{zoom_length
} = $self->get_ref_map()->initial_zoom_height();
251 if ($self->get_clicked()) {
254 #die "Was going to reset cM_start and cM_end (cM defined... ".($self->get_cM()).")\n";
255 my $start = $self->get_cM()-($self->{zoom_length
}/2);
256 my $end = $self->get_cM()+($self->{zoom_length
}/2);
260 $end = $self->{zoom_length
};
263 # print STDERR "REF CHR: ".$self->get_ref_chr()."\n";
265 if ($end > $self->get_ref_chr_len()) {
266 $end = $self->get_ref_chr_len();
267 $start = $end - $self->{zoom_length
};
270 $self->set_cM_start($start);
271 $self->set_cM_end($end);
274 # $self->set_clicked(0);
276 # adjust the cM start value if it is below zero. This could (but shouldn't) happen
277 # during scrolling and zooming operations.
279 if ($self->get_cM_start() < 0) {
280 $self->set_cM_start(0);
281 $self->set_cM_end($self->{zoom_length
});
282 $self->set_cM(($self->get_cM_start()+$self->get_cM_end())/2);
284 if ($self->get_cM_end() > $self->get_ref_chr_len()) {
285 my $end = $self->get_ref_chr_len();
286 $self->set_cM_end($end);
287 $self->set_cM_start($end-$self->{zoom_length
});
290 if (!$self->{ref_map_name
}) { $self->{fatal_errors
} .= "Fatal error: The map id you entered is invalid.<br />"; }
292 if ($self->get_show_physical() && (!$self->get_ref_map()->has_physical())) {
293 $self->append_error("Note: You selected to show physical maps for a map that does not have an associated physical map. The physical map has been turned off.<p /> ");
294 $self->set_show_physical(0);
298 if ($self->get_confidence()==0) { $message= "I(LOD<2) and above [all]"; }
299 elsif ($self->get_confidence()==1) { $message = "I(LOD2) and above"; }
300 elsif ($self->get_confidence()==2) { $message = "CF(LOD3) and above"; }
301 elsif ($self->get_confidence()==3) { $message = "F(LOD>=3)"; }
302 if ($self->get_confidence()>-2) { $self->append_error("Only showing confidence of $message\n<p />"); }
304 # note: the force parameter is not part of the state hashref, because it
305 # would change the key and thus the cache file name.
307 my $state_hashref = {
308 chr_nr
=> $self->get_ref_chr(),
309 map_version_id
=> $self->get_map_version_id(),
311 show_ruler
=> $self->{show_ruler
},
312 show_IL
=> $self->{show_IL
},
313 show_offsets
=> $self->get_show_offsets(),
314 comp_map_version_id
=> $self->get_comp_map_version_id(),
315 comp_chr
=> $self->{comp_chr
},
316 color_model
=> $self->{color_model
},
317 show_physical
=> $self->{show_physical
},
318 size
=> $self->{size
},
319 show_zoomed
=> $self->{show_zoomed
},
320 confidence
=> $self->{confidence
},
321 hilite
=> $self->{hilite
},
322 marker_type
=> $self->{display_marker_type
},
323 cM_start
=> $self->get_cM_start(),
324 cM_end
=> $self->get_cM_end(),
325 #clicked => $self->get_clicked(),
329 # print STDERR "STATE HASHREF CONTENTS: \n";
330 # foreach my $k (%$state_hashref) {
331 ## print STDERR "$k = $$state_hashref{$k}.\n";
333 $self->set_state_hashref($state_hashref);
338 =head2 function generate_page()
340 Synopsis: generates the page to STDOUT in html
351 if ($self->{fatal_errors
}) { return; }
353 $self->_adjust_parameters();
356 $self->display_toolbar();
360 =head2 function get_image()
362 Synopsis: generates the viewer image as a png file
364 Returns: an array with the image path (semi-absolute) and the image url
365 Side effects: creates the image and stores it into a file
374 my $cache = CXGN
::Tools
::WebImageCache
->new();
375 my $state_hashref = $self->get_state_hashref();
376 # my $vhost_conf=CXGN::VHost->new();
377 my @sorted_values = map { $state_hashref->{$_} } sort keys %$state_hashref;
378 my $key = join "-", @sorted_values;
379 # print STDERR "USING KEY: $key\n";
380 $cache->set_key($key);
381 $cache->set_expiration_time(86400);
382 $cache->set_basedir($self->get_basedir());
383 #vhost_conf->get_conf('basepath'));
384 $cache->set_temp_dir($self->get_temp_dir());
385 #File::Spec->catfile($vhost_conf->get_conf('tempfiles_subdir'), "/cview"));
386 $cache->set_map_name("imagemap");
387 $cache->set_force( $self->get_force() );
389 if (! $cache->is_valid()) {
390 $self->generate_image();
391 $cache->set_image_data( $self->{map}->render_png_string() );
392 $cache->set_image_map_data( $self->{map}->get_image_map("imagemap") );
394 $self->{image_html
}= $cache->get_image_html();
402 my $x_distance = 120; # the number of pixels the different elements are spaced
403 my $element_count = 0.5; # the number of elements currently placed
407 if ($self->get_show_zoomed()) {
408 $map_width+=$x_distance;
410 if ($self->get_show_IL()) { $map_width+=$x_distance; }
412 #print STDERR "Size requested: $self->{size}\n";
413 if ($self->get_size() =~ /small/i) {
414 $self->{map_height
} = 300;
415 $self->set_chr_height(230);
417 elsif ($self->get_size()=~ /large/i) {
418 $self->{map_height
} = 800;
419 $self->set_chr_height(650);
422 $self->{map_height
} = 470;
423 $self->set_chr_height(400);
426 #print STDERR "Chr height: $self->{chr_height}\n";
427 $self->{map} = CXGN
::Cview
::MapImage
-> new
("", $map_width, $self->{map_height
});
429 # show IL lines if requested
431 if ($self->get_show_IL() && $self->get_ref_map()->has_IL()) {
432 my $map_factory = CXGN
::Cview
::MapFactory
->new($self->get_dbh(), $self->get_db_backend());
433 #print STDERR "Current map_id = ".$self->get_map_id()."\n";
434 my $IL_map = $map_factory->create({ map_version_id
=>"il6.".($self->get_map_id()) });
435 $self->{IL
} = $IL_map->get_chromosome($self->get_ref_chr());
437 $self->{IL
} -> set_height
($self->get_chr_height());
438 $self->{IL
} -> set_horizontal_offset
($x_distance*$element_count, 40);
439 $self->{IL
} -> set_vertical_offset
(40);
440 $self->{IL
} -> set_caption
("IL");
442 $self->{map}->add_chromosome($self->{IL
});
443 $element_count=$element_count+0.95;
446 elsif ($self->get_show_IL() && !$self->get_ref_map()->has_IL()) {
447 $self->append_error("You chose to display the IL information for a map that has no associated IL information.
448 The IL display has been turned off.<P>");
449 $self->set_show_IL(0);
452 # show the physical map if requested
454 if ($self->get_show_physical()) {
455 my $map_factory = CXGN
::Cview
::MapFactory
->new($self->get_dbh(), $self->get_db_backend());
457 my $physical_map = $map_factory -> create
( {map_version_id
=> "p9"});
459 # we get the overview chromosome, because it is more compact for the comparison
461 $self->{p
} = $physical_map->get_overview_chromosome($self->get_ref_chr());
462 $self->{p
}->set_horizontal_offset($x_distance*$element_count);
463 $self->{p
}->set_vertical_offset(40);
464 $self->{p
}->set_height($self->get_chr_height());
466 $self->{map}->add_physical($self->{p
});
473 $self->{c1
} = $self->get_ref_map()->get_chromosome($self->get_ref_chr());
474 #if ($self->get_show_offsets()) { $self->{c1}->set_display_marker_offset(); }
476 # adjust the appearance of the chromosome
478 $self->{c1
}->set_height($self->get_chr_height());
479 $self->{c1
}->set_vertical_offset(40);
480 $self->{c1
}->set_horizontal_offset($x_distance * $element_count);
481 $self->{c1
}->set_caption($self->get_ref_chr());
482 $self->{c1
}->set_labels_left();
483 $self->{c1
}->set_units( $self->get_ref_map()->get_units() );
484 $self->{c1
}->set_width( $self->get_ref_map()->get_preferred_chromosome_width() );
486 $self->append_error($self->get_ref_map()->get_messages());
487 my @m = $self->{c1
}->get_markers();
489 # get the markers and determine the highest confidence level
493 if ($m->get_confidence()>$highest) { $highest = $m->get_confidence(); }
497 if ($m->get_confidence() == $highest) { push @fm, $m; }
502 if ($self->get_ref_map()->collapsed_marker_count()) {
503 $interval = @fm/$self->get_ref_map()->collapsed_marker_count();
507 if (@m<$self->get_ref_map()->collapsed_marker_count()) { $interval=1; }
508 my $frame_marker_count =0;
509 for (my $i=0; $i<@m; $i++) {
510 $m[$i]->hide_label();
512 # show label if it is hilited...
514 my $marker_name = $m[$i]->get_name();
515 if ($self->get_hilite()=~ /\b$marker_name\b/i) {
516 $m[$i]->show_label();
520 # otherwise only show one in $interval markers of the
524 if ($m[$i]->get_confidence() == $highest) {
526 if ($frame_marker_count % $interval==0) {
527 $m[$i] -> show_label
();
531 else { $m[$i]->show_label(); }
532 $frame_marker_count++;
536 #else { $m[$i]->set_url("/search/markers/markerinfo.pl?id=".$m[$i]->get_marker_name()); }
537 set_marker_color
($m[$i], $self->get_color_model());
538 if ($m[$i]->get_confidence() < $self->get_confidence()) { $m[$i]->hide_label(); }
542 # make the chromosome clickable using the rasterize function and
545 #my $raster_size = int($self->{c1}->get_length() / 20) || 2;
546 if ($self->get_ref_map()->can_zoom()) {
547 $self->{c1
}->rasterize(1); #$raster_size);
548 $self->{c1
}->set_rasterize_link("view_chromosome.pl?map_version_id=".($self->get_map_version_id())."&chr_nr=".($self->get_ref_chr())."&show_physical=".($self->get_show_physical())."&show_IL=".($self->get_show_IL())."&show_ruler=".($self->get_show_ruler())."&show_offsets=".($self->get_show_offsets())."&color_model=".($self->get_color_model())."&comp_map_version_id=".($self->get_comp_map_version_id())."&comp_chr=".($self->get_comp_chr())."&zoom=".($self->get_zoom())."&size=".($self->get_size())."&hilite=".($self->get_hilite())."&confidence=".($self->get_confidence())."&show_zoomed=1&marker_type=".($self->get_display_marker_type())."&cM_start=".($self->get_cM_start())."&cM_end=".($self->get_cM_end())."&clicked=1&cM=");
551 $self->{map} -> add_chromosome
($self->{c1
});
553 # show the ruler if requested
555 if ($self->get_show_ruler()) {
556 $self->{r
} = $self->{c1
}->get_ruler();
557 $self->{r
}->set_horizontal_offset($x_distance/6);
558 $self->{r
}->set_vertical_offset(40);
559 $self->{r
}->set_height($self->get_chr_height());
560 $self->{r
}->set_start_value(0);
561 $self->{r
}->set_end_value($self->{c1
}->get_length());
562 $self->{map}->add_ruler($self->{r
});
565 # draw the chromosome section if a chromosome section was requested
566 # (that is, if cM is defined)
570 my @m2; # the markers on c2. Keep for later use.
571 if ($self->{show_zoomed
} && $self->get_ref_map()->can_zoom()) {
575 #$self->{c2} = CXGN::Cview::Chromosome -> new ($self->get_ref_chr(), $self->get_chr_height(), $x_distance*$element_count, 40);
576 $self->{c2
} = $self->get_ref_map()->get_chromosome_section($self->get_ref_chr(), $self->get_cM_start(), $self->get_cM_end(), $self->get_comp_chr());
577 if ($self->get_show_offsets()) { $self->{c2
}->set_display_marker_offset(); }
578 $self->{c2
}->set_height($self->get_chr_height());
579 $self->{c2
}->set_vertical_offset(40);
580 $self->{c2
}->set_hilite($self->get_hilite_zoomed());
581 $self->{c2
}->set_horizontal_offset($x_distance*$element_count);
584 # because we have incomplete length information from the query above,
585 # we set the length of the zoomed in chromosome
586 # to be the same as the comparison chromosome (the length is simply
587 # the marker position of the bottom marker)
589 $self->{c2
}->set_length($self->{c1
}->get_length());
591 # correct the cM_start and cM_end if out of range
593 #if ($self->get_cM_start() < 0) { $self->set_cM_start(0); }
594 if ($self->get_cM_end()>$self->{c2
}->get_length()) {
595 $self->set_cM_end($self->{c2
}->get_length());
597 $self->{c2
} ->set_units( $self->get_ref_map()->get_units() );
598 $self->{c2
} ->set_color(255, 220 ,220);
599 @m2 = $self->{c2
}->get_markers();
602 # go through the markers and show them according to confidence filter,
603 # add mark for overgo information etc.
605 for (my $i=0; $i<@m2; $i++) {
607 # hilite markers to be hilited
609 my $marker_name = $m2[$i]->get_name();
610 if ($self->get_hilite()=~/\b$marker_name\b/i) {
612 $m2[$i]->get_label()->set_hidden(0);
615 # hide markers with confidence below confidence threshold
617 if ($m2[$i]->get_confidence() < $self->{confidence
}) {
618 $m2[$i]->hide_label();
621 # hide markers that are not of the type that should be displayed
623 my $marker_type = $self->get_display_marker_type();
624 if ($self->get_display_marker_type() && ($m2[$i]->get_marker_type()!~/$marker_type/i)) {
625 $m2[$i]->hide_label();
627 set_marker_color
($m2[$i], $self->get_color_model());
630 # set the url only if the marker is visible (otherwise imagemap outside the image will be
631 # generated that confuses some browsers (such as Explorer).
633 if ($m2[$i]->is_visible()) {
634 # if (!$m2[$i]->get_url()) { # some url's may already be set in the data adapter.
635 # $m2[$i]->set_url( $self->get_ref_map()->get_marker_link($m2[$i]->get_id()) );
640 #$m[$i]->set_url("");
645 # set up the section and connections to the left hand chromosome
647 $self->{c2
} -> set_section
($self->get_cM_start(), $self->get_cM_end());
648 $self->{c1
} -> set_hilite_color
(255, 220,220);
649 $self->{c1
} -> set_hilite
($self->get_cM_start(), $self->get_cM_end());
650 $self->{link1
} = CXGN
::Cview
::ChrLink
-> new
($self->{c1
}, $self->get_cM_start(), $self->{c2
}, $self->get_cM_start());
651 $self->{link1
} -> set_color
(10, 10, 10);
652 $self->{link2
} = CXGN
::Cview
::ChrLink
-> new
($self->{c1
}, $self->get_cM_end(), $self->{c2
}, $self->get_cM_end());
653 $self->{link2
} -> set_color
(10, 10, 10);
654 $self->{map}->add_chr_link($self->{link1
});
655 $self->{map}->add_chr_link($self->{link2
});
657 $self->{map} -> add_chromosome
($self->{c2
});
660 # draw the map comparison if the map comparison was requested (comp_map comp_chr will be defined).
663 if ($self->get_comp_map() && $self->get_comp_chr()) {
665 #print STDERR "Generating the comparative map...\n";
669 #$self->{c3} = CXGN::Cview::chromosome -> new ($self->get_comp_chr(), $self->{chr_height}, $x_distance * $element_count, 40);
671 $self->{c3
}=$self->get_comp_map()->get_chromosome($self->get_comp_chr());
673 $self->{c3
}->set_height($self->get_chr_height());
674 $self->{c3
}->set_horizontal_offset($x_distance * $element_count);
675 $self->{c3
}->set_vertical_offset(40);
676 $self->{c3
}->set_units( $self->get_comp_map()->get_units() );
678 #print STDERR "Fetching map $self->{comp_map} chr $self->{comp_chr} from the database...\n";
680 #print STDERR "Adjusting colors etc...\n";
681 $self->{c3
} ->set_color(150, 150 ,200);
682 $self->{c3
} ->set_caption($self->get_comp_chr());
684 @m3 = $self->{c3
}->get_markers();
685 #print STDERR "$self->{comp_chr} has ".@m3." markers...\n";
686 for (my $i=0; $i<@m3; $i++) {
688 #print STDERR "Marker read:". $m3[$i]->get_name()."\n";
689 CXGN
::Cview
::Utils
::set_marker_color
($m3[$i], $self->get_color_model());
690 #$m3[$i]->set_url("/search/markers/markerinfo.pl?type=".$m3[$i]->get_marker_type()."&id=".$m3[$i]->get_marker_name());;
693 #print STDERR "Adding the chromosome to the map...\n";
694 $self->{map}->add_chromosome($self->{c3
});
696 # determine if the magnified section exists -- then draw the correspondence lines to that chromosome object (c2)
697 # else draw them to the original chromosome object (c1).
699 if (exists($self->{c2
})) {
700 $self->{c2
}->set_labels_left();
702 my $link_list = get_chromosome_links
($self->{c2
}, $self->{c3
});
703 foreach my $clink ($link_list->get_link_list()) {
704 $self->{map}->add_chr_link($clink);
707 foreach my $m3 (@m3) {
709 if ($link_list->has_link($m3->get_marker_name())) {
713 if ($m3->get_confidence < $self->{confidence
}) { $m3->hide_label(); }
714 my $marker_name = $m3->get_name();
715 if ($self->get_hilite()=~/\b$marker_name\b/i) {
722 #print STDERR "LINKS:::::::::::::::\n";
723 my $link_list = get_chromosome_links
($self->{c1
}, $self->{c3
});
724 foreach my $clink ($link_list->get_link_list()) {
725 #print STDERR " adding link...\n";
726 $self->{map}->add_chr_link($clink);
728 foreach my $m3 (@m3) {
730 set_marker_color
($m3, $self->get_color_model());
732 if ($link_list->has_link($m3->get_marker_name())) {
735 if ($m3->get_confidence < $self->{confidence
}) { $m3->hide_label(); }
736 if ($m3->get_name() eq $self->get_hilite()) {
743 if ($self->get_show_ruler()) {
744 $self->{r3
} = $self->{c3
}->get_ruler();
745 $self->{r3
}->set_horizontal_offset($element_count*$x_distance);
746 $self->{r3
}->set_vertical_offset(40);
747 $self->{r3
}->set_height($self->get_chr_height());
748 $self->{r3
}->set_start_value(0);
749 $self->{r3
}->set_end_value($self->{c3
}->get_length());
751 $self->{map}->add_ruler($self->{r3
});
759 =head2 function get_chr_height()
761 Synopsis: Accessor for the chr_height property
763 Returns: the current chr_height
764 Side effects: The chromosomes are being drawn with the chr_height in pixels
771 return $self->{chr_height
};
774 =head2 function set_chr_height()
777 Arguments: the chromosome height in pixels. In small mode, height is 230 pixels, and
778 normal mode the height is 400 pixels.
787 $self->{chr_height
}=shift;
790 =head2 accessors get_ref_map(), set_ref_map()
794 Args/Ret: the reference map as a CXGN::Cview::Map object
795 of the appropriate sub-class.
796 Side Effects: this will be the map displayed as the reference
804 if (!exists($self->{ref_map
})) { $self->{ref_map
}=undef; }
805 return $self->{ref_map
};
811 $self->{ref_map
}=shift;
814 =head2 accessors get_comp_map(), set_comp_map()
817 Property: the comparison map, as a CXGN::Cview::Map object
818 (or subclass thereof)
827 if (!exists($self->{comp_map
})) { $self->{comp_map
}=undef; }
828 return $self->{comp_map
};
834 $self->{comp_map
}=shift;
840 =head2 accessors set_map_id(), get_map_id()
842 Synopsis: sets the map_id for the reference chromosome
843 Parameters: map_id (integer)
845 Side effects: the map corresponding to map_id will be drawn as the reference chromosome
846 Status: DEPRECATED. Call $chr_viewer->get_ref_map()->get_id() instead...
853 $self->{map_id
}=shift;
858 # if (!exists($self->{map_id})) { $self->{map_id}=0; }
859 if (!exists($self->{map_id
})) { $self->{map_id
}=0; }
860 return $self->{map_id
};
863 =head2 accessors get_map_version_id(), set_map_version_id()
866 Desc: the map_version_id of the reference map
874 sub get_map_version_id
{
876 return $self->{map_version_id
};
880 sub set_map_version_id
{
882 $self->{map_version_id
}=shift;
885 =head2 accessors get_comp_map_version_id(), set_comp_map_version_id()
888 Desc: the map_version_id of the comparison map
896 sub get_comp_map_version_id
{
898 return $self->{comp_map_version_id
};
902 sub set_comp_map_version_id
{
904 $self->{comp_map_version_id
}=shift;
907 =head2 function set_comp_map_id()
909 Synopsis: setter function for the map id of the comparison chromosome
910 Parameters: the map id (integer)
912 Side effects: the specified map will be drawn as the reference chromosome
918 sub set_comp_map_id
{
920 $self->{comp_map_id
}=shift;
923 =head2 function get_comp_map_id()
925 Synopsis: get the current map id of the comparison chromosome
927 Returns: map id of the comparison chromosome
934 sub get_comp_map_id
{
936 if (!exists($self->{comp_map_id
})) { $self->{comp_map_id
}=0; }
937 return $self->{comp_map_id
};
940 =head2 function set_ref_chr()
942 Synopsis: setter function for the specifying the reference chromosome
943 number/linkage group name
944 Parameters: the desired chromosome number/linkage group name (string)
946 Side effects: the specified chromosome/linkage group will be displayed as
947 the reference chromosome
955 $self->{chr_nr
}=shift;
958 =head2 function get_ref_chr()
960 Synopsis: accessor function for set_ref_chr
962 Returns: the chromosome number/linkage group name for the reference
963 chromosome/linkage group
972 if (!exists($self->{chr_nr
}) || !defined($self->{chr_nr
})) { $self->{chr_nr
}=0; }
973 return $self->{chr_nr
};
976 =head2 function set_comp_chr()
978 Synopsis: setter function for specifying the comparison chromosome/linkage
980 Parameters: chromosome number/linkage group name
982 Side effects: the corrsponding chromosome will be drawn as the comparison chromosome
990 $self->{comp_chr
}=shift;
993 =head2 function get_comp_chr()
995 Synopsis: accessor function for set_comp_chr
1006 if (!exists($self->{comp_chr
})) { $self->{comp_chr
}=0; }
1007 return $self->{comp_chr
};
1010 =head2 accessors get_ref_chr_len, set_ref_chr_len
1020 sub get_ref_chr_len
{
1022 return $self->{ref_chr_len
};
1025 sub set_ref_chr_len
{
1027 $self->{ref_chr_len
} = shift;
1032 =head2 function set_cM_start()
1034 Synopsis: for a chromosome section, sets the starting point in cM
1035 Parameters: cM start position
1037 Side effects: cleans the input to be an integer
1045 my $cM_start = shift;
1046 $cM_start =~ s/[^0-9.]//g;
1047 #$cM_start =~ s/.*?(\d+\.?\d*).*/$1/;
1048 $self->{cM_start
}=abs($cM_start);
1051 =head2 function get_cM_start()
1053 Synopsis: accessor function for the cM_start property
1064 if (!exists($self->{cM_start
}) || !defined($self->{cM_start
})) { $self->{cM_start
}=0; }
1066 return sprintf "%.2f", $self->{cM_start
};
1069 =head2 function set_cM_end()
1071 Synopsis: sets the end of a chromosome /linkage group section, in cM
1072 Parameters: cM of end of section
1074 Side effects: On a chromosome section, this will define the endpoints of the section.
1075 If set_section has not been called, this will define which section is
1076 hilited. The cM and zoom property will be automatically re-calculated.
1085 $cM_end =~ s/[^0-9.]//g;
1086 if ($cM_end eq "" || !$cM_end) { $cM_end=0; }
1087 $self->{cM_end
}=abs(($cM_end));
1090 =head2 function get_cM_end()
1092 Synopsis: accessor function for the cM_end property
1103 if (!exists($self->{cM_end
}) || !defined($self->{cM_end
})) { $self->{cM_end
}=0; }
1104 return sprintf "%.2f", $self->{cM_end
};
1107 =head2 function set_cM()
1109 Synopsis: sets the cM property. This is the approximate location in which
1110 the user has clicked. If set_cM is set, cM_start and cM_end will be
1111 calculated automatically using the current zoom levels.
1112 Parameters: the cM position (integer)
1114 Side effects: recalculates cM_start and cM_end.
1125 =head2 function get_cM()
1127 Synopsis: accessor function for the cM property
1138 if (!exists($self->{cM
})) { $self->{cM
}=0; }
1142 =head2 function set_zoom()
1144 Synopsis: sets the zoom level on the reference chromosome
1145 Parameters: zoom level (1..10). 10 is the highest zoom level (most enlarged section
1146 showing fewer markers). Zoom levels outside the legal range are rounded to
1147 the nearest legal value.
1150 Status: Deprecated. Zooming is now implemented by setting cM_start and cM_end
1157 $self->{zoom
}=shift;
1158 if (!exists($self->{zoom
}) || $self->{zoom
} eq "") { $self->{zoom
}=0; }
1159 if ($self->{zoom
}==0) { $self->{zoom
} =1; }
1160 if ($self->{zoom
} > 10) { $self->{zoom
} =10; }
1163 =head2 function get_zoom()
1165 Synopsis: accessor function for the zoom property.
1167 Returns: the current zoom level (1..10)
1169 Status: Deprecated. Zooming is now implented by directly setting cM_start and cM_end.
1176 if (!exists($self->{zoom
})) { $self->{zoom
}=1; }
1177 return $self->{zoom
};
1180 =head2 accessors get_clicked, set_clicked
1182 Usage: my $flag = $cv -> get_clicked()
1183 Desc: returns true if this page should be regenerated
1184 as a response to a user clicking on the chromosome
1185 (instead of using some of the toolbar buttons),
1195 return $self->{clicked
};
1200 $self->{clicked
} = shift;
1205 =head2 function get_show_ruler()
1207 Synopsis: accessor function for the show_ruler property.
1209 Returns: true if ruler is shown, false otherwise
1216 sub get_show_ruler
{
1218 if (!exists($self->{show_ruler
})) { $self->{show_ruler
}=0; }
1219 return $self->{show_ruler
};
1222 =head2 function set_show_ruler()
1224 Synopsis: setter function for the show_ruler property.
1225 Parameters: true or false (0 or 1)
1227 Side effects: true causes the ruler to be displayed for both the reference and comparison map
1228 (if present), false hides the ruler.
1234 sub set_show_ruler
{
1236 $self->{show_ruler
} = shift;
1239 =head2 function set_show_IL()
1241 Synopsis: setter function for the show_IL property
1242 Parameters: true or false
1244 Side effects: if the current reference map has associated IL information, true will
1245 cause the IL map to be displayed alongside with the chromosome.
1253 $self->{show_IL
}=shift;
1256 =head2 function get_show_IL()
1258 Synopsis: accessor function for the show_IL property
1260 Returns: true or false
1269 if (!exists($self->{show_IL
})) { $self->{show_IL
}=0; }
1270 return $self ->{show_IL
};
1273 =head2 function set_show_physical()
1275 Synopsis: true causes the physical map to be displayed if the current reference map
1276 has an associated physical map
1277 Parameters: true/false
1285 sub set_show_physical
{
1287 $self->{show_physical
}=shift;
1290 =head2 function get_show_physical()
1292 Synopsis: true causes the physical map to be displayed if the current reference map
1293 has an associated physical map
1302 sub get_show_physical
{
1304 if (!exists($self->{show_physical
})) { $self->{show_physical
}=0; }
1305 return $self->{show_physical
};
1308 =head2 accessors set_show_offsets(), get_show_offsets()
1310 Property: if the offsets should be shown (each marker will display a
1311 label opposite of the marker label, showing the offset in map
1312 units for that marker, for the zoomed-in section
1318 sub get_show_offsets
{
1320 return $self->{show_offsets
};
1323 sub set_show_offsets
{
1325 $self->{show_offsets
}=shift;
1331 =head2 function get_size()
1333 Synopsis: accessor function for the size property
1335 Returns: "small" or "normal" or "large"
1344 if (!exists($self->{size
})) { $self->{size
}=0; }
1345 return $self->{size
};
1348 =head2 function set_size()
1350 Synopsis: sets the size of the image
1351 Parameters: string ("normal", "small" and "large" are currently supported).
1353 Side effects: "smaller" causes the entire map image to be rendered smaller
1354 (ideal for a laptop monitor)
1355 "normal" causes the entire map image to be rendered to fit a desktop monitor
1357 "larger" for really large monitors (>20\")
1365 $self->{size
}=shift;
1368 =head2 function set_hilite()
1370 Synopsis: hilites the specified markers on the reference map (unhides if necessary)
1371 on the zoomed-in map and on the comparison map.
1372 Parameters: a string, containing an enumeration of marker names to be hilited, separated
1373 by spaces (although other delimiters will also work such as comma, semicolons,
1376 Side effects: the hilited marker name will appear with a yellow background.
1385 $hilite =~ tr/\,\.\:\;\// /;
1386 $hilite =~ s/\s+/ /;
1387 $self->{hilite
} = $hilite;
1391 =head2 function get_hilite()
1393 Synopsis: accessor function for the hilite property
1395 Returns: the name of the currently hilited marker
1404 if (!exists($self->{hilite
})) { $self->{hilite
}=""; }
1405 return $self->{hilite
};
1408 =head2 function set_confidence()
1410 Synopsis: sets the minimal confidence level to be displayed
1411 Parameters: confidence level (-1, 0..3)
1412 -1: uncalculated confidence, 0 - interval marker ... 3 - frame marker
1414 Side effects: markers below the specified confidence level will be hidden
1420 sub set_confidence
{
1422 my $confidence = shift;
1423 $confidence =~ s/[A-Za-z]//g;
1424 if ($confidence eq "" || $confidence == undef ) { $confidence =-2; }
1425 $confidence = $confidence +0;
1426 $self->{confidence
} = $confidence;
1429 =head2 function get_confidence()
1431 Synopsis: accessor function for the confidence property
1433 Returns: the current lowest confidence level that is displayed
1434 Normal values for the confidence property are:
1440 If the confidence property is not set, it will return -2,
1441 causing all markers to be displayed.
1442 Side effects: markers with a lower confidence value (see list above) won\'t be
1449 sub get_confidence
{
1451 if (!exists($self->{confidence
})) { $self->{confidence
}=-2; }
1452 return $self->{confidence
};
1456 =head2 functions set_display_marker_type(), get_display_marker_type()
1458 Synopsis: $self->set_display_marker_type('COS');
1459 Arguments: a marker type. Any of COS, RFLP, ...
1461 Side effects: Will also set $self->{error} to indicate to the
1462 user that marker type subsets are shown.
1463 Description: if set_display_marker_type is called with a marker
1464 type argument, only that marker type will be shown
1465 on the viewer. If called with undef, shows all markers.
1469 sub set_display_marker_type
{
1472 if ($type && ("RFLP CAPS COS SSR"=~ /\b$type\b/)) {
1473 $self->{display_marker_type
}=$type;
1474 $self->append_error("Only markers of the type $self->{display_marker_type} are shown on the zoomed map.<br />");
1478 sub get_display_marker_type
{
1480 if (!exists($self->{display_marker_type
})) { $self->{display_marker_type
}=""; }
1481 return $self->{display_marker_type
};
1485 =head2 function set_show_zoomed()
1487 Synopsis: setter function for the show_zoomed property
1488 Parameters: show_zoomed property (0 or 1)
1489 Returns: status of the current show_zoomed property (0 or 1)
1490 Side effects: 0 will cause the zoomed in chromosome section not to be drawn
1491 1 will cause a zoomed in chromosome section to be drawn
1497 sub set_show_zoomed
{
1499 $self->{show_zoomed
} = shift;
1503 =head2 function get_show_zoomed()
1505 Synopsis: accessor function for the show_zoomed property
1507 Returns: status of the current show_zoomed property (0 or 1)
1515 sub get_show_zoomed
{
1517 if (!exists($self->{show_zoomed
})) { $self->{show_zoomed
}=0; }
1518 return $self->{show_zoomed
};
1521 =head2 accessors get_hilite_zoomed(), set_hilite_zoomed()
1523 Usage: $chr_viewer->set_hilite_zoomed($cM_start, $cM_end)
1524 Desc: hilites the given region in the zoomed-in section,
1525 using the current hilite color.
1526 Ret: The getter returns the start and end in cM
1527 Args: the start in cM [real], the end in cM [real]
1528 Side Effects: hilites the corresponding region
1529 Notes: the intended use for this is to hilite sections,
1530 such as the boundaries for ILs on the zoomed in
1535 sub set_hilite_zoomed
{
1537 $self->{hilite_zoom_start
}= shift;
1538 $self->{hilite_zoom_end
} = shift;
1543 sub get_hilite_zoomed
{
1545 return ($self->{hilite_zoom_start
}, $self->{hilite_zoom_end
});
1548 =head2 function get_color_model()
1551 Parameters: name of color model (currently, confidence and marker_type are supported)
1553 Side effects: sets the color model property to the specified color model
1560 sub set_color_model
{
1562 $self->{color_model
} = shift;
1565 =head2 function get_color_model()
1569 Returns: the name of the current marker color model
1576 sub get_color_model
{
1578 if (!exists($self->{color_model
})) { $self->{color_model
}=""; }
1579 return $self->{color_model
};
1583 =head2 function get_color_legend()
1587 Returns: a string containing html code for the marker color legend
1594 sub get_color_legend
{
1597 my $link = "view_chromosome.pl?map_version_id=".$self->get_map_version_id()."&chr_nr=".$self->get_ref_chr()."&show_physical=".$self->get_show_physical."&show_IL=".$self->get_show_IL()."&show_offsets=".$self->get_show_offsets()."&show_ruler=".$self->get_show_ruler()."&color_model=".$self->get_color_model()."&comp_map_version_id=".$self->get_comp_map_version_id()."&comp_chr=".$self->get_comp_chr()."&zoom=".$self->get_zoom()."&size=".$self->get_size()."&cM=".$self->get_cM()."&cM_start=".$self->get_cM_start()."&cM_end=".$self->get_cM_end()."&hilite=".$self->get_hilite()."&show_zoomed=".$self->get_show_zoomed()."";
1598 if ($self->{color_model
} eq "marker_types") {
1602 $string = "<b>Marker color by type:</b>
1603 <a href=\"$link\&marker_type=RFLP\" style=\"color:#FF0000\">RFLP</a> |
1604 <a href=\"$link\&marker_type=SSR\" style=\"color:#00FF00\">SSR</a> |
1605 <a href=\"$link\&marker_type=CAPS\" style=\"color:#0000FF\">CAPS</a> |
1606 <a href=\"$link\&marker_type=COS\" style=\"color:#FF00FF\">COS</a> |
1607 <font color=#000000>other</font>
1608 [<a href=\"$link\&marker_type=\" style=\"color:#111111\">show all</a>]";
1612 $string = "<b>Marker color by LOD score:</b>
1613 <a href=\"$link\&confidence=3\" style=\"color:#FF0000\">F(LOD3)</a> |
1614 <a href=\"$link\&confidence=2\" style=\"color:#00FF00\">CF(LOD>=3</a> |
1615 <a href=\"$link\&confidence=1\" style=\"color:#0000FF\">I(LOD2)</a> |
1616 <a href=\"$link\&confidence=0\" style=\"color:#000000\">I(LOD<2)</a> |
1617 <a href=\"$link\&confidence=-2\" style=\"color:#777777\">uncalculated</a> ";
1622 =head2 function get_marker_map_links()
1626 Returns: a string with html code for the marker map links pull down menu.
1627 if there is no appropriate map linked to the reference map,
1628 a string is returned that says so.
1629 Side effects: calls the get_chromosome_connections() function of the reference
1638 sub get_marker_map_links
{
1640 #print STDERR "get_marker_map_links...\n";
1641 # query the database for maps and chromosome that any of the markers of the current chromosome lie on.
1643 my $chr_nr = $self->get_ref_chr();
1644 my $F2_2000 = CXGN
::Cview
::Map
::SGN
::Genetic
->new($self->get_dbh(), CXGN
::Cview
::Map
::Tools
::find_current_version
( $self->get_dbh(), CXGN
::Cview
::Map
::Tools
::current_tomato_map_id
()));
1646 my $F2_2000_version_id = $F2_2000->get_id();
1648 my $form="<form style=\"margin-bottom:0\" action=\"/cview/view_chromosome.pl\">
1649 <input type=\"hidden\" name=\"chr_nr\" value=\"".($self->get_ref_chr())."\" />
1650 <input type=\"hidden\" name=\"map_version_id\" value=\"".($self->get_map_version_id())."\" />
1651 <input type=\"hidden\" name=\"zoom\" value=\"".($self->get_zoom())."\" />
1652 <input type=\"hidden\" name=\"show_ruler\" value=\"".($self->get_show_ruler())."\" />
1653 <input type=\"hidden\" name=\"show_IL\" value=\"".($self->get_show_IL())."\" />
1654 <input type=\"hidden\" name=\"show_offsets\" value=\"".($self->get_show_offsets())."\" />
1655 <input type=\"hidden\" name=\"cM_start\" value=\"".($self->get_cM_start())."\" />
1656 <input type=\"hidden\" name=\"cM_end\" value=\"".($self->get_cM_end())."\" />
1657 <input type=\"hidden\" name=\"show_physical\" value=\"".($self->get_show_physical())."\" />
1658 <input type=\"hidden\" name=\"color_model\" value=\"".($self->get_color_model())."\" />
1659 <input type=\"hidden\" name=\"size\" value=\"".($self->get_size())."\" />
1660 <input type=\"hidden\" name=\"show_zoomed\" value=\"".($self->get_show_zoomed())."\" />
1661 <input type=\"hidden\" name=\"hilite\" value=\"".($self->get_hilite())."\" />
1662 <input type=\"hidden\" name=\"marker_type\" value=\"".($self->get_display_marker_type())."\" /> ";
1664 my @options = $self->get_ref_map()->get_chromosome_connections($self->get_ref_chr());
1668 $form .= "<select name=\"map_chr_select\">";
1669 foreach my $o (@options) {
1670 # print STDERR $o->{map_version_id}, $o->{chr_nr}, $o->{short_name}."<br />\n";
1672 if ($o->{map_version_id
} == $self->get_comp_map_version_id()) {
1673 $selected = "selected=\"selected\"";
1676 $form .= qq { <option value
="$o->{map_version_id} $o->{lg_name}" $selected>Map
$o->{short_name
} Chromosome
$o->{lg_name
} ($o->{marker_count
} markers
)</option
> };
1679 $form .="</select>\n";
1680 $self->{compare_disabled
} = "";
1683 $form .= "<select name=\"map_chr_select\" disabled=\"disabled\" >";
1684 $form .= "<option value=\"\" disabld=\"disabled\" >No maps to compare to</option>";
1685 $form .= "</select>\n";
1686 $self->{compare_disabled
} = qq{ disabled
="disabled" };
1689 $form .= "<input type=\"submit\" value=\"Compare\" $self->{compare_disabled} /></form>";
1697 if (!exists($self->{errors
})) { $self ->{errors
}=""; }
1698 $self->{errors
}.=$append;
1703 return $self->{errors
};
1706 =head2 function get_preceding_chromosome()
1708 Synopsis: gives the name of the chromosome or linkage group preceding the
1710 Parameters: chromosome name / linkage group name
1711 Returns: the chromosome number or linkage group name preceding this
1712 chromosome/linkage group
1721 sub get_preceding_chromosome
{
1724 my $chr_count = scalar( @
{$self->{chromo_names
}} );
1726 my $old_chr_index=0;
1728 # find current chromosome in chromo_names array (a hash would be more elegant...)
1730 for (my $i=0; $i< (@
{$self->{chromo_names
}}); $i++) {
1731 if (${$self->{chromo_names
}}[$i] eq $chr_nr) {
1736 if ($old_chr_index==0) { $chr_index = $chr_count-1; }
1737 else { $chr_index = $old_chr_index-1; }
1738 return ${$self->{chromo_names
}}[$chr_index];
1741 =head2 function get_next_chromosome()
1743 Synopsis: gives the name of the chromosome or linkage group following the given
1745 Parameters: chromosome name / linkage group name
1746 Returns: the chromosome number or linkage group name following this
1747 chromosome/linkage group
1756 sub get_next_chromosome
{
1759 my $chr_count = scalar( @
{$self->{chromo_names
}} );
1761 my $old_chr_index = 0;
1762 for (my $i=0; $i< (@
{$self->{chromo_names
}}); $i++) {
1763 if (${$self->{chromo_names
}}[$i] eq $chr_nr) {
1768 if ($old_chr_index == ($chr_count-1)) { $chr_index = 0; }
1769 else { $chr_index = $old_chr_index+1; }
1770 return ${$self->{chromo_names
}}[$chr_index];
1773 sub get_preceding_comp_chromosome
{
1776 if (!($self->get_comp_map())) {
1779 my $chr_count = scalar( @
{$self->{comp_chromo_names
}} );
1781 my $old_chr_index = 0;
1783 for (my $i=0; $i< (@
{$self->{comp_chromo_names
}}); $i++) {
1784 if (${$self->{comp_chromo_names
}}[$i] eq $chr_nr) {
1789 if ($old_chr_index == 0) { $chr_index = $chr_count-1; }
1790 else { $chr_index = $old_chr_index-1; }
1791 return ${$self->{comp_chromo_names
}}[$chr_index];
1794 sub get_next_comp_chromosome
{
1797 if (!($self->get_comp_map())) {
1801 my $chr_count = scalar( @
{$self->{comp_chromo_names
}} );
1803 my $old_chr_index = 0;
1804 for (my $i=0; $i< (@
{$self->{comp_chromo_names
}}); $i++) {
1805 if (${$self->{comp_chromo_names
}}[$i] eq $chr_nr) {
1811 if ($old_chr_index == ($chr_count-1)) { $chr_index = 0; }
1812 else { $chr_index = $old_chr_index+1; }
1813 return ${$self->{comp_chromo_names
}}[$chr_index];
1818 =head2 function display_toolbar()
1820 Synopsis: displays the toolbar by printing html to STDOUT
1823 Side effects: prints html code to STDOUT
1829 sub display_toolbar
{
1831 #$self->{scrolldown} = $self->{cM}+2*$self->{unzoomedheight}/$self->{zoom}/3;
1835 $self->{scrolldown_start
} = $self->get_cM_start() + ($self->{zoom_length
} / 2);
1836 $self->{scrolldown_end
} = $self->get_cM_end() + ($self->{zoom_length
} / 2);
1837 if ($self->{scrolldown_end
} > $self->get_ref_chr_len()) {
1839 $self->{scrolldown_end
}= $self->get_ref_chr_len();
1840 $self->{scrolldown_start
} = $self->{scrolldown_end
}-$self->{zoom_length
};
1842 #$self->{scrollup} = $self->{cM}-2*$self->{unzoomedheight}/$self->{zoom}/3;
1843 $self->{scrollup_start
} = $self->get_cM_start()- ($self->{zoom_length
} / 2);
1844 $self->{scrollup_end
} = $self->get_cM_end() - ($self->{zoom_length
} /2);
1845 if ($self->{scrollup_start
}<0) {
1846 $self->{scrollup_start
}=0;
1847 $self->{scrollup_end
}=$self->{zoom_length
};
1850 if ($self->{zoom_length
}==0) { die "ZOOM LENGTH IS 0!\n"; }
1851 #$self->{zoom_in} = $self->{zoom}+1;
1852 $self->{zoom_in_start
} = $self->get_cM_start() +($self->{zoom_length
}/4);
1853 $self->{zoom_in_end
} = $self->get_cM_end() - ($self->{zoom_length
}/4);
1855 #$self->{zoom_out} = $self->{zoom}-1;
1856 $self->{zoom_out_start
} = $self->get_cM_start() - ($self->{zoom_length
}/4);
1857 $self->{zoom_out_end
} = $self->get_cM_end + ($self->{zoom_length
}/4);
1859 if ($self->{zoom_out_end
} > $self->get_ref_chr_len()) {
1860 $self->{zoom_out_end
} = $self->get_ref_chr_len();
1861 $self->{zoom_out_start
} = $self->{zoom_out_end
} - $self->{zoom_length
};
1864 # set buttons to disabled when no zoomed-in chromosome is displayed.
1865 if (!$self->{show_zoomed
} || !$self->get_ref_map()->can_zoom()) {
1866 $self->{zoom_in_disabled
}="disabled=\"disabled\"";
1867 $self->{zoom_out_disabled
} = "disabled=\"disabled\"";
1868 $self->{scroll_up_disabled
} = "disabled=\"disabled\"";
1869 $self->{scroll_down_disabled
} = "disabled=\"disabled\"";
1874 # if (!$self->map_has_physical($self->{map_id})) {
1875 if (!$self->get_ref_map()->has_physical()) {
1876 $self->{physical_disabled
} = "disabled=\"disabled\"";
1879 if (!$self->get_ref_map()->has_IL()) {
1880 $self->{IL_disabled
} = qq { disabled
="disabled" };
1883 $self->{IL_disabled
} = "";
1886 if ($self->{show_zoomed
}) {
1887 #$self->{zoom_in_disabled} = "";
1888 $self->{enable_zoom_text
} = "Hide zoomed";
1889 $self->{enable_zoom_value
} = 0;
1890 $self->{toggle_zoomed_section
} = 0;
1893 $self->{zoom_in_disabled
} = " disabled=\"disabled\" ";
1894 $self->{enable_zoom_text
} = "Show zoomed";
1895 $self->{enable_zoom_value
} =1;
1896 $self->{toggle_zoomed_section
} = 10;
1898 if (!$self->get_ref_map->can_zoom()) {
1899 $self->{zoomed_button_enabled
}= " disabled=\"disabled\" ";
1902 # $self->{next_chromosome} = $self->{chr_nr} + 1;
1903 # if ($self->{next_chromosome} > $self->{max_chr}) { $self->{next_chromosome} = 1; }
1905 $self->{next_chromosome
} = $self->get_next_chromosome($self->get_ref_chr());
1907 # $self->{preceding_chromosome} = $self->{chr_nr}-1;
1908 # if ($self->{preceding_chromosome} == 0) { $self->{preceding_chromosome} = $self->{max_chr}; }
1910 $self->{preceding_chromosome
} = $self -> get_preceding_chromosome
($self->get_ref_chr());
1912 # $self->{next_comp_chr} = $self->{comp_chr} + 1;
1913 # if ($self->{next_comp_chr} > $self->{comp_max_chr}) { $self->{next_comp_chr} = 1; }
1915 $self->{next_comp_chr
} = $self->get_next_comp_chromosome($self->get_comp_chr());
1917 # $self->{preceding_comp_chr} = $self -> {comp_chr} -1;
1918 # if ($self->{preceding_comp_chr} ==0 ) { $self->{preceding_comp_chr} = $self->{comp_max_chr}; }
1919 $self->{preceding_comp_chr
} = $self->get_preceding_comp_chromosome($self->get_comp_chr());
1922 # $self->{imagemap} = $self->{map}->get_image_map("imagemap");
1924 $self->{marker_map_links
} = $self->get_marker_map_links();
1926 my $comp_map_caption = "";
1927 my $chromo_designation = "chr";
1928 if ($self->get_comp_chr()=~/[A-Za-z]/) { $chromo_designation = "linkage group"; }
1929 if ($self->get_comp_map_version_id()) { $comp_map_caption = "<td>Comparing to $chromo_designation <b>$self->{comp_chr}</b> of map </td><td bgcolor=\"#9999CC\"><a href=\"/cview/map.pl?map_version_id=$self->{comp_map_version_id}\"><b>$self->{comp_map_name}</b></a> </td>"; }
1931 # some legends need to know the state of the script...
1932 $self->get_ref_map()->get_legend()->set_state_hashref($self->get_state_hashref());
1933 $self->get_ref_map()->get_legend()->set_mode($self->get_color_model());
1934 my $color_legend = $self->get_ref_map()->get_legend()->get_legend_html();
1935 my $toggle_ruler= !($self->{show_ruler
});
1936 my $toggle_physical = !($self->{show_physical
});
1937 my $toggle_IL = ! ($self->{show_IL
});
1938 my $toggle_offsets = ! ($self->get_show_offsets());
1940 my $toggle_size_select = qq { <select name
="size" > };
1943 if ($self->{size
}=~/small/i) { $selected[0]=qq { selected
="1" }; }
1944 elsif ($self->{size
}=~/large/i) { $selected[2]= qq { selected
="1" }; }
1945 else { $selected[1]= qq { selected
="1" }; }
1946 $toggle_size_select .= qq { <option value
="small" $selected[0] >Small
</option
> };
1947 $toggle_size_select .= qq { <option value
="normal" $selected[1] >Normal
</option
> };
1948 $toggle_size_select .= qq { <option value
="large" $selected[2] >Large
</option
> };
1949 $toggle_size_select .= qq { </select> };
1951 if (!$self->get_comp_map_version_id()) {
1952 $self->{hide_comparison
} = "disabled=\"disabled\"";
1955 $self->{maps_select
} = CXGN
::Cview
::Utils
::get_maps_select
($self->get_dbh(), $self->get_ref_map()->get_id());
1957 my $view_entire_map_link = " View entire comparative map";
1958 if ($self->get_comp_map_version_id()) {
1959 $view_entire_map_link = " <a href=\"/cview/view_maps.pl?center_map_version_id=".($self->get_ref_map()->get_id())."&right_map_version_id=$self->{comp_map_version_id}\">View entire comparative map</a>";
1962 $self->{url_map_name
} = $self->{ref_map_name
};
1963 $self->{url_map_name
} =~ s/ /\+/g;
1966 my $show_marker_link = "Show markers between 0 and 0 cM";
1967 if ($self->{show_zoomed
} && $self->get_ref_map()->can_zoom()) {
1968 $show_marker_link= "<a href=\"/search/markers/markersearch.pl?
1969 w822_pos_start=".$self->get_cM_start()."&w822_pos_end=".$self->get_cM_end()."&w822_maps=".(CXGN
::Cview
::Map
::Tools
::find_map_id_with_version
($self->get_dbh(), $self->get_ref_map()->get_id()))."&w822_confs=$self->{confidence}&&w822_submit=Search&w822_chromos=".$self->get_ref_chr()."\"\n>Search markers between ".($self->get_cM_start())." and ".($self->get_cM_end())." ".$self->get_ref_map()->get_units()."</a>";
1971 $chromo_designation = "chr";
1972 if ($self->get_ref_chr()=~/[A-Za-z]/) { $chromo_designation = "linkage group"; }
1974 my $state_hashref = $self->get_state_hashref();
1977 my $scroll_up_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
("Scroll up", $state_hashref);
1978 $scroll_up_button -> set_property
("cM_start", $self->{scrollup_start
});
1979 $scroll_up_button -> set_property
("cM_end", $self->{scrollup_end
});
1980 $scroll_up_button -> set_enabled
($self->{scroll_up_disabled
});
1981 my $scroll_up_html = $scroll_up_button -> render_string
();
1983 my $scroll_down_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
("Scroll down", $state_hashref);
1984 $scroll_down_button -> set_property
("cM_start", $self->{scrolldown_start
});
1985 $scroll_down_button -> set_property
("cM_end", $self->{scrolldown_end
});
1986 $scroll_down_button -> set_enabled
($self->{scroll_down_disabled
});
1987 my $scroll_down_html = $scroll_down_button -> render_string
();
1989 my $zoom_in_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
("Zoom in", $state_hashref);
1990 $zoom_in_button -> set_property
("cM_start", $self->{zoom_in_start
});
1991 $zoom_in_button -> set_property
("cM_end", $self->{zoom_in_end
});
1992 $zoom_in_button -> set_enabled
($self->{zoom_in_disabled
});
1993 my $zoom_in_html = $zoom_in_button -> render_string
();
1996 my $zoom_out_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
("Zoom out", $state_hashref);
1997 $zoom_out_button -> set_property
("cM_start", $self->{zoom_out_start
});
1998 $zoom_out_button -> set_property
("cM_end", $self->{zoom_out_end
});
1999 $zoom_out_button -> set_enabled
($self->{zoom_out_disabled
});
2000 my $zoom_out_html = $zoom_out_button-> render_string
();
2002 my $show_zoomed_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
($self->{enable_zoom_text
}, $state_hashref);
2003 $show_zoomed_button->set_enabled($self->{zoomed_button_enabled
});
2004 $show_zoomed_button -> set_property
("show_zoomed", $self->{toggle_zoomed_section
});
2006 my $show_zoomed_html = $show_zoomed_button -> render_string
();
2008 my $hide_comparison_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
("Hide comparison", $state_hashref);
2009 $hide_comparison_button -> set_property
("comp_map_version_id", 0);
2010 $hide_comparison_button -> set_property
("comp_chr", 0);
2011 $hide_comparison_button -> set_enabled
($self->{hide_comparison
});
2012 my $hide_comparison_html = $hide_comparison_button -> render_string
();
2014 my $switch_chromosomes_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
("Switch chromosomes", $state_hashref);
2015 $switch_chromosomes_button -> set_property
("comp_chr", $self->get_ref_chr());
2016 $switch_chromosomes_button -> set_property
("chr_nr", $self->get_comp_chr());
2017 $switch_chromosomes_button -> set_property
("map_version_id", $self->get_comp_map_version_id());
2018 $switch_chromosomes_button -> set_property
("comp_map_version_id", $self->get_map_version_id());
2019 $switch_chromosomes_button -> set_enabled
($self->{hide_comparison
});
2020 my $switch_chromosomes_html = $switch_chromosomes_button -> render_string
();
2022 my $sync_preceding_chr_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
->new("<<", $state_hashref);
2023 $sync_preceding_chr_button ->set_property("chr_nr", $self->{preceding_chromosome
});
2024 $sync_preceding_chr_button ->set_property("comp_chr", $self->{preceding_comp_chr
});
2025 $sync_preceding_chr_button ->set_enabled($self->{hide_comparison
});
2026 my $sync_preceding_chr_html = $sync_preceding_chr_button->render_string();
2028 my $sync_next_chr_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
->new(">>", $state_hashref);
2029 $sync_next_chr_button ->set_property("chr_nr", $self->{next_chromosome
});
2030 $sync_next_chr_button ->set_property("comp_chr", $self->{next_comp_chr
});
2031 $sync_next_chr_button ->set_enabled($self->{hide_comparison
});
2032 my $sync_next_chr_html = $sync_next_chr_button->render_string();
2034 my $previous_chr_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
($self->{preceding_chromosome
}."<", $state_hashref);
2035 $previous_chr_button -> set_property
("chr_nr", $self->{preceding_chromosome
});
2036 my $previous_chr_html = $previous_chr_button -> render_string
();
2038 my $next_chr_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
(">".$self->{next_chromosome
}, $state_hashref);
2039 $next_chr_button -> set_property
("chr_nr", $self->{next_chromosome
});
2040 my $next_chr_html = $next_chr_button -> render_string
();
2042 my $preceding_comp_chr_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
($self->{preceding_comp_chr
}."<", $state_hashref);
2043 $preceding_comp_chr_button -> set_property
("comp_chr", $self->{preceding_comp_chr
});
2044 $preceding_comp_chr_button -> set_enabled
($self->{hide_comparison
});
2045 my $preceding_comp_chr_html = $preceding_comp_chr_button -> render_string
();
2047 my $next_comp_chr_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
(">".$self->{next_comp_chr
}, $state_hashref);
2048 $next_comp_chr_button -> set_property
("comp_chr", $self->{next_comp_chr
});
2049 $next_comp_chr_button -> set_enabled
($self->{hide_comparison
});
2050 my $next_comp_chr_html = $next_comp_chr_button -> render_string
();
2052 my $ruler_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
("Ruler", $state_hashref);
2053 $ruler_button -> set_property
("show_ruler", $toggle_ruler);
2054 my $ruler_html = $ruler_button->render_string();
2056 my $physical_map_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
-> new
("Physical map", $state_hashref);
2057 $physical_map_button -> set_property
("show_physical", $toggle_physical);
2058 $physical_map_button -> set_enabled
($self->{physical_disabled
});
2059 my $physical_map_html = $physical_map_button -> render_string
();
2061 my $IL_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
->new("IL", $state_hashref);
2062 $IL_button -> set_property
("show_IL", $toggle_IL);
2063 $IL_button -> set_enabled
($self->{IL_disabled
});
2064 my $IL_html = $IL_button -> render_string
();
2066 my $offset_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
->new("Offsets", $state_hashref);
2067 $offset_button -> set_property
("show_offsets", $toggle_offsets);
2068 $offset_button -> set_enabled
($self->{zoom_button_enabled
});
2069 my $offset_html = $offset_button-> render_string
();
2071 # my $size_button = CXGN::Cview::Chromosome_view::toolbar_button -> new($size_button_text, $state_hashref);
2072 # $size_button -> set_property("size", $toggle_size);
2073 # my $size_html = $size_button -> render_string();
2075 my $errors = $self->get_errors();
2077 my $chr_nr = $self->get_ref_chr();
2078 my $map_version_id = $self->get_map_version_id();
2079 my $map_name = $self->get_ref_map()->get_short_name();
2080 my $zoom = $self->get_zoom();
2081 my $cM = $self->get_cM();
2082 my $show_ruler = $self->get_show_ruler();
2083 my $show_IL = $self->get_show_IL();
2084 my $show_offsets = $self->get_show_offsets();
2085 my $comp_map_version_id= $self ->get_comp_map_version_id();
2086 my $comp_chr= $self->get_comp_chr();
2087 my $color_model = $self->get_color_model();
2088 my $show_physical = $self->get_show_physical();
2089 my $size = $self->get_size();
2090 my $show_zoomed = $self->get_show_zoomed();
2091 my $confidence = $self->get_confidence();
2092 my $hilite = $self->get_hilite();
2093 my $display_marker_type = $self->get_display_marker_type();
2094 my $cM_start = $self->get_cM_start();
2095 my $cM_end = $self->get_cM_end();
2097 my $zoom_range_html = qq {
2098 <form style
="margin-bottom:0" >
2099 <input type
="hidden" name
="map_version_id" value
="$map_version_id" />
2100 <input type
="hidden" name
="chr_nr" value
="$chr_nr" size
="2" />
2101 <input type
="hidden" name
="show_ruler" value
="$show_ruler" />
2102 <input type
="hidden" name
="show_IL" value
="$show_IL" />
2103 <input type
="hidden" name
="show_offsets" value
="$show_offsets" />
2104 <input type
="hidden" name
="comp_map_version_id" value
="$comp_map_version_id" />
2105 <input type
="hidden" name
="comp_chr" value
="$comp_chr" />
2106 <input type
="hidden" name
="color_model" value
="$color_model" />
2107 <input type
="hidden" name
="show_physical" value
="$show_physical" />
2108 <input type
="hidden" name
="size" value
="$size" />
2109 <input type
="hidden" name
="show_zoomed" value
="1" />
2110 <input type
="hidden" name
="confidence" value
="$confidence" />
2111 <input type
="hidden" name
="hilite" value
="$hilite" />
2112 <input type
="hidden" name
="marker_type" value
="$display_marker_type" />
2114 <b
>zoom range
:</b> <input name="cM_start" size="3" value="$cM_start" /> to
<input name
="cM_end" size
="3" value
="$cM_end" />
2115 <input type
="submit" value
="show" />
2125 <table summary="" cellpadding="0" cellspacing="0"><tr><td>Viewing $chromo_designation <b>$chr_nr</b> of map </td><td bgcolor="#CC9999"><a href=\"/cview/map.pl?map_version_id=$map_version_id\"><b>$map_name</b></a></td><td> </td>
2127 <td> [<a href="/help/cview.pl">Help</a>]</td>
2130 <table summary="" cellpadding="0" cellspacing="0"><tr>
2140 <table summary="" cellpadding="0" cellspacing="0"><tr><td>
2169 <td width="10"> </td><td>
2172 <!-- $show_marker_link -->
2178 <table summary="" cellpadding="0" cellspacing="0" border="0">
2179 <tr><td valign="middle" width="120"><b>Compare map to:</b> </td><td valign="middle">$self->{marker_map_links}</td></tr>
2182 <table summary="" cellpadding="0" cellspacing="0">
2184 <tr><td width="120"> </td><td>
2186 $hide_comparison_html
2192 $switch_chromosomes_html
2200 $view_entire_map_link
2206 <table summary=""><tr><td>
2208 <form style="margin-bottom:0" action="/cview/view_chromosome.pl">
2210 <table summary="" cellpadding="0" border="0" cellspacing="0">
2211 <tr valign="middle"><td valign="middle" width="120">
2212 <b>Jump to map:</b></td><td>$self->{maps_select}</td><td valign="middle"> chr </td><td>
2213 <input type="text" name="chr_nr" value="$chr_nr" size="2" />
2214 <input type="hidden" name="zoom" value="$zoom" />
2215 <!-- <input type="hidden" name="cM" value="$cM" /> -->
2216 <input type="hidden" name="cM_start" value="$cM_start" />
2217 <input type="hidden" name="cM_end" value="$cM_end" />
2218 <input type="hidden" name="show_ruler" value="$show_ruler" />
2219 <input type="hidden" name="show_IL" value="$show_IL" />
2220 <input type="hidden" name="show_offsets" value="$show_offsets" />
2221 <input type="hidden" name="comp_map_version_id" value="$comp_map_version_id" />
2222 <input type="hidden" name="comp_chr" value="$comp_chr" />
2223 <input type="hidden" name="color_model" value="$color_model" />
2224 <input type="hidden" name="show_physical" value="$show_physical" />
2225 <input type="hidden" name="size" value="$size" />
2226 <input type="hidden" name="show_zoomed" value="$show_zoomed" />
2227 <input type="hidden" name="confidence" value="$confidence" />
2228 <input type="hidden" name="hilite" value="$hilite" />
2229 <input type="hidden" name="marker_type" value="$display_marker_type" />
2230 <input type="submit" value="Jump" />
2237 <td width="20"> </td>
2240 <form style="margin-bottom:0" action="/cview/view_chromosome.pl">
2241 <b>Highlight marker:</b>
2242 <input type="text" name="hilite" value="$hilite" size="5" />
2243 <input type="submit" value="Highlight" />
2244 <input type="hidden" name="zoom" value="$zoom" />
2245 <!-- <input type="hidden" name="cM" value="$cM" /> -->
2246 <input type="hidden" name="cM_start" value="$cM_start" />
2247 <input type="hidden" name="cM_end" value="$cM_end" />
2248 <input type="hidden" name="chr_nr" value="$chr_nr" />
2249 <input type="hidden" name="map_version_id" value="$map_version_id" />
2250 <input type="hidden" name="show_ruler" value="$show_ruler" />
2251 <input type="hidden" name="show_IL" value="$show_IL" />
2252 <input type="hidden" name="show_offsets" value="$show_offsets" />
2253 <input type="hidden" name="comp_map_version_id" value="$comp_map_version_id" />
2254 <input type="hidden" name="comp_chr" value="$comp_chr" />
2255 <input type="hidden" name="color_model" value="$color_model" />
2256 <input type="hidden" name="show_zoomed" value="$show_zoomed" />
2257 <input type="hidden" name="confidence" value="$confidence" />
2258 <input type="hidden" name="show_physical" value="$show_physical" />
2259 <input type="hidden" name="size" value="$size" />
2260 <input type="hidden" name="marker_type" value="$display_marker_type" />
2271 <table summary="" cellpadding="0" cellspacing="0" border="0"><tr>
2272 <td width="120"> </td>
2273 <td colspan="3" align="center"><b>Reference chromosome</b></td>
2274 <td width="20"> </td>
2275 <td colspan="3" align="center"><b>Comparison chromosome</b></td>
2278 <td width="120"> </td>
2281 <table summary="" cellpadding="0" cellspacing="0" border="0"><tr><td>
2282 $sync_preceding_chr_html
2288 <td align="center" valign="middle">
2292 unless($chr_nr ne "") {$chr_nr =" ";}
2297 <b>$chr_nr</b> </td>
2304 <td width="20"> </td>
2306 $preceding_comp_chr_html
2310 <td align="center" valign="middle">
2315 unless($comp_chr ne "") {$comp_chr =" ";}
2320 <b>$comp_chr</b> </td>
2323 <table summary="" cellpadding="0" cellspacing="0" border="0"><tr><td>
2333 <table summary="" cellpadding="0" cellspacing="0">
2334 <tr><td valign="middle" width="120">
2335 <b>Show/hide:</b></td>
2361 <td width="30"> </td>
2362 <td valign="middle"> <b>image size: </b> </td><td>
2364 <form style="margin-bottom:0" action="/cview/view_chromosome.pl">
2366 <input type="submit" value="change" />
2367 <input type="hidden" name="zoom" value="$zoom" />
2368 <input type="hidden" name="cM_start" value="$cM_start" />
2369 <input type="hidden" name="cM_end" value="$cM_end" />
2370 <input type="hidden" name="chr_nr" value="$chr_nr" />
2371 <input type="hidden" name="map_version_id" value="$map_version_id" />
2372 <input type="hidden" name="show_ruler" value="$show_ruler" />
2373 <input type="hidden" name="show_IL" value="$show_IL" />
2374 <input type="hidden" name="show_offsets" value="$show_offsets" />
2375 <input type="hidden" name="comp_map_version_id" value="$comp_map_version_id" />
2376 <input type="hidden" name="comp_chr" value="$comp_chr" />
2377 <input type="hidden" name="color_model" value="$color_model" />
2378 <input type="hidden" name="show_zoomed" value="$show_zoomed" />
2379 <input type="hidden" name="confidence" value="$confidence" />
2380 <input type="hidden" name="show_physical" value="$show_physical" />
2381 <input type="hidden" name="marker_type" value="$display_marker_type" />
2400 =head2 accessors set_state_hashref(), get_state_hashref()
2402 Property: the state_hashref is a hash describing the current
2403 state of the Chromosome_viewer, essentially collecting
2404 all the processed page arguments.
2405 Args/Ret: a hash reference
2406 Side Effects: the state_hashref determines what the toolbar buttons
2407 and links constructed on the page will contain as
2412 sub get_state_hashref
{
2414 return $self->{state_hashref
};
2417 sub set_state_hashref
{
2419 $self->{state_hashref
}=shift;
2423 =head2 accessors set_force(), get_force()
2425 Property: force - regenerate cached files whatever the
2427 Args/Ret true for re-generation, false for letting cache
2428 decide when to re-generate the images.
2429 Side Effects: true will force regenerate all associated files
2436 if (!exists($self->{force
}) || !defined($self->{force
})) {
2439 return $self->{force
};
2444 $self->{force
}=shift;
2461 if (!exists($self->{temp_dir
})) {
2462 die "Chromosome_viewer: need a temp_dir for storing images... STOP!\n";
2465 return $self->{temp_dir
};
2482 $self->{temp_dir
}=shift;
2498 if (!exists($self->{basedir
})) {
2499 die "Chromosome_viewer: need a basedir for storing images... STOP!\n";
2501 return $self->{basedir
};
2518 $self->{basedir
}=shift;
2521 =head2 accessors get_db_backend, set_db_backend
2523 Usage: $v ->set_db_backend("cxgn");
2524 Desc: sets the db backend of the comparative viewer.
2525 following values are allowed:
2526 o cxgn - the cxgn database
2527 o cmap - the cmap database
2528 o cxgn_and_cmap - both databases are queried for maps.
2529 Property a string describing the database backend to be used.
2530 Side Effects: the specified backend will be used
2534 sub get_db_backend
{
2536 return $self->{db_backend
};
2539 sub set_db_backend
{
2541 $self->{db_backend
} = shift;
2548 package CXGN
::Cview
::Chromosome_view
::toolbar_button
;
2553 my $self = bless $args, $class;
2557 my $properties_hashref = shift;
2559 $self->set_name($name);
2561 %{$self->{properties
}} = ( 'chr_nr' => "",
2562 'map_version_id' => "",
2566 'show_offsets'=> "",
2567 'comp_map_version_id' => "",
2569 'color_model' => "",
2570 'show_zoomed' => "",
2571 'show_physical' => "",
2575 'marker_type' => "",
2582 foreach my $k (keys(%$properties_hashref)) {
2583 if (exists(${$self->{properties
}}{$k})) {
2584 ${$self->{properties
}}{$k}=$$properties_hashref{$k};
2586 else { print STDERR
"property $k is not supported in toolbar_button package.\n"; }
2593 $self->{name
}=shift;
2598 return $self->{name
};
2603 $self->{action
} = shift;
2608 if (!exists($self->{action
})) { $self->{action
}=""; }
2609 return $self->{action
};
2613 # parameter: true or false setting to enabled or disabled
2616 $self->{enabled
} = shift;
2621 return $self->{enabled
};
2626 my $property = shift;
2628 if (!$value) { $value=""; }
2629 if (!exists(${$self->{properties
}}{$property})) {
2630 print STDERR
"Warning: toolbar_button: property $property does not exist!\n";
2634 ${$self->{properties
}}{$property}=$value;
2642 my $action = $self->get_action();
2644 if ($action eq "") {
2647 my $s = "<form style=\"margin-bottom:0\" action=\"$action\">\n";
2649 foreach my $p (keys %{$self->{properties
}}) {
2650 #print STDERR "Printing toolbar button: hidden field: $p, $self->{properties}{$p}\n";
2651 if (exists($self->{properties
}{$p}) && $self->{properties
}{$p}) {
2652 $s .= "<input type=\"hidden\" name=\"$p\" value=\"$self->{properties}{$p}\" />\n";
2658 if ($self->is_enabled()) {
2659 $disabled = "disabled=\"disabled\"";
2664 $s .="<input type=\"submit\" value=\"".$self->get_name()."\" $disabled />\n";
2671 print $self->render_string();
2675 # <FORM style="margin-bottom:0" action=/cview/view_chromosome.pl>
2676 # <INPUT TYPE=hidden NAME=chr_nr VALUE="$self->{chr_nr}" />
2677 # <INPUT TYPE=hidden NAME=map_id VALUE="$self->{map_id}" />
2678 # <INPUT TYPE=hidden NAME=zoom VALUE="$self->{zoom}" />
2679 # <INPUT TYPE=hidden NAME=cM VALUE="$self->{cM}" />
2680 # <INPUT TYPE=hidden NAME=show_ruler VALUE="$self->{show_ruler}" />
2681 # <INPUT TYPE=hidden NAME=show_IL VALUE="$self->{IL}" />
2682 # <INPUT TYPE=hidden NAME=comp_map VALUE="$self->{comp_map}" />
2683 # <INPUT TYPE=hidden NAME=comp_chr VALUE="$self->{comp_chr}" />
2684 # <INPUT TYPE=hidden NAME=color_model VALUE="$self->{color_model}" />
2685 # <INPUT TYPE=hidden NAME=show_zoomed VALUE="$self->{show_zoomed}" />
2686 # <INPUT TYPE=hidden NAME=show_physical VALUE="$self->{show_physical}" />
2687 # <INPUT TYPE=hidden NAME=confidence VALUE="$self->{confidence}" />
2688 # <INPUT TYPE=hidden NAME=size VALUE="$toggle_size" />
2689 # <INPUT TYPE=hidden NAME=hilite VALUE="$self->{hilite}" />
2690 # <INPUT TYPE=submit VALUE="$size_button" />