| Bio-SAGE-DataProcessing documentation | Contained in the Bio-SAGE-DataProcessing distribution. |
Bio::SAGE::DataProcessing::MinimumPhredFilter - A filter that validates sequences based on minimum Phred score.
use Bio::SAGE::DataProcessing::MinimumPhredFilter; $filter = new Bio::SAGE::DataProcessing::MinimumPhredFilter->new( 20 );
This module is a concrete subclass of Bio::SAGE::DataProcessing::Filter. The implementation considers a sequence valid if all nucleotides have a Phred score that exceeds that specified for the filter.
Included with Bio::SAGE::DataProcessing.
This module requires the Bio::SAGE::DataProcessing::Filter package.
1.10 2004.06.19 - Initial release. 0.01 2004.05.02 - prototype
Constructor.
Arguments
$minPhred
The minimum phred value that all nucleotides in a sequence must have in order to be considered valid.
Usage
my $filter = Bio::SAGE::DataProcessing::MinimumPhredFilter->new( 20 );
if( $filter->is_tag_valid( "AAAAAAAAAA" ) ) {
print "VALID!\n";
}
This implements the is_valid subroutine required in concrete subclasses of Bio::SAGE::DataProcessing::Filter.
Arguments
$sequence
The tag sequence.
$scores
A space-separated string of Phred scores for the specified sequence.
Returns
Returns non-zero if the valid, zero if invalid.
Usage
my $filter = Bio::SAGE::DataProcessing::MinimumPhredFilter->new();
if( $filter->is_tag_valid( "AAAAAAAAAA" ) ) {
print "VALID!\n";
}
The default implementation provided by the base class Bio::SAGE::DataProcessing::Filter is used. See the documentation for the base class for more information.
Copyright(c)2004 Scott Zuyderduyn <scottz@bccrc.ca>. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Scott Zuyderduyn <scottz@bccrc.ca> BC Cancer Research Centre
1.20
Bio::SAGE::DataProcessing(1). Bio::SAGE::DataProcessing::Filter(1).
Nothing yet.
| Bio-SAGE-DataProcessing documentation | Contained in the Bio-SAGE-DataProcessing distribution. |
# *%) $Id: MinimumPhredFilter.pm,v 1.5 2004/10/15 22:30:46 scottz Exp $ # # Copyright (c) 2004 Scott Zuyderduyn <scottz@bccrc.ca>. # All rights reserved. This program is free software; you # can redistribute it and/or modify it under the same # terms as Perl itself. package Bio::SAGE::DataProcessing::MinimumPhredFilter;
use Bio::SAGE::DataProcessing::Filter; use base qw( Bio::SAGE::DataProcessing::Filter ); use strict; use diagnostics; use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK ); #require Exporter; #require AutoLoader; #@ISA = qw( Exporter AutoLoader ); @ISA = qw( Bio::SAGE::DataProcessing::Filter ); @EXPORT = qw(); $VERSION = $Bio::SAGE::DataProcessing::VERSION; my $PACKAGE = "Bio::SAGE::DataProcessing::MinimumPhredFilter";
####################################################### sub new { #######################################################
my $class = shift;
$class->SUPER::new( @_ );
}
####################################################### sub is_valid { #######################################################
my $this = shift;
my $sequence = shift || die( $PACKAGE . "::is_valid no sequence defined." );
my $scores = shift;
if( $Bio::SAGE::DataProcessing::DEBUG >= 1 ) {
print STDERR $PACKAGE . "::is_valid looking at " . $scores . "\n";
}
if( !defined( $scores ) ) { return 1; }
my $min_phred = $this->{'args'}[0];
if( $min_phred == 0 ) {
if( $Bio::SAGE::DataProcessing::DEBUG >= 1 ) {
print STDERR $PACKAGE . "::is_valid no need to check, minimum phred is 0\n";
}
return 1;
}
my @scores = split( /\s/, $scores );
foreach my $score ( @scores ) {
if( $score < $min_phred ) {
if( $Bio::SAGE::DataProcessing::DEBUG >= 1 ) {
print STDERR $PACKAGE . "::is_valid $score does not meet minimum $min_phred\n";
}
return 0;
}
}
if( $Bio::SAGE::DataProcessing::DEBUG >= 1 ) {
print STDERR $PACKAGE . "::is_valid scores passed\n";
}
return 1;
}
#######################################################
#######################################################
1; __END__