add POD to SGN::Exception
[sgn.git] / mason / markers / polymorphisms.mas
blobd81e33dddce8803689c10810e7f28868e1c66648
2 <%doc>
4 =head1 NAME
6 /markers/polymorphisms.mas - a Mason component displaying information about map polymorphisms of marker product lengths
8 =head1 DESCRIPTION
10 parameters 
12 =over 5
14 =item *
16 $marker - a CXGN::Marker object.
19 =back
21 =head1 AUTHOR
23 Lukas Mueller <lam87@cornell.edu>
25 =cut
27 </%doc>
29 <%args>
30 $marker
31 </%args>
33 <%perl>
34   my $polymorphisms_html='';
35 my $dbh = $marker->{dbh};
36 my @displayed_pcr=();
37 my $experiments=$marker->experiments();    
38 if($experiments and @{$experiments}) {
39   for my $experiment(@{$experiments}) {
40     my $pcr=$experiment->{pcr_experiment};
41     my $rflp=$experiment->{rflp_experiment};
42     if($pcr and !grep {$_==$pcr->pcr_experiment_id()} @displayed_pcr) {
43       my $pcr_bands=$pcr->pcr_bands_hash_of_strings();
44       my $digest_bands=$pcr->pcr_digest_bands_hash_of_strings();
45       my $pcr_bands_html='';
46       my $digest_bands_html='';
47       for my $accession_id(keys(%{$pcr_bands})) {
48         my $accession_name=CXGN::Accession->new($dbh,$accession_id)->verbose_name();
49         $pcr_bands_html.="<b>$accession_name:</b> $pcr_bands->{$accession_id}<br />";
50       }
51       for my $accession_id(keys(%{$digest_bands})) {
52         my $accession_name=CXGN::Accession->new($dbh,$accession_id)->verbose_name();
53         $digest_bands_html.="<b>$accession_name:</b> $digest_bands->{$accession_id}<br />";
54       }
55       my $mg='';
56       if($pcr->mg_conc()) {    
57         $mg=$pcr->mg_conc().'mM';
58       }
59       my $temp='';
60       if($pcr->temp()) { 
61         $temp=$pcr->temp().'&deg;C';
62       }                    
63       $polymorphisms_html.='<tr><td width="100%">';
64       my $fwd=$pcr->fwd_primer();
65       my $rev=$pcr->rev_primer();
66       if($fwd) {
67         $fwd='<span class="sequence">'.$fwd.'</span>';
68       }
69       else {
70         $fwd='<span class="ghosted">Unknown</span>';
71       }
72       if($rev) {
73         $rev='<span class="sequence">'.$rev.'</span>';
74       }
75       else {
76         $rev='<span class="ghosted">Unknown</span>';
77       }  
78       my $enz=$pcr->enzyme()||'unknown enzyme';                 
79       $temp||='<span class="ghosted">Unknown</span>';
80       $mg||='<span class="ghosted">Unknown</span>';
81       my $digest_title="Digested band sizes (using $enz)";
82       unless($digest_bands_html) {
83         $digest_title='&nbsp;'; 
84         $digest_bands_html='&nbsp;'; 
85       }
86       $polymorphisms_html.=CXGN::Page::FormattingHelpers::info_table_html
87         (
88          '__title'=>"PCR data&nbsp;&nbsp;&nbsp;<span class=\"tinytype\">Exp. ID ".$pcr->pcr_experiment_id."</span>",
89          "Forward primer (5'-3')"=>"<span class=\"sequence\">$fwd</span>",
90          "Reverse primer (5'-3')"=>"<span class=\"sequence\">$rev</span>",
91          'Accessions and product sizes'=>$pcr_bands_html,
92          $digest_title=>$digest_bands_html,
93          'Approximate temperature'=>$temp,
94          'Mg<sup>+2</sup> concentration'=>$mg,
95          '__multicol'=>3,
96          '__tableattrs'=>"width=\"100%\"",
97         );
98       $polymorphisms_html.='</td></tr>';
99     }
100   }
102 if($polymorphisms_html) {
103  print  info_section_html(title=>'Other PCR data',contents=>'<table width="100%" cellspacing="0" cellpadding="0" border="0">'.$polymorphisms_html.'</table>');
105 else {
106   return '';
109 </%perl>