A simple class to represent a MSTNode. More...
#include <MSTNode.h>
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 &) |
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:
parentIdx
: (int
) 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.
estIdx
: (int
) 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.
metric
: (float
) The similarity/distance metric generated by a given EST analyzer indicating the relationship between this node and its parent node.
alignmentMetric
: (int
) The alignment metric generated by a given EST analyzer indicating alignment relationship between this node and its parent node.
Definition at line 71 of file MSTNode.h.
MSTNode::MSTNode | ( | ) | [inline] |
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.
[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). |
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
[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. |
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.
Definition at line 196 of file MSTNode.h.
References alignmentMetric.
int MSTNode::getESTIdx | ( | ) | const [inline] |
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.
Definition at line 111 of file MSTNode.cpp.
References estIdx, EST::getEST(), and EST::getInfo().
float MSTNode::getMetric | ( | ) | const [inline] |
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
[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.
std::ostream& operator<< | ( | std::ostream & | , | |
const MSTNode & | ||||
) | [friend] |
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().
int MSTNode::estIdx |
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().
float MSTNode::metric |
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().