5 /locus/map_location.mas - a component for displaying locus chromosome/map/marker location/s
22 Naama Menda <nm249@cornell.edu>
41 use CXGN::Phenome::Locus;
43 use CXGN::Cview::MapFactory;
44 use CXGN::Cview::ChrMarkerImage;
49 my $lg_name = $locus->get_linkage_group();
50 my $arm = $locus->get_lg_arm();
51 my $location_html = qq|<table><tr>|;
53 my @locus_marker_objs = $locus->get_locus_markers(); #array of locus_marker objects
54 foreach my $lmo (@locus_marker_objs) {
55 my $marker_id = $lmo->get_marker_id(); #{marker_id};
56 my $marker = CXGN::Marker->new( $locus->get_dbh(), $marker_id ); #a new marker object
57 my $marker_name = $marker->name_that_marker();
58 my $experiments = $marker->current_mapping_experiments();
61 and grep { $_->{location} } @{$experiments} )
64 for my $experiment ( @{$experiments} ) {
65 if ( my $loc = $experiment->{location} ) {
66 my $map_version_id = $loc->map_version_id();
67 my $lg_name = $loc->lg_name();
68 if ($map_version_id) {
70 CXGN::Cview::MapFactory->new( $locus->get_dbh() );
71 my $map = $map_factory->create(
72 { map_version_id => $map_version_id } );
73 my $map_version_id = $map->get_id();
74 my $map_name = $map->get_short_name();
76 CXGN::Cview::ChrMarkerImage->new(
77 "", 250, 150, $locus->get_dbh(), $lg_name, $map, $marker_name,
78 $c->get_conf("basepath"), $c->get_conf('tempfiles_subdir')."/cview",
80 my ( $image_path, $image_url ) =
81 $chromosome->get_image_filename();
83 qq|<img src="$image_url" usemap="#map$count" border="0" alt="" />|;
85 $chromosome->get_image_map("map$count") . "<br />";
86 $chr_link .= $map_name;
90 $location_html .= "</tr><tr>" ;
93 $location_html .= "<td>" . $chr_link . "</td>";
100 #draw chromosome with marker-range for loci w/o associated marker, only a chromosome arm annotation
101 if ( scalar(@locus_marker_objs) == 0 && $lg_name ) {
102 my $organism = $locus->get_common_name();
104 'Tomato' => 9, #F2 2000 map
109 my $map_id = $org_hash{$organism};
110 my $map_factory = CXGN::Cview::MapFactory->new( $locus->get_dbh() );
112 my $map = $map_factory->create( { map_id => $map_id } );
114 my $map_name = $map->get_short_name();
115 my ( $north, $south, $center ) = $map->get_centromere($lg_name);
118 $dummy_name = "$arm arm" if $arm;
120 CXGN::Cview::ChrMarkerImage->new( "", 250, 150, $locus->get_dbh(),
121 $lg_name, $map, $dummy_name, $c->get_conf("basepath"), $c->get_conf('tempfiles_subdir')."/cview");
123 my ($chr) = $chr_image->get_chromosomes();
125 my $range_marker = CXGN::Cview::Marker::RangeMarker->new($chr);
126 my ( $offset, $nrange, $srange );
127 if ( $arm eq 'short' ) {
128 $offset = $nrange = $srange = $center / 2;
130 elsif ( $arm eq 'long' ) {
131 my $stelomere = $chr->get_length();
132 $offset = ( $center + $stelomere ) / 2;
133 $nrange = $srange = ( $stelomere - $center ) / 2;
135 $range_marker->set_offset($offset); #center of north/south arm
136 $range_marker->set_north_range($nrange);
137 $range_marker->set_south_range($srange);
138 $range_marker->set_marker_name($dummy_name);
139 if ( !$dummy_name ) { $range_marker->hide_label(); }
140 $range_marker->set_label_spacer(20);
141 $range_marker->get_label()->set_name($dummy_name);
142 $range_marker->get_label->set_stacking_level(2);
143 $chr->add_marker($range_marker);
144 my ( $image_path, $image_url ) = $chr_image->get_image_filename();
146 qq|<img src="$image_url" usemap="#chr_arm_map" border="0" alt="" />|;
147 $chr_link .= $chr_image->get_image_map("chr_arm_map") . "<br />";
148 $chr_link .= $map_name;
149 $location_html .= "<td>" . $chr_link . "</td>";
152 $location_html .= "</tr></table>";