(
"Calc Results:");
145 unsigned intkey_x = 0;
168 if(id_str.empty())
continue;
196 if(attr_name ==
"label") {
197(*node).SetLabel(attr_value);
215 floatmax_branch_dist = 0.0f;
216 for(
autoiter = node.GetChildren().begin(); iter != node.GetChildren().end(); ++iter) {
217max_branch_dist =
std::max(max_branch_dist, (*
m_Tree)[*iter]->GetDistance() + (*
m_Tree)[*iter]->GetMaxChildDistance());
221node->SetMaxChildDistance(max_branch_dist);
226 else if(
delta==0 && node.HasParent()) {
229node.GetValue().GetDistance();
240 unsigned intkey_x = -1;
242 boolnode_has_key =
true;
245 if((*node).GetSeqID().IsNull()) {
246node_has_key =
false;
252comp_key.
m_IDStr= (*node).GetSeqID()->GetSeqIdString();
261node_has_key =
false;
271std::vector<AttrKey>::iterator iter;
281 if(comp_key.
m_IDStr== (*iter).m_IDStr) {
285objects::CSeq_id sid((*iter).m_IDStr);
286 if((*node).GetSeqID()->Match(sid))
309 if(seqid_str.empty())
continue;
311objects::CSeq_id sid(seqid_str);
313 if((*node).GetSeqID()->Match(sid)) {
319 catch(...){
break;}
326 if(node.HasParent()) {
335(*node).SetNumLeaves(0);
336(*node).SetNumLeavesEx(0);
344 if(!(node).IsLeaf()) {
345(*node).SetPamlCounter(
m_PamlID++);
351(*node).SetDisplayLabel(
"");
355 if(node.IsLeaf() && ((*node).GetLabel().length() >
m_MaxLabelLen)) {
359 TClusterIDclusterID = (*node).GetClusterID();
362 if(clusterID != -1) {
367 if((*node).HasSelClusters()) {
369vector<int> selection_clusters = (*node).GetSelClusters();
371 for(
size_t i=0;
i<selection_clusters.size(); ++
i) {
374 m_Clusters[selection_clusters[
i]].push_back(x_node);
378(*node).GetMarkerColors().
clear();
384(*node).SetClusterColorIdx(-1);
389node->SetMaxChildDistance(0.0f);
393 returntraverse_code;
413(*node).IDX().first =
m_PosX;
414(*node).IDX().second =
m_PosY;
439(*node).IDX().first =
m_PosX;
440(*node).IDX().second =
m_PosY;
462it != node.SubNodeEnd();
467 if(node.Expanded()){
469(*node).SetNumLeavesEx((*node).GetNumLeavesEx() + 1);
472(*node).SetNumLeavesEx((*node).GetNumLeavesEx() + (*nn).GetNumLeavesEx());
478(*node).SetNumLeaves((*node).GetNumLeaves() + 1);
481(*node).SetNumLeaves((*node).GetNumLeaves() + (*nn).GetNumLeaves());
497 m_Rect.
Init(xy.
X()-1e-04, xy.
Y()-1e-04, xy.
X()+1e-04, xy.
Y()+1e-04);
526 stringpriority_str = (*node).GetBioTreeFeatureList().GetFeatureValue(
m_PriorityId);
529 if(priority_str !=
"") {
564 size_tnum_leaves = (*m_Tree)[node_idx].GetValue().GetNumLeaves();
566 m_PriorityId= (*m_Tree).GetFeatureDict().GetId(
"$PRIORITY");
599 floatmax_child_dist = 0.0f;
600 booldo_not_collapse =
false;
604 floatchild_dist =
std::max(0.0f, child_node->GetDistance());
608do_not_collapse =
true;
612max_child_dist = 0.0f;
614 m_Distances[node_idx].m_MaxChildDist = max_child_dist;
616sprintf(
buf,
"%f", max_child_dist);
636 returntraverse_code;
648 floatmax_branch_dist = 0.0f;
672 returntraverse_code;
716 returntraverse_code;
731vector<TTreeIdx> path;
739 TTreeIdxparent_idx = (*m_Tree)[idx].GetParent();
755leaf_dist += (*m_Tree)[idx].GetValue().GetDistance();
777 returntraverse_code;
809 if(node->GetLabel() !=
"") {
815 returntraverse_code;
892 TNodeType& parent = (*m_Tree)[parent_idx];
917 TNodeType& parent = (*m_Tree)[parent_idx];
939 TNodeType& parent = (*m_Tree)[parent_idx];
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
Things for representing and manipulating bio trees.
Template class to create a table with custom row-column access.
const TColumn & Column(unsigned int idx) const
Get column name.
unsigned int ColumnIdx(const TColumn &col) const
Get column index.
const TValueType & GetCell(unsigned int row_idx, unsigned int col_idx) const
Access table element by index.
unsigned int Rows() const
Number of rows.
unsigned int Cols() const
Number of column.
TDistance GetDistance() const
CRgbaGradColorTable * m_ColorTable
void x_UpdateProperties(TNodeType &node, int row_idx)
Updates node properties using values from m_AttrTable.
virtual ETreeTraverseCode x_OnStepDown(TTreeIdx x_node)
CPhyloTreeNode::TTreeIdx m_CollapsedParentIdx
CPhyloTreeCalculator(TTreeType *tree, CRgbaGradColorTable *color_table)
virtual ETreeTraverseCode x_OnStep(TTreeIdx x_node, int delta)
void SetAttrTable(const TAttrTable &attr)
TClusterID m_MaxClusterID
virtual ETreeTraverseCode x_OnStepRight(TTreeIdx x_node)
TBioTreeFeatureId m_AttrKeyId
string m_LabelFormat
label calculation
const TAttrTable * m_AttrTable
Attributes with seq-ids optionally provided to update tree properties.
CPhyloTree::TClusterID TClusterID
void Init(CRgbaGradColorTable *ct)
vector< AttrKey > m_AttrKeys
Mapping for efficient lookup of seq-ids in m_AttrTable.
virtual ETreeTraverseCode x_OnStepLeft(TTreeIdx x_node)
TTreeIdx m_MaxDistNode
Index of node that is furthest from the root.
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
vector< float > m_Distances
Distance of each node from root.
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
vector< pair< string, string > > m_LabelRanges
Min and max label values (according to lexicographic.
string GetLabelForNode(const CPhyloTree &tree, const CPhyloTreeNode &node, const string &format)
vector< float > m_Distances
Max distace of any child of a node from the root, saved in same order as node array in tree.
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
float m_MaxDist
Keep track of overall max and min distances.
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
CRef< SCollapsable > m_CheckCollapseFunc
vector< SChildMaxDist > m_Distances
Max distace of any direct child of a node from the root, saved in same order as node array in tree.
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
float m_MaxDist
Total distance along m_MaxPath.
vector< TTreeIdx > m_MaxDistPathToRoot
vector< TTreeIdx > m_SortedMaxDistPathToRoot
vector< float > m_Distances
Distance of each node from root node.
void GetLongest(vector< TTreeIdx > &path, float &length)
TTreeIdx m_MaxDistNode
Node at greatest distance from root, its distance and vector of nodes from root to m_MaxDistNode (sor...
vector< TTreeIdx > m_MaxPath
Path (set of nodes) that is the longest path in the tree.
bool Expanded() const
Return true if node is currently not collapsed.
TNodeList_I SubNodeEndEx()
TNodeList_I SubNodeBeginEx()
Return the child nodes only if visible.
float m_LeafMidpoint
Index of leaf at center of subtree (leaves in subtree/2)
TTreeIdx m_PriorityLeafIdx
Leaf with highest priority number.
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
size_t m_MaxPriorityLeafNum
Leaf index of node with m_MaxPriority.
void Init(TTreeIdx node_idx)
int m_MaxPriority
Max priority value found in priority field in subtree.
TBioTreeFeatureId m_PriorityId
Id of priority feature in tree.
size_t m_LeafCount
Current leaf count (as we iterate over the subtree)
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
const vector< pair< string, string > > & m_LabelRanges
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
const vector< float > & m_Distances
virtual ETreeTraverseCode x_OnStep(TTreeIdx node_idx, int delta)
Tree subclass also has functions and data needed for rendering and selection.
void SortSubtreeDist(TTreeIdx idx, const vector< float > &distances, bool order)
Sort the children of a node based on length of longest subtree.
CBioTreeFeatureDictionary & GetFeatureDict()
Return feature dictionary.
void SortLabel(TTreeIdx idx, bool order)
Sort the children of a node based on label comparison (alphabetical order)
void SortLabelRange(TTreeIdx idx, const vector< pair< string, string > > &subtree_labels, bool order)
Sort the children of a node based on the alphanumeric range of their child nodes.
void Sort(TTreeIdx idx, bool order)
Sort the children of a node based on the number of children they have.
CRgbaGradColorTable Provides a storage for colors (to eliminate color creation overhead) and Function...
void RemoveChild(TTreeIdx child_idx)
Remove child node if it is a child of this node.
TNodeList & GetChildren()
Return the indices of this node's child nodes.
void SetParent(TTreeIdx parent_idx)
Set index of nodes parent.
bool HasChild(TTreeIdx child_idx) const
Check if another node is a child of this node.
TData & GetValue()
Return the value object for the node.
bool HasParent() const
Check if the node has a parent.
TNodeList::const_iterator TNodeList_CI
bool IsLeaf() const
Report whether this is a leaf node.
static TTreeIdx Null()
Static function that returns the null value.
void AddChild(TTreeIdx child_idx)
Add a child node.
TNodeType & GetParent(TNodeType &node)
Return a reference to the parent node of the given node.
TNodeType::TNodeList_I TNodeList_I
static TTreeIdx Null()
Return the index value that represents a NULL node.
void SetRootIdx(TTreeIdx idx)
Set the index of the root node of the tree.
virtual bool x_Allowed(TNodeType &)
virtual ETreeTraverseCode x_OnStep(TTreeIdx x_node, int delta)
vector< TTreeIdx > m_TreeStack
virtual ETreeTraverseCode x_OnStepDown(TTreeIdx x_node)
ETreeTraverseCode operator()(TTreeType &tree, TTreeIdx tree_node, int delta)
virtual ETreeTraverseCode x_OnStep(TTreeIdx x_node, int delta)
virtual ETreeTraverseCode x_OnStepRight(TTreeIdx x_node)
CPhyloTree::TTreeIdx TTreeIdx
CPhyloTree::TNodeType TNodeType
virtual ETreeTraverseCode x_OnStepLeft(TTreeIdx x_node)
Include a standard set of the NCBI C++ Toolkit most basic headers.
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
TBioTreeFeatureId GetId(const string &feature_name) const
If feature is already registered returns its id by name.
bool HasFeature(const string &feature_name) const
Check if feature is listed in the dictionary.
@ eTreeTraverseStop
Stop traversal (return form algorithm)
@ eTreeTraverse
Keep traversal.
@ eTreeTraverseStepOver
Do not traverse current node (pick the next one)
constexpr auto sort(_Init &&init)
const struct ncbi::grid::netcache::search::fields::SIZE size
Compressed bitset (entry point to bm.h)
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Int4 delta(size_t dimension_, const Int4 *score_)
Structure allows us to more efficiently store and look up keys (usually seq-ids) in m_AttrTable.
size_t TTreeIdx
Bi-directionaly linked N way tree allocated in a contiguous memory block.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4