ClusterMaker Class Reference

The base class of all cluster makers. More...

#include <ClusterMaker.h>

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

List of all members.

Public Member Functions

virtual void showArguments (std::ostream &os)
 Display valid command line arguments for this cluster maker.
virtual bool parseArguments (int &argc, char **argv)
 Process command line arguments.
virtual int makeClusters ()=0
 Method to begin clustering.
ESTAnalyzergetAnalyzer () const
 Obtain the EST analyzer set for this cluster maker.
virtual int addDummyCluster (const std::string name)=0
 Add a dummy cluster to the cluster maker.
virtual void addEST (const int clusterID, const int estIdx)=0
 Add a EST directly to a given cluster.
virtual int initialize ()=0
 A method to handle initialization tasks for the ClusterMaker.
virtual ~ClusterMaker ()
 The destructor.

Protected Member Functions

 ClusterMaker (const std::string &name, ESTAnalyzer *analyzer, const int refESTidx, const std::string &outputFileName)
 The default constructor.

Protected Attributes

const std::string name
 The name of this cluster maker.
const int refESTidx
 The index of the reference EST in a given file.
const std::string outputFileName
 The file to which results must be written.
ESTAnalyzer *const analyzer
 The analyzer to be used for generating EST similarity metrics.

Private Member Functions

ClusterMakeroperator= (const ClusterMaker &src)
 A dummy operator=.

Static Private Attributes

static arg_parser::arg_record commonArgsList []
 The set of common arguments for all cluster makers.

Detailed Description

The base class of all cluster makers.

This class must be the base class of all cluster makers in the system. This class provides some default functionality that can be readily used by each cluster maker.

Definition at line 48 of file ClusterMaker.h.


Constructor & Destructor Documentation

ClusterMaker::~ClusterMaker (  )  [virtual]

The destructor.

The destructor frees memory allocated for holding any data in this base class.

Definition at line 55 of file ClusterMaker.cpp.

ClusterMaker::ClusterMaker ( const std::string &  name,
ESTAnalyzer analyzer,
const int  refESTidx,
const std::string &  outputFileName 
) [protected]

The default constructor.

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

Parameters:
[in] name The human readable name for this cluster maker. This name is used when generating errors, warnings, and other output messages for this object.
[in,out] analyzer The EST analyzer to be used by this ClusterMaker for generating similarity metrics between two given ESTs.
[in] refESTidx The reference EST's index in a given multi-FASTA file. Index values start with 0 (zero). The refESTidx is supplied as a global argument that is processed in the main() method. This value is simply copied to the refESTidx member in this class.
[in] outputFileName The file name to which output must be written. If a valid output file is not specified, then results are written to standard output. The outputFileName is simply copied to the outputFileName member object.

Definition at line 48 of file ClusterMaker.cpp.


Member Function Documentation

virtual int ClusterMaker::addDummyCluster ( const std::string  name  )  [pure virtual]

Add a dummy cluster to the cluster maker.

This method can be used to add a dummy cluster to the cluster maker. The dummy clusters are added as direct descendants of the root cluster with the given name.

Note:
This method is currently used by the Filter hierarchy to add ESTs that are logically filtered out and must not be part of the core clustering process.
Parameters:
[in] name A human readable name to be set for this cluster.
Returns:
If a cluster was successfully added, then this method returns a unique integer that identifies the newly added cluster. This value must be used to add entries to this cluster via the ClusterMaker::addEST method.

Implemented in MSTClusterMaker.

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

virtual void ClusterMaker::addEST ( const int  clusterID,
const int  estIdx 
) [pure virtual]

Add a EST directly to a given cluster.

This method can be used to add an EST directly to a cluster. This bypasses any traditional mechanism and directly adds the EST to the specified cluster.

Note:
The EST is added with an invalid metric value. ESTs added to a cluster are not included in the standard clustering process. Adding an EST that has already been added to the same/another cluster results in undefined behaviors.
Parameters:
[in] clusterID The unique ID of the cluster to which the EST is to be added. This value must have been obtained from an earlier (successful) call to the ClusterMaker::addDummyCluster method.
[in] estIdx The EST to be added to the given cluster. Once the EST has been added to this cluster it will not be included in the clustering process performed by this cluster maker.

Implemented in MSTClusterMaker.

Referenced by Filter::applyFilter(), and Filter::processFilterData().

ESTAnalyzer* ClusterMaker::getAnalyzer (  )  const [inline]

Obtain the EST analyzer set for this cluster maker.

This method must be used to obtain the EST analyzer set for this cluster maker.

Returns:
The EST analyzer set for this cluster maker. If a valid EST analyzer has not been set then this method returns NULL.

Definition at line 118 of file ClusterMaker.h.

References analyzer.

Referenced by LCFilter::initialize(), and LCFilter::runFilter().

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

A method to handle initialization tasks for the ClusterMaker.

This method is called after the cluster maker has been created but before the ESTs have been loaded into the ESTAnalyzer.

Note:
This method must load all the ESTs to be processed via the ESTAnalyzer API methods.
Returns:
This method returns zero on success. On errors, this method returns a non-zero value.

Implemented in MSTClusterMaker, and TransMSTClusterMaker.

Referenced by main().

virtual int ClusterMaker::makeClusters (  )  [pure virtual]

Method to begin clustering.

This method must be used to create clusters based on a given EST analysis method. This method is a pure-virtual method. Therefore all cluster maker classes must override this method to perform all the necessary operations.

Note:
This method must be invoked only after the initialize() method is invoked.

Implemented in MSTClusterMaker, and PMSTClusterMaker.

Referenced by main().

ClusterMaker & ClusterMaker::operator= ( const ClusterMaker 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.

Definition at line 82 of file ClusterMaker.cpp.

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

Process command line arguments.

This method is used to process command line arguments specific to this cluster maker. This method is typically used from the main method just after the cluster maker 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 cluster maker 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.
[in,out] argv The array of command line arguments.
Returns:
This method returns true if the command line arguments were successfully processed. Otherwise this method returns false. This method returns true if all arguments are consumed successfully.

Reimplemented in MSTClusterMaker, and PMSTClusterMaker.

Definition at line 72 of file ClusterMaker.cpp.

References arg_parser::check_args().

Referenced by main().

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

Display valid command line arguments for this cluster maker.

This method must be used to display all valid command line options that are supported by this cluster maker. 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 cluster maker 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.

Reimplemented in MSTClusterMaker, and PMSTClusterMaker.

Definition at line 58 of file ClusterMaker.cpp.

References commonArgsList.

Referenced by showUsage().


Member Data Documentation

ESTAnalyzer* const ClusterMaker::analyzer [protected]
Initial value:
 {
    {NULL, NULL, NULL, arg_parser::BOOLEAN}
}

The set of common arguments for all cluster makers.

This instance variable contains a static list of arguments that are common all the cluster makers. The common argument list is statically defined and shared by all cluster maker instances.

Note:
This makes cluster maker class hierarchy not MT-safe.

Definition at line 264 of file ClusterMaker.h.

Referenced by showArguments().

const std::string ClusterMaker::name [protected]

The name of this cluster maker.

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

Definition at line 221 of file ClusterMaker.h.

Referenced by PMSTClusterMaker::showArguments(), and MSTClusterMaker::showArguments().

const std::string ClusterMaker::outputFileName [protected]

The file to which results must be written.

This member object is used to hold the file name to which all the clustering results are to be written. This member is initialized to NULL. However, the value is changed by the parseArguments method depending on the actual value specified by the user.

Definition at line 242 of file ClusterMaker.h.

Referenced by MSTClusterMaker::buildAndShowClusters(), and PMSTClusterMaker::makeClusters().

const int ClusterMaker::refESTidx [protected]

The index of the reference EST in a given file.

This member object is used to hold the index of a reference EST in a given file. The index values begin from 0 (zero). This member is initialized in the constructor and is never changed during the lifetime of this object. This reference est index is typically the root node of any clustering operations that are performed.

Definition at line 232 of file ClusterMaker.h.

Referenced by MSTClusterMaker::manager(), and PMSTClusterMaker::mergeManager().


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

Generated on 19 Mar 2010 for PEACE by  doxygen 1.6.1