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 } );
94 print "map_version_id = $map_version_id could not be instantiated\n";
97 my $map_name = $map->get_short_name();
98 if ($map_version_id) {
99 $map_id = $map->get_id();
103 and defined($lg_name)
104 and defined($position) )
107 "<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>";
112 '<span class="ghosted">Map data not available</span>';
116 if ( $subscript and $multicol > 1 ) { $multicol++; }
119 "<b>Map:</b> $map_url <span class=\"tinytype\">Loc. ID "
120 . $loc->location_id()
122 '__tableattrs' => "width=\"$width\"",
123 '__multicol' => $multicol,
124 'Chromosome' => $loc->lg_name(),
125 'Position ' => sprintf( '%.2f cM', $loc->position() ),
126 'Confidence' => $loc->confidence(),
127 'Protocol' => $protocol
130 push( @locations, ( 'Subscript' => $subscript ) );
132 $locations_html .= '<td width = "25%">';
134 CXGN::Page::FormattingHelpers::info_table_html(@locations);
135 $locations_html .= '</td>';
136 $locations_html .= '<td align="center">';
137 ####$map_factory = CXGN::Cview::MapFactory->new($dbh);
138 ####### my $map=$map_factory->create({map_version_id=>$map_version_id});
139 ####### my $map_version_id=$map->get_id();
141 my $hilite_name = $marker_name;
143 $hilite_name .= $subscript;
145 my $chromosome = CXGN::Cview::ChrMarkerImage->new(
146 "", 150, 150, $dbh, $lg_name, $map, $hilite_name,
147 $c->get_conf("basepath"), $c->get_conf('tempfiles_subdir')."/cview",
149 my ( $image_path, $image_url ) =
150 $chromosome->get_image_filename();
152 qq|<img src="$image_url" usemap="#map$count" border="0" alt="" />|;
153 $chr_link .= $chromosome->get_image_map("map$count");
154 $chr_link .= '<br />' . $map_name;
156 $locations_html .= '<br />';
157 $locations_html .= $chr_link;
158 $locations_html .= '</td></tr></table>';
161 #if we have a pcr experiment that was used to map this marker to this location, make a section for this experiment's data
163 and !grep { $_ == $pcr->pcr_experiment_id() }
167 '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr>';
168 my $pcr_bands = $pcr->pcr_bands_hash_of_strings();
170 my %pcr_bands_by_name = ();
171 my $sth = $dbh->prepare("SELECT organism.species || ' ' || stock.name FROM public.stock JOIN public.organism USING(organism_id) WHERE stock_id=?");
173 foreach my $p (keys %$pcr_bands) {
176 $pcr_bands_by_name{($sth->fetchrow_array)} = $pcr_bands->{$p};
180 my $digest_bands = $pcr->pcr_digest_bands_hash_of_strings();
182 my %pcr_digest_bands_by_name = ();
183 foreach my $p (keys %$digest_bands) {
185 $pcr_digest_bands_by_name{($sth->fetchrow_array)} = $digest_bands->{$p};
190 CXGN::Page::FormattingHelpers::info_table_html(
196 my $digest_bands_html =
197 CXGN::Page::FormattingHelpers::info_table_html(
200 %pcr_digest_bands_by_name,
203 if ( $pcr->mg_conc() ) {
204 $mg = $pcr->mg_conc() . 'mM';
207 if ( $pcr->temp() ) {
208 $temp = $pcr->temp() . '°C';
210 $locations_html .= '<td>';
211 my $fwd = $pcr->fwd_primer()
212 || '<span class="ghosted">Unknown</span>';
213 my $rev = $pcr->rev_primer()
214 || '<span class="ghosted">Unknown</span>';
215 my $enz = $pcr->enzyme() || 'unknown enzyme';
216 my $dcaps = $pcr->dcaps_primer();
217 $temp ||= '<span class="ghosted">Unknown</span>';
218 $mg ||= '<span class="ghosted">Unknown</span>';
219 my $digest_title = "Digested band sizes (using $enz)";
221 unless ($digest_bands_html) {
222 $digest_title = ' ';
223 $digest_bands_html = ' ';
227 my ( $dcaps_left, $dcaps_right );
230 $dcaps_left = "dCAPS primer (5'-3')";
231 $dcaps_right = "<span class=\"sequence\">$dcaps</span>";
234 my $pcr_seq = $pcr->get_sequences;
236 my ($aspe, $aspe_primers);
237 $aspe_primers = join ('<BR>' , @{ $pcr_seq->{ASPE_primer} } ) if $pcr_seq->{ASPE_primer} ;
239 $aspe = "ASPE primers (5'-3')";
240 $aspe_primers = "<span class=\"snp\">$aspe_primers</span>"
243 $snp_nuc = join ('<BR>' , @{ $pcr_seq->{SNP} } ) if $pcr_seq->{SNP} ;
245 $snp = "SNP nucleotide";
246 $snp_nuc = "<span class=\"snp\">$snp_nuc</span>"
248 my ($three_prime, $seq3);
249 $seq3 = join ('<BR>' , @{ $pcr_seq->{three_prime_flanking_region} } ) if $pcr_seq->{three_prime_flanking_region} ;
251 $three_prime = "3' flanking region";
252 $seq3 = "<span class=\"assay\">$seq3</span>"
254 my ($five_prime, $seq5);
255 $seq5 = join ('<BR>' , @{ $pcr_seq->{five_prime_flanking_region} } ) if $pcr_seq->{five_prime_flanking_region} ;
257 $five_prime = "5' flanking region";
258 $seq5 = "<span class=\"assay\">$seq5</span>"
260 my ($indel, $indel_seq);
261 $indel_seq = join ('<BR>' , @{ $pcr_seq->{indel} } ) if $pcr_seq->{indel} ;
264 $indel_seq = "<span class=\"indel\">$indel_seq</span>"
267 CXGN::Page::FormattingHelpers::info_table_html(
269 "PCR data <span class=\"tinytype\">Exp. ID "
270 . $pcr->pcr_experiment_id()
272 "Forward primer (5'-3')" =>
273 "<span class=\"sequence\">$fwd</span>",
274 "Reverse primer (5'-3')" =>
275 "<span class=\"sequence\">$rev</span>",
276 $dcaps_left => $dcaps_right,
277 'Accessions and product sizes' => $pcr_bands_html,
278 $digest_title => $digest_bands_html,
279 'Approximate temperature' => $temp,
280 'Mg<sup>+2</sup> concentration' => $mg,
282 '__tableattrs' => "width=\"100%\"",
285 CXGN::Page::FormattingHelpers::info_table_html(
287 "Assay data <span class=\"tinytype\"></span>",
288 $three_prime => $seq3,
289 $five_prime => $seq5,
290 $aspe => $aspe_primers,
292 $indel => $indel_seq,
294 '__tableattrs' => "width=\"100%\"",
295 ) if $aspe || $indel;
296 $locations_html .= '</td></tr></table>';
297 push( @displayed_pcr, $pcr->pcr_experiment_id() );
306 <&| /page/info_section.mas, title=>'Mapped locations', collapsible=>1, collapsed=>0 &>
307 <% $locations_html %>