package SGN::View::Mason::Commands;
use strict;
use vars qw($m $c);
HTML::Mason::Component::FileBased->new(
'code' => sub {
use utf8; local $SGN::View::Mason::Commands::m = $HTML::Mason::Commands::m;
HTML::Mason::Exception::Params->throw
    ( error =>
      "Odd number of parameters passed to component expecting name/value pairs"
    ) if @_ % 2;
my ( $marker );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( marker ) )
    {
        HTML::Mason::Exception::Params->throw
            ( error => "no value sent for required parameter '$arg'" )
                unless exists $pos{$arg};
    }
#line 23 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
    $marker = $_[ $pos{'marker'} ];
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 26 "/home/production/cxgn/sgn/mason/markers/rflp.mas"

use CXGN::Page::FormattingHelpers qw/ info_table_html columnar_table_html /;
use CXGN::Tools::Identifiers qw/ link_identifier /;
use SGN::Controller::Marker;

sub fmt_sequence {
  my $seq = shift
    or return '<span class="ghosted">not available</span>';
  '<span class="sequence">'.CXGN::Page::FormattingHelpers::html_break_string($seq,90).'</span>'
}
sub fmt_rflp_image_link {
    my $marker = shift;
    my $l = SGN::Controller::Marker->rflp_image_link( $c, $marker )
        or return '<span class="ghosted">'.$marker->get_name.' image not available</span>';
    return '<a href="/marker/SGN-M'.$marker->marker_id.'/rflp_image/view">'.$marker->get_name.' RFLP image</a>';
}
sub len_pct {
    my ($len,$seq) = @_;
    return sprintf('%d (%0.1f%% of RFLP seq)',$len,$len/length($seq)*100);
}

my $e_val_blast_cutoff = '1.0e-4';
#line 1 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '
' );
#line 21 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '
' );
#line 25 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '
' );
#line 49 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '
' );
#line 50 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
 if( my $r = $marker->rflp_data() ) {
     my ($forward_unigene_matches, $reverse_unigene_matches) = $marker->rflp_unigene_matches( $r->{forward_seq_id}, $r->{reverse_seq_id} );
$m->print( '
      ' );
#line 53 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->comp( { content => sub {
#line 53 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '

         ' );
#line 61 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print(  info_table_html( __border => 0, __multicol => 5,
              'Insert size'     => $r->{insert_size},
              'Vector'          => $r->{vector},
              'Cutting Site'    => $r->{cutting_site},
              'Drug Resistance' => $r->{drug_resistance},
              'Image'           => fmt_rflp_image_link( $marker ),              
         ) );
#line 61 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '
         ' );
#line 65 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print(  info_table_html( __border => 0,
              'Forward sequence' => fmt_sequence( $r->{forward_seq} ),
              'Reverse sequence' => fmt_sequence( $r->{reverse_seq} ),
         ) );
#line 65 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '

      ' );
#line 67 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
} }, '/page/info_section.mas', title=>'RFLP details'
 );
#line 67 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '
       ' );
#line 68 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->comp( { content => sub {
#line 68 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '
' );
#line 69 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
          if( @$forward_unigene_matches || @$reverse_unigene_matches ) {
$m->print( '               ' );
#line 76 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print(  columnar_table_html(
                      headings => ['Unigene','e value','Match length (bp)','Strand'],
                      data     => [
                                    ( map [ link_identifier($_->[0]), $_->[1], len_pct($_->[2], $r->{forward_seq}), '+' ], @$forward_unigene_matches ),
                                    ( map [ link_identifier($_->[0]), $_->[1], len_pct($_->[2], $r->{reverse_seq}), '-' ], @$reverse_unigene_matches ),
                                  ],
               ) );
#line 76 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '
' );
#line 77 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
          }
$m->print( '       ' );
#line 78 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
} }, '/page/info_section.mas', title => 'RFLP sequence matches to unigenes'
 );
#line 78 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
$m->print( '

' );
#line 80 "/home/production/cxgn/sgn/mason/markers/rflp.mas"
}
;return;
},
'declared_args' => {
  '$marker' => { default => undef }
},
'load_time' => 1763079527,

)
;