[Bioperl-l] Can't get Bio::Tools::StandAloneBlast blastall to work in a cgi script

Jason Stajich jason at cgt.duhs.duke.edu
Sat Jun 28 11:42:29 EDT 2003


>From Bio::Tools::Run::StandAloneBlast documentation:

"Before running StandAloneBlast it is necessary: to install BLAST on your
system, to edit set the environmental variable $BLASTDIR or your $PATH
variable to point to the BLAST directory, and to ensure that users have
execute privileges for the BLAST program.  If the databases which will be
searched by BLAST are located in the data subdirectory of the blast
program directory (the default installation location), StandAloneBlast
will find them; however, if the database files are located in any other
location, environmental variable $BLASTDATADIR will need to be set to
point to that directory."

Any easy fix is to add this line to your script:
BEGIN {
  $ENV{'BLASTDIR'} = '/path/where/blastall/is';
}

On Fri, 27 Jun 2003, hackstam wrote:

> Can anyone help me to get Bio::Tools::StandAloneBlast
> blastall to work in a cgi script.  I have a perl script with
> the same code as posted below except for the cgi information
> working fine.  I even was able to run the perl script in the
> cgi-bin directory.  However whenever I run the code below I
> alway get the following error:
> -------------- WARNING ---------------------
> MSG: cannot find path to blastall
> ---------------------------------------------------
> [Fri Jun 27 12:50:15 2003] simple_graphics.cgi: Can't call
> method "next_result" on an undefined value at
> /var/www/cgi-bin/simple_graphics.cgi line 42.
>
> Here is my code:
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> use CGI;
> use CGI::Session;
> use CGI::Carp qw (fatalsToBrowser);
> use Bio::SearchIO;
> use Bio::SeqIO;
> use Bio::Tools::Run::StandAloneBlast;
> use Bio::Graphics;
> use Bio::SeqFeature::Generic;
>
> my $q = new CGI;
>
> #array that will hold names and hsps
> my @hsps;
> my $program='tblastn';
> my $database='seroD_contigs';
>
>
> my $seq
> ="MLSLKTLLCTLLTVSSVLATPBPARDPSSIQFVHEENKKRYYDYDHGSLGEPIRGVNI
> GGWLLLEPYITPSLFEAFRTNDDNDEGIPVDEYHFCQYLGKDLAKSRLQSHQSTFYQEQD
> FANIASQGFNLVRIPIGYWAFQTLDDDPYVSGLQESYLDQAIGWARNNSLKVWVDLHGAA
> GSQNGFDNSGLRDSQKFLEDSNLAVTTNVLNYILKKYSAEEYLDTVIGIELINEPLGPVL
> DMDKMKNDYLAPAYEYLRNNIKSDQVIIIHDAFQPYNQWDDFMTENDGYWGVTIDHHHTQ
> VFASDQLERSIDEHIKVACEWGTGVLNESHWTVCGEFAAALTDCTKWLNSVGFGARYDGS
> WVNGDQTSSYIGSCANNDDIAYWSDERKENTRRYVEAQLDAFEMRGGWIIWCYKTESSLE
> WDAQRLMFNGLFPQPLTDRKYPNQCGTISN";
> my $evalue='1e-6';
> my $id="test query";
> my $anum='EXG1 YLR300W CHR 12';
>
> my $query =Bio::Seq->new(-seq => $seq, -id=> $id,
> -accession_number=>$anum);
> my $factory=Bio::Tools::Run::StandAloneBlast->new(
> 						  'program'=> 'tblastn',
> 						  'database' => $database,
> 						  'e' => $evalue,
> 						  _READMETHOD => "Blast"
> 						  );
> my @names;
> my $blast_report=$factory->blastall($query);
> my $result = $blast_report->next_result;
>
>
> my $panel=Bio::Graphics::Panel->new(-length =>
> $result->query_length,
> 				    -width=> 800,
> 				    -pad_left=>10,
> 				    -pad_right=>10,
> 				    );
>
> my $full_length=Bio::SeqFeature::Generic->new(-start=>1,
> -end=>$result->query_length, -seqname=>$result->query_name);
>
> $panel->add_track($full_length,
> 		  -glyph => 'arrow',
> 		  -tick => 2,
> 		  -fgcolor=> 'black',
> 		  -double=> 1,
> 		  -label=> 1,
> 		 );
> my $track =$panel->add_track(-glyph=> 'graded_segments',
> 			     -label => 1,
> 			     -connector=> 'dashed',
> 			     -bgcolor => 'blue',
> 			     -font2color =>'red',
> 			     -sort_order => 'high_score',
> 			     -description=>sub{
> 			       my $feature=shift;
> 			       return unless $feature->has_tag('description');
> 			       my ($description) =
> $feature->each_tag_value('description');
> 			       my $score=$feature->score;
> 			       "$description score=$score";
> 			     });
> while(my $hit = $result->next_hit){
>   next unless $hit->significance < 1e-20;
>   my $feature=Bio::SeqFeature::Generic->new(-score =>
> $hit->raw_score,
> 					    -seqname =>$hit->name,
> 					    -tag => {
> 						     description=> $hit->description
> 						    },
> 					    );
>   while (my $hsp= $hit->next_hsp){
>     $feature->add_sub_SeqFeature($hsp, 'EXPAND');
>   }
>
>   $track->add_feature($feature);
>
> }
>
> print $q->header(-type=>"text/html"),
>   $q->start_html(-title =>"Graph");
>
> #print $panel->png;
> print $q->end_html();
>
> Any help is very much appreciated. Thanks!!!!!!!
> Annette
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list