[Bioperl-l] BLASTing with a seqio/seq object...

Sendu Bala bix at sendu.me.uk
Tue Nov 28 12:39:29 UTC 2006


Samantha Thompson wrote:
> Hi,
> I am trying to learn bioperl and I'm attempting a few basic thing! I 
> seem to be ok with reading in and outputting sequences and files now I 
> am trying to do a simple BLAST search using a sequence (a sequence 
> object in fact). The code I am attempting to run is at the bottom of the 
> message...
> I am probably making a dumb mistake and don't understand the 
> capabilities of the objects well enough, but the info for the 
> remoteblast->submit_blast function says that it can take sequences as an 
> argument, I've also tried sending the fasta file name containing my 
> sequence as an argument to submit_blast,  with the same result.... I 
> have also tried sending $seqio_obj->next_seq...........  i.e the 
> following error message displayed on my terminal:
> 
> Can't call method "submit_blast" on an undefined value at bioptest2.pl 
> line 22, <GEN0> line 1.

Always start your perl scripts with 'use strict;'. This will help you 
find and fix the main problem with your script, that you made a 
RemoteBlast object and stored it as $remote_blast, but then tried to use 
submit_blast() on $remoteBlast which doesn't exist.

I've rewritten your code below:

use strict;
> use Bio::Seq;
> use Bio::SeqIO;
> 
> use Bio::Tools::Run::RemoteBlast;
> use Bio::SearchIO;
> 
> #seq bit
> 
# $seq_obj = Bio::Seq->new(-format => 'fasta');
# above line doesn't do anything, $seq_obj gets overwritten below
> 
my $seqio_obj = Bio::SeqIO->new(-file => 
"/biol/people/mres/st537/MalEfasta.txt", -format => 'fasta');
> 
my $seq_obj = $seqio_obj->next_seq;
> 
> 
> 
> #blast bit
> 
my $remote_blast = Bio::Tools::Run::RemoteBlast->new(-prog => 'blastp', 
-db => 'nr', -expect => '1e-15' );

# submit_blast takes the sequence object, not the sequence string
my $blastreturn_obj = $remote_blast->submit_blast($seq_obj);




More information about the Bioperl-l mailing list