[Bio] / FigWebServices / index.cgi Repository:
ViewVC logotype

Diff of /FigWebServices/index.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.58, Fri Jan 28 18:16:57 2005 UTC revision 1.59, Tue Feb 15 05:01:23 2005 UTC
# Line 188  Line 188 
188  #-----------------------------------------------------------------------  #-----------------------------------------------------------------------
189  #  Search (text) || Find Genes in Org that Might Play the Role  #  Search (text) || Find Genes in Org that Might Play the Role
190  #-----------------------------------------------------------------------  #-----------------------------------------------------------------------
191  elsif (($pattern = $cgi->param('pattern')) && ($cgi->param('Search') || $cgi->param('Find Genes in Org that Might Play the Role')))  elsif ( ( $pattern = $cgi->param('pattern') )
192         && ( $cgi->param('Search')
193           || $cgi->param('Search genome selected below')
194           || $cgi->param('Find Genes in Org that Might Play the Role')
195            )
196          )
197  {  {
198      #  Remove leading and trailing spaces from pattern -- GJO:      #  Remove leading and trailing spaces from pattern -- GJO:
199      $pattern =~ s/^\s+//;      $pattern =~ s/^\s+//;
# Line 383  Line 388 
388                  $cgi->textfield(-name => "maxrole", -size => 6, -value => 100),                  $cgi->textfield(-name => "maxrole", -size => 6, -value => 100),
389                  "</td></td></table>",                  "</td></td></table>",
390                  $cgi->submit('Search'),                  $cgi->submit('Search'),
391                    $cgi->submit('Search genome selected below'),
392                  $cgi->reset('Clear'),                  $cgi->reset('Clear'),
393                  $cgi->hr);                  $cgi->hr);
394    
# Line 433  Line 439 
439    
440      my $n_genomes = @orgs;      my $n_genomes = @orgs;
441    
442      push( @$html, $cgi->h2('If You Need to Pick an Organism for Options Below'),      push( @$html, $cgi->h2('If You Need to Pick a Genome for Options Below'),
443                    "<TABLE>\n",                    "<TABLE>\n",
444                    "   <TR>\n",                    "   <TR>\n",
445                    "      <TD>",                    "      <TD>",
# Line 597  Line 603 
603      my $check_all = $cgi->param('Select all') || 0;      my $check_all = $cgi->param('Select all') || 0;
604    
605      # RAE added lines to allow searching within a single organism      # RAE added lines to allow searching within a single organism
606      if ($cgi->param('korgs'))      # if ($cgi->param('korgs'))
607      {      # {
608       $cgi->param('korgs') =~ /\((\d+\.*\d*)\)/;      #  $cgi->param('korgs') =~ /\((\d+\.*\d*)\)/;
609       $org=$1; # this should be undef if korgs is not defined      #  $org=$1; # this should be undef if korgs is not defined
610    
611       push (@$html, $cgi->br, "Matches found in ",$cgi->param('korgs'), $cgi->p);      #  push (@$html, $cgi->br, "Matches found in ",$cgi->param('korgs'), $cgi->p);
612       my @clean_data; my @clean_index;      #  my @clean_data; my @clean_index;
613       while (@$peg_index_data)      #  while (@$peg_index_data)
614       {      #  {
615         my ($data, $index)=(shift @$peg_index_data, shift @$role_index_data);      #   my ($data, $index)=(shift @$peg_index_data, shift @$role_index_data);
616         next unless (${$data}[0] =~ /^fig\|$org\.peg/);      #   next unless (${$data}[0] =~ /^fig\|$org\.peg/);
617         push @clean_data, $data;      #   push @clean_data, $data;
618         push @clean_index, $index;      #   push @clean_index, $index;
619       }      #  }
620    
621       @$peg_index_data=@clean_data;      #  @$peg_index_data=@clean_data;
622       @$role_index_data=@clean_index;      #  @$role_index_data=@clean_index;
623      }      # }
624      ## End of added lines      ## End of added lines
625    
626        # GJO version with separate submit buttons
627    
628        if ( $cgi->param('korgs') && $cgi->param('korgs') =~ /\((\d+\.*\d*)\)/
629                                  && $cgi->param('Search genome selected below')
630           )
631        {
632            my $org = $1;
633            push @$html, $cgi->br, "Matches found in ",$cgi->param('korgs'), $cgi->p;
634            @$peg_index_data = grep { $_->[0] =~ /^fig\|$org\.peg/ } @$peg_index_data;
635        }
636    
637        if ( ( $maxpeg > 0 ) && @$peg_index_data )
   
     if ($maxpeg > 0)  
638      {      {
639            #
640            #  This needs to get redone with Rob's javascript checkbox code.
641            #  It will be MUCH faster and correctly preserve state (which this
642            #  does not currently do for all options).
643            #  -- GJO
644            #
645          push( @$html, $cgi->start_form(-action => "index.cgi"),          push( @$html, $cgi->start_form(-action => "index.cgi"),
646                        $cgi->hidden(-name => 'user',    -value => $user),                        $cgi->hidden(-name => 'user',    -value => $user),
647                        $cgi->hidden(-name => 'pattern', -value => $pattern),                        $cgi->hidden(-name => 'pattern', -value => $pattern),
# Line 648  Line 667 
667          my $n = @$peg_index_data;          my $n = @$peg_index_data;
668          if ($n > $maxpeg)          if ($n > $maxpeg)
669          {          {
670              $msg = "Showing First $maxpeg Out of $n PEGs";              $msg = "Showing first $maxpeg out of $n protein genes";
671              $#{$peg_index_data} = $maxpeg-1;              $#{$peg_index_data} = $maxpeg-1;
672          }          }
673          else          else
# Line 667  Line 686 
686                        $cgi->end_form                        $cgi->end_form
687              );              );
688      }      }
689        elsif ( $maxpeg > 0 )
690        {
691            push @$html, $cgi->h3('No matching protein genes');
692        }
693    
694      if ($maxrole > 0)      if ( ( $maxrole > 0 ) && @$role_index_data )
695      {      {
696          my $n = @$role_index_data;          my $n = @$role_index_data;
697          if ($n > $maxrole)          if ($n > $maxrole)
698          {          {
699              $msg = "Showing First $maxrole Out of $n Roles";              $msg = "Showing first $maxrole out of $n Roles";
700              $#{$role_index_data} = $maxrole - 1;              $#{$role_index_data} = $maxrole - 1;
701          }          }
702          else          else
# Line 686  Line 709 
709          my $tab = [ map { &format_role_entry($fig,$cgi,$_) } @$role_index_data ];          my $tab = [ map { &format_role_entry($fig,$cgi,$_) } @$role_index_data ];
710          push( @$html, &HTML::make_table($col_hdrs,$tab,$msg) );          push( @$html, &HTML::make_table($col_hdrs,$tab,$msg) );
711      }      }
712        elsif ( $maxrole > 0 )
713        {
714            push @$html, $cgi->h3('No matching roles');
715        }
716  }  }
717    
718    
719  sub format_peg_entry {  sub format_peg_entry {
720      my( $fig, $cgi, $entry, $checked) = @_;      my( $fig, $cgi, $entry, $checked) = @_;
721      my($i,$function,$who);      my($i,$function,$who);

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.59

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3