Merge branch 'master' into topic/brapi_observations_call
[sgn.git] / mason / markers / rflp.mas
blob889e29b646df98339c7f8f1066d2202bdb165fc3
2 <%doc>
4 =head1 NAME
6 /markers/rflp.mas - a Mason component displaying information about rflp (known function genes) markers
8 =head1 ARGS
10 =head2 marker
12 a CXGN::Marker object.
14 =head1 AUTHOR
16 Robert Buels <rmb32@cornell.edu>
18 =cut
20 </%doc>
22 <%args>
23 $marker
24 </%args>
26 <%init>
27 use CXGN::Page::FormattingHelpers qw/ info_table_html columnar_table_html /;
28 use CXGN::Tools::Identifiers qw/ link_identifier /;
29 use SGN::Controller::Marker;
31 sub fmt_sequence {
32   my $seq = shift
33     or return '<span class="ghosted">not available</span>';
34   '<span class="sequence">'.CXGN::Page::FormattingHelpers::html_break_string($seq,90).'</span>'
36 sub fmt_rflp_image_link {
37     my $marker = shift;
38     my $l = SGN::Controller::Marker->rflp_image_link( $c, $marker )
39         or return '<span class="ghosted">'.$marker->get_name.' image not available</span>';
40     return '<a href="/marker/SGN-M'.$marker->marker_id.'/rflp_image/view">'.$marker->get_name.' RFLP image</a>';
42 sub len_pct {
43     my ($len,$seq) = @_;
44     return sprintf('%d (%0.1f%% of RFLP seq)',$len,$len/length($seq)*100);
47 my $e_val_blast_cutoff = '1.0e-4';
48 </%init>
50 % if( my $r = $marker->rflp_data() ) {
51 %     my ($forward_unigene_matches, $reverse_unigene_matches) = $marker->rflp_unigene_matches( $r->{forward_seq_id}, $r->{reverse_seq_id} );
53       <&| /page/info_section.mas, title=>'RFLP details' &>
55          <% info_table_html( __border => 0, __multicol => 5,
56               'Insert size'     => $r->{insert_size},
57               'Vector'          => $r->{vector},
58               'Cutting Site'    => $r->{cutting_site},
59               'Drug Resistance' => $r->{drug_resistance},
60               'Image'           => fmt_rflp_image_link( $marker ),              
61          )%>
62          <% info_table_html( __border => 0,
63               'Forward sequence' => fmt_sequence( $r->{forward_seq} ),
64               'Reverse sequence' => fmt_sequence( $r->{reverse_seq} ),
65          )%>
67       </&>
68        <&| /page/info_section.mas, title => 'RFLP sequence matches to unigenes' &>
69 %          if( @$forward_unigene_matches || @$reverse_unigene_matches ) {
70                <% columnar_table_html(
71                       headings => ['Unigene','e value','Match length (bp)','Strand'],
72                       data     => [
73                                     ( map [ link_identifier($_->[0]), $_->[1], len_pct($_->[2], $r->{forward_seq}), '+' ], @$forward_unigene_matches ),
74                                     ( map [ link_identifier($_->[0]), $_->[1], len_pct($_->[2], $r->{reverse_seq}), '-' ], @$reverse_unigene_matches ),
75                                   ],
76                )%>
77 %          }
78        </&>