[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.87, Mon Oct 24 14:41:30 2005 UTC revision 1.88, Mon Oct 24 21:42:53 2005 UTC
# Line 996  Line 996 
996      close( SEQ );      close( SEQ );
997    
998      if (! $ENV{"BLASTMAT"}) { $ENV{"BLASTMAT"} = "$FIG_Config::blastmat" }      if (! $ENV{"BLASTMAT"}) { $ENV{"BLASTMAT"} = "$FIG_Config::blastmat" }
999      my $blast_opt = $cgi->param( 'blast_options' );      my $blast_opt = $cgi->param( 'blast_options' ) || '';
     my $blastall = "$FIG_Config::ext_bin/blastall";  
1000    
1001      if ( $tool eq "blastp" )      if ( $tool eq "blastp" )
1002      {      {
1003          my $db = "$FIG_Config::organisms/$org/Features/peg/fasta";          my $db = "$FIG_Config::organisms/$org/Features/peg/fasta";
1004          &verify_db( $db, "p" );          &verify_db( $db, "p" );
1005          @out = map { &HTML::set_prot_links($cgi,$_) } `$blastall -i $tmp_seq -d $db -p blastp $blast_opt`;          @out = map { &HTML::set_prot_links($cgi,$_) } execute_blastall( 'blastp', $tmp_seq, $db, $blast_opt );
1006      }      }
1007    
1008      elsif ( $tool eq "blastx" )      elsif ( $tool eq "blastx" )
1009      {      {
1010          my $db = "$FIG_Config::organisms/$org/Features/peg/fasta";          my $db = "$FIG_Config::organisms/$org/Features/peg/fasta";
1011          &verify_db( $db, "p" );          &verify_db( $db, "p" );
1012          @out = map { &HTML::set_prot_links($cgi,$_) } `$blastall -i $tmp_seq -d $db -p blastx $blast_opt`;          @out = map { &HTML::set_prot_links($cgi,$_) } execute_blastall( 'blastx', $tmp_seq, $db, $blast_opt );
1013      }      }
1014    
1015      elsif ( $tool eq "blastn" )      elsif ( $tool eq "blastn" )
1016      {      {
1017          my $db = "$FIG_Config::organisms/$org/contigs";          my $db = "$FIG_Config::organisms/$org/contigs";
1018          &verify_db( $db, "n" );                               ### fix to get all contigs          &verify_db( $db, "n" );                               ### fix to get all contigs
1019          @out = `$blastall -i $tmp_seq -d $db -p blastn -r 1 -q -1 $blast_opt`;          @out = execute_blastall( 'blastn', $tmp_seq, $db, "-r 1 -q -1 " . $blast_opt );
1020          push @$html, blast_graphics( $fig, $cgi, $org, \@out, $tool );          push @$html, blast_graphics( $fig, $cgi, $org, \@out, $tool );
1021      }      }
1022    
# Line 1025  Line 1024 
1024      {      {
1025          my $db = "$FIG_Config::organisms/$org/contigs";          my $db = "$FIG_Config::organisms/$org/contigs";
1026          &verify_db( $db, "n" );                               ### fix to get all contigs          &verify_db( $db, "n" );                               ### fix to get all contigs
1027          @out = `$blastall -i $tmp_seq -d $db -p tblastn $blast_opt`;          @out = execute_blastall( 'tblastn', $tmp_seq, $db, $blast_opt );
1028          push @$html, blast_graphics( $fig, $cgi, $org, \@out, $tool );          push @$html, blast_graphics( $fig, $cgi, $org, \@out, $tool );
1029      }      }
1030    
1031      elsif ( $tool eq 'blastp against complete genomes' )     ### this tool gets nonstandard treatment: RAO      elsif ( $tool eq 'blastp against complete genomes' )     ### this tool gets nonstandard treatment: RAO
1032      {      {
1033            my $blastall = "$FIG_Config::ext_bin/blastall";
1034          &blast_complete($fig,$cgi,$html,$tmp_seq,$blastall);          &blast_complete($fig,$cgi,$html,$tmp_seq,$blastall);
1035          unlink($tmp_seq);          unlink($tmp_seq);
1036          return;          return;
# Line 1038  Line 1038 
1038    
1039      if (@out < 1)          #  This is really a bigger problem than no hits (GJO)      if (@out < 1)          #  This is really a bigger problem than no hits (GJO)
1040      {      {
1041          push(@$html,$cgi->h1("Sorry, no hits"));          push @$html, $cgi->h1( "Sorry, no blast output" );
1042      }      }
1043      else      else
1044      {      {
1045          push(@$html,$cgi->pre);          push @$html, $cgi->pre, @out, $cgi->end_pre;
         push(@$html,@out);  
         push(@$html,$cgi->end_pre);  
1046      }      }
1047      unlink( $tmp_seq );      unlink( $tmp_seq );
1048  }  }
1049    
1050    
1051    # `$blastall -p $prog -i $tmp_seq -d $db $blast_opt`
1052    # execute_blastall( $prog, $input_file, $db, $options )
1053    
1054    sub execute_blastall
1055    {
1056        my( $prog, $input, $db, $options ) = @_;
1057    
1058        my $blastall = "$FIG_Config::ext_bin/blastall";
1059        my @args = ( '-p', $prog, '-i', $input, '-d', $db, split(/\s+/, $options) );
1060    
1061        my $bfh;
1062        my $pid = open( $bfh, "-|" );
1063        if ( $pid == 0 )
1064        {
1065            exec( $blastall,  @args );
1066            die join( " ", $blastall, @args, "failed: $!" );
1067        }
1068    
1069        my @out = <$bfh>;
1070        @out;
1071    }
1072    
1073    
1074  sub blast_complete {  sub blast_complete {
1075      my($fig,$cgi,$html,$seq_file,$blastall) = @_;      my($fig,$cgi,$html,$seq_file,$blastall) = @_;
1076      my($genome,@sims);      my($genome,@sims);

Legend:
Removed from v.1.87  
changed lines
  Added in v.1.88

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3