[Bioperl-l] Bio::SearchIO::Writer::HTMLResultWriter problem
simona bazzocchi
simona_bazzocchi at yahoo.it
Thu Oct 25 03:46:53 UTC 2007
Hi all,
I'd like to parse my blast file to outuput in a html file filtering on percent identity, (75% identical or better). So I've just copied and pasted to create my perl file.
I launched this command:
perl searchIO.pl blast_file.txt
But it returned this error: "t
Bareword found where operator expected at searchIO.pl line 26, near "->length E"
(Missing operator before E?)
syntax error at searchIO.pl line 26, near "->length E"
syntax error at searchIO.pl line 30, near "<gt"
Execution of searchIO.pl aborted due to compilation errors."
Here below you can find searchIO.pl
thanks
#!/usr/bin/perl
use Bio::SearchIO;
use Bio::SearchIO::Writer::HTMLResultWriter;
my $in = new Bio::SearchIO(-format => 'blast',
-file => shift @ARGV);
my $writer = new Bio::SearchIO::Writer::HTMLResultWriter();
my $out = new Bio::SearchIO(-writer => $writer);
$out->write_result($in->next_result);
# to filter your output
my $MinLength = 100; # need a variable with scope outside the method
sub hsp_filter {
my $hsp = shift;
return 1 if $hsp->length('total') > $MinLength;
}
sub result_filter {
my $result = shift;
return $hsp->num_hits > 0;
}
sub hit_filter {
my $hit = shift;
return $hit->length E<gt> 100; # test if length of the hit sequence
# long enough
}
my $writer = new Bio::SearchIO::Writer::TextResultWriter(
-filters => { 'HIT' =E<gt> \&hit_filter }
);
my $out = new Bio::SearchIO(-writer => $writer);
$out->write_result($in->next_result);
# can also set the filter via the writer object
$writer->filter('RESULT', \&result_filter);
---------------------------------
Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3
More information about the Bioperl-l
mailing list