The base class of all filters. More...
#include <Filter.h>
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 | |
Filter & | operator= (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. |
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.
Filter::~Filter | ( | ) | [virtual] |
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.
[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.
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):
First the clusterID to which the ESTs were added must be appended to the superList.
Next, the number of ESTs that were filtered out by this filter must be appended to the superList.
Finally, the indexes of the ESTs that were filtered out by this filter must be appended to the superList.
[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.
[in] | otherEST | The index (zero based) of the EST that must be subject to which the reference EST is to be compared. |
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.
Implemented in LCFilter, and LengthFilter.
int Filter::getFilterCount | ( | ) | [inline] |
Method to obtain the count of times 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.
Definition at line 239 of file Filter.h.
References filterName.
Referenced by printStats().
int Filter::getRunCount | ( | ) | [inline] |
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.
Implemented in LCFilter, and LengthFilter.
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.
[in] | src | The source object from where data is to be copied. Currently this value is ignored. |
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
.
[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. |
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.
[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.
[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.
[in] | estIndex | The index (zero based) of the EST to which the filter rules are to be applied. |
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.
[out] | os | The output stream to which the valid command line arguments must be written. |
Implemented in LCFilter, and LengthFilter.
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().
FilteredESTList Filter::filteredESTList [private] |
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().