[Bioperl-l] results problem with StandAloneBlast
Genevieve DeClerck
gad14 at cornell.edu
Tue May 30 16:57:41 UTC 2006
Thanks for your comment Sendu, it was very helpful. I think this must be
what's going on.. I am using $blast_report->next_result in both
subroutines. It appears that analyzing the blast results first w/ my
sort subroutine empties (?) the $blast_result object so that when I try
to print, there is nothing left to print. (and visa-versa when I print
first then try to sort).
So, from the looks of things, using next_result has the effect of
popping the Bio::Search::Result::ResultI objects off of the SearchIO
blast report object??
It seems I could get around this by making a copy of the blast report by
setting it to another new variable...(not the most elegant solution) but
I'm having trouble with this...
If I do:
my $blast_report_copy = $blast_report;
I'm just copying the reference to the SearchIO blast result, so it
doesn't help me. How can I make another physical copy of this blast
result object? Seems like a simple thing but how to do it is escaping me.
But better yet, the way to go is to 'reset the counter,' or to find a
way to look at/print/sort the results without removing data from the
blast result object. How is this done though??
Sendu and Brian, I didn't post the sort_results subroutine because it is
sprawling, as is a lot of my code. The code I provided was more like an
aid for my explanation of the problem.. it doesn't actually run - sorry
for the confusion, I should have more clear on that. The important
thing to know perhaps is that both sort_results and print_blast_results
contain a foreach loop where I am using the 'next_results' method to
view blast results. (And to clarify for Torsten, the blastall() is
working just fine - the analysis/viewing of the results object is where
I am encountering the problem.)
Any other ideas would be greatly appreciated...
Thank you,
Genevieve
Sendu Bala wrote:
> Genevieve DeClerck wrote:
>
>> Hi,
>
> [snip]
>
>> If I've sorted the results the sorted-results will print to screen,
>> however when I try to print the Hit Table results nothing is returned,
>> as if the blast results have evaporated.... and visa versa, if i
>> comment out the part where i point my sorting subroutine to the blast
>> results reference, my hit table results suddenly prints to screen.
>
> [snip]
>
>> Here's an abbreviated version of my code:
>
> [snip]
>
>> #######
>> ### the following 2 actions seem to be mutually exclusive.
>> # 1) sort results into 1-hitter, 2-hitter, etc. groups of
>> # SeqFeature objs stored in arrays. arrays are then printed
>> # to stdout
>> &sort_results($blast_report);
>>
>> # 2) print blast results
>> &print_blast_results($blast_report);
>
>
>> sub print_blast_results{
>> my $report = shift;
>> while(my $result = $report->next_result()){
>
> [snip]
>
> You didn't give us your sort_results subroutine, but is it as simple as
> they both use $report->next_result (and/or $result->next_hit), but you
> don't reset the internal counter back to the start, so the second
> subroutine tries to get the next_result and finds the first subroutine
> has already looked at the last result and so next_result returns false?
>
> From a quick look it wasn't obvious how to reset the counter. Hopefully
> this can be done and someone else knows how.
>
More information about the Bioperl-l
mailing list