Merge branch 'master' of github.com:solgenomics/sgn
[sgn.git] / lib / CXGN / Cview / Map / SGN / Genetic.pm
blob8166404db4870eed5ad039fca4724eaa78a3d043
1 package CXGN::Cview::Map::SGN::Genetic;
3 =head1 NAME
5 CXGN::Cview::Map::SGN::Genetic - a class implementing a genetic map
7 =head1 DESCRIPTION
9 This class implements a genetic map populated from the SGN database. This class inherits from L<CXGN::Cview::Map>.
11 Note: the common name (available through get_common_name()) for the map organism is now taken through the following join: sgn.accession -> public.organism -> sgn.organismgroup_member ->sgn.organism_group (July 2010).
13 =head1 AUTHOR(S)
15 Lukas Mueller <lam87@cornell.edu>
17 =head1 FUNCTIONS
19 This class implements the following functions (for more information, see L<CXGN::Cview::Map>):
21 =cut
23 use strict;
24 use warnings;
26 use CXGN::Cview::Legend::Genetic;
27 use CXGN::Cview::Map;
28 use CXGN::Cview::Map::Tools;
30 use base qw | CXGN::Cview::Map |;
32 =head2 function new
34 Synopsis: my $genetic = CXGN::Cview::Map::SGN::Genetic->
35 new( $dbh, $map_version_id);
36 Arguments: (1) a database handle, preferably generated with
37 CXGN::DB::Connection
38 (2) the map version id for the desired map.
39 Returns: a Genetic map object
40 Side effects: accesses the database
41 Description:
43 =cut
45 sub new {
46 my $class = shift;
47 my $dbh = shift;
48 my $map_version_id = shift;
50 my $self = $class->SUPER::new($dbh);
51 $self->set_id($map_version_id);
52 $self->fetch();
54 # set some defaults
55 $self->set_preferred_chromosome_width(20);
57 # fetch the chromosome lengths
59 my $query = "SELECT lg_name, max(position) FROM sgn.linkage_group JOIN sgn.marker_location USING(lg_id) WHERE linkage_group.map_version_id=? GROUP BY lg_name, lg_order ORDER BY lg_order";
60 my $sth = $self->get_dbh()->prepare($query);
61 $sth->execute($self->get_id());
62 my @chromosome_lengths = ();
63 while (my ($lg_name, $length) = $sth->fetchrow_array()) {
64 push @chromosome_lengths, $length;
66 $self->set_chromosome_lengths(@chromosome_lengths);
68 if ($self->get_chromosome_count() == 0) { return undef; }
70 my $legend = CXGN::Cview::Legend::Genetic->new($self);
71 # $legend->set_mode("marker_types");
72 $self->set_legend($legend);
74 return $self;
77 sub fetch {
78 my $self = shift;
80 # get the map metadata
82 my $query = "SELECT map_version_id, map_type, short_name, long_name, abstract, public.organism.common_name, organismgroup.name FROM sgn.map JOIN sgn.map_version using(map_id) LEFT JOIN sgn.accession on(parent_1=accession.accession_id) LEFT JOIN public.organism on (public.organism.organism_id=accession.chado_organism_id) LEFT JOIN sgn.organismgroup_member on (public.organism.organism_id=organismgroup_member.organism_id) join sgn.organismgroup using(organismgroup_id) WHERE map_version_id=?";
83 my $sth = $self->get_dbh()->prepare($query);
84 $sth->execute($self->get_id());
85 my ($map_version_id, $map_type, $short_name, $long_name, $abstract, $organism_name, $common_name) = $sth->fetchrow_array();
86 $self->set_id($map_version_id);
87 $self->set_type($map_type);
88 $self->set_short_name($short_name);
89 $self->set_long_name($long_name);
90 $self->set_abstract($abstract);
91 $self->set_organism($organism_name);
92 $self->set_common_name($common_name);
93 $self->set_units("cM");
95 # get information about associated linkage_groups
97 my $chr_name_q = "SELECT distinct(linkage_group.lg_name), lg_order FROM sgn.linkage_group WHERE map_version_id=? ORDER BY lg_order";
98 my $chr_name_h = $self->get_dbh()->prepare($chr_name_q);
99 $chr_name_h->execute($self->get_id());
100 my @names = ();
101 while (my ($lg_name) = $chr_name_h->fetchrow_array()) {
102 push @names, $lg_name;
104 $self->set_chromosome_names(@names);
105 $self->set_chromosome_count(scalar(@names));
106 $self->set_preferred_chromosome_width(20);
108 # get the location of the centromeres
110 my $centromere_q = "SELECT lg_name, min(position) as north_centromere, max(position) as south_centromere FROM linkage_group left join marker_location on (north_location_id=location_id or south_location_id=location_id) where linkage_group.map_version_id=? group by linkage_group.lg_id, linkage_group.map_version_id, lg_order, lg_name order by lg_order";
111 my $centromere_h = $self->get_dbh()->prepare($centromere_q);
112 $centromere_h->execute($self->get_id());
113 while (my ($lg_name, $north, $south) = $centromere_h->fetchrow_array()) {
114 $self->set_centromere($lg_name, $north, $south);
120 =head2 function get_chromosome
121 Synopsis: see L<CXGN::Cview::Map>
122 Arguments:
123 Returns:
124 Side effects:
125 Description:
127 =cut
129 sub get_chromosome {
130 my $self = shift;
131 my $chr_nr = shift;
132 # my $marker_confidence_cutoff = shift; # the confidence cutoff. 3=frame 2=coseg 1=interval LOD=2 0=interval
134 # if (!$marker_confidence_cutoff) { $marker_confidence_cutoff=-1; }
136 my $chromosome = CXGN::Cview::Chromosome->new();
137 $chromosome->set_name($chr_nr);
138 $chromosome->set_caption($chr_nr);
140 my %seq_bac = ();
142 my $physical = 'physical';
144 if ($self->get_id() == CXGN::Cview::Map::Tools::find_current_version($self->get_dbh(), CXGN::Cview::Map::Tools::current_tomato_map_id())) {
146 # get the sequenced BACs
148 my $Sequenced_BAC_query =
150 SELECT
151 distinct $physical.bac_marker_matches.bac_id,
152 $physical.bac_marker_matches.cornell_clone_name,
153 $physical.bac_marker_matches.marker_id,
154 $physical.bac_marker_matches.position
155 FROM
156 $physical.bac_marker_matches
157 LEFT JOIN sgn.linkage_group USING (lg_id)
158 LEFT JOIN sgn_people.bac_status USING (bac_id)
159 WHERE
160 sgn.linkage_group.lg_name=?
161 AND sgn_people.bac_status.status='complete'
163 my $sth2 = $self->get_dbh->prepare($Sequenced_BAC_query);
164 $sth2->execute($chr_nr);
165 while (my ($bac_id, $name, $marker_id, $offset)=$sth2->fetchrow_array()) {
166 # print STDERR "Sequenced BAC for: $bac_id, $name, $marker_id, $offset...\n";
167 $name = CXGN::Genomic::Clone->retrieve($bac_id)->clone_name();
169 my $m = CXGN::Cview::Marker::SequencedBAC->new($chromosome, $bac_id, $name, "", "", "", "", $offset);
170 $m->get_label()->set_text_color(200,200,80);
171 $m->get_label()->set_line_color(200,200,80);
172 $seq_bac{$marker_id}=$m;
176 # get the "normal" markers
178 my $query = "
179 SELECT
180 marker_experiment.marker_id,
181 alias,
182 mc_name,
183 confidence_id,
185 subscript,
186 position,
188 FROM
189 sgn.map_version
190 inner join sgn.linkage_group using (map_version_id)
191 inner join sgn.marker_location using (lg_id)
192 inner join sgn.marker_experiment using (location_id)
193 inner join sgn.marker_alias using (marker_id)
194 inner join sgn.marker_confidence using (confidence_id)
195 left join sgn.marker_collectible using (marker_id)
196 left join sgn.marker_collection using (mc_id)
197 WHERE
198 map_version.map_version_id=?
199 and lg_name=?
200 and preferred='t'
201 ORDER BY
202 position,
203 confidence_id desc
206 #print STDERR "MY ID: ".$self->get_id()." MY CHR NR: ".$chr_nr."\n";
208 my $sth = $self->get_dbh -> prepare($query);
209 $sth -> execute($self->get_id(), $chr_nr);
211 while (my ($marker_id, $marker_name, $marker_type, $confidence, $order_in_loc, $location_subscript, $offset, $loc_type) = $sth->fetchrow_array()) {
212 #print STDERR "Marker Read: $marker_id\t$marker_name\t$marker_type\t$offset\n";
213 my $m = CXGN::Cview::Marker -> new($chromosome, $marker_id, $marker_name, $marker_type, $confidence, $order_in_loc, $location_subscript, $offset, undef , $loc_type, 0);
214 #print STDERR "dataadapter baccount = $bac_count!\n";
215 if ($loc_type == 100) { $m -> set_frame_marker(); }
216 $m -> set_url( $self->get_marker_link($m->get_id()));
217 $self->set_marker_color($m, $self->get_legend()->get_mode());
219 #print STDERR "CURRENT MODE IS: ".$self->get_legend()->get_mode()."\n";
220 $chromosome->add_marker($m);
222 if (exists($seq_bac{$marker_id})) {
223 #print STDERR "Adding Sequenced BAC [".($seq_bac{$marker_id}->get_name())."] to map...[$marker_id]\n";
224 $chromosome->add_marker($seq_bac{$marker_id});
229 foreach my $mi ($self->get_map_items()) {
231 my ($chr, $offset, $name) = split /\s+/, $mi;
234 if (!$chr || !$offset || !$name) { next; }
236 if ($chr ne $chr_nr) { next; }
238 my $m = CXGN::Cview::Marker->new($chromosome);
240 $m->get_label()->set_label_text($name);
241 $m->set_offset($offset);
242 $m->get_label()->set_hilited(1);
243 $m->show_label();
244 $m->get_label()->set_url('');
245 $m->set_marker_name($name); # needed for proper marker ordering in the chromosome
246 $chromosome->add_marker($m);
251 $chromosome->sort_markers();
253 $chromosome -> _calculate_chromosome_length();
255 return $chromosome;
259 =head2 function get_chromosome_section
261 Synopsis: my $chr_section = $map->get_chromosome_section(5, 120, 180);
262 Arguments: linkage group number, start offset, end offset
263 Returns:
264 Side effects:
265 Description:
267 =cut
269 sub get_chromosome_section {
270 my $self = shift;
271 my $chr_nr = shift; # the chromosome number
272 my $start = shift; # the start of the section in cM
273 my $end = shift; # the end of the section in cM
275 my $chromosome = CXGN::Cview::Chromosome->new();
277 # main query to get the marker data, including the BACs that
278 # are associated with this marker -- needs to be refactored to
279 # work with the materialized views for speed improvements.
281 my $query =
283 SELECT
284 marker_experiment.marker_id,
285 alias,
286 mc_name,
287 confidence_id,
289 subscript,
290 position,
292 min(physical.probe_markers.overgo_probe_id),
293 count(distinct(physical.overgo_associations.bac_id)),
294 max(physical.oa_plausibility.plausible)
295 FROM
296 map_version
297 inner join linkage_group using (map_version_id)
298 inner join marker_location using (lg_id)
299 inner join marker_experiment using (location_id)
300 inner join marker_alias using (marker_id)
301 inner join marker_confidence using (confidence_id)
302 left join marker_collectible using (marker_id)
303 left join marker_collection using (mc_id)
304 LEFT JOIN physical.probe_markers ON (marker_experiment.marker_id=physical.probe_markers.marker_id)
305 LEFT JOIN physical.overgo_associations USING (overgo_probe_id)
306 LEFT JOIN physical.oa_plausibility USING (overgo_assoc_id)
307 WHERE
308 map_version.map_version_id=?
309 and lg_name=?
310 and preferred='t'
311 -- and current_version='t'
312 AND position >= ?
313 AND position <= ?
314 GROUP BY
315 marker_experiment.marker_id,
316 alias,
317 mc_name,
318 confidence_id,
319 subscript,
320 position
321 ORDER BY
322 position,
323 confidence_id desc,
324 max(physical.oa_plausibility.plausible),
325 max(physical.probe_markers.overgo_probe_id)
329 my $sth = $self->get_dbh()-> prepare($query);
330 # print STDERR "START/END: $start/$end\n";
331 $sth -> execute($self->get_id(), $chr_nr, $start, $end);
333 # for each marker, look if there is a associated fully sequenced BAC, and add that
334 # as a marker of type Sequenced_BAC to the map at the right location
336 my $bac_status_q =
338 SELECT
339 cornell_clone_name,
340 bac_id
341 FROM
342 physical.bac_marker_matches
343 JOIN sgn_people.bac_status using (bac_id)
344 WHERE
345 physical.bac_marker_matches.marker_id=?
346 AND sgn_people.bac_status.status='complete'
349 my $bac_status_h = $self->get_dbh()->prepare($bac_status_q);
350 my $seq_bac;
352 while (my ($marker_id, $marker_name, $marker_type, $confidence, $order_in_loc, $location_subscript, $offset, $loc_type, $overgo, $bac_count, $plausible, $status, $bac_name, $bac_id) = $sth->fetchrow_array()) {
353 #print STDERR "Marker Read: $marker_id\t$marker_name\t$marker_type\toffset: $offset\tovergo: $overgo\tbac_count: $bac_count\tplausible: $plausible\n";
354 my $seq_bac=undef;
355 my $seq_bac_name="";
356 my $seq_bac_id="";
357 if (!$plausible || $plausible == 0) { $bac_count = 0; }
358 my $m = CXGN::Cview::Marker -> new($chromosome, $marker_id, $marker_name, $marker_type, $confidence, $order_in_loc, $location_subscript, $offset, , $loc_type, 0, $overgo, $bac_count);
359 $m->set_url($self->get_marker_link($m->get_id()));
360 $self->set_marker_color($m, $self->get_legend()->get_mode());
361 #print STDERR "dataadapter baccount = $bac_count!\n";
362 if ($loc_type == 100) { $m -> set_frame_marker(); }
364 # only add the sequenced BAC information to the F2-2000.
366 if ($self->get_id() == CXGN::Cview::Map::Tools::find_current_version($self->get_dbh(), CXGN::Cview::Map::Tools::current_tomato_map_id())) {
368 $bac_status_h->execute($marker_id);
369 ($seq_bac_name, $seq_bac_id) = $bac_status_h->fetchrow_array();
371 # change the name to look more standard
373 if ($seq_bac_name) {
374 if ($seq_bac_name =~ m/(\d+)([A-Z])(\d+)/i) {
375 $seq_bac_name = sprintf ("%3s%04d%1s%02d", "HBa",$1,$2,$3);
377 $seq_bac = CXGN::Cview::Marker::SequencedBAC->new($chromosome, $seq_bac_id, $seq_bac_name, "", "", "", "", $offset);
381 # add the marker $m to the chromosome
383 $chromosome->add_marker($m);
385 if ($m->has_overgo()) {
386 $m->set_mark_color(100, 100, 100); # draw a gray circle for overgos
387 $m->set_show_mark(1);
388 $m->set_mark_link( "/tools/seedbac/sbfinder.pl?marker=".$m->get_marker_name() );
390 #print STDERR "# BACS: ".($m2[$i]->has_bacs())."\n";
391 if ($m->has_bacs()) {
392 $m->set_mark_color(180, 0, 0); # draw a red circle for associated bacs
393 $m->set_show_mark(1);
394 $m->set_mark_link("/tools/seedbac/sbfinder.pl?marker=".$m->get_marker_name());
396 if (!$m->is_visible()) {
397 $m->set_show_mark(0);
400 # add the sequenced BAC to the chromosome
401 # -url link needs to be changed
402 # -add a confidence level of 3 so that it is always displayed.
404 if ($seq_bac) {
405 $seq_bac->set_confidence(3);
406 $seq_bac->set_url("/maps/physical/clone_info.pl?id=$seq_bac_id");
407 $chromosome->add_marker($seq_bac);
410 $chromosome->set_section($start, $end);
411 $chromosome -> _calculate_chromosome_length();
415 return $chromosome;
418 =head2 function get_overview_chromosome
420 Synopsis:
421 Arguments:
422 Returns:
423 Side effects:
424 Description:
426 =cut
428 sub get_overview_chromosome {
429 my $self = shift;
430 my $chr_nr = shift;
431 my $chr = $self->get_chromosome($chr_nr);
432 $chr->set_width( $self->get_preferred_chromosome_width()/2 );
433 foreach my $m ($chr->get_markers()) {
434 $m->hide_label();
435 $m->hide_mark();
437 return $chr;
440 =head2 get_chromosome_connections()
442 Usage: @list = $map->get_chromosome_connections($lg_name)
443 Args: a linkage group name from the current map
444 Returns: a list of hashrefs, containing 4 keys
445 map_version_id, lg_name, marker_count, short_name
446 and the corresponding values
447 Side Effects: the information will be used to populate the
448 drop down menu in the comparative viewer.
449 Example:
451 =cut
453 sub get_chromosome_connections {
454 my $self = shift;
455 my $chr_nr = shift;
457 my $query =
459 SELECT
460 c_map_version.map_version_id,
461 c_map.short_name,
462 c_linkage_group.lg_name,
463 count(distinct(marker.marker_id)) as marker_count
464 from
465 marker
466 join marker_experiment using(marker_id)
467 join marker_location using (location_id)
468 join linkage_group on (marker_location.lg_id=linkage_group.lg_id)
469 join map_version on (linkage_group.map_version_id=map_version.map_version_id)
471 join marker_experiment as c_marker_experiment on
472 (marker.marker_id=c_marker_experiment.marker_id)
473 join marker_location as c_marker_location on
474 (c_marker_experiment.location_id=c_marker_location.location_id)
475 join linkage_group as c_linkage_group on (c_marker_location.lg_id=c_linkage_group.lg_id)
476 join map_version as c_map_version on
477 (c_linkage_group.map_version_id=c_map_version.map_version_id)
478 join map as c_map on (c_map.map_id=c_map_version.map_id)
479 where
480 map_version.map_version_id=?
481 and linkage_group.lg_name=?
482 and c_map_version.map_version_id !=map_version.map_version_id
483 and c_map_version.current_version='t'
484 group by
485 c_map_version.map_version_id,
486 c_linkage_group.lg_name,
487 c_map.short_name
488 order by
489 marker_count desc
492 my $sth = $self->get_dbh() -> prepare($query);
493 $sth -> execute($self->get_id(), $chr_nr);
494 my @chr_list = ();
496 #print STDERR "***************** Done with query..\n";
497 while (my $hashref = $sth->fetchrow_hashref()) {
498 #print STDERR "READING----> $hashref->{map_version_id} $hashref->{lg_name} $hashref->{marker_count}\n";
499 push @chr_list, $hashref;
503 # hard code some connections to agp and fish maps.
505 my $tomato_version_id = CXGN::Cview::Map::Tools::find_current_version($self->get_dbh(), CXGN::Cview::Map::Tools::current_tomato_map_id());
506 ###print STDERR $self->get_id()." VERSUS $tomato_version_id\n\n";
508 if ($self->get_id() == $tomato_version_id) {
510 ##print STDERR "***** Map ".$self->get_id(). " pushing agp and fish map!\n\n";
511 push @chr_list, { map_version_id => "agp",
512 short_name => "Tomato AGP map",
513 lg_name => $chr_nr,
514 marker_count => "?"
516 push @chr_list, { map_version_id => 25,
517 short_name => "FISH map",
518 lg_name => $chr_nr,
519 marker_count => "?"
522 else {
523 warn $self->get_id()." has no other associated maps...\n\n";
526 return @chr_list;
529 =head2 function has_linkage_group
531 Synopsis:
532 Arguments:
533 Returns:
534 Side effects:
535 Description:
537 =cut
539 sub has_linkage_group {
540 my $self = shift;
541 my $candidate = shift;
542 foreach my $lg ($self->get_chromosome_names()) {
543 if ($lg eq $candidate) {
544 return 1;
547 return 0;
550 =head2 function get_marker_count
552 accesses the database to count the marker on the given map/chromosome.
554 =cut
556 sub get_marker_count {
557 my $self =shift;
558 my $chr_name = shift;
559 my $query = "SELECT count(distinct(location_id)) FROM sgn.map_version JOIN marker_location using (map_version_id)
560 JOIN linkage_group using (lg_id)
561 WHERE linkage_group.lg_name=? and map_version.map_version_id=?";
562 my $sth = $self->get_dbh()->prepare($query);
563 $sth->execute($chr_name, $self->get_id());
564 my ($count) = $sth->fetchrow_array();
565 return $count;
569 sub get_map_stats {
570 my $self = shift;
571 my $query =
573 select
574 mc_name,
575 count(distinct(marker.marker_id))
576 from
577 marker join marker_collectible using (marker_id)
578 join marker_collection using(mc_id)
579 join marker_experiment on (marker.marker_id=marker_experiment.marker_id)
580 join marker_location on (marker_experiment.location_id=marker_location.location_id)
581 where
582 marker_location.map_version_id=?
583 group by
584 mc_name
587 my $total_count = 0;
589 my $s = "<table summary=\"\"><tr><td>&nbsp;</td><td>\# markers</td></tr>";
590 my $sth = $self->get_dbh() -> prepare($query);
591 $sth -> execute($self->get_id());
593 my $map_name = $self->get_short_name();
594 $map_name =~ s/ /\+/g;
596 while (my ($type, $count)= $sth->fetchrow_array()) {
597 $s .="<tr><td>$type</td><td align=\"right\"><a href=\"/search/markers/markersearch.pl?types=$type&amp;maps=$map_name\">$count</a></td></tr>";
598 $total_count += $count;
602 $s .= "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n";
603 $s .= "<tr><td><b>Total</b>: </td><td align=\"right\"><a href=\"/search/markers/markersearch.pl?maps=$map_name\"><b>$total_count</b></a></td></tr>";
604 $s .= "</table>";
606 my $protocol_q = "SELECT distinct(marker_experiment.protocol), count(distinct(marker_experiment.marker_experiment_id))
607 FROM marker
608 JOIN marker_experiment using (marker_id)
609 JOIN marker_location using (location_id)
610 JOIN linkage_group using (map_version_id)
611 WHERE map_version_id=?
612 GROUP BY marker_experiment.protocol";
613 my $pqh = $self->get_dbh()->prepare($protocol_q);
614 $pqh ->execute($self->get_id());
616 my $total_protocols = 0;
617 $s.= qq { <br /><br /><table><tr><td colspan="2"><b>Protocols:</b></td></tr> };
618 $s.= qq { <tr><td>&nbsp;</td><td>&nbsp;</td></tr> };
619 $s.= qq { <tr><td>&nbsp;</td><td>\# markers</td></tr> };
620 while (my ($protocol, $count) = $pqh->fetchrow_array()) {
621 $s.= qq { <tr><td>$protocol</td><td align="right">$count</td></tr> };
622 $total_protocols += $count;
624 $s .= qq { <tr><td colspan="2">&nbsp;</td></tr> };
625 $s .= qq { <tr><td><b>Total:</b></td><td align="right"><b>$total_protocols</b></td></tr> };
626 $s .= "</table>";
628 return $s;
633 =head2 function has_IL
635 Synopsis:
636 Arguments:
637 Returns:
638 Side effects:
639 Description:
641 =cut
643 sub has_IL {
644 my $self =shift;
646 if ($self->get_short_name()=~/1992|2000/) {
647 #print STDERR "Map ".$self->get_short_name()." has an associated IL map.\n";
648 return 1;
650 #print STDERR "Map ".$self->get_short_name()." does not have an associated IL map.\n";
651 return 0;
654 =head2 function has_physical
656 Synopsis:
657 Arguments:
658 Returns:
659 Side effects:
660 Description:
662 =cut
664 sub has_physical {
665 my $self = shift;
666 if ($self->get_short_name()=~/2000/) {
667 return 1;
669 return 0;
672 =head2 function can_zoom
674 Whether this map support zooming in. These ones do.
676 =cut
678 sub can_zoom {
679 return 1;
682 =head2 function get_marker_link
684 Synopsis:
685 Arguments:
686 Returns:
687 Side effects:
688 Description:
690 =cut
692 sub get_marker_link {
693 my $self =shift;
694 my $id = shift;
695 return "/search/markers/markerinfo.pl?marker_id=$id";
699 =head2 function set_marker_color()
701 Synopsis:
702 Parameters: marker object [CXGN::Cview::Marker], color model [string]
703 Returns: nothing
704 Side effects: sets the marker color according to the supplied marker color model
705 the color model is a string from the list:
706 "marker_types", "confidence"
707 Status: implemented
708 Example:
709 Note: this function was moved to Utils from ChromosomeViewer, such that
710 it is available for other scripts, such as view_maps.pl
712 =cut
714 sub set_marker_color {
715 my $self = shift;
716 my $m = shift;
717 my $color_model = shift || '';
719 if ($color_model eq "marker_types") {
720 if ($m->get_marker_type() =~ /RFLP/i) {
721 $m->set_color(255, 0, 0);
722 $m->set_label_line_color(255, 0,0);
723 $m->set_text_color(255,0,0);
725 elsif ($m->get_marker_type() =~ /SSR/i) {
726 $m->set_color(0, 255, 0);
727 $m->set_label_line_color(0, 255,0);
728 $m->set_text_color(0,255,0);
730 elsif ($m->get_marker_type() =~ /CAPS/i) {
731 $m->set_color(0, 0, 255);
732 $m->set_label_line_color(0, 0,255);
733 $m->set_text_color(0,0,255);
735 elsif ($m->get_marker_type() =~ /COS/i) {
736 $m->set_color(255,0 , 255);
737 $m->set_label_line_color(255,0, 255);
738 $m->set_text_color(255,0,255);
740 else {
741 $m->set_color(0, 0, 0);
742 $m->set_label_line_color(0, 0,0);
743 $m->set_text_color(0,0,0);
747 else {
748 my $c = $m -> get_confidence();
749 if ($c==0) {
750 $m->set_color(0,0,0);
751 $m->set_label_line_color(0,0,0);
752 $m->set_text_color(0,0,0);
754 if ($c==1) {
755 $m->set_color(0,0,255);
756 $m->set_label_line_color(0,0,255);
757 $m->set_text_color(0,0,255);
760 if ($c==2) {
761 $m->set_color(0,255, 0);
762 $m->set_label_line_color(0,255,0);
763 $m->set_text_color(0,255,0);
765 if ($c==3) {
766 $m->set_color(255, 0, 0);
767 $m->set_label_line_color(255, 0,0);
768 $m->set_text_color(255, 0,0);
770 if ($c==4) {
771 $m->set_color(128, 128, 128);
772 $m->set_label_line_color(128, 128, 128);
773 $m->set_text_color(128, 128, 128);
778 sub can_overlay {
779 return 1;