[Bio] / Sprout / SHToolSearch.pm Repository:
ViewVC logotype

Diff of /Sprout/SHToolSearch.pm

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

revision 1.5, Thu Dec 6 14:58:03 2007 UTC revision 1.6, Mon Jan 19 21:56:19 2009 UTC
# Line 4  Line 4 
4    
5      use strict;      use strict;
6      use Tracer;      use Tracer;
7      use CGI;      use CGI qw(-nosticky);
8      use HTML;      use HTML;
9      use Sprout;      use Sprout;
10      use Sim;      use Sim;
# Line 122  Line 122 
122                                      exec => 'blastall -i $seqFile -d $db -m 7 -FF -p blastp $options',                                      exec => 'blastall -i $seqFile -d $db -m 7 -FF -p blastp $options',
123                                      output => \&blastXML,                                      output => \&blastXML,
124                                      inputType => 'prot',                                      inputType => 'prot',
125                                      extras => [[bsc => 0, title => "Bit Score", style => "rightAlign", download => 'num'],                                      extras => [[evalue => 0, title => "eValue", style => "leftAlign", download => 'num'],
126                                                 [queryLoc => undef, title => "Query Location", style => "leftAlign", download => 'text'],                                                 [queryLoc => undef, title => "Query Location", style => "leftAlign", download => 'text'],
127                                                 [hitLoc => undef, title => "Hit Location", style => "leftAlign", download => 'text'],                                                 [hitLoc => undef, title => "Hit Location", style => "leftAlign", download => 'text'],
128                                                 [alignment => undef, title => "Alignment", style => "code", download => 'align']],                                                 [alignment => undef, title => "Alignment", style => "code", download => 'align']],
# Line 134  Line 134 
134                                      exec => 'blastall -i $seqFile -d $db -m 7 -FF -p blastx $options',                                      exec => 'blastall -i $seqFile -d $db -m 7 -FF -p blastx $options',
135                                      output => \&blastXML,                                      output => \&blastXML,
136                                      inputType => 'prot',                                      inputType => 'prot',
137                                      extras => [[bsc => 0, title => "Bit Score", style => "rightAlign", download => 'num'],                                      extras => [[evalue => 0, title => "eValue", style => "leftAlign", download => 'num'],
138                                                 [queryLoc => undef, title => "Query Location", style => "leftAlign", download => 'text'],                                                 [queryLoc => undef, title => "Query Location", style => "leftAlign", download => 'text'],
139                                                 [hitLoc => undef, title => "Hit Location", style => "leftAlign", download => 'text'],                                                 [hitLoc => undef, title => "Hit Location", style => "leftAlign", download => 'text'],
140                                                 [alignment => undef, title => "Alignment", style => "code", download => 'align']],                                                 [alignment => undef, title => "Alignment", style => "code", download => 'align']],
# Line 146  Line 146 
146                                      exec => 'blastall -i $seqFile -d $db -m 7 -FF -p blastn $options',                                      exec => 'blastall -i $seqFile -d $db -m 7 -FF -p blastn $options',
147                                      output => \&blastXML,                                      output => \&blastXML,
148                                      inputType => 'dna',                                      inputType => 'dna',
149                                      extras => [[bsc => 0, title => "Bit Score", style => "rightAlign", download => 'num'],                                      extras => [[evalue => 0, title => "eValue", style => "leftAlign", download => 'num'],
150                                                 [queryLoc => undef, title => "Query Location", style => "leftAlign", download => 'text'],                                                 [queryLoc => undef, title => "Query Location", style => "leftAlign", download => 'text'],
151                                                 [hitLoc => undef, title => "Hit Location", style => "leftAlign", download => 'text'],                                                 [hitLoc => undef, title => "Hit Location", style => "leftAlign", download => 'text'],
152                                                 [alignment => undef, title => "Alignment", style => "code", download => 'align']],                                                 [alignment => undef, title => "Alignment", style => "code", download => 'align']],
# Line 282  Line 282 
282              my $message = scalar(@results) . " hits found. $keepCount kept.";              my $message = scalar(@results) . " hits found. $keepCount kept.";
283              Trace($message) if T(3);              Trace($message) if T(3);
284              $self->PrintLine("$message<br />");              $self->PrintLine("$message<br />");
285            } else {
286                Confess("Blast data not found at $db.");
287          }          }
288      }      }
289      # Return the resulting list.      # Return the resulting list.
# Line 304  Line 306 
306  between the query sequence and the target. The from- and to-locations for the query sequence  between the query sequence and the target. The from- and to-locations for the query sequence
307  are stored as C<Hsp_query-from> and C<Hsp_query-to>, and for the target object they are  are stored as C<Hsp_query-from> and C<Hsp_query-to>, and for the target object they are
308  C<Hsp_hit-from> and C<Hsp_hit-to>. The alignment is stored in C<Hsp_hseq>, C<Hsp_qseq>, and  C<Hsp_hit-from> and C<Hsp_hit-to>. The alignment is stored in C<Hsp_hseq>, C<Hsp_qseq>, and
309  C<Hsp_midline>. The bit score is in C<Hsp_bit-score>.  C<Hsp_midline>. The bit score is in C<Hsp_bit-score> and the e-value is in C<Hsp_evalue>.
310    
311  =over 4  =over 4
312    
# Line 384  Line 386 
386                  $hitLoc->Reverse if $point->{'Hsp_hit-frame'} < 0;                  $hitLoc->Reverse if $point->{'Hsp_hit-frame'} < 0;
387                  my $queryLoc = BasicLocation->new($queryName, $point->{'Hsp_query-from'}, "_", $point->{'Hsp_query-to'});                  my $queryLoc = BasicLocation->new($queryName, $point->{'Hsp_query-from'}, "_", $point->{'Hsp_query-to'});
388                  $queryLoc->Reverse if $point->{'Hsp_query-frame'} < 0;                  $queryLoc->Reverse if $point->{'Hsp_query-frame'} < 0;
389                  # Finally, we get the bit score, formatted nicely for the display.                  # We also need the e-value.
390                    my $eValue = $point->{'Hsp_evalue'};
391                    # Finally, we get the bit score, formatted nicely for the sorting.
392                  my $bsc = sprintf("%0.3f", $point->{'Hsp_bit-score'});                  my $bsc = sprintf("%0.3f", $point->{'Hsp_bit-score'});
393                  # Now we can build our output tuple.                  # Now we can build our output tuple.
394                  push @retVal, { queryLoc  => $queryLoc->SeedString,                  push @retVal, { queryLoc  => $queryLoc->SeedString,
395                                  hitLoc    => $hitLoc->SeedString,                                  hitLoc    => $hitLoc->SeedString,
396                                  bsc       => $bsc,                                  evalue    => $eValue,
397                                  alignment => $alignment,                                  alignment => $alignment,
398                                  sortKey   => $self->ToolSortKey($genome, $bsc, $hitLoc),                                  sortKey   => $self->ToolSortKey($genome, $bsc, $hitLoc),
399                                };                                };
# Line 634  Line 638 
638      # values; the others apply to menus.      # values; the others apply to menus.
639      my $sequence = $cgi->param('sequence') || "";      my $sequence = $cgi->param('sequence') || "";
640      my $options = $cgi->param('options') || "";      my $options = $cgi->param('options') || "";
641        my $neighborhood = $cgi->param('neighborhood') || RHLocations::NEIGHBORHOOD;
642      # Get the selected tool and compute the corresponding button caption.      # Get the selected tool and compute the corresponding button caption.
643      my $toolChosen = $cgi->param('tool') || "";      my $toolChosen = $cgi->param('tool') || "";
644      my $caption = ($toolChosen ? $ToolTable{$toolChosen}->{buttonName} : "");      my $caption = ($toolChosen ? $ToolTable{$toolChosen}->{buttonName} : "");
645      # Create the menus. First is the tool menu.      # Create the menus. First is the tool menu.
646      my @valueList = ("", sort keys %ToolTable);      my @valueList = ("", sort keys %ToolTable);
647      my $toolMenu = $cgi->popup_menu(-name => "tool", -values => \@valueList,      my $toolMenu = CGI::popup_menu(-name => "tool", -values => \@valueList,
648                                      -onChange => 'setSubmit(this.value)');                                      -onChange => 'setSubmit(this.value)',
649                                        -default => $toolChosen);
650      # Create the genome selection menu.      # Create the genome selection menu.
651      my $menu = $self->NmpdrGenomeMenu("genome", 'multiple', \@selected);      my $menu = $self->NmpdrGenomeMenu("genome", 'multiple', \@selected);
652      # The general structure here will be to have the DNA/protein sequence on the top,      # The general structure here will be to have the DNA/protein sequence on the top,
653      # then genome selector and finally the small controls.      # then genome selector and finally the small controls.
654      my @rows = ();      my @rows = ();
655      push @rows, $cgi->Tr($cgi->td("Tool"), $cgi->td($toolMenu));      push @rows, CGI::Tr(CGI::td("Tool"), CGI::td($toolMenu));
656      push @rows, $cgi->Tr($cgi->td("Sequence in Raw or FASTA Format"),      push @rows, CGI::Tr(CGI::td("Sequence in Raw or FASTA Format"),
657                           $cgi->td({colspan => 2}, $cgi->textarea(-name => "sequence", -rows => 5, -cols => 62)));                           CGI::td({colspan => 2}, CGI::textarea(-name => "sequence", -rows => 5,
658      push @rows, $cgi->Tr($cgi->td("Select one or more genomes"),                                                                 -value => $sequence, -cols => 62)));
659                           $cgi->td({colspan => 2}, $menu));      push @rows, CGI::Tr(CGI::td("Select one or more genomes"),
660      push @rows, $cgi->Tr($cgi->td("Blast Options"),                           CGI::td({colspan => 2}, $menu));
661                           $cgi->td({colspan => 2}, $cgi->textfield(-name => 'options', size => 45)));      push @rows, CGI::Tr(CGI::td("Blast Options"),
662      push @rows, $cgi->Tr($cgi->td("Neighborhood Width"),                           CGI::td({colspan => 2}, CGI::textfield(-name => 'options', size => 45,
663                           $cgi->td($cgi->textfield(-name => 'neighborhood', -size => 5, -value => RHLocations::NEIGHBORHOOD)));                                                                   -value => $options)));
664        push @rows, CGI::Tr(CGI::td("Neighborhood Width"),
665                             CGI::td(CGI::textfield(-name => 'neighborhood', -size => 5,
666                                                    -value => $neighborhood)));
667      push @rows, $self->SubmitRow($caption);      push @rows, $self->SubmitRow($caption);
668      # Create the table.      # Create the table.
669      $retVal .= $self->MakeTable(\@rows);      $retVal .= $self->MakeTable(\@rows);
# Line 751  Line 760 
760                          $rhelp->PutExtraColumns(%{$result});                          $rhelp->PutExtraColumns(%{$result});
761                          # Create an ERDB object for the hit location. We use BasicLocation to                          # Create an ERDB object for the hit location. We use BasicLocation to
762                          # parse it into its components.                          # parse it into its components.
763                          my $data = RHLocations::BuildLocationRecord($result->{hitLoc});                          my $data = $rhelp->BuildLocationRecord($result->{hitLoc});
764                          # Now put the location data and its sort key into the output stream.                          # Now put the location data and its sort key into the output stream.
765                          $rhelp->PutData($result->{sortKey}, $result->{hitLoc}, $data);                          $rhelp->PutData($result->{sortKey}, $result->{hitLoc}, $data);
766                          # Tell the user every so often what kind of progress we're making.                          # Tell the user every so often what kind of progress we're making.

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3