5 /markers/locations.mas - a Mason component displaying information about map locations of markers
15 $marker - a CXGN::Marker object.
22 Lukas Mueller <lam87@cornell.edu>
33 use CXGN::Cview::MapFactory;
34 use CXGN::Cview::ChrMarkerImage;
36 my $locations_html = '';
37 my $marker_name = $marker->get_name();
41 #if we have some experiments, and they are an arrayref, and there is at least one location in them
42 my $experiments = $marker->current_mapping_experiments() || [];
46 and grep { $_->{location} } @{$experiments} )
49 for my $experiment ( @{$experiments} ) {
51 #make sure we have a location before we go about showing location data--some experiments do not have locations
52 if ( my $loc = $experiment->{location} ) {
54 #make sure we haven't displayed a location entry with the same location ID already
55 unless ( grep { $_ == $loc->location_id() } @displayed_locs ) {
56 push( @displayed_locs, $loc->location_id() );
58 $locations_html .= '<br /><br /><br />';
61 '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr>';
63 #make a section detailing the location
65 my $pcr = $experiment->{pcr_experiment};
66 my $rflp = $experiment->{rflp_experiment};
67 $protocol = $experiment->{protocol};
76 $protocol = '<span class="ghosted">Unknown</span>';
80 #make a link to the map this marker can be found on
81 my $map_version_id = $loc->map_version_id();
82 my $lg_name = $loc->lg_name();
83 my $position = $loc->position();
84 my $subscript = $loc->subscript();
89 my $dbh = $marker->{dbh};
90 my $map_factory = CXGN::Cview::MapFactory->new($dbh);
92 $map_factory->create( { map_version_id => $map_version_id } );
93 my $map_name = $map->get_short_name();
94 if ($map_version_id) {
95 $map_id = $map->get_id();
100 and defined($position) )
103 "<a href=\"/cview/view_chromosome.pl?map_version_id=$map_version_id&chr_nr=$lg_name&cM=$position&hilite=$marker_name$subscript&zoom=1\">$map_name v$map_version_id</a>";
108 '<span class="ghosted">Map data not available</span>';
112 if ( $subscript and $multicol > 1 ) { $multicol++; }
115 "<b>Map:</b> $map_url <span class=\"tinytype\">Loc. ID "
116 . $loc->location_id()
118 '__tableattrs' => "width=\"$width\"",
119 '__multicol' => $multicol,
120 'Chromosome' => $loc->lg_name(),
121 'Position ' => sprintf( '%.2f cM', $loc->position() ),
122 'Confidence' => $loc->confidence(),
123 'Protocol' => $protocol
126 push( @locations, ( 'Subscript' => $subscript ) );
128 $locations_html .= '<td width = "25%">';
130 CXGN::Page::FormattingHelpers::info_table_html(@locations);
131 $locations_html .= '</td>';
132 $locations_html .= '<td align="center">';
133 ####$map_factory = CXGN::Cview::MapFactory->new($dbh);
134 ####### my $map=$map_factory->create({map_version_id=>$map_version_id});
135 ####### my $map_version_id=$map->get_id();
137 my $hilite_name = $marker_name;
139 $hilite_name .= $subscript;
141 my $chromosome = CXGN::Cview::ChrMarkerImage->new(
142 "", 150, 150, $dbh, $lg_name, $map, $hilite_name,
143 $c->get_conf("basepath"), $c->get_conf('tempfiles_subdir')."/cview",
145 my ( $image_path, $image_url ) =
146 $chromosome->get_image_filename();
148 qq|<img src="$image_url" usemap="#map$count" border="0" alt="" />|;
149 $chr_link .= $chromosome->get_image_map("map$count");
150 $chr_link .= '<br />' . $map_name;
152 $locations_html .= '<br />';
153 $locations_html .= $chr_link;
154 $locations_html .= '</td></tr></table>';
156 #if we have a pcr experiment that was used to map this marker to this location, make a section for this experiment's data
158 and !grep { $_ == $pcr->pcr_experiment_id() }
162 '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr>';
163 my $pcr_bands = $pcr->pcr_bands_hash_of_strings();
164 my $digest_bands = $pcr->pcr_digest_bands_hash_of_strings();
166 CXGN::Page::FormattingHelpers::info_table_html(
171 CXGN::Accession->new( $dbh, $_ )->verbose_name;
172 $accession_name => $pcr_bands->{$_}
175 my $digest_bands_html =
176 CXGN::Page::FormattingHelpers::info_table_html(
181 CXGN::Accession->new( $dbh, $_ )->verbose_name();
182 $accession_name => $digest_bands->{$_};
183 } keys %$digest_bands,
186 if ( $pcr->mg_conc() ) {
187 $mg = $pcr->mg_conc() . 'mM';
190 if ( $pcr->temp() ) {
191 $temp = $pcr->temp() . '°C';
193 $locations_html .= '<td>';
194 my $fwd = $pcr->fwd_primer()
195 || '<span class="ghosted">Unknown</span>';
196 my $rev = $pcr->rev_primer()
197 || '<span class="ghosted">Unknown</span>';
198 my $enz = $pcr->enzyme() || 'unknown enzyme';
199 my $dcaps = $pcr->dcaps_primer();
200 $temp ||= '<span class="ghosted">Unknown</span>';
201 $mg ||= '<span class="ghosted">Unknown</span>';
202 my $digest_title = "Digested band sizes (using $enz)";
204 unless ($digest_bands_html) {
205 $digest_title = ' ';
206 $digest_bands_html = ' ';
210 my ( $dcaps_left, $dcaps_right );
213 $dcaps_left = "dCAPS primer (5'-3')";
214 $dcaps_right = "<span class=\"sequence\">$dcaps</span>";
218 CXGN::Page::FormattingHelpers::info_table_html(
220 "PCR data <span class=\"tinytype\">Exp. ID "
221 . $pcr->pcr_experiment_id()
223 "Forward primer (5'-3')" =>
224 "<span class=\"sequence\">$fwd</span>",
225 "Reverse primer (5'-3')" =>
226 "<span class=\"sequence\">$rev</span>",
227 $dcaps_left => $dcaps_right,
228 'Accessions and product sizes' => $pcr_bands_html,
229 $digest_title => $digest_bands_html,
230 'Approximate temperature' => $temp,
231 'Mg<sup>+2</sup> concentration' => $mg,
233 '__tableattrs' => "width=\"100%\"",
235 $locations_html .= '</td></tr></table>';
236 push( @displayed_pcr, $pcr->pcr_experiment_id() );
243 ###print blue_section_html('Mapped locations',$locations_html);
246 <&| /page/info_section.mas, title=>'Mapped locations', collapsible=>1, collapsed=>0 &>
247 <% $locations_html %>