Filter Class Reference

The base class of all filters. More...

#include <Filter.h>

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

List of all members.

Public Member Functions

virtual void showArguments (std::ostream &os)=0
 Display valid command line arguments for this filter.
virtual bool parseArguments (int &argc, char **argv)=0
 Process command line arguments.
virtual int initialize ()=0
 Method to begin filter analysis (if any).
virtual void finalize ()=0
 Method to indicate completion of filter analysis.
void addFilterData (std::vector< int > &superList) const
 Add cluster ID and indexes of ESTs filtered by this filter to a list.
int applyFilter (const int otherEST)
 Determine if the given EST passes this filter condition.
const std::string & getName () const
 Obtain human-readable name for this filter.
virtual ~Filter ()
 The destructor.
virtual void printStats (std::ostream &os) const
 Method to display statistics regarding operation of this filter.
int getRunCount ()
 Method to obtain the count of times this filter was run.
int getFilterCount ()
 Method to obtain the count of times this filter rejected (or filtered-out) an EST.

Static Public Member Functions

static void processFilterData (const std::vector< int > &superList, ClusterMaker *clusterMaker)
 Helper method to process filter data from another process.

Protected Member Functions

 Filter (const std::string &filterName, ClusterMaker *clusterMaker)
 The default constructor.
virtual int runFilter (const int estIndex)=0
 Apply filter rules to determine if this EST should be filtered out.

Protected Attributes

const std::string filterName
 The name of this filter.
ClusterMaker *const clusterMaker
 The cluster maker set for this filter.

Private Member Functions

Filteroperator= (const Filter &src)
 A dummy operator=.

Private Attributes

int runCount
 Variable to track the number of times this filter was run.
int filterCount
 Variable to track the number of times this filter filtered out an EST.
FilteredESTList filteredESTList
 The list of ESTs filtered out by this filter.

Detailed Description

The base class of all filters.

This class must be the base class of all filters in the system. This class provides some default functionality that can be readily used by the filters. This class enables the FilterChain to manage a list of filters and dispatch method calls to various filters.

A set of filters (stored in the FilterChain class) are run on all entries in a FASTA file prior to commencement of the core clustering operation. The filters perform various validation operations to ensure ESTs are good prior to clustering. Filtering ensures that the overall quality of clustering provided by PEACE is good.

Each filter object in the chain implements a specific type of filteration operation and ultimately returns an integer indicating the cluster to which an EST is to be assigned. If the cluster ID is -1, then that indicates that the EST must be subjected to regular clustering operations.

Definition at line 79 of file Filter.h.


Constructor & Destructor Documentation

Filter::~Filter (  )  [virtual]

The destructor.

The destructor for the filter.

Definition at line 48 of file Filter.cpp.

Filter::Filter ( const std::string &  filterName,
ClusterMaker clusterMaker 
) [protected]

The default constructor.

The constructor has been made protected to ensure that this class is never directly instantiated. Instead one of the derived Filter classes must be instantiated via the FilterFactory API methods.

Parameters:
[in] filterName The human readable name for this filter. This name is used when generating errors, warnings, and other output messages for this filter.
[in] clusterMaker The cluster maker class that is being used for analysis. This class can be used by this filter for performing specific operations.

Definition at line 41 of file Filter.cpp.

References filterCount, and runCount.


Member Function Documentation

void Filter::addFilterData ( std::vector< int > &  superList  )  const

Add cluster ID and indexes of ESTs filtered by this filter to a list.

This method is used to accumulate the set of ESTs that were filtered out by this filter into a single superList. The super list is then broadcasted to other processes for their reference. The data from this filter is to be added to the superList in the following format (to ease broadcasting to other processes):

  1. First the clusterID to which the ESTs were added must be appended to the superList.

  2. Next, the number of ESTs that were filtered out by this filter must be appended to the superList.

  3. Finally, the indexes of the ESTs that were filtered out by this filter must be appended to the superList.

Parameters:
[out] superList The vector to which the filter data is to be added.

Definition at line 71 of file Filter.cpp.

References filteredESTList.

int Filter::applyFilter ( const int  otherEST  ) 

Determine if the given EST passes this filter condition.

This method can be used to determine if a given EST passes this filter and if it must be subjected to the core clustering operations.

Parameters:
[in] otherEST The index (zero based) of the EST that must be subject to which the reference EST is to be compared.
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.

Definition at line 53 of file Filter.cpp.

References ClusterMaker::addEST(), clusterMaker, filterCount, filteredESTList, runCount, and runFilter().

virtual void Filter::finalize (  )  [pure virtual]

Method to indicate completion of filter analysis.

This method is invoked after all the filteration operations have been successfully completed. This method typically performs any clean up operations that may be necessary.

Note:
Derived classes must override this method.

Implemented in LCFilter, and LengthFilter.

int Filter::getFilterCount (  )  [inline]

Method to obtain the count of times this filter rejected (or filtered-out) an EST.

Returns:
The number of times calls to this filter rejected (or filtered-out) an EST.

Definition at line 289 of file Filter.h.

References filterCount.

const std::string& Filter::getName (  )  const [inline]

Obtain human-readable name for this filter.

This method must be used to obtain the human readable name set for this filter. This method essentially returns the value set when this filter class was instantiated.

Returns:
A human readable name associated with this filter.

Definition at line 239 of file Filter.h.

References filterName.

Referenced by printStats().

int Filter::getRunCount (  )  [inline]

Method to obtain the count of times this filter was run.

Returns:
The number of times this filter was called.

Definition at line 279 of file Filter.h.

References runCount.

virtual int Filter::initialize (  )  [pure virtual]

Method to begin filter analysis (if any).

This method is invoked just before commencement of filtration. This method typically loads additional information that may be necessary for a given filter. In addition, it may perform any pre-processing as the case may be.

Note:
Derived classes must override this method.
Returns:
If the initialization process was sucessful, then this method returns 0. Otherwise this method returns with a non-zero error code.

Implemented in LCFilter, and LengthFilter.

Filter& Filter::operator= ( const Filter 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 in LCFilter, and LengthFilter.

virtual bool Filter::parseArguments ( int &  argc,
char **  argv 
) [pure 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.

Note:
Derived filter classes must override this method to process any command line arguments that are custom to their operation. When this method is overridden don't forget to call the corresponding base class implementation to display common options.
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.

Implemented in LCFilter, and LengthFilter.

void Filter::printStats ( std::ostream &  os  )  const [virtual]

Method to display statistics regarding operation of this filter.

This method can be used to obtain a dump of the statistics gathered regarding the operation of this filter. The typical statistic generated by filters includes:

  • The number of times the filter was called. More specifically this value indicates the number of times the applyFilter() method was invoked.

  • The number of successful matches reported by this filter. This number indirectly indicates the number of times other filters were invoked.

Note:
Derived filter classes may override this method to display additional statistics. However, the additional information must be displayed after the base class method has completed its task.
Parameters:
[out] os The output stream to which the statistics regarding the filter is to be dumped.

Definition at line 107 of file Filter.cpp.

References filterCount, getName(), and runCount.

void Filter::processFilterData ( const std::vector< int > &  superList,
ClusterMaker clusterMaker 
) [static]

Helper method to process filter data from another process.

This is a helper method to process a given list of entries (that was built by the addFilterData() method) obtained from another process. This list can contain entries from multiple filters. This method method processes the list of entries and adds the indicated ESTs to corresponding clusters on local processes. This ensures that filters that were independently applied on different parallel processes are consistently reflected on all processes participating in the clustering process.

Note:
This method is present here so that the interface of this class is symmeetric in the sense that the list generated by the addFilterData method is also processed by this method.
The method is also static because it processes lists from multiple filters and not just one. This is more of "purity" of API and its significance rather than anything else.
Parameters:
[in] superList The super list to be processed by this method.
[in] clusterMaker The cluster maker object that is being used for analysis.

Definition at line 87 of file Filter.cpp.

References ClusterMaker::addEST().

Referenced by FilterChain::allToAllBroadcast().

virtual int Filter::runFilter ( const int  estIndex  )  [protected, pure 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.

Note:
Derived filter classes must override this method and provide a proper implementation.
Parameters:
[in] estIndex The index (zero based) of the EST to which the filter rules are to be applied.
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.

Implemented in LCFilter, and LengthFilter.

Referenced by applyFilter().

virtual void Filter::showArguments ( std::ostream &  os  )  [pure 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. Note that derived classes may override this method to display additional command line options that are applicable to it. This method is typically used in the main() method when displaying usage information.

Note:
Derived filter classes must override this method to display help for their custom command line arguments. When this method is overridden don't forget to call the corresponding base class implementation to display common options.
Parameters:
[out] os The output stream to which the valid command line arguments must be written.

Implemented in LCFilter, and LengthFilter.


Member Data Documentation

ClusterMaker* const Filter::clusterMaker [protected]

The cluster maker set for this filter.

This instance variable is initialized to refer to the top-level cluster maker class to be used by this filter for any operations that may be necessary. Note that this pointer cannot be change after it is set in the constructor.

Definition at line 350 of file Filter.h.

Referenced by LCFilter::addDummyEntry(), applyFilter(), LengthFilter::initialize(), LCFilter::initialize(), and LCFilter::runFilter().

int Filter::filterCount [private]

Variable to track the number of times this filter filtered out an EST.

This instance vairable tracks the number of times the filter filtered out an EST. This value is incremented in the applyFilter() method each time the runFilter() method returns a non -1 value.

Definition at line 370 of file Filter.h.

Referenced by applyFilter(), Filter(), getFilterCount(), and printStats().

The list of ESTs filtered out by this filter.

This instance variable is used to track the set of ESTs that were filtered out by this filter. A single filter can filter out ESTs and add them to different dummy clusters. Consequently a hash map is used to track the information. The key to the hash map is the cluster ID to which filtered ESTs were added. The value in the hash map is a vector that contains the index of the ESTs that were added to the cluster. Entries to the hash map are added by the applyFilter method.

Definition at line 384 of file Filter.h.

Referenced by addFilterData(), and applyFilter().

const std::string Filter::filterName [protected]

The name of this filter.

This instance variable contains the human recognizable name for this filter. This value is set when the filter is instantiated (in the constructor) and is never changed during the life time of this filter. This information is used when generating errors, warnings, and other output messages.

Definition at line 341 of file Filter.h.

Referenced by getName(), LengthFilter::parseArguments(), and LCFilter::parseArguments().

int Filter::runCount [private]

Variable to track the number of times this filter was run.

This instance variable is used to track the number of times this filter was run. This variable is initialized to zero in the constructor. It is incremented each time the applyFilter() method is invoked to run the the filter.

Definition at line 360 of file Filter.h.

Referenced by applyFilter(), Filter(), getRunCount(), and printStats().


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

Generated on 19 Mar 2010 for PEACE by  doxygen 1.6.1