I am not sure if i got it right but I believe the error is because Blastall expects a Bio::SeqIO object. To convert sequences to a Bio::SeqIO object which you can directly pass on to your blastall call, you may use IO::String (see bioperl documentation on SeqIO)
The following worked for me. First define a string variable to store sequences in fasta format
my $sequence_string = "";
Then replace these lines in your code
push(@translated_seqs, $temp_seq) unless($temp_seq->seq() =~ /\*+/);
with
$sequence_string = $sequence_string.">".$temp_seq->display_id."\n".$temp_seq->seq."\n" unless($temp_seq->seq =~ /\*+/);
(As
biohisham suggested
Re^3: BioPerl StandAloneBlast is returning unexpected undefined SearchIO object, there may be better ways to select open reading frames.)
Before calling Blast, convert the string to SeqIO object as follows:
my $stringfh = new IO::String($sequence_string);
my $seqio = new Bio::SeqIO(-fh => $stringfh, -format => 'fasta');
my $blaster = Bio::Tools::Run::StandAloneBlast->new(@params);
Loop through sequences to blast and continue with whatever you want to do with your blast report
while( my $seq = $seqio->next_seq ) {
my $blast_report = $blaster->blastall($seq);
...
while( my $BLAST_result = $blast_report->next_result ) {
...
while( my $hit = $BLAST_result->next_hit ) {
...
}
}
}
The parser worked fine with the blast report in default format but failed to read the ‘blasttable’ format. I haven't understand the reason for this.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.