<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
Everything is working well but there is still one point that giving me
some trouble.<br>
When I filter the hsps and all the hsps of a given hit are removed, the
description line of the hit is still present in the HTML file.<br>
Is there a way to get rid of this description line ?<br>
Is the only solution to inherit from Bio::SearchIO::Writer::HTMLWriter
and overriding the "to_string" method ?<br>
<br>
Thanks,<br>
<br>
Rémi<br>
<br>
<br>
Chris Fields wrote:
<blockquote cite="mid:DBE07E1A-CCE8-4A89-86FF-82A8D04D7F14@illinois.edu"
type="cite">
<pre wrap="">Let us know how it goes, and if you run into any bugs.
chris
On May 28, 2010, at 9:31 AM, Remi wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Thank you very much !!!!
I'm gonna try it right away
Chris Fields wrote:
</pre>
<blockquote 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>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>