<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=iso-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thank you very much !!!!<br>
I'm gonna try it right away<br>
<br>
Chris Fields wrote:
<blockquote cite="mid:441CAD42-5B02-4606-BF41-A3DC2233F285@illinois.edu"
type="cite">
<pre wrap="">Remi,
Using the constructor that way is not supported. But it's completely unnecessary.
Are you using Bio::SearchIO::Writer::HTMLWriter? It filters results/hits/HSPs as it writes the HTML, no need to clone. That in combination with GenericResult::rewind() should work. You can use that module, or inherit and override whatever methods are necessary. Or just use it as a reference on how to do what you need.
Something like the following should work (of course completely untested :)
my $result = $in->next_result;
# filter on HSP
write_html('result1.html', $result, { 'HSP' => \&hsp_filter });
# rewind the result to go back to the beginning
$result->rewind;
# open a new filehandle here for second report output
# filter on hit and HSP
write_html('result2.html', $result, { 'HIT' => \&hit_filter,
'HSP' => \&hsp_filter });
# rewind the result to go back to the beginning
$result->rewind;
# and so on....
sub write_html {
my ($file, $result, $filters) = @_;
# note that $filter is a hash ref above
my $writer = Bio::SearchIO::Writer::HTMLResultWriter->new
(-filters => $filters );
my $out = Bio::SearchIO->new(-writer => $writer, -file => $file);
$out->write_result($result);
}
sub hsp_filter {
my $hsp = shift;
return 1 if $hsp->length('total') > 100;
}
sub hit_filter {
my $hit = shift;
return 1 if $hit->significance < 1e-5;
}
chris
On May 28, 2010, at 7:17 AM, Remi wrote:
</pre>
<blockquote type="cite">
<pre wrap="">You're right, it's not working there is some missing fields ...
Actually, I'm writing a script that filter Result Object based on some criteria and I want the script to be kind of interactive like :
-Display Result object as HTML
-Ask for filter criteria
-Filter Result object
-Display filtered Result object as HTML.
... etc
And I would like to make a copy of the Result object before each filtering step in order to be able to redo it.
I'll have a look to the modules you've mentioned, thanks.
Dave Messina wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi Rémi,
As far as I know, cloning objects is not natively supported in BioPerl (or Perl itself, for that matter).
So I don't think the code you showed will work.
However, there are modules such as Clone::More and Clone::Fast that can do it.
<a class="moz-txt-link-freetext" href="http://search.cpan.org/~wazzuteke/Clone-More-0.90.2/lib/Clone/More.pm">http://search.cpan.org/~wazzuteke/Clone-More-0.90.2/lib/Clone/More.pm</a>
<a class="moz-txt-link-freetext" href="http://search.cpan.org/~wazzuteke/Clone-Fast-0.93/lib/Clone/Fast.pm">http://search.cpan.org/~wazzuteke/Clone-Fast-0.93/lib/Clone/Fast.pm</a>
Out of curiosity, what are you trying to do with the cloned objects? Someone might be able to suggest another way to accomplish the same goal.
Dave
</pre>
</blockquote>
<pre wrap="">_______________________________________________
Bioperl-l mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Bioperl-l@lists.open-bio.org">Bioperl-l@lists.open-bio.org</a>
<a class="moz-txt-link-freetext" href="http://lists.open-bio.org/mailman/listinfo/bioperl-l">http://lists.open-bio.org/mailman/listinfo/bioperl-l</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>