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

hackstam hackstam at SLU.EDU
Fri Jun 27 14:32:18 EDT 2003


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


More information about the Bioperl-l mailing list