Bio-BioStudio

 view release on metacpan or  search on metacpan

gbrowse_plugins/BS_ChromosomeDiff.pm  view on Meta::CPAN

      "Make alignments for features with nucleotide sequence differences"
    ),
    td(
      checkbox_group(
        -name       => $self->config_name('NALIGN'),
        -values     => \%onlabels,
        -linebreak  => 0,
        -default    => 0
      )
    )
  );
           
  push @choices, TR(
    {-class => 'searchtitle'},
    th(
      {-align => 'RIGHT', -width => '50%'},
      "Make protein alignments for features with translation differences"
    ),
    td(
      checkbox_group(
        -name       => $self->config_name('PALIGN'),
        -values     => \%onlabels,
        -linebreak  => 0,
        -default    => 0
      )
    )
  );

  push @choices, TR(
    {-class => 'searchtitle'},
    th('Sort results by feature or by change type?'),
    td(
      radio_group(
        -name     => $self->config_name('GROUP'),
        -values   => ['feature', 'type'],
        -default  => 'feature',
        -labels   => {
          'feature' => 'feature',
          'type'    => 'change type'
        },
      )
    )
  );
                                 
  push @choices, TR(
    {-class => 'searchbody'},
    th(
      {-align => 'CENTER', -width => '50%'},
      "Choose an \"original\""
    ),
    th(
      {-align=>'CENTER'},
      "Choose a \"variant\""
    )
  );
       
  push @choices, TR(
    {-class => 'searchtitle'},
    td(
      {-align => 'CENTER', -width => '50%'},
      popup_menu(
        -name     => $self->config_name('FIRST'),
        -values   => \@srcs,
        -default  => $sourcename
      ),
    ),
    td(
      {-align=>'CENTER'},
      popup_menu(
        -name     => $self->config_name('SECOND'),
        -values   => \@srcs,
        -default  => $sourcename
      )
    )
  );
       
  my $html= table(@choices);
  return $html;
}

=head2 dump

Call BS_ChromosomeDiff and pass the parameters
Then monitor the scripts progress; print periodic output.

=cut

sub dump
{
  my ($self, $segment) = @_;

  #If we're monitoring the results, print out from the cache and refresh in 5
  if (my $sid = param('session'))
  {
    my $cache = get_cache_handle($plugin_name);
    my $data = $cache->get($sid);
    unless($data and ref $data eq 'ARRAY')
    {
      #some kind of error
      exit 0;
    }
    print $data->[0]
      ? start_html(-title => "Results for $plugin_name job $sid")
      : start_html(-title => "Running $plugin_name job $sid",
                   -head=>meta({-http_equiv =>'refresh', -content => '60'}));
    print p(i("This page will refresh in 1 minute")) unless $data->[0];
    print pre($data->[1]);
    print p(i("...continuing...")) unless $data->[0];
    print end_html;
    return;
  }
 
  #Otherwise we're launching the script
  else
  {
   #Prepare persistent variables
    my $sid = Digest::MD5::md5_hex(Digest::MD5::md5_hex(time().{}.rand().$$));
    my $cache = get_cache_handle($plugin_name);
    $cache->set($sid, [0, q{}]);
  
   #Prepare arguments
    my $pa               = $self->configuration;
    my $command;
    $pa->{OUTPUT} = "html";
    $pa->{$_} = "\"$pa->{$_}\"" foreach (grep {$pa->{$_} =~ /\ /} keys %{$pa});
    $command .= "--" . $_ . q{ } . $pa->{$_} . q{ } foreach (keys %{$pa});
   
   #If we're the parent, prepare the url and offer a link.
    if (my $pid = fork)



( run in 1.150 second using v1.01-cache-2.11-cpan-364913b4093 )