1 package CXGN
::Cview
::ChromosomeViewer
;
7 use CXGN
::DB
::Connection
;
8 use CXGN
::Tools
::WebImageCache
;
9 use CXGN
::Cview
::Map
::Tools
;
11 use CXGN
::Cview
::Utils qw
|set_marker_color get_maps_select get_chromosome_links
|;
12 use CXGN
::Cview
::MapImage
;
13 use CXGN
::Cview
::Chromosome
;
14 use CXGN
::Cview
::Chromosome
::Physical
;
15 use CXGN
::Cview
::Chromosome
::PachyteneIdiogram
;
17 use CXGN
::Cview
::ChrLink
;
18 use CXGN
::Cview
::MapFactory
;
20 use base qw
| CXGN
::DB
::Object
|;
24 CXGN::Cview::ChromosomeViewer -- a module to display comparative chromosome maps
28 my $viewer = CXGN::Cview::ChromosomeViewer->new;
29 $viewer->set_map_id($map_id);
30 $viewer->set_map_version_id($map_version_id);
31 $viewer->set_ref_chr($chr_nr);
33 $viewer->set_zoom($zoom);
34 $viewer->set_show_physical($show_physical);
35 $viewer->set_show_ruler($show_ruler);
36 $viewer->set_show_IL($show_IL);
37 $viewer->set_comp_map_id($comp_map_id);
38 $viewer->set_comp_map_version_id($comp_map_version_id);
39 $viewer->set_comp_chr($comp_chr);
40 $viewer->set_color_model($color_model);
41 if ($map_chr_select) {
42 my ($comp_map_id, $comp_chr) = split / /, $map_chr_select;
43 $viewer->set_comp_map_id($comp_map_id);
44 $viewer->set_comp_chr($comp_chr);
46 $viewer->set_cM_start($cM_start);
47 $viewer->set_cM_end($cM_end);
48 $viewer->set_confidence($confidence);
49 $viewer->set_show_zoomed($show_zoomed);
50 $viewer->set_hilite_zoomed($zoomed_hilite_start, $zoomed_hilite_end);
51 $viewer->set_force($force);
53 $viewer->generate_page();
59 ChromosomeViewer caches the images it produces using CXGN::Tools::WebImageCache. The expiration time is set to a day or so.
61 The cache for the image generated by any given URL can be reset by setting the force parameter to 1.
66 Lukas Mueller (lam87@cornell.edu)
70 The following functions are defined in the class:
76 Synopsis: generates a new chromosome_viewer object
77 Parameters: $dbh - a database handle
78 Returns: an object handle
79 Side effects: sets some useful default values, creates an SGN page object and
80 establishes a connection to the database through the page object.
90 if ( !$dbh ) { die "ChromosomeViewer now takes a dbh parameter."; }
91 my $self = $class->SUPER::new
( $dbh, @_ );
93 $self->{unzoomedheight
} = 20; # how many cM are seen at zoom level 1
95 # $self -> {raster_size} = 5; # the default raster size for genetic maps
96 # for sequence-based maps this will be changed to 1
98 $self->set_temp_dir("/tmp")
99 ; # set some default for the temp_dir. However, this
100 # should be visible by apache (which tmp isn't).
104 =head2 function _adjust_parameters()
106 Synopsis: adjusts parameters; needs to be called before calling generate_image
109 Side effects: adjusts parameters to make program more robust against out-of-range
113 Notes: this function is only used internally
117 sub _adjust_parameters
{
120 # initialize some variables to prevent undefined blabla errors
121 $self->{fatal_errors
} = "";
122 if ( !$self->get_ref_chr() ) { $self->set_ref_chr(1); }
123 if ( !$self->get_hilite() ) { $self->set_hilite(""); }
124 if ( !( $self->get_cM_start() ) ) { $self->set_cM_start(0); }
126 # print STDERR "\n *** Map ID is : ".($self->get_map_id())." ***\n";
128 # It's possible for our objects to have empty strings for map_id attributes.
129 # The following weirdness preserves the interface invariant that get_map_id sets
130 # a desirable default map_id.
132 my $map_id = $self->get_map_id();
134 if ( $self->get_map_version_id() ) {
135 $self->set_map_id(0);
138 if ( $self->get_comp_map_version_id() ) {
139 $self->set_comp_map_id(0);
142 if ( !$self->get_map_version_id() && $map_id eq '' ) {
143 $self->set_map_id(undef);
144 $map_id = $self->get_map_id();
147 # generate the map objects
150 CXGN
::Cview
::MapFactory
->new( $self->get_dbh(), { cview_db_backend
=>$self->get_db_backend() });
152 # print STDERR "Generating MapFactory with id ".$self->get_map_version_id()."\n";
153 # print STDERR "IS A ".ref($map_factory)."\n";
156 $map_factory->create(
158 map_version_id
=> $self->get_map_version_id(),
159 map_id
=> $self->get_map_id()
164 if ( !$self->get_ref_map() ) {
166 # if an illegal map id was supplied, create a default map.
168 $map_factory->create(
169 { map_id
=> CXGN
::Cview
::Map
::Tools
::current_tomato_map_id
() }
172 $self->append_error("Note: Displaying default map, F2-2000.");
175 $self->{ref_map_name
} = $self->get_ref_map()->get_short_name();
176 $self->set_map_version_id( $self->get_ref_map()->get_id() );
177 $self->{ref_map_type
} = $self->get_ref_map()->get_type();
179 if ( $self->get_comp_map_id() || $self->get_comp_map_version_id() ) {
181 $map_factory->create(
183 map_version_id
=> $self->get_comp_map_version_id(),
184 map_id
=> $self->get_comp_map_id()
189 # { map_id => $self->get_comp_map_id(),
190 # map_version_id => $self->get_comp_map_version_id(),
195 # define the comparison map
197 if ( $self->get_comp_map() ) {
198 $self->{comp_map_name
} = $self->get_comp_map()->get_short_name();
199 $self->set_comp_map_version_id( $self->get_comp_map()->get_id() );
200 $self->{comp_map_type
} = $self->get_comp_map()->get_type();
202 # @{$self->{comp_chromo_names}} = $self->get_chr_names($self->get_comp_map_id());
203 @
{ $self->{comp_chromo_names
} } =
204 $self->get_comp_map()->get_chromosome_names();
206 #$self->{comp_max_chr} = $self->get_chr_count($self->get_comp_map_id());
207 $self->{comp_max_chr
} = scalar( @
{ $self->{comp_chromo_names
} } );
210 # test if the supplied chromosome is a legal chromosome on the specific map.
211 # if not, try to find a close match.
213 #if (!$self->is_ok_chr($self->get_map_id(), $self->get_ref_chr())) {
214 if ( !$self->get_ref_map()->has_linkage_group( $self->get_ref_chr() ) ) {
216 # print STDERR "chr ".$self->get_ref_chr()." is not a valid chromosome\n";
217 my $old_chr = $self->get_ref_chr();
219 $chr =~ s/.*(\d{1,2}.*)/$1/;
221 #if (!$self->is_ok_chr($self->get_map_id(), $chr)) {
222 if ( !$self->get_ref_map()->has_linkage_group($chr) ) {
223 $chr =~ s/.*(\d).*/$1/;
225 if ( !$self->get_ref_map()->has_linkage_group($chr) ) {
227 #$self->append_errors("The specified chromosome ($old_chr) was not found on map $self->{ref_map_name}!<br /><br />");
228 $self->set_ref_chr(1);
231 $self->set_ref_chr($chr);
233 "The chromosome/linkage group $old_chr does not seem to exist on map "
234 . $self->get_ref_map()->get_short_name()
235 . ". The closest we could find was $chr, displayed below.<br /><br />"
240 # if no map_id was supplied, we show the F2.2000 as default
242 if ( !$self->get_map_id() ) {
243 $self->set_map_id( CXGN
::Cview
::Map
::Tools
::current_tomato_map_id
() );
246 # @{$self->{chromo_names}} = $self->get_chr_names($self->{map_id});
247 @
{ $self->{chromo_names
} } = $self->get_ref_map()->get_chromosome_names();
249 #$self->{max_chr} = $self->get_chr_count($self->get_map_id());;
250 # get the number of chromosomes of the map.
252 $self->{max_chr
} = scalar( $self->get_ref_map()->get_chromosome_count() );
254 if ( $self->get_ref_chr() < 0 ) {
255 $self->set_ref_chr( abs( $self->get_ref_chr() ) );
258 # set the default zoom size in MB for sequence maps
260 $self->{unzoomedheight
} = $self->get_ref_map()->initial_zoom_height();
262 # $self->{unzoomedheight}=4;
266 # adjust cM_start and cM_end if the chromosome was clicked.
268 # if ((($self->get_cM_start()==0) && ($self->get_cM_end()==0)) || ($self->get_cM_end()-$self->get_cM_start()==0)) {
270 $self->set_ref_chr_len(
271 $self->get_ref_map()->get_chr_len_by_name( $self->get_ref_chr() ) );
272 if ( $self->get_cM_start() > $self->get_cM_end() ) {
273 $self->set_cM_start( $self->get_cM_end() );
274 $self->set_cM_end( $self->get_cM_start() +
275 $self->get_ref_map()->initial_zoom_height() );
278 $self->{zoom_length
} = $self->get_cM_end() - $self->get_cM_start();
280 if ( $self->{zoom_length
} == 0 ) {
281 $self->{zoom_length
} = $self->get_ref_map()->initial_zoom_height();
284 if ( $self->get_clicked() ) {
286 #die "Was going to reset cM_start and cM_end (cM defined... ".($self->get_cM()).")\n";
287 my $start = $self->get_cM() - ( $self->{zoom_length
} / 2 );
288 my $end = $self->get_cM() + ( $self->{zoom_length
} / 2 );
292 $end = $self->{zoom_length
};
295 # print STDERR "REF CHR: ".$self->get_ref_chr()."\n";
297 if ( $end > $self->get_ref_chr_len() ) {
298 $end = $self->get_ref_chr_len();
299 $start = $end - $self->{zoom_length
};
302 $self->set_cM_start($start);
303 $self->set_cM_end($end);
307 # $self->set_clicked(0);
309 # adjust the cM start value if it is below zero. This could (but shouldn't) happen
310 # during scrolling and zooming operations.
312 if ( $self->get_cM_start() < 0 ) {
313 $self->set_cM_start(0);
314 $self->set_cM_end( $self->{zoom_length
} );
315 $self->set_cM( ( $self->get_cM_start() + $self->get_cM_end() ) / 2 );
317 if ( $self->get_cM_end() > $self->get_ref_chr_len() ) {
318 my $end = $self->get_ref_chr_len();
319 $self->set_cM_end($end);
320 $self->set_cM_start( $end - $self->{zoom_length
} );
323 if ( !$self->{ref_map_name
} ) {
324 $self->{fatal_errors
} .=
325 "Fatal error: The map id you entered is invalid.<br />";
328 if ( $self->get_show_physical()
329 && ( !$self->get_ref_map()->has_physical() ) )
332 "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 /> "
334 $self->set_show_physical(0);
338 if ( $self->get_confidence() == 0 ) {
339 $message = "I(LOD<2) and above [all]";
341 elsif ( $self->get_confidence() == 1 ) { $message = "I(LOD2) and above"; }
342 elsif ( $self->get_confidence() == 2 ) { $message = "CF(LOD3) and above"; }
343 elsif ( $self->get_confidence() == 3 ) { $message = "F(LOD>=3)"; }
344 if ( $self->get_confidence() > -2 ) {
345 $self->append_error("Only showing confidence of $message\n<p />");
348 # note: the force parameter is not part of the state hashref, because it
349 # would change the key and thus the cache file name.
351 my $state_hashref = {
352 chr_nr
=> $self->get_ref_chr(),
353 map_version_id
=> $self->get_map_version_id(),
355 show_ruler
=> $self->{show_ruler
},
356 show_IL
=> $self->{show_IL
},
357 show_offsets
=> $self->get_show_offsets(),
358 comp_map_version_id
=> $self->get_comp_map_version_id(),
359 comp_chr
=> $self->{comp_chr
},
360 color_model
=> $self->{color_model
},
361 show_physical
=> $self->{show_physical
},
362 size
=> $self->{size
},
363 show_zoomed
=> $self->{show_zoomed
},
364 confidence
=> $self->{confidence
},
365 hilite
=> $self->{hilite
},
366 marker_type
=> $self->{display_marker_type
},
367 cM_start
=> $self->get_cM_start(),
368 cM_end
=> $self->get_cM_end(),
370 #clicked => $self->get_clicked(),
374 # print STDERR "STATE HASHREF CONTENTS: \n";
375 # foreach my $k (%$state_hashref) {
376 ## print STDERR "$k = $$state_hashref{$k}.\n";
378 $self->set_state_hashref($state_hashref);
382 =head2 function generate_page()
384 Synopsis: generates the page to STDOUT in html
395 if ( $self->{fatal_errors
} ) { return; }
397 $self->_adjust_parameters();
400 $self->display_toolbar();
404 =head2 function get_image()
406 Synopsis: generates the viewer image as a png file
408 Returns: an array with the image path (semi-absolute) and the image url
409 Side effects: creates the image and stores it into a file
418 my $cache = CXGN
::Tools
::WebImageCache
->new();
419 my $state_hashref = $self->get_state_hashref();
421 my @sorted_values = map {
422 if ( exists( $state_hashref->{$_} ) && defined( $state_hashref->{$_} ) )
424 $state_hashref->{$_};
426 } sort keys %$state_hashref;
427 my $key = join "-", @sorted_values;
429 # print STDERR "USING KEY: $key\n";
430 $cache->set_key($key);
431 $cache->set_expiration_time(86400);
432 $cache->set_basedir( $self->get_basedir() );
434 $cache->set_temp_dir( $self->get_temp_dir() );
436 $cache->set_map_name("imagemap");
437 $cache->set_force( $self->get_force() );
439 if ( !$cache->is_valid() ) {
440 $self->generate_image();
441 $cache->set_image_data( $self->{map}->render_png_string() );
442 $cache->set_image_map_data( $self->{map}->get_image_map("imagemap") );
444 $self->{image_html
} = $cache->get_image_html();
451 120; # the number of pixels the different elements are spaced
452 my $element_count = 0.5; # the number of elements currently placed
456 if ( $self->get_show_zoomed() ) {
457 $map_width += $x_distance;
459 if ( $self->get_show_IL() ) { $map_width += $x_distance; }
461 #print STDERR "Size requested: $self->{size}\n";
462 if ( $self->get_size() =~ /small/i ) {
463 $self->{map_height
} = 300;
464 $self->set_chr_height(230);
466 elsif ( $self->get_size() =~ /large/i ) {
467 $self->{map_height
} = 800;
468 $self->set_chr_height(650);
471 $self->{map_height
} = 470;
472 $self->set_chr_height(400);
475 #print STDERR "Chr height: $self->{chr_height}\n";
477 CXGN
::Cview
::MapImage
->new( "", $map_width, $self->{map_height
} );
479 # show IL lines if requested
481 if ( $self->get_show_IL() && $self->get_ref_map()->has_IL() ) {
483 CXGN
::Cview
::MapFactory
->new( $self->get_dbh(),
484 { cview_db_backend
=> $self->get_db_backend()} );
486 #print STDERR "Current map_id = ".$self->get_map_id()."\n";
487 my $IL_map = $map_factory->create(
488 { map_version_id
=> "il6." . ( $self->get_map_id() ) } );
489 $self->{IL
} = $IL_map->get_chromosome( $self->get_ref_chr() );
491 $self->{IL
}->set_height( $self->get_chr_height() );
492 $self->{IL
}->set_horizontal_offset( $x_distance * $element_count, 40 );
493 $self->{IL
}->set_vertical_offset(40);
494 $self->{IL
}->set_caption("IL");
496 $self->{map}->add_chromosome( $self->{IL
} );
497 $element_count = $element_count + 0.95;
500 elsif ( $self->get_show_IL() && !$self->get_ref_map()->has_IL() ) {
502 "You chose to display the IL information for a map that has no associated IL information.
503 The IL display has been turned off.<P>"
505 $self->set_show_IL(0);
508 # show the physical map if requested
510 if ( $self->get_show_physical() ) {
512 CXGN
::Cview
::MapFactory
->new( $self->get_dbh(),
513 { cview_db_backend
=> $self->get_db_backend()} );
515 my $physical_map = $map_factory->create( { map_version_id
=> "p9" } );
517 # we get the overview chromosome, because it is more compact for the comparison
520 $physical_map->get_overview_chromosome( $self->get_ref_chr() );
521 $self->{p
}->set_horizontal_offset( $x_distance * $element_count );
522 $self->{p
}->set_vertical_offset(40);
523 $self->{p
}->set_height( $self->get_chr_height() );
525 $self->{map}->add_physical( $self->{p
} );
532 $self->{c1
} = $self->get_ref_map()->get_chromosome( $self->get_ref_chr() );
534 #if ($self->get_show_offsets()) { $self->{c1}->set_display_marker_offset(); }
536 # adjust the appearance of the chromosome
538 $self->{c1
}->set_height( $self->get_chr_height() );
539 $self->{c1
}->set_vertical_offset(40);
540 $self->{c1
}->set_horizontal_offset( $x_distance * $element_count );
541 $self->{c1
}->set_caption( $self->get_ref_chr() );
542 $self->{c1
}->set_labels_left();
544 $self->{c1
}->set_units( $self->get_ref_map->get_units() );
546 ->set_width( $self->get_ref_map()->get_preferred_chromosome_width() );
548 $self->append_error( $self->get_ref_map()->get_messages() );
549 my @m = $self->{c1
}->get_markers();
552 # get the markers and determine the highest confidence level
556 if ( $m->get_confidence() > $highest ) {
557 $highest = $m->get_confidence();
562 if ( $m->get_confidence() == $highest ) { push @fm, $m; }
567 if ( $self->get_ref_map()->collapsed_marker_count() ) {
568 $interval = @fm / $self->get_ref_map()->collapsed_marker_count();
571 if ( @m < $self->get_ref_map()->collapsed_marker_count() ) {
574 my $frame_marker_count = 0;
575 for ( my $i = 0 ; $i < @m ; $i++ ) {
576 $m[$i]->hide_label();
579 # show label if it is hilited...
581 my $marker_name = $m[$i]->get_name();
582 if ( $self->get_hilite() =~ /\b$marker_name\b/i ) {
583 $m[$i]->show_label();
588 # otherwise only show one in $interval markers of the
591 if ( $interval > 0 ) {
592 if ( $m[$i]->get_confidence() == $highest ) {
593 if ( $interval > 1 ) {
594 if ( $frame_marker_count % $interval == 0 ) {
595 $m[$i]->show_label();
599 else { $m[$i]->show_label(); }
600 $frame_marker_count++;
604 set_marker_color
( $m[$i], $self->get_color_model() );
605 if ( $m[$i]->get_confidence() < $self->get_confidence() ) {
606 $m[$i]->hide_label();
611 # make the chromosome clickable using the rasterize function and
614 #my $raster_size = int($self->{c1}->get_length() / 20) || 2;
615 if ( $self->get_ref_map()->can_zoom() ) {
616 $self->{c1
}->rasterize(1); #$raster_size);
617 $self->{c1
}->set_rasterize_link( "view_chromosome.pl?map_version_id="
618 . ( $self->get_map_version_id() )
620 . ( $self->get_ref_chr() )
621 . "&show_physical="
622 . ( $self->get_show_physical() )
624 . ( $self->get_show_IL() )
626 . ( $self->get_show_ruler() )
627 . "&show_offsets="
628 . ( $self->get_show_offsets() )
629 . "&color_model="
630 . ( $self->get_color_model() )
631 . "&comp_map_version_id="
632 . ( $self->get_comp_map_version_id() )
634 . ( $self->get_comp_chr() )
636 . ( $self->get_zoom() )
638 . ( $self->get_size() )
640 . ( $self->get_hilite() )
642 . ( $self->get_confidence() )
643 . "&show_zoomed=1&marker_type="
644 . ( $self->get_display_marker_type() )
646 . ( $self->get_cM_start() )
648 . ( $self->get_cM_end() )
649 . "&clicked=1&cM=" );
652 $self->{map}->add_chromosome( $self->{c1
} );
655 # show the ruler if requested
657 if ( $self->get_show_ruler() ) {
658 $self->{r
} = $self->{c1
}->get_ruler();
659 $self->{r
}->set_horizontal_offset( $x_distance / 6 );
660 $self->{r
}->set_vertical_offset(40);
661 $self->{r
}->set_height( $self->get_chr_height() );
662 $self->{r
}->set_start_value(0);
663 $self->{r
}->set_end_value( $self->{c1
}->get_length() );
664 $self->{r
}->set_units( $self->get_ref_map()->get_units() );
665 $self->{map}->add_ruler( $self->{r
} );
669 # draw the chromosome section if a chromosome section was requested
670 # (that is, if cM is defined)
674 my @m2; # the markers on c2. Keep for later use.
675 if ( $self->{show_zoomed
} && $self->get_ref_map()->can_zoom() ) {
679 #$self->{c2} = CXGN::Cview::Chromosome -> new ($self->get_ref_chr(), $self->get_chr_height(), $x_distance*$element_count, 40);
680 $self->{c2
} = $self->get_ref_map()->get_chromosome_section(
681 $self->get_ref_chr(), $self->get_cM_start(),
682 $self->get_cM_end(), $self->get_comp_chr()
684 if ( $self->get_show_offsets() ) {
685 $self->{c2
}->set_display_marker_offset();
687 $self->{c2
}->set_height( $self->get_chr_height() );
688 $self->{c2
}->set_vertical_offset(40);
689 $self->{c2
}->set_hilite( $self->get_hilite_zoomed() );
690 $self->{c2
}->set_horizontal_offset( $x_distance * $element_count );
691 $self->{c2
}->set_units( $self->{c1
}->get_units() );
693 # because we have incomplete length information from the query above,
694 # we set the length of the zoomed in chromosome
695 # to be the same as the comparison chromosome (the length is simply
696 # the marker position of the bottom marker)
698 $self->{c2
}->set_length( $self->{c1
}->get_length() );
701 # correct the cM_start and cM_end if out of range
703 #if ($self->get_cM_start() < 0) { $self->set_cM_start(0); }
704 if ( $self->get_cM_end() > $self->{c2
}->get_length() ) {
705 $self->set_cM_end( $self->{c2
}->get_length() );
708 # $self->{c2}->set_units( $self->{c1}->get_units() );
709 $self->{c2
}->set_color( 255, 220, 220 );
710 @m2 = $self->{c2
}->get_markers();
713 # go through the markers and show them according to confidence filter,
714 # add mark for overgo information etc.
716 for ( my $i = 0 ; $i < @m2 ; $i++ ) {
719 # hilite markers to be hilited
721 my $marker_name = $m2[$i]->get_name();
722 if ( $self->get_hilite() =~ /\b$marker_name\b/i ) {
724 $m2[$i]->get_label()->set_hidden(0);
728 # hide markers with confidence below confidence threshold
730 if ( $m2[$i]->get_confidence() < $self->{confidence
} ) {
731 $m2[$i]->hide_label();
735 # hide markers that are not of the type that should be displayed
737 my $marker_type = $self->get_display_marker_type();
738 if ( $self->get_display_marker_type()
739 && ( $m2[$i]->get_marker_type() !~ /$marker_type/i ) )
741 $m2[$i]->hide_label();
743 set_marker_color
( $m2[$i], $self->get_color_model() );
746 # set the url only if the marker is visible (otherwise imagemap outside the image will be
747 # generated that confuses some browsers (such as Explorer).
749 if ( $m2[$i]->is_visible() ) {
759 # set up the section and connections to the left hand chromosome
761 $self->{c2
}->set_section( $self->get_cM_start(), $self->get_cM_end() );
762 $self->{c1
}->set_hilite_color( 255, 220, 220 );
763 $self->{c1
}->set_hilite( $self->get_cM_start(), $self->get_cM_end() );
764 $self->{link1
} = CXGN
::Cview
::ChrLink
->new(
765 $self->{c1
}, $self->get_cM_start(),
766 $self->{c2
}, $self->get_cM_start()
768 $self->{link1
}->set_color( 10, 10, 10 );
769 $self->{link2
} = CXGN
::Cview
::ChrLink
->new(
770 $self->{c1
}, $self->get_cM_end(),
771 $self->{c2
}, $self->get_cM_end()
773 $self->{link2
}->set_color( 10, 10, 10 );
774 $self->{map}->add_chr_link( $self->{link1
} );
775 $self->{map}->add_chr_link( $self->{link2
} );
777 $self->{map}->add_chromosome( $self->{c2
} );
781 # draw the map comparison if the map comparison was requested (comp_map comp_chr will be defined).
784 if ( $self->get_comp_map() && $self->get_comp_chr() ) {
786 #print STDERR "Generating the comparative map...\n";
790 #$self->{c3} = CXGN::Cview::chromosome -> new ($self->get_comp_chr(), $self->{chr_height}, $x_distance * $element_count, 40);
793 $self->get_comp_map()->get_chromosome( $self->get_comp_chr() );
795 $self->{c3
}->set_height( $self->get_chr_height() );
796 $self->{c3
}->set_horizontal_offset( $x_distance * $element_count );
797 $self->{c3
}->set_vertical_offset(40);
798 $self->{c3
}->set_units( $self->get_comp_map()->get_units() );
800 #print STDERR "Fetching map $self->{comp_map} chr $self->{comp_chr} from the database...\n";
802 #print STDERR "Adjusting colors etc...\n";
803 $self->{c3
}->set_color( 150, 150, 200 );
804 $self->{c3
}->set_caption( $self->get_comp_chr() );
806 @m3 = $self->{c3
}->get_markers();
808 #print STDERR "$self->{comp_chr} has ".@m3." markers...\n";
809 for ( my $i = 0 ; $i < @m3 ; $i++ ) {
811 #print STDERR "Marker read:". $m3[$i]->get_name()."\n";
812 CXGN
::Cview
::Utils
::set_marker_color
( $m3[$i],
813 $self->get_color_model() );
817 #print STDERR "Adding the chromosome to the map...\n";
818 $self->{map}->add_chromosome( $self->{c3
} );
821 # determine if the magnified section exists -- then draw the correspondence lines to that chromosome object (c2)
822 # else draw them to the original chromosome object (c1).
824 if ( exists( $self->{c2
} ) ) {
825 $self->{c2
}->set_labels_left();
827 my $link_list = get_chromosome_links
( $self->{c2
}, $self->{c3
} );
828 foreach my $clink ( $link_list->get_link_list() ) {
829 $self->{map}->add_chr_link($clink);
832 foreach my $m3 (@m3) {
834 if ( $link_list->has_link( $m3->get_marker_name() ) ) {
838 if ( $m3->get_confidence < $self->{confidence
} ) {
841 my $marker_name = $m3->get_name();
842 if ( $self->get_hilite() =~ /\b$marker_name\b/i ) {
850 #print STDERR "LINKS:::::::::::::::\n";
851 my $link_list = get_chromosome_links
( $self->{c1
}, $self->{c3
} );
852 foreach my $clink ( $link_list->get_link_list() ) {
854 #print STDERR " adding link...\n";
855 $self->{map}->add_chr_link($clink);
857 foreach my $m3 (@m3) {
859 set_marker_color
( $m3, $self->get_color_model() );
861 if ( $link_list->has_link( $m3->get_marker_name() ) ) {
864 if ( $m3->get_confidence < $self->{confidence
} ) {
867 if ( $m3->get_name() eq $self->get_hilite() ) {
874 if ( $self->get_show_ruler() ) {
875 $self->{r3
} = $self->{c3
}->get_ruler();
876 $self->{r3
}->set_horizontal_offset( $element_count * $x_distance );
877 $self->{r3
}->set_vertical_offset(40);
878 $self->{r3
}->set_height( $self->get_chr_height() );
879 $self->{r3
}->set_start_value(0);
880 $self->{r3
}->set_end_value( $self->{c3
}->get_length() );
882 $self->{map}->add_ruler( $self->{r3
} );
887 =head2 function get_chr_height()
889 Synopsis: Accessor for the chr_height property
891 Returns: the current chr_height
892 Side effects: The chromosomes are being drawn with the chr_height in pixels
899 return $self->{chr_height
};
902 =head2 function set_chr_height()
905 Arguments: the chromosome height in pixels. In small mode, height is 230 pixels, and
906 normal mode the height is 400 pixels.
915 $self->{chr_height
} = shift;
918 =head2 accessors get_ref_map(), set_ref_map()
922 Args/Ret: the reference map as a CXGN::Cview::Map object
923 of the appropriate sub-class.
924 Side Effects: this will be the map displayed as the reference
932 if ( !exists( $self->{ref_map
} ) ) { $self->{ref_map
} = undef; }
933 return $self->{ref_map
};
939 $self->{ref_map
} = shift;
942 =head2 accessors get_comp_map(), set_comp_map()
945 Property: the comparison map, as a CXGN::Cview::Map object
946 (or subclass thereof)
955 if ( !exists( $self->{comp_map
} ) || !defined( $self->{comp_map
} ) ) {
956 $self->{comp_map
} = undef;
958 return $self->{comp_map
};
964 $self->{comp_map
} = shift;
967 =head2 accessors set_map_id(), get_map_id()
969 Synopsis: sets the map_id for the reference chromosome
970 Parameters: map_id (integer)
972 Side effects: the map corresponding to map_id will be drawn as the reference chromosome
973 Status: DEPRECATED. Call $chr_viewer->get_ref_map()->get_id() instead...
980 $self->{map_id
} = shift;
986 # if (!exists($self->{map_id})) { $self->{map_id}=0; }
987 if ( !exists( $self->{map_id
} ) || !defined( $self->{map_id
} ) ) {
990 return $self->{map_id
};
993 =head2 accessors get_default_map_id, set_default_map_id
1003 sub get_default_map_id
{
1005 return $self->{default_map_id
};
1008 sub set_default_map_id
{
1010 $self->{default_map_id
} = shift;
1014 =head2 accessors get_map_version_id(), set_map_version_id()
1017 Desc: the map_version_id of the reference map
1025 sub get_map_version_id
{
1027 return $self->{map_version_id
};
1031 sub set_map_version_id
{
1033 $self->{map_version_id
} = shift;
1036 =head2 accessors get_comp_map_version_id(), set_comp_map_version_id()
1039 Desc: the map_version_id of the comparison map
1047 sub get_comp_map_version_id
{
1049 if ( !exists( $self->{comp_map_version_id
} )
1050 || !defined( $self->{comp_map_version_id
} ) )
1052 $self->{comp_map_version_id
} = '';
1054 return $self->{comp_map_version_id
};
1058 sub set_comp_map_version_id
{
1060 $self->{comp_map_version_id
} = shift;
1063 =head2 function set_comp_map_id()
1065 Synopsis: setter function for the map id of the comparison chromosome
1066 Parameters: the map id (integer)
1068 Side effects: the specified map will be drawn as the reference chromosome
1074 sub set_comp_map_id
{
1076 $self->{comp_map_id
} = shift;
1079 =head2 function get_comp_map_id()
1081 Synopsis: get the current map id of the comparison chromosome
1083 Returns: map id of the comparison chromosome
1090 sub get_comp_map_id
{
1092 if ( !exists( $self->{comp_map_id
} ) || !defined( $self->{comp_map_id
} ) ) {
1093 $self->{comp_map_id
} = 0;
1095 return $self->{comp_map_id
};
1098 =head2 function set_ref_chr()
1100 Synopsis: setter function for the specifying the reference chromosome
1101 number/linkage group name
1102 Parameters: the desired chromosome number/linkage group name (string)
1104 Side effects: the specified chromosome/linkage group will be displayed as
1105 the reference chromosome
1113 $self->{chr_nr
} = shift;
1116 =head2 function get_ref_chr()
1118 Synopsis: accessor function for set_ref_chr
1120 Returns: the chromosome number/linkage group name for the reference
1121 chromosome/linkage group
1130 if ( !exists( $self->{chr_nr
} ) || !defined( $self->{chr_nr
} ) ) {
1131 $self->{chr_nr
} = 0;
1133 return $self->{chr_nr
};
1136 =head2 function set_comp_chr()
1138 Synopsis: setter function for specifying the comparison chromosome/linkage
1140 Parameters: chromosome number/linkage group name
1142 Side effects: the corrsponding chromosome will be drawn as the comparison chromosome
1150 $self->{comp_chr
} = shift;
1153 =head2 function get_comp_chr()
1155 Synopsis: accessor function for set_comp_chr
1166 if ( !exists( $self->{comp_chr
} ) || !defined( $self->{comp_chr
} ) ) {
1167 $self->{comp_chr
} = 0;
1169 return $self->{comp_chr
};
1172 =head2 accessors get_ref_chr_len, set_ref_chr_len
1182 sub get_ref_chr_len
{
1184 if ( !exists( $self->{ref_chr_len
} ) || !defined( $self->{ref_chr_len
} ) ) {
1185 $self->{ref_chr_len
} = '';
1187 return $self->{ref_chr_len
};
1190 sub set_ref_chr_len
{
1192 $self->{ref_chr_len
} = shift;
1195 =head2 function set_cM_start()
1197 Synopsis: for a chromosome section, sets the starting point in cM
1198 Parameters: cM start position
1200 Side effects: cleans the input to be an integer
1208 my $cM_start = shift;
1209 $cM_start =~ s/[^0-9.]//g;
1211 #$cM_start =~ s/.*?(\d+\.?\d*).*/$1/;
1212 $self->{cM_start
} = abs($cM_start);
1215 =head2 function get_cM_start()
1217 Synopsis: accessor function for the cM_start property
1228 if ( !exists( $self->{cM_start
} ) || !defined( $self->{cM_start
} ) ) {
1229 $self->{cM_start
} = 0;
1232 return sprintf "%.2f", $self->{cM_start
};
1235 =head2 function set_cM_end()
1237 Synopsis: sets the end of a chromosome /linkage group section, in cM
1238 Parameters: cM of end of section
1240 Side effects: On a chromosome section, this will define the endpoints of the section.
1241 If set_section has not been called, this will define which section is
1242 hilited. The cM and zoom property will be automatically re-calculated.
1251 $cM_end =~ s/[^0-9.]//g;
1252 if ( !defined($cM_end) || !$cM_end ) { $cM_end = 0; }
1253 $self->{cM_end
} = abs( ($cM_end) );
1256 =head2 function get_cM_end()
1258 Synopsis: accessor function for the cM_end property
1269 if ( !exists( $self->{cM_end
} ) || !defined( $self->{cM_end
} ) ) {
1270 $self->{cM_end
} = 0;
1272 return sprintf "%.2f", $self->{cM_end
};
1275 =head2 function set_cM()
1277 Synopsis: sets the cM property. This is the approximate location in which
1278 the user has clicked. If set_cM is set, cM_start and cM_end will be
1279 calculated automatically using the current zoom levels.
1280 Parameters: the cM position (integer)
1282 Side effects: recalculates cM_start and cM_end.
1290 $self->{cM
} = shift;
1293 =head2 function get_cM()
1295 Synopsis: accessor function for the cM property
1306 if ( !exists( $self->{cM
} ) || !defined( $self->{cM
} ) ) {
1312 =head2 function set_zoom()
1314 Synopsis: sets the zoom level on the reference chromosome
1315 Parameters: zoom level (1..10). 10 is the highest zoom level (most enlarged section
1316 showing fewer markers). Zoom levels outside the legal range are rounded to
1317 the nearest legal value.
1320 Status: Deprecated. Zooming is now implemented by setting cM_start and cM_end
1327 $self->{zoom
} = shift;
1328 if ( !exists( $self->{zoom
} )
1329 || !defined( $self->{zoom
} )
1330 || $self->{zoom
} eq "" )
1334 if ( $self->{zoom
} == 0 ) { $self->{zoom
} = 1; }
1335 if ( $self->{zoom
} > 10 ) { $self->{zoom
} = 10; }
1338 =head2 function get_zoom()
1340 Synopsis: accessor function for the zoom property.
1342 Returns: the current zoom level (1..10)
1344 Status: Deprecated. Zooming is now implented by directly setting cM_start and cM_end.
1351 if ( !exists( $self->{zoom
} ) || !defined( $self->{zoom
} ) ) {
1354 return $self->{zoom
};
1357 =head2 accessors get_clicked, set_clicked
1359 Usage: my $flag = $cv -> get_clicked()
1360 Desc: returns true if this page should be regenerated
1361 as a response to a user clicking on the chromosome
1362 (instead of using some of the toolbar buttons),
1372 if ( !exists( $self->{clicked
} ) || !defined( $self->{clicked
} ) ) {
1373 $self->{clicked
} = 0;
1375 return $self->{clicked
};
1380 $self->{clicked
} = shift;
1383 =head2 function get_show_ruler()
1385 Synopsis: accessor function for the show_ruler property.
1387 Returns: true if ruler is shown, false otherwise
1394 sub get_show_ruler
{
1396 if ( !exists( $self->{show_ruler
} ) || !defined( $self->{show_ruler
} ) ) {
1397 $self->{show_ruler
} = 0;
1399 return $self->{show_ruler
};
1402 =head2 function set_show_ruler()
1404 Synopsis: setter function for the show_ruler property.
1405 Parameters: true or false (0 or 1)
1407 Side effects: true causes the ruler to be displayed for both the reference and comparison map
1408 (if present), false hides the ruler.
1414 sub set_show_ruler
{
1416 $self->{show_ruler
} = shift;
1419 =head2 function set_show_IL()
1421 Synopsis: setter function for the show_IL property
1422 Parameters: true or false
1424 Side effects: if the current reference map has associated IL information, true will
1425 cause the IL map to be displayed alongside with the chromosome.
1433 $self->{show_IL
} = shift;
1436 =head2 function get_show_IL()
1438 Synopsis: accessor function for the show_IL property
1440 Returns: true or false
1449 if ( !exists( $self->{show_IL
} ) || !defined( $self->{show_IL
} ) ) {
1450 $self->{show_IL
} = 0;
1452 return $self->{show_IL
};
1455 =head2 function set_show_physical()
1457 Synopsis: true causes the physical map to be displayed if the current reference map
1458 has an associated physical map
1459 Parameters: true/false
1467 sub set_show_physical
{
1469 $self->{show_physical
} = shift;
1472 =head2 function get_show_physical()
1474 Synopsis: true causes the physical map to be displayed if the current reference map
1475 has an associated physical map
1484 sub get_show_physical
{
1486 if ( !exists( $self->{show_physical
} )
1487 || !defined( $self->{show_physical
} ) )
1489 $self->{show_physical
} = 0;
1491 return $self->{show_physical
};
1494 =head2 accessors set_show_offsets(), get_show_offsets()
1496 Property: if the offsets should be shown (each marker will display a
1497 label opposite of the marker label, showing the offset in map
1498 units for that marker, for the zoomed-in section
1504 sub get_show_offsets
{
1506 if ( !exists( $self->{show_offsets
} ) || !defined( $self->{show_offsets
} ) )
1508 $self->{show_offsets
} = 0;
1510 return $self->{show_offsets
};
1513 sub set_show_offsets
{
1515 $self->{show_offsets
} = shift;
1518 =head2 function get_size()
1520 Synopsis: accessor function for the size property
1522 Returns: "small" or "normal" or "large"
1531 if ( !exists( $self->{size
} ) or !defined( $self->{size
} ) ) {
1534 return $self->{size
};
1537 =head2 function set_size()
1539 Synopsis: sets the size of the image
1540 Parameters: string ("normal", "small" and "large" are currently supported).
1542 Side effects: "smaller" causes the entire map image to be rendered smaller
1543 (ideal for a laptop monitor)
1544 "normal" causes the entire map image to be rendered to fit a desktop monitor
1546 "larger" for really large monitors (>20\")
1554 $self->{size
} = shift;
1557 =head2 function set_hilite()
1559 Synopsis: hilites the specified markers on the reference map (unhides if necessary)
1560 on the zoomed-in map and on the comparison map.
1561 Parameters: a string, containing an enumeration of marker names to be hilited, separated
1562 by spaces (although other delimiters will also work such as comma, semicolons,
1565 Side effects: the hilited marker name will appear with a yellow background.
1573 my $hilite = shift || '';
1574 $hilite =~ tr/\,\.\:\;\// /;
1575 $hilite =~ s/\s+/ /;
1576 $self->{hilite
} = $hilite;
1580 =head2 function get_hilite()
1582 Synopsis: accessor function for the hilite property
1584 Returns: the name of the currently hilited marker
1593 if ( !exists( $self->{hilite
} ) || !defined( $self->{hilite
} ) ) {
1594 $self->{hilite
} = "";
1596 return $self->{hilite
};
1599 =head2 function set_confidence()
1601 Synopsis: sets the minimal confidence level to be displayed
1602 Parameters: confidence level (-1, 0..3)
1603 -1: uncalculated confidence, 0 - interval marker ... 3 - frame marker
1605 Side effects: markers below the specified confidence level will be hidden
1611 sub set_confidence
{
1613 my $confidence = shift || '';
1614 $confidence =~ s/[A-Za-z]//g;
1615 if ( !defined($confidence) || $confidence eq "" ) { $confidence = -2; }
1616 $confidence = $confidence + 0;
1617 $self->{confidence
} = $confidence;
1620 =head2 function get_confidence()
1622 Synopsis: accessor function for the confidence property
1624 Returns: the current lowest confidence level that is displayed
1625 Normal values for the confidence property are:
1631 If the confidence property is not set, it will return -2,
1632 causing all markers to be displayed.
1633 Side effects: markers with a lower confidence value (see list above) won\'t be
1640 sub get_confidence
{
1642 if ( !exists( $self->{confidence
} ) || !defined( $self->{confidence
} ) ) {
1643 $self->{confidence
} = -2;
1645 return $self->{confidence
};
1648 =head2 functions set_display_marker_type(), get_display_marker_type()
1650 Synopsis: $self->set_display_marker_type('COS');
1651 Arguments: a marker type. Any of COS, RFLP, ...
1653 Side effects: Will also set $self->{error} to indicate to the
1654 user that marker type subsets are shown.
1655 Description: if set_display_marker_type is called with a marker
1656 type argument, only that marker type will be shown
1657 on the viewer. If called with undef, shows all markers.
1661 sub set_display_marker_type
{
1664 if ( $type && ( "RFLP CAPS COS SSR" =~ /\b$type\b/ ) ) {
1665 $self->{display_marker_type
} = $type;
1666 $self->append_error(
1667 "Only markers of the type $self->{display_marker_type} are shown on the zoomed map.<br />"
1672 sub get_display_marker_type
{
1674 if ( !exists( $self->{display_marker_type
} )
1675 || !defined( $self->{display_marker_type
} ) )
1677 $self->{display_marker_type
} = "";
1679 return $self->{display_marker_type
};
1682 =head2 function set_show_zoomed()
1684 Synopsis: setter function for the show_zoomed property
1685 Parameters: show_zoomed property (0 or 1)
1686 Returns: status of the current show_zoomed property (0 or 1)
1687 Side effects: 0 will cause the zoomed in chromosome section not to be drawn
1688 1 will cause a zoomed in chromosome section to be drawn
1694 sub set_show_zoomed
{
1696 $self->{show_zoomed
} = shift;
1699 =head2 function get_show_zoomed()
1701 Synopsis: accessor function for the show_zoomed property
1703 Returns: status of the current show_zoomed property (0 or 1)
1710 sub get_show_zoomed
{
1712 if ( !exists( $self->{show_zoomed
} ) || !defined( $self->{show_zoomed
} ) ) {
1713 $self->{show_zoomed
} = 0;
1715 return $self->{show_zoomed
};
1718 =head2 accessors get_hilite_zoomed(), set_hilite_zoomed()
1720 Usage: $chr_viewer->set_hilite_zoomed($cM_start, $cM_end)
1721 Desc: hilites the given region in the zoomed-in section,
1722 using the current hilite color.
1723 Ret: The getter returns the start and end in cM
1724 Args: the start in cM [real], the end in cM [real]
1725 Side Effects: hilites the corresponding region
1726 Notes: the intended use for this is to hilite sections,
1727 such as the boundaries for ILs on the zoomed in
1732 sub set_hilite_zoomed
{
1734 $self->{hilite_zoom_start
} = shift;
1735 $self->{hilite_zoom_end
} = shift;
1739 sub get_hilite_zoomed
{
1741 if ( !exists( $self->{hilite_zoom_start
} )
1742 || !defined( $self->{hilite_zoom_start
} ) )
1744 $self->{hilite_zoom_start
} = '';
1746 if ( !exists( $self->{hilite_zoom_end
} )
1747 || !defined( $self->{hilite_zoom_end
} ) )
1749 $self->{hilite_zoom_end
} = '';
1751 return ( $self->{hilite_zoom_start
}, $self->{hilite_zoom_end
} );
1754 =head2 function get_color_model()
1757 Parameters: name of color model (currently, confidence and marker_type are supported)
1759 Side effects: sets the color model property to the specified color model
1765 sub set_color_model
{
1767 $self->{color_model
} = shift;
1770 =head2 function get_color_model()
1774 Returns: the name of the current marker color model
1781 sub get_color_model
{
1783 if ( !exists( $self->{color_model
} ) || !defined( $self->{color_model
} ) ) {
1784 $self->{color_model
} = "";
1786 return $self->{color_model
};
1789 =head2 function get_color_legend()
1793 Returns: a string containing html code for the marker color legend
1800 sub get_color_legend
{
1804 "view_chromosome.pl?map_version_id="
1805 . $self->get_map_version_id()
1807 . $self->get_ref_chr()
1808 . "&show_physical="
1809 . $self->get_show_physical
1811 . $self->get_show_IL()
1812 . "&show_offsets="
1813 . $self->get_show_offsets()
1814 . "&show_ruler="
1815 . $self->get_show_ruler()
1816 . "&color_model="
1817 . $self->get_color_model()
1818 . "&comp_map_version_id="
1819 . $self->get_comp_map_version_id()
1821 . $self->get_comp_chr()
1829 . $self->get_cM_start()
1831 . $self->get_cM_end()
1833 . $self->get_hilite()
1834 . "&show_zoomed="
1835 . $self->get_show_zoomed() . "";
1836 if ( $self->{color_model
} eq "marker_types" ) {
1838 $string = "<b>Marker color by type:</b>
1839 <a href=\"$link\&marker_type=RFLP\" style=\"color:#FF0000\">RFLP</a> |
1840 <a href=\"$link\&marker_type=SSR\" style=\"color:#00FF00\">SSR</a> |
1841 <a href=\"$link\&marker_type=CAPS\" style=\"color:#0000FF\">CAPS</a> |
1842 <a href=\"$link\&marker_type=COS\" style=\"color:#FF00FF\">COS</a> |
1843 <font color=#000000>other</font>
1844 [<a href=\"$link\&marker_type=\" style=\"color:#111111\">show all</a>]";
1848 $string = "<b>Marker color by LOD score:</b>
1849 <a href=\"$link\&confidence=3\" style=\"color:#FF0000\">F(LOD3)</a> |
1850 <a href=\"$link\&confidence=2\" style=\"color:#00FF00\">CF(LOD>=3</a> |
1851 <a href=\"$link\&confidence=1\" style=\"color:#0000FF\">I(LOD2)</a> |
1852 <a href=\"$link\&confidence=0\" style=\"color:#000000\">I(LOD<2)</a> |
1853 <a href=\"$link\&confidence=-2\" style=\"color:#777777\">uncalculated</a> ";
1858 =head2 function get_marker_map_links()
1862 Returns: a string with html code for the marker map links pull down menu.
1863 if there is no appropriate map linked to the reference map,
1864 a string is returned that says so.
1865 Side effects: calls the get_chromosome_connections() function of the reference
1874 sub get_marker_map_links
{
1877 #print STDERR "get_marker_map_links...\n";
1878 # query the database for maps and chromosome that any of the markers of the current chromosome lie on.
1880 my $chr_nr = $self->get_ref_chr();
1881 my $default_map = CXGN
::Cview
::Map
::SGN
::Genetic
->new(
1883 CXGN
::Cview
::Map
::Tools
::find_current_version
(
1884 $self->get_dbh(), #CXGN::Cview::Map::Tools::current_tomato_map_id()
1885 $self->get_default_map_id(),
1889 my $default_map_version_id = $default_map->get_id();
1892 "<form style=\"margin-bottom:0\" action=\"/cview/view_chromosome.pl\">
1893 <input type=\"hidden\" name=\"chr_nr\" value=\""
1894 . ( $self->get_ref_chr() ) . "\" />
1895 <input type=\"hidden\" name=\"map_version_id\" value=\""
1896 . ( $self->get_map_version_id() ) . "\" />
1897 <input type=\"hidden\" name=\"zoom\" value=\"" . ( $self->get_zoom() ) . "\" />
1898 <input type=\"hidden\" name=\"show_ruler\" value=\""
1899 . ( $self->get_show_ruler() ) . "\" />
1900 <input type=\"hidden\" name=\"show_IL\" value=\""
1901 . ( $self->get_show_IL() ) . "\" />
1902 <input type=\"hidden\" name=\"show_offsets\" value=\""
1903 . ( $self->get_show_offsets() ) . "\" />
1904 <input type=\"hidden\" name=\"cM_start\" value=\""
1905 . ( $self->get_cM_start() ) . "\" />
1906 <input type=\"hidden\" name=\"cM_end\" value=\""
1907 . ( $self->get_cM_end() ) . "\" />
1908 <input type=\"hidden\" name=\"show_physical\" value=\""
1909 . ( $self->get_show_physical() ) . "\" />
1910 <input type=\"hidden\" name=\"color_model\" value=\""
1911 . ( $self->get_color_model() ) . "\" />
1912 <input type=\"hidden\" name=\"size\" value=\""
1913 . ( $self->get_size() ) . "\" />
1914 <input type=\"hidden\" name=\"show_zoomed\" value=\""
1915 . ( $self->get_show_zoomed() ) . "\" />
1916 <input type=\"hidden\" name=\"hilite\" value=\""
1917 . ( $self->get_hilite() ) . "\" />
1918 <input type=\"hidden\" name=\"marker_type\" value=\""
1919 . ( $self->get_display_marker_type() ) . "\" /> ";
1922 $self->get_ref_map()->get_chromosome_connections( $self->get_ref_chr() );
1926 $form .= "<select name=\"map_chr_select\">";
1927 foreach my $o (@options) {
1929 # print STDERR $o->{map_version_id}, $o->{chr_nr}, $o->{short_name}."<br />\n";
1932 if ( defined( $self->get_comp_map_version_id() )
1933 && $o->{map_version_id
} eq $self->get_comp_map_version_id() )
1935 $selected = "selected=\"selected\"";
1939 qq { <option value
="$o->{map_version_id} $o->{lg_name}" $selected>Map
$o->{short_name
} Chromosome
$o->{lg_name
} ($o->{marker_count
} markers
)</option
> };
1942 $form .= "</select>\n";
1943 $self->{compare_disabled
} = "";
1946 $form .= "<select name=\"map_chr_select\" disabled=\"disabled\" >";
1948 "<option value=\"\" disabld=\"disabled\" >No maps to compare to</option>";
1949 $form .= "</select>\n";
1950 $self->{compare_disabled
} = qq{ disabled
="disabled" };
1954 "<input type=\"submit\" value=\"Compare\" $self->{compare_disabled} /></form>";
1961 my $append = shift || '';
1962 if ( !exists( $self->{errors
} ) || !defined( $self->{errors
} ) ) {
1963 $self->{errors
} = "";
1965 $self->{errors
} .= $append;
1970 return $self->{errors
};
1973 =head2 function get_preceding_chromosome()
1975 Synopsis: gives the name of the chromosome or linkage group preceding the
1977 Parameters: chromosome name / linkage group name
1978 Returns: the chromosome number or linkage group name preceding this
1979 chromosome/linkage group
1988 sub get_preceding_chromosome
{
1991 my $chr_count = scalar( @
{ $self->{chromo_names
} } );
1993 my $old_chr_index = 0;
1996 # find current chromosome in chromo_names array (a hash would be more elegant...)
1998 for ( my $i = 0 ; $i < ( @
{ $self->{chromo_names
} } ) ; $i++ ) {
1999 if ( ${ $self->{chromo_names
} }[$i] eq $chr_nr ) {
2000 $old_chr_index = $i;
2004 if ( $old_chr_index == 0 ) { $chr_index = $chr_count - 1; }
2005 else { $chr_index = $old_chr_index - 1; }
2006 return ${ $self->{chromo_names
} }[$chr_index];
2009 =head2 function get_next_chromosome()
2011 Synopsis: gives the name of the chromosome or linkage group following the given
2013 Parameters: chromosome name / linkage group name
2014 Returns: the chromosome number or linkage group name following this
2015 chromosome/linkage group
2024 sub get_next_chromosome
{
2027 my $chr_count = scalar( @
{ $self->{chromo_names
} } );
2029 my $old_chr_index = 0;
2030 for ( my $i = 0 ; $i < ( @
{ $self->{chromo_names
} } ) ; $i++ ) {
2031 if ( ${ $self->{chromo_names
} }[$i] eq $chr_nr ) {
2032 $old_chr_index = $i;
2036 if ( $old_chr_index == ( $chr_count - 1 ) ) { $chr_index = 0; }
2037 else { $chr_index = $old_chr_index + 1; }
2038 return ${ $self->{chromo_names
} }[$chr_index];
2041 sub get_preceding_comp_chromosome
{
2044 if ( !( $self->get_comp_map() ) ) {
2047 my $chr_count = scalar( @
{ $self->{comp_chromo_names
} } );
2049 my $old_chr_index = 0;
2051 for ( my $i = 0 ; $i < ( @
{ $self->{comp_chromo_names
} } ) ; $i++ ) {
2052 if ( ${ $self->{comp_chromo_names
} }[$i] eq $chr_nr ) {
2053 $old_chr_index = $i;
2057 if ( $old_chr_index == 0 ) { $chr_index = $chr_count - 1; }
2058 else { $chr_index = $old_chr_index - 1; }
2059 return ${ $self->{comp_chromo_names
} }[$chr_index];
2062 sub get_next_comp_chromosome
{
2065 if ( !( $self->get_comp_map() ) ) {
2069 my $chr_count = scalar( @
{ $self->{comp_chromo_names
} } );
2071 my $old_chr_index = 0;
2072 for ( my $i = 0 ; $i < ( @
{ $self->{comp_chromo_names
} } ) ; $i++ ) {
2073 if ( ${ $self->{comp_chromo_names
} }[$i] eq $chr_nr ) {
2074 $old_chr_index = $i;
2078 if ( $old_chr_index == ( $chr_count - 1 ) ) { $chr_index = 0; }
2079 else { $chr_index = $old_chr_index + 1; }
2080 return ${ $self->{comp_chromo_names
} }[$chr_index];
2085 =head2 function display_toolbar()
2087 Synopsis: displays the toolbar by printing html to STDOUT
2090 Side effects: prints html code to STDOUT
2096 sub display_toolbar
{
2099 #$self->{scrolldown} = $self->{cM}+2*$self->{unzoomedheight}/$self->{zoom}/3;
2101 $self->{scrolldown_start
} =
2102 $self->get_cM_start() + ( $self->{zoom_length
} / 2 );
2103 $self->{scrolldown_end
} =
2104 $self->get_cM_end() + ( $self->{zoom_length
} / 2 );
2105 if ( $self->{scrolldown_end
} > $self->get_ref_chr_len() ) {
2107 $self->{scrolldown_end
} = $self->get_ref_chr_len();
2108 $self->{scrolldown_start
} =
2109 $self->{scrolldown_end
} - $self->{zoom_length
};
2112 #$self->{scrollup} = $self->{cM}-2*$self->{unzoomedheight}/$self->{zoom}/3;
2113 $self->{scrollup_start
} =
2114 $self->get_cM_start() - ( $self->{zoom_length
} / 2 );
2115 $self->{scrollup_end
} = $self->get_cM_end() - ( $self->{zoom_length
} / 2 );
2116 if ( $self->{scrollup_start
} < 0 ) {
2117 $self->{scrollup_start
} = 0;
2118 $self->{scrollup_end
} = $self->{zoom_length
};
2121 if ( $self->{zoom_length
} == 0 ) { die "ZOOM LENGTH IS 0!\n"; }
2123 #$self->{zoom_in} = $self->{zoom}+1;
2124 $self->{zoom_in_start
} =
2125 $self->get_cM_start() + ( $self->{zoom_length
} / 4 );
2126 $self->{zoom_in_end
} = $self->get_cM_end() - ( $self->{zoom_length
} / 4 );
2128 #$self->{zoom_out} = $self->{zoom}-1;
2129 $self->{zoom_out_start
} =
2130 $self->get_cM_start() - ( $self->{zoom_length
} / 4 );
2131 $self->{zoom_out_end
} = $self->get_cM_end + ( $self->{zoom_length
} / 4 );
2133 if ( $self->{zoom_out_end
} > $self->get_ref_chr_len() ) {
2134 $self->{zoom_out_end
} = $self->get_ref_chr_len();
2135 $self->{zoom_out_start
} = $self->{zoom_out_end
} - $self->{zoom_length
};
2138 # set buttons to disabled when no zoomed-in chromosome is displayed.
2139 if ( !$self->{show_zoomed
} || !$self->get_ref_map()->can_zoom() ) {
2140 $self->{zoom_in_disabled
} = "disabled=\"disabled\"";
2141 $self->{zoom_out_disabled
} = "disabled=\"disabled\"";
2142 $self->{scroll_up_disabled
} = "disabled=\"disabled\"";
2143 $self->{scroll_down_disabled
} = "disabled=\"disabled\"";
2146 # if (!$self->map_has_physical($self->{map_id})) {
2147 if ( !$self->get_ref_map()->has_physical() ) {
2148 $self->{physical_disabled
} = "disabled=\"disabled\"";
2151 if ( !$self->get_ref_map()->has_IL() ) {
2152 $self->{IL_disabled
} = qq { disabled
="disabled" };
2155 $self->{IL_disabled
} = "";
2158 if ( $self->{show_zoomed
} ) {
2160 #$self->{zoom_in_disabled} = "";
2161 $self->{enable_zoom_text
} = "Hide zoomed";
2162 $self->{enable_zoom_value
} = 0;
2163 $self->{toggle_zoomed_section
} = 0;
2166 $self->{zoom_in_disabled
} = " disabled=\"disabled\" ";
2167 $self->{enable_zoom_text
} = "Show zoomed";
2168 $self->{enable_zoom_value
} = 1;
2169 $self->{toggle_zoomed_section
} = 10;
2171 if ( !$self->get_ref_map->can_zoom() ) {
2172 $self->{zoomed_button_enabled
} = " disabled=\"disabled\" ";
2175 # $self->{next_chromosome} = $self->{chr_nr} + 1;
2176 # if ($self->{next_chromosome} > $self->{max_chr}) { $self->{next_chromosome} = 1; }
2178 $self->{next_chromosome
} =
2179 $self->get_next_chromosome( $self->get_ref_chr() );
2181 # $self->{preceding_chromosome} = $self->{chr_nr}-1;
2182 # if ($self->{preceding_chromosome} == 0) { $self->{preceding_chromosome} = $self->{max_chr}; }
2184 $self->{preceding_chromosome
} =
2185 $self->get_preceding_chromosome( $self->get_ref_chr() );
2187 # $self->{next_comp_chr} = $self->{comp_chr} + 1;
2188 # if ($self->{next_comp_chr} > $self->{comp_max_chr}) { $self->{next_comp_chr} = 1; }
2190 $self->{next_comp_chr
} =
2191 $self->get_next_comp_chromosome( $self->get_comp_chr() );
2193 # $self->{preceding_comp_chr} = $self -> {comp_chr} -1;
2194 # if ($self->{preceding_comp_chr} ==0 ) { $self->{preceding_comp_chr} = $self->{comp_max_chr}; }
2195 $self->{preceding_comp_chr
} =
2196 $self->get_preceding_comp_chromosome( $self->get_comp_chr() );
2198 # $self->{imagemap} = $self->{map}->get_image_map("imagemap");
2200 $self->{marker_map_links
} = $self->get_marker_map_links();
2202 my $comp_map_caption = "";
2203 my $chromo_designation = "chr";
2204 if ( $self->get_comp_chr() =~ /[A-Za-z]/ ) {
2205 $chromo_designation = "linkage group";
2207 if ( $self->get_comp_map_version_id() ) {
2209 "<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>";
2212 # some legends need to know the state of the script...
2213 $self->get_ref_map()->get_legend()
2214 ->set_state_hashref( $self->get_state_hashref() );
2215 $self->get_ref_map()->get_legend()->set_mode( $self->get_color_model() );
2216 my $color_legend = $self->get_ref_map()->get_legend()->get_legend_html();
2217 my $toggle_ruler = !( $self->{show_ruler
} );
2218 my $toggle_physical = !( $self->{show_physical
} );
2219 my $toggle_IL = !( $self->{show_IL
} );
2220 my $toggle_offsets = !( $self->get_show_offsets() );
2222 my $toggle_size_select = qq { <select name
="size" > };
2224 my @selected = ( '', '', '' );
2225 if ( $self->{size
} =~ /small/i ) { $selected[0] = qq { selected
="1" }; }
2226 elsif ( $self->{size
} =~ /large/i ) { $selected[2] = qq { selected
="1" }; }
2227 else { $selected[1] = qq { selected
="1" }; }
2228 $toggle_size_select .=
2229 qq { <option value
="small" $selected[0] >Small
</option
> };
2230 $toggle_size_select .=
2231 qq { <option value
="normal" $selected[1] >Normal
</option
> };
2232 $toggle_size_select .=
2233 qq { <option value
="large" $selected[2] >Large
</option
> };
2234 $toggle_size_select .= qq { </select> };
2236 if ( !$self->get_comp_map_version_id() ) {
2237 $self->{hide_comparison
} = "disabled=\"disabled\"";
2240 $self->{maps_select
} =
2241 CXGN
::Cview
::Utils
::get_maps_select
( $self->get_dbh(),
2242 $self->get_ref_map()->get_id(), undef, $self->get_db_backend);
2244 my $view_entire_map_link = " View entire comparative map";
2245 if ( $self->get_comp_map_version_id() ) {
2246 $view_entire_map_link =
2247 " <a href=\"/cview/view_maps.pl?center_map_version_id="
2248 . ( $self->get_ref_map()->get_id() )
2249 . "&right_map_version_id=$self->{comp_map_version_id}\">View entire comparative map</a>";
2252 $self->{url_map_name
} = $self->{ref_map_name
};
2253 $self->{url_map_name
} =~ s/ /\+/g;
2255 my $show_marker_link = "Show markers between 0 and 0 cM";
2256 if ( $self->{show_zoomed
} && $self->get_ref_map()->can_zoom() ) {
2257 $show_marker_link = "<a href=\"/search/markers/markersearch.pl?
2259 . $self->get_cM_start()
2260 . "&w822_pos_end="
2261 . $self->get_cM_end()
2264 CXGN
::Cview
::Map
::Tools
::find_map_id_with_version
(
2265 $self->get_dbh(), $self->get_ref_map()->get_id()
2268 . "&w822_confs=$self->{confidence}&&w822_submit=Search&w822_chromos="
2269 . $self->get_ref_chr()
2270 . "\"\n>Search markers between "
2271 . ( $self->get_cM_start() ) . " and "
2272 . ( $self->get_cM_end() ) . " "
2273 . $self->get_ref_map()->get_units() . "</a>";
2275 $chromo_designation = "chr";
2276 if ( $self->get_ref_chr() =~ /[A-Za-z]/ ) {
2277 $chromo_designation = "linkage group";
2280 my $state_hashref = $self->get_state_hashref();
2282 my $scroll_up_button =
2283 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "Scroll up",
2285 $scroll_up_button->set_property( "cM_start", $self->{scrollup_start
} );
2286 $scroll_up_button->set_property( "cM_end", $self->{scrollup_end
} );
2287 $scroll_up_button->set_enabled( $self->{scroll_up_disabled
} );
2288 my $scroll_up_html = $scroll_up_button->render_string();
2290 my $scroll_down_button =
2291 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "Scroll down",
2293 $scroll_down_button->set_property( "cM_start", $self->{scrolldown_start
} );
2294 $scroll_down_button->set_property( "cM_end", $self->{scrolldown_end
} );
2295 $scroll_down_button->set_enabled( $self->{scroll_down_disabled
} );
2296 my $scroll_down_html = $scroll_down_button->render_string();
2298 my $zoom_in_button =
2299 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "Zoom in",
2301 $zoom_in_button->set_property( "cM_start", $self->{zoom_in_start
} );
2302 $zoom_in_button->set_property( "cM_end", $self->{zoom_in_end
} );
2303 $zoom_in_button->set_enabled( $self->{zoom_in_disabled
} );
2304 my $zoom_in_html = $zoom_in_button->render_string();
2306 my $zoom_out_button =
2307 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "Zoom out",
2309 $zoom_out_button->set_property( "cM_start", $self->{zoom_out_start
} );
2310 $zoom_out_button->set_property( "cM_end", $self->{zoom_out_end
} );
2311 $zoom_out_button->set_enabled( $self->{zoom_out_disabled
} );
2312 my $zoom_out_html = $zoom_out_button->render_string();
2314 my $show_zoomed_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
->new(
2315 $self->{enable_zoom_text
},
2317 $show_zoomed_button->set_enabled( $self->{zoomed_button_enabled
} );
2318 $show_zoomed_button->set_property( "show_zoomed",
2319 $self->{toggle_zoomed_section
} );
2321 my $show_zoomed_html = $show_zoomed_button->render_string();
2323 my $hide_comparison_button =
2324 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "Hide comparison",
2326 $hide_comparison_button->set_property( "comp_map_version_id", 0 );
2327 $hide_comparison_button->set_property( "comp_chr", 0 );
2328 $hide_comparison_button->set_enabled( $self->{hide_comparison
} );
2329 my $hide_comparison_html = $hide_comparison_button->render_string();
2331 my $switch_chromosomes_button =
2332 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "Switch chromosomes",
2334 $switch_chromosomes_button->set_property( "comp_chr",
2335 $self->get_ref_chr() );
2336 $switch_chromosomes_button->set_property( "chr_nr", $self->get_comp_chr() );
2337 $switch_chromosomes_button->set_property( "map_version_id",
2338 $self->get_comp_map_version_id() );
2339 $switch_chromosomes_button->set_property( "", "" );
2340 $switch_chromosomes_button->set_property( "", "" );
2341 $switch_chromosomes_button->set_property( "comp_map_version_id",
2342 $self->get_map_version_id() );
2343 $switch_chromosomes_button->set_enabled( $self->{hide_comparison
} );
2344 my $switch_chromosomes_html = $switch_chromosomes_button->render_string();
2346 my $sync_preceding_chr_button =
2347 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "<<",
2349 $sync_preceding_chr_button->set_property( "chr_nr",
2350 $self->{preceding_chromosome
} );
2351 $sync_preceding_chr_button->set_property( "comp_chr",
2352 $self->{preceding_comp_chr
} );
2353 $sync_preceding_chr_button->set_enabled( $self->{hide_comparison
} );
2354 my $sync_preceding_chr_html = $sync_preceding_chr_button->render_string();
2356 my $sync_next_chr_button =
2357 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( ">>",
2359 $sync_next_chr_button->set_property( "chr_nr", $self->{next_chromosome
} );
2360 $sync_next_chr_button->set_property( "comp_chr", $self->{next_comp_chr
} );
2361 $sync_next_chr_button->set_enabled( $self->{hide_comparison
} );
2362 my $sync_next_chr_html = $sync_next_chr_button->render_string();
2364 my $previous_chr_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
->new(
2365 $self->{preceding_chromosome
} . "<",
2367 $previous_chr_button->set_property( "chr_nr",
2368 $self->{preceding_chromosome
} );
2369 my $previous_chr_html = $previous_chr_button->render_string();
2371 my $next_chr_button = CXGN
::Cview
::Chromosome_view
::toolbar_button
->new(
2372 ">" . $self->{next_chromosome
},
2374 $next_chr_button->set_property( "chr_nr", $self->{next_chromosome
} );
2375 my $next_chr_html = $next_chr_button->render_string();
2377 my $preceding_comp_chr_button =
2378 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new(
2379 $self->{preceding_comp_chr
} . "<",
2381 $preceding_comp_chr_button->set_property( "comp_chr",
2382 $self->{preceding_comp_chr
} );
2383 $preceding_comp_chr_button->set_enabled( $self->{hide_comparison
} );
2384 my $preceding_comp_chr_html = $preceding_comp_chr_button->render_string();
2386 my $next_comp_chr_button =
2387 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new(
2388 ">" . $self->{next_comp_chr
},
2390 $next_comp_chr_button->set_property( "comp_chr", $self->{next_comp_chr
} );
2391 $next_comp_chr_button->set_enabled( $self->{hide_comparison
} );
2392 my $next_comp_chr_html = $next_comp_chr_button->render_string();
2395 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "Ruler",
2397 $ruler_button->set_property( "show_ruler", $toggle_ruler );
2398 my $ruler_html = $ruler_button->render_string();
2400 my $physical_map_button =
2401 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "Physical map",
2403 $physical_map_button->set_property( "show_physical", $toggle_physical );
2404 $physical_map_button->set_enabled( $self->{physical_disabled
} );
2405 my $physical_map_html = $physical_map_button->render_string();
2408 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "IL", $state_hashref );
2409 $IL_button->set_property( "show_IL", $toggle_IL );
2410 $IL_button->set_enabled( $self->{IL_disabled
} );
2411 my $IL_html = $IL_button->render_string();
2414 CXGN
::Cview
::Chromosome_view
::toolbar_button
->new( "Offsets",
2416 $offset_button->set_property( "show_offsets", $toggle_offsets );
2417 $offset_button->set_enabled( $self->{zoom_button_enabled
} );
2418 my $offset_html = $offset_button->render_string();
2420 # my $size_button = CXGN::Cview::Chromosome_view::toolbar_button -> new($size_button_text, $state_hashref);
2421 # $size_button -> set_property("size", $toggle_size);
2422 # my $size_html = $size_button -> render_string();
2424 my $errors = $self->get_errors();
2426 my $chr_nr = $self->get_ref_chr();
2427 my $map_version_id = $self->get_map_version_id();
2428 my $map_name = $self->get_ref_map()->get_short_name();
2429 my $zoom = $self->get_zoom();
2430 my $cM = $self->get_cM();
2431 my $show_ruler = $self->get_show_ruler();
2432 my $show_IL = $self->get_show_IL();
2433 my $show_offsets = $self->get_show_offsets();
2434 my $comp_map_version_id = $self->get_comp_map_version_id() || '';
2435 my $comp_chr = $self->get_comp_chr() || '';
2436 my $color_model = $self->get_color_model() || '';
2437 my $show_physical = $self->get_show_physical() || 0;
2438 my $size = $self->get_size() || 0;
2439 my $show_zoomed = $self->get_show_zoomed() || 0;
2440 my $confidence = $self->get_confidence() || -2;
2441 my $hilite = $self->get_hilite() || '';
2442 my $display_marker_type = $self->get_display_marker_type() || '';
2443 my $cM_start = $self->get_cM_start() || '';
2444 my $cM_end = $self->get_cM_end() || '';
2446 my $zoom_range_html = qq {
2447 <form style
="margin-bottom:0" >
2448 <input type
="hidden" name
="map_version_id" value
="$map_version_id" />
2449 <input type
="hidden" name
="chr_nr" value
="$chr_nr" size
="2" />
2450 <input type
="hidden" name
="show_ruler" value
="$show_ruler" />
2451 <input type
="hidden" name
="show_IL" value
="$show_IL" />
2452 <input type
="hidden" name
="show_offsets" value
="$show_offsets" />
2453 <input type
="hidden" name
="comp_map_version_id" value
="$comp_map_version_id" />
2454 <input type
="hidden" name
="comp_chr" value
="$comp_chr" />
2455 <input type
="hidden" name
="color_model" value
="$color_model" />
2456 <input type
="hidden" name
="show_physical" value
="$show_physical" />
2457 <input type
="hidden" name
="size" value
="$size" />
2458 <input type
="hidden" name
="show_zoomed" value
="1" />
2459 <input type
="hidden" name
="confidence" value
="$confidence" />
2460 <input type
="hidden" name
="hilite" value
="$hilite" />
2461 <input type
="hidden" name
="marker_type" value
="$display_marker_type" />
2463 <b
>zoom range
:</b> <input name="cM_start" size="3" value="$cM_start" /> to
<input name
="cM_end" size
="3" value
="$cM_end" />
2464 <input type
="submit" value
="show" />
2473 <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>
2475 <td> [<a href="/help/cview.pl">Help</a>]</td>
2478 <table summary="" cellpadding="0" cellspacing="0"><tr>
2488 <table summary="" cellpadding="0" cellspacing="0"><tr><td>
2517 <td width="10"> </td><td>
2520 <!-- $show_marker_link -->
2526 <table summary="" cellpadding="0" cellspacing="0" border="0">
2527 <tr><td valign="middle" width="120"><b>Compare map to:</b> </td><td valign="middle">$self->{marker_map_links}</td></tr>
2530 <table summary="" cellpadding="0" cellspacing="0">
2532 <tr><td width="120"> </td><td>
2534 $hide_comparison_html
2540 $switch_chromosomes_html
2548 $view_entire_map_link
2554 <table summary=""><tr><td>
2556 <form style="margin-bottom:0" action="/cview/view_chromosome.pl">
2558 <table summary="" cellpadding="0" border="0" cellspacing="0">
2559 <tr valign="middle"><td valign="middle" width="120">
2560 <b>Jump to map:</b></td><td>$self->{maps_select}</td><td valign="middle"> chr </td><td>
2561 <input type="text" name="chr_nr" value="$chr_nr" size="2" />
2562 <input type="hidden" name="zoom" value="$zoom" />
2563 <!-- <input type="hidden" name="cM" value="$cM" /> -->
2564 <input type="hidden" name="cM_start" value="$cM_start" />
2565 <input type="hidden" name="cM_end" value="$cM_end" />
2566 <input type="hidden" name="show_ruler" value="$show_ruler" />
2567 <input type="hidden" name="show_IL" value="$show_IL" />
2568 <input type="hidden" name="show_offsets" value="$show_offsets" />
2569 <input type="hidden" name="comp_map_version_id" value="$comp_map_version_id" />
2570 <input type="hidden" name="comp_chr" value="$comp_chr" />
2571 <input type="hidden" name="color_model" value="$color_model" />
2572 <input type="hidden" name="show_physical" value="$show_physical" />
2573 <input type="hidden" name="size" value="$size" />
2574 <input type="hidden" name="show_zoomed" value="$show_zoomed" />
2575 <input type="hidden" name="confidence" value="$confidence" />
2576 <input type="hidden" name="hilite" value="$hilite" />
2577 <input type="hidden" name="marker_type" value="$display_marker_type" />
2578 <input type="submit" value="Jump" />
2585 <td width="20"> </td>
2588 <form style="margin-bottom:0" action="/cview/view_chromosome.pl">
2589 <b>Highlight marker:</b>
2590 <input type="text" name="hilite" value="$hilite" size="5" />
2591 <input type="submit" value="Highlight" />
2592 <input type="hidden" name="zoom" value="$zoom" />
2593 <!-- <input type="hidden" name="cM" value="$cM" /> -->
2594 <input type="hidden" name="cM_start" value="$cM_start" />
2595 <input type="hidden" name="cM_end" value="$cM_end" />
2596 <input type="hidden" name="chr_nr" value="$chr_nr" />
2597 <input type="hidden" name="map_version_id" value="$map_version_id" />
2598 <input type="hidden" name="show_ruler" value="$show_ruler" />
2599 <input type="hidden" name="show_IL" value="$show_IL" />
2600 <input type="hidden" name="show_offsets" value="$show_offsets" />
2601 <input type="hidden" name="comp_map_version_id" value="$comp_map_version_id" />
2602 <input type="hidden" name="comp_chr" value="$comp_chr" />
2603 <input type="hidden" name="color_model" value="$color_model" />
2604 <input type="hidden" name="show_zoomed" value="$show_zoomed" />
2605 <input type="hidden" name="confidence" value="$confidence" />
2606 <input type="hidden" name="show_physical" value="$show_physical" />
2607 <input type="hidden" name="size" value="$size" />
2608 <input type="hidden" name="marker_type" value="$display_marker_type" />
2619 <table summary="" cellpadding="0" cellspacing="0" border="0"><tr>
2620 <td width="120"> </td>
2621 <td colspan="3" align="center"><b>Reference chromosome</b></td>
2622 <td width="20"> </td>
2623 <td colspan="3" align="center"><b>Comparison chromosome</b></td>
2626 <td width="120"> </td>
2629 <table summary="" cellpadding="0" cellspacing="0" border="0"><tr><td>
2630 $sync_preceding_chr_html
2636 <td align="center" valign="middle">
2640 unless ( $chr_nr ne "" ) { $chr_nr = " "; }
2644 <b>$chr_nr</b> </td>
2651 <td width="20"> </td>
2653 $preceding_comp_chr_html
2657 <td align="center" valign="middle">
2662 unless ( $comp_chr ne "" ) { $comp_chr = " "; }
2666 <b>$comp_chr</b> </td>
2669 <table summary="" cellpadding="0" cellspacing="0" border="0"><tr><td>
2679 <table summary="" cellpadding="0" cellspacing="0">
2680 <tr><td valign="middle" width="120">
2681 <b>Show/hide:</b></td>
2707 <td width="30"> </td>
2708 <td valign="middle"> <b>image size: </b> </td><td>
2710 <form style="margin-bottom:0" action="/cview/view_chromosome.pl">
2712 <input type="submit" value="change" />
2713 <input type="hidden" name="zoom" value="$zoom" />
2714 <input type="hidden" name="cM_start" value="$cM_start" />
2715 <input type="hidden" name="cM_end" value="$cM_end" />
2716 <input type="hidden" name="chr_nr" value="$chr_nr" />
2717 <input type="hidden" name="map_version_id" value="$map_version_id" />
2718 <input type="hidden" name="show_ruler" value="$show_ruler" />
2719 <input type="hidden" name="show_IL" value="$show_IL" />
2720 <input type="hidden" name="show_offsets" value="$show_offsets" />
2721 <input type="hidden" name="comp_map_version_id" value="$comp_map_version_id" />
2722 <input type="hidden" name="comp_chr" value="$comp_chr" />
2723 <input type="hidden" name="color_model" value="$color_model" />
2724 <input type="hidden" name="show_zoomed" value="$show_zoomed" />
2725 <input type="hidden" name="confidence" value="$confidence" />
2726 <input type="hidden" name="show_physical" value="$show_physical" />
2727 <input type="hidden" name="marker_type" value="$display_marker_type" />
2744 =head2 accessors set_state_hashref(), get_state_hashref()
2746 Property: the state_hashref is a hash describing the current
2747 state of the ChromosomeViewer, essentially collecting
2748 all the processed page arguments.
2749 Args/Ret: a hash reference
2750 Side Effects: the state_hashref determines what the toolbar buttons
2751 and links constructed on the page will contain as
2756 sub get_state_hashref
{
2758 return $self->{state_hashref
};
2761 sub set_state_hashref
{
2763 $self->{state_hashref
} = shift;
2766 =head2 accessors set_force(), get_force()
2768 Property: force - regenerate cached files whatever the
2770 Args/Ret true for re-generation, false for letting cache
2771 decide when to re-generate the images.
2772 Side Effects: true will force regenerate all associated files
2779 if ( !exists( $self->{force
} ) || !defined( $self->{force
} ) ) {
2780 $self->{force
} = "";
2782 return $self->{force
};
2787 $self->{force
} = shift;
2803 if ( !exists( $self->{temp_dir
} ) ) {
2804 die "ChromosomeViewer: need a temp_dir for storing images... STOP!\n";
2807 return $self->{temp_dir
};
2824 $self->{temp_dir
} = shift;
2840 if ( !exists( $self->{basedir
} ) ) {
2841 die "ChromosomeViewer: need a basedir for storing images... STOP!\n";
2843 return $self->{basedir
};
2860 $self->{basedir
} = shift;
2863 =head2 accessors get_db_backend, set_db_backend
2865 Usage: $v ->set_db_backend("cxgn");
2866 Desc: sets the db backend of the comparative viewer.
2867 following values are allowed:
2868 o cxgn - the cxgn database
2869 o cmap - the cmap database
2870 o cxgn_and_cmap - both databases are queried for maps.
2871 Property a string describing the database backend to be used.
2872 Side Effects: the specified backend will be used
2876 sub get_db_backend
{
2878 return $self->{db_backend
} || 'cxgn';
2881 sub set_db_backend
{
2883 $self->{db_backend
} = shift;
2886 =head2 accessors get_context, set_context
2888 Usage: $cv -> set_context( CXGN::Context->new() );
2889 Property: A context object
2890 Side Effects: The context object provides things like temp
2891 file locations, etc.
2898 return $self->{context
};
2903 $self->{context
} = shift;
2906 package CXGN
::Cview
::Chromosome_view
::toolbar_button
;
2911 my $self = bless $args, $class;
2915 my $properties_hashref = shift;
2917 $self->set_name($name);
2919 %{ $self->{properties
} } = (
2921 'map_version_id' => "",
2925 'show_offsets' => "",
2926 'comp_map_version_id' => "",
2928 'color_model' => "",
2929 'show_zoomed' => "",
2930 'show_physical' => "",
2934 'marker_type' => "",
2941 foreach my $k ( keys(%$properties_hashref) ) {
2942 if ( exists( ${ $self->{properties
} }{$k} ) ) {
2943 ${ $self->{properties
} }{$k} = $$properties_hashref{$k};
2947 "property $k is not supported in toolbar_button package.\n";
2955 $self->{name
} = shift;
2960 return $self->{name
};
2965 $self->{action
} = shift;
2970 if ( !exists( $self->{action
} ) ) { $self->{action
} = ""; }
2971 return $self->{action
};
2976 # parameter: true or false setting to enabled or disabled
2979 $self->{enabled
} = shift;
2984 return $self->{enabled
};
2989 my $property = shift;
2991 if ( !$value ) { $value = ""; }
2992 if ( !exists( ${ $self->{properties
} }{$property} ) ) {
2994 "Warning: toolbar_button: property $property does not exist!\n";
2998 ${ $self->{properties
} }{$property} = $value;
3006 my $action = $self->get_action();
3008 if ( $action eq "" ) {
3011 my $s = "<form style=\"margin-bottom:0\" action=\"$action\">\n";
3013 foreach my $p ( keys %{ $self->{properties
} } ) {
3015 #print STDERR "Printing toolbar button: hidden field: $p, $self->{properties}{$p}\n";
3016 if ( exists( $self->{properties
}{$p} ) && $self->{properties
}{$p} ) {
3018 "<input type=\"hidden\" name=\"$p\" value=\"$self->{properties}{$p}\" />\n";
3024 if ( $self->is_enabled() ) {
3025 $disabled = "disabled=\"disabled\"";
3031 "<input type=\"submit\" value=\""
3033 . "\" $disabled />\n";
3040 print $self->render_string();