package SGN::View::Mason::Commands;
use strict;
use vars qw($m $c);
my %_def =
(
'.really_display' => HTML::Mason::Component::Subcomponent->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 ( $seq, $styles, $regions, $width, $subdiv, $blast_url );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( seq ) )
    {
        HTML::Mason::Exception::Params->throw
            ( error => "no value sent for required parameter '$arg'" )
                unless exists $pos{$arg};
    }
#line 89 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
    $seq = $_[ $pos{'seq'} ];
#line 90 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
     $styles = exists $pos{'styles'} ? $_[ $pos{'styles'} ] :  undef;
#line 91 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
     $regions = exists $pos{'regions'} ? $_[ $pos{'regions'} ] :  undef;
#line 92 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
     $width = exists $pos{'width'} ? $_[ $pos{'width'} ] :  80;
#line 93 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
     $subdiv = exists $pos{'subdiv'} ? $_[ $pos{'subdiv'} ] :  10;
#line 94 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
     $blast_url = exists $pos{'blast_url'} ? $_[ $pos{'blast_url'} ] :  undef;
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 86 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '

' );
#line 96 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '
' );
#line 97 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"

    use POSIX;

    #insert default space and break styles
    $styles ||= {};
    $styles->{space} ||= '<span style="margin: 0 0.5em"></span>';
    $styles->{break} ||= '<br />';

    #insert space and break regions
    $regions ||= [];
    if( $subdiv || $width ) {
        # break every $width bases, and also hash them to use for filtering the spaces
        my %breaks =
            !$width ? ()
                    : map { $_ *= $width; $_ => ['break',$_] }
                      1..POSIX::floor($seq->length/$width);
        push @$regions, values %breaks;

        # spaces every $subdiv bases, except where there is a break already
        push @$regions,
             !$subdiv ? ()
                      : map { $_ *= $subdiv; $breaks{$_} ? () : ['space',$_] }
                        1..POSIX::floor($seq->length/$subdiv);

    }
#line 123 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '
<span class="sequence">
  >' );
#line 125 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print(  $seq->id  );
#line 125 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( ' ' );
#line 125 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print(  $seq->desc  );
#line 125 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '
' );
#line 126 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
 if( $blast_url ) {
$m->print( '    <form style="display: inline" method="post" action="' );
#line 127 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print(  $blast_url  );
#line 127 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '">
        <input type="hidden" name="seq" value="' );
#line 128 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( (map {; $m->interp->apply_escapes($_, 'h') } ( '>'.$seq->id."\n".$seq->seq)) );
#line 128 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '" />
        <input style="padding: 1px; line-height: 0.8" type="submit" value="BLAST" />
    </form>
' );
#line 131 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
 }
$m->print( '
  <br />
  ' );
#line 134 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->comp(   '/util/markup_string.mas',
     styles  => $styles,
     string  => $seq->seq,
     regions => $regions,
    
); #line 138 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '
</span>

' );
;return;
},
'declared_args' => {
  '$blast_url' => { default => ' undef' },
  '$regions' => { default => ' undef' },
  '$seq' => { default => undef },
  '$styles' => { default => ' undef' },
  '$subdiv' => { default => ' 10' },
  '$width' => { default => ' 80' }
},

)
,

);
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 %ARGS = @_;
my ( $seq );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

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

#line 72 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '
' );
#line 76 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '
' );
#line 77 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
 if( $seq->length > 50_000 ) {
$m->print( '    <span class="sequence">
      >' );
#line 79 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print(  $seq->id  );
#line 79 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( ' ' );
#line 79 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print(  $seq->desc  );
#line 79 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '
      <br /><span class="warning">Sequence too large to display.</span>
    </span>
' );
#line 82 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
 } else {
$m->print( '    ' );
#line 83 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->comp(   '.really_display', %ARGS   
); #line 83 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
$m->print( '
' );
#line 84 "/home/production/cxgn/sgn/mason/sequence/with_markup.mas"
 }
$m->print( '
' );
;return;
},
'declared_args' => {
  '$seq' => { default => undef }
},
'load_time' => 1778161189,
'subcomps' => \%_def,

)
;