MSTNode Class Reference

A simple class to represent a MSTNode. More...

#include <MSTNode.h>

List of all members.

Public Member Functions

 MSTNode ()
 A default constructor.
 MSTNode (const int parentIndex, const int estIndex, const float nodeMetric, const int alignment=0, const int directionValue=1)
 A convenience constructor to create a MSTNode.
void serialize (std::ostream &os, const bool addAlignment) const
 Method to write the node information to an output stream.
std::string getESTInfo () const
 Returns the FASTA header corresponding to the EST for this node.
float getMetric () const
 Returns the metric value set for this node.
int getAlignmentMetric () const
 Returns the distance metric value set for this node.
int getESTIdx () const
 Returns the index of the EST that is set for this node.

Static Public Member Functions

static int deSerialize (std::istream &is, MSTNode &node, bool &haveAlignment)
 Method to read the node information to an input stream.

Public Attributes

int parentIdx
 The zero-based index of the parent EST.
int estIdx
 The zero-based index of the EST that a given MST node represents.
float metric
 The similarity/distance metric generated by a given EST analyzer indicating the relationship between this node and its parent node.
int alignmentMetric
 The alignment metric generated by a given EST analyzer indicating some of the alignment relationship between this node and its parent node.
int direction
 A simple index to indicate the direction of the analysis.

Friends

std::ostream & operator<< (std::ostream &, const MSTNode &)

Detailed Description

A simple class to represent a MSTNode.

This inner class is used to represent a node in the MST. A MSTNode contains the information about each EST added to the MST as detailed below. Ecapsulation of the data into a single Node class eases creation and manipulation of the MST.

A MSTNode encapsulates the following information about each node in a MST:

Definition at line 71 of file MSTNode.h.


Constructor & Destructor Documentation

MSTNode::MSTNode (  )  [inline]

A default constructor.

A default constructor is needed by STL for performing various operations. The default constructor merely sets all the members to an invalid value (-1).

Definition at line 81 of file MSTNode.h.

MSTNode::MSTNode ( const int  parentIndex,
const int  estIndex,
const float  nodeMetric,
const int  alignment = 0,
const int  directionValue = 1 
) [inline]

A convenience constructor to create a MSTNode.

This constructor provides a convenient mechanism to create and initialize an MSTNode object with necessary information.

Parameters:
[in] parentIndex The index of the parent EST for this Node. If a parent does not exist, then this value should be -1.
[in] estIndex The index of the EST. This value must be the index of the corresponding EST in the list of ESTs returned by EST::getESTList() method.
[in] nodeMetric The similarity/distance metric between this EST and its parent EST.
[in] alignment The alignment metric generated by a given EST analyzer indicating some of the alignment relationship between this node and its parent node.
[in] directionValue The direction value generated by a given EST analyzer indicating whether this node and its parent node are related by reverse-complementing (-1) or not (1).

Definition at line 109 of file MSTNode.h.


Member Function Documentation

int MSTNode::deSerialize ( std::istream &  is,
MSTNode node,
bool &  haveAlignment 
) [static]

Method to read the node information to an input stream.

This method can be used to deserialize the information for this node from a given input stream (or file) that was previous generated through a successful call to the serialize() method. If the first character in the line is a "#" (pound character) then this method ignores the line and proceeds to process the next one.

The data read is assumed to be in the the following comma separated format:

parentESTidx, ESTidx, metric
Parameters:
[in,out] is The input stream from which the data is to be written.
[out] node The node that must be populated with the data from the MST file.
[out] haveAlignment If the entry deserialized by this method had alignment data then this parameters is set to true. Otherwise this parameter is set to false. Note that the value is updated only if a valid line was successfully read.
Returns:
This method returns 0 if the data for the node was successfully read. It returns -1 on EOF. On errors, it returns a positive, non-zero value.

Definition at line 63 of file MSTNode.cpp.

References alignmentMetric, direction, estIdx, MAX_LINE_SIZE, metric, and parentIdx.

Referenced by MST::deSerialize().

int MSTNode::getAlignmentMetric (  )  const [inline]

Returns the distance metric value set for this node.

This method returns the distance metric value for this node when the node was instantiated.

Returns:
The distance metric value set for this node.

Definition at line 196 of file MSTNode.h.

References alignmentMetric.

int MSTNode::getESTIdx (  )  const [inline]

Returns the index of the EST that is set for this node.

This method returns the index of the EST that was set when this node was created.

Returns:
The index of the EST set for this node.

Definition at line 205 of file MSTNode.h.

References estIdx.

std::string MSTNode::getESTInfo (  )  const

Returns the FASTA header corresponding to the EST for this node.

This function obtains the EST corresponding to the ESTidx value stored in this node via the EST::getEST() method and then returns the information associated with the EST. The information about the EST is determined via the EST::getInfo() method.

Returns:
The FASTA header associated with the given EST. If no information is available this method returns an empty string.

Definition at line 111 of file MSTNode.cpp.

References estIdx, EST::getEST(), and EST::getInfo().

float MSTNode::getMetric (  )  const [inline]

Returns the metric value set for this node.

This method returns the metric value for this node when the node was instantiated.

Returns:
The metric value set for this node.

Definition at line 187 of file MSTNode.h.

References metric.

void MSTNode::serialize ( std::ostream &  os,
const bool  addAlignment 
) const

Method to write the node information to an output stream.

This method can be used to serialize the information in this node to a given output stream (or file). The data is written in the following comma format:

parentESTidx, ESTidx, metric
Parameters:
[out] os The output stream to which the data is to be written.
[in] addAlignment If this flag is true, then this method also serializes the alignment metric value associated with this node.

Definition at line 53 of file MSTNode.cpp.

References alignmentMetric, direction, estIdx, metric, and parentIdx.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const MSTNode  
) [friend]

Member Data Documentation

The alignment metric generated by a given EST analyzer indicating some of the alignment relationship between this node and its parent node.

Definition at line 231 of file MSTNode.h.

Referenced by deSerialize(), getAlignmentMetric(), and serialize().

A simple index to indicate the direction of the analysis.

-1 indicates that the child EST is reverse-complemented from the parent EST. 1 indicates that the parent and child ESTs are in the same direction.

Definition at line 238 of file MSTNode.h.

Referenced by deSerialize(), and serialize().

The zero-based index of the EST that a given MST node represents.

This value is the index of the corresponding EST in the list of ESTs returned by EST::getESTList() method.

Definition at line 219 of file MSTNode.h.

Referenced by deSerialize(), getESTIdx(), getESTInfo(), operator<<(), and serialize().

The similarity/distance metric generated by a given EST analyzer indicating the relationship between this node and its parent node.

Definition at line 225 of file MSTNode.h.

Referenced by deSerialize(), getMetric(), operator<<(), and serialize().

The zero-based index of the parent EST.

If a node has no parent (it is the root of the MST) then this value is set to -1. The parentIdx is an offset into the list of ESTs returned by EST::getESTList() method.

Definition at line 212 of file MSTNode.h.

Referenced by deSerialize(), operator<<(), and serialize().


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

Generated on 19 Mar 2010 for PEACE by  doxygen 1.6.1