LengthFilter Class Reference

A simple filter to filter out reads shorter than a given length. More...

#include <LengthFilter.h>

Inheritance diagram for LengthFilter:
Inheritance graph
[legend]
Collaboration diagram for LengthFilter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void showArguments (std::ostream &os)
 Display valid command line arguments for this filter.
virtual bool parseArguments (int &argc, char **argv)
 Process command line arguments.
virtual int initialize ()
 Method to begin filter analysis (if any).
virtual void finalize ()
 Method to indicate completion of filter analysis.
virtual ~LengthFilter ()
 The destructor.

Protected Member Functions

 LengthFilter (ClusterMaker *clusterMaker)
 The default constructor.
virtual int runFilter (const int otherEST)
 Apply filter rules to determine if this EST should be filtered out.

Private Member Functions

LengthFilteroperator= (const LengthFilter &src)
 A dummy operator=.

Private Attributes

int clusterID
 Variable to track the ID of the cluster to which short ESTs must be added.

Static Private Attributes

static arg_parser::arg_record argsList []
 The set of arguments specific to this filter.
static int minESTLen = 50
 The minmum length threshold for ESTs to be used by this filter.

Friends

class FilterFactory

Detailed Description

A simple filter to filter out reads shorter than a given length.

This class provides a simple filter that can be used to filter out ESTs that are shorter than a given number of nucleotides. This filter can be enabled by specifying its name, namely lengthFilter, in the filter chain (that is specified as the command line argument to PEACE). If this filter is specified then the lengthFilterSize command line argument is used to determine the threshold length value (ESTs shorter than this value will be filtered out).

This filter creates an dummy cluster with the meta name "Short ESTs (filtered by LengthFilter)" and adds any ESTs filtered out by this EST to that cluster.

This class has been developed by extending the Filter base class and implementing the necessary API methods specified by the base class. This enables the LengthFilter to be used in the FilterChain along with other filters to filter out ESTs. In addition, note that this class cannot be directly instantiated. Instead, the FilterFactory::create() method must be used to obtain an instance of this class.

Definition at line 66 of file LengthFilter.h.


Constructor & Destructor Documentation

virtual LengthFilter::~LengthFilter (  )  [inline, virtual]

The destructor.

The destructor for the filter. The destructor currently has no specific tasks to perform as this filter does not use any dynamic memory.

Definition at line 133 of file LengthFilter.h.

LengthFilter::LengthFilter ( ClusterMaker clusterMaker  )  [protected]

The default constructor.

The constructor has been made protected to ensure that this class is never directly instantiated. Instead an instance should be created via a suitable call to the FilterFactory API method(s).

Parameters:
[in] clusterMaker The cluster maker class that is being used for analysis. This parameter is simply passed onto the base class for its use. It is used the initialize method to create a dummy cluster for use by this filter.

Definition at line 51 of file LengthFilter.cpp.

References clusterID.


Member Function Documentation

virtual void LengthFilter::finalize (  )  [inline, virtual]

Method to indicate completion of filter analysis.

This method is invoked after all the filteration operations have been successfully completed. Currently method this method does not have any specific tasks to perform.

Implements Filter.

Definition at line 125 of file LengthFilter.h.

int LengthFilter::initialize (  )  [virtual]

Method to begin filter analysis (if any).

This method is invoked just before commencement of filtration. This method adds a new dummy cluster using the ClusterMaker API methods. The dummy cluster is used to classify ESTs that were filtered out by this filter.

Returns:
This method returns zero to indicate that initialization was completed successfully. On errors (that is a cluster could not be created) then this method returns a non-zero error code.

Implements Filter.

Definition at line 81 of file LengthFilter.cpp.

References ClusterMaker::addDummyCluster(), ASSERT, clusterID, and Filter::clusterMaker.

LengthFilter& LengthFilter::operator= ( const LengthFilter src  )  [private]

A dummy operator=.

The operator=() is supressed for this class as it has constant members whose value is set when the object is created. These values cannot be changed during the lifetime of this object.

Parameters:
[in] src The source object from where data is to be copied. Currently this value is ignored.
Returns:
Reference to this.

Reimplemented from Filter.

bool LengthFilter::parseArguments ( int &  argc,
char **  argv 
) [virtual]

Process command line arguments.

This method is used to process command line arguments specific to this filter. This method is typically used from the main method just after the filter has been instantiated. This method consumes all valid command line arguments. If the command line arguments were valid and successfully processed, then this method returns true.

Parameters:
[in,out] argc The number of command line arguments to be processed. This value is updated when valid command line arguments are consumed by the filter.
[in,out] argv The array of command line arguments. The number of entries in this array are modified and updated when valid arguments are consumed by the filter.
Returns:
This method returns true if the command line arguments were successfully processed. Otherwise this method returns false.

Implements Filter.

Definition at line 65 of file LengthFilter.cpp.

References arg_parser::check_args(), Filter::filterName, and minESTLen.

int LengthFilter::runFilter ( const int  otherEST  )  [protected, virtual]

Apply filter rules to determine if this EST should be filtered out.

This method is invoked from the applyFilter() method to perform the actual filtering. The filtering is performed on the given EST in the following manner:

  1. This method first obtains the specified EST from the list of ESTs.

  2. If the nucleotide sequence of this EST is shorter than minESTLength then this method filters out this EST and returns the ID of the cluster to which this EST must be added. The ID of the cluster is determined in the LengthFilter::initialize() method.

Returns:
This method returns -1 if the est must be subject to further filteration or core EST analyis and clustering. If the specified est is to be filtered out, then this method returns a non-zero integer value. This value is used to place the EST into an artifically created cluster to help users identify such clusters.

Implements Filter.

Definition at line 90 of file LengthFilter.cpp.

References ASSERT, clusterID, EST::getEST(), EST::getESTCount(), EST::getSequence(), and minESTLen.

void LengthFilter::showArguments ( std::ostream &  os  )  [virtual]

Display valid command line arguments for this filter.

This method must be used to display all valid command line options that are supported by this filter. This method overrides the corresponding method in the base class API. This method is typically used in the main() method when displaying usage information.

Parameters:
[out] os The output stream to which the valid command line arguments must be written.

Implements Filter.

Definition at line 58 of file LengthFilter.cpp.


Friends And Related Function Documentation

friend class FilterFactory [friend]

Definition at line 67 of file LengthFilter.h.


Member Data Documentation

Initial value:
 {
    {"--minESTLen", "Minimum EST length to be permitted by this filter",
     &LengthFilter::minESTLen, arg_parser::INTEGER},    
    {NULL, NULL, NULL, arg_parser::BOOLEAN}
}

The set of arguments specific to this filter.

This instance variable contains a static list of arguments that are specific only to this filter class. This argument list is statically defined and shared by all instances of this class.

Note:
Use of static arguments and parameters renders this filter class not to be MT-safe.

Definition at line 199 of file LengthFilter.h.

int LengthFilter::clusterID [private]

Variable to track the ID of the cluster to which short ESTs must be added.

This instance variable is used to track the ID of the cluster to which short ESTs must be added by this filter. This value is set in the LengthFilter::initialize() method.

Definition at line 187 of file LengthFilter.h.

Referenced by initialize(), LengthFilter(), and runFilter().

int LengthFilter::minESTLen = 50 [static, private]

The minmum length threshold for ESTs to be used by this filter.

This instance variable contains the length of the shortest EST that must be permitted through by this filter. All ESTs shorter than this length will be filtered out. The default length is 50. However, this value can be overridden by using the --minESTLen command line argument.

Definition at line 210 of file LengthFilter.h.

Referenced by parseArguments(), and runFilter().


The documentation for this class was generated from the following files:

Generated on 19 Mar 2010 for PEACE by  doxygen 1.6.1