[Bioperl-l] BLASTing BioSeq objects

Shawn shawnh@fugu-sg.org
11 Dec 2002 08:55:45 +0800


oh ok, misread you. Your original solution was almost there.
 this works for me:

use Bio::SeqIO;
use IO::String;
my $query_str = ">A\nACCCCCCC";

my $stringfh = new IO::String($query_str);
my $sio = new Bio::SeqIO(-fh => $stringfh, -format => 'fasta');
my $seq = $sio->next_seq;

print $seq->seq;


shawn

On Wed, 2002-12-11 at 00:38, James Wasmuth wrote:
> 
> >my $seq = new Bio::Seq(-seq=>$query_str,-id=>"blast_seq");
> >my $fact = Bio::Tools::Run::StandAloneBlast->new('program'=>'blastn',
> >	                                        'database'=>"mydb",
> >		                               'outfile'=>'tmp/xxx');
> >my $blast_report = $fact->blastall($seq);
> >  
> >
> 
> 
> Unfortunately I've tried something along these lines.  The problem seems 
> to caused by the query sequence being in fasta format.  In the error log 
> I get a message...
> 
> "MSG: Attempting to set the sequence to [>GLBH_CAEEL
> <--some aa-->] which does not look healthy"
> 
> I know that this is because entering a sequence using '-seq' it has to 
> be raw and so have no fasta header or "\n" characters, so I am trying to 
> get round this.  I've done it by storing the query sequence as a file 
> and using this to blast with but had been hoping to avoid this...
> 
> James
> 
> 
> 
> Shawn wrote:
> 
> >You probably want to do:
> >
> >
> >cheers,
> >
> >shawn
> >
> >On Tue, 2002-12-10 at 23:40, James Wasmuth wrote:
> >  
> >
> >>Hi all,
> >>
> >>I'm trying to blast a sequence which is introduced to the program as a 
> >>string all implemented as a CGI userinterface.  The sequence is in fasta 
> >>format, though I hope to extend this to any.
> >>
> >>I thought I had been able to create a Bio::Seq object from the string, 
> >>which StandAloneBlast requires,  by doing...
> >>
> >>my $stringfh = new IO::String($query_str);
> >>my $bioSeq_obj = new Bio::Seq(-fh => $stringfh, -format => 'fasta');
> >>
> >>however a check on the length of the sequence in the object reveals it 
> >>to be zero in length.
> >>
> >>Anyone any ideas?  Should I first create a SeqIO object and convert this 
> >>to a Bio::Seq object and then BLAST.  If so, how is this conversion done?
> >>
> >>I'm sure the answers are in the archive but have been unable to locate 
> >>them...
> >>
> >>Many Thanks
> >>James
> >>
> >>_______________________________________________
> >>Bioperl-l mailing list
> >>Bioperl-l@bioperl.org
> >>http://bioperl.org/mailman/listinfo/bioperl-l
> >>
> >>    
> >>
> >
> >
> >  
> >
> 
> -- 
> 
> Nematode Bioinformatics
> Blaxter Nematode Genomics Group
> Institute of Cell, Animal and Population Biology
> Ashworth Labs
> University of Edinburgh
> King's Buildings
> Edinburgh
> EH9 3JT
> 
> 0131 650 7403
> 
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>