midpointDist = 0.0;
58 doubledToNewParent = 0, dToNewChild = 0;
67 if(oldTree.
size() == 0) {
78midpointDist = dmax/2.0;
80 while(cursor1.
is_valid() && dToEnd1 < midpointDist) {
81dToEnd1 += cursor1->distance;
83cursor1 = tmpTree.
parent(cursor2);
88 if(!cursor1.
is_valid() || !tmpTree.
parent(cursor1).is_valid()) {
93item =
SeqItem(
"New Root", -1, dToEnd1-midpointDist);
95cursor2->distance -= item.
distance;
96 if(dToEnd1 == midpointDist) {
97newTreeRoot = cursor1;
98cursor1 = tmpTree.
parent(newTreeRoot);
108cursor2 = newTreeRoot;
109dToNewParent = cursor2->distance;
110cursor2->distance = 0.0;
116dToNewChild = cursor1->distance;
117cursor1->distance = dToNewParent;
118dToNewParent = dToNewChild;
120cursor1 = tmpTree.
parent(cursor2);
125tmpTreeCursor = cursor2.
begin();
126 while(tmpTreeCursor != tmpSibling) {
129tmpTreeCursor->distance += cursor2->distance;
151 if(nTopLevelNodes == 2) {
157cursor1 = tmpTree.
end();
159cursor1->distance += dToNewParent;
160}
else if(nTopLevelNodes > 2) {
164 newTree.SeqTreeBase::operator=(tmpTree.
reroot(newTreeRoot));
167 if(nTopLevelNodes > 2) {
172newTreeCursor =
newTree.begin();
173 while(!found && newTreeCursor !=
newTree.end()) {
174 if(*newTreeCursor == item) {
175sit = newTreeCursor.
begin();
176 while(sit != newTreeCursor.
end()) {
177 if(*sit == nullItem) {
178sit->distance = dToNewParent;
183found = (
count== 1) ?
true:
false;
205 doublerootDMax = 0.0, d1 = 0.0, d2 = 0.0;
207 if(atree.
size() < 2) {
209end1 = atree.
end();
210end2 = atree.
end();
234it = atree.
begin();
235 while(it != atree.
end() && foundCount < 2) {
236 if(rootEnd1.
is_valid() && *it == *rootEnd1) {
239}
else if(rootEnd2.is_valid() && *it == *rootEnd2) {
247 if(foundCount < 2) {
254 if(
result&& rootEnd1 != rootEnd2 && rootDMax > 0) {
260end1 = atree.
end();
261end2 = atree.
end();
275 doublelocalMax, localBranch1, localBranch2;
279 assert(dBranch1 >= dBranch2);
290 doublesibDist, testDist;
294 while(
result&& sibCursor != cursor.
end()) {
295sibDist = sibCursor->distance;
301 result=
GetMaxPath(sibCursor, localMax, localBranch1, localEnd1, localBranch2, localEnd2);
303testDist = localBranch1 + sibDist + dBranch1;
305 if(localMax > dMax && localMax > testDist) {
310dBranch1 = localBranch1 + sibDist;
311dBranch2 = localBranch2 + sibDist;
313}
else if(testDist >= localMax && testDist > dMax) {
316 if(localBranch1 + sibDist > dBranch1) {
320dBranch1 = localBranch1 + sibDist;
323dBranch2 = localBranch1 + sibDist;
326}
else if(dMax >= localMax && dMax >= testDist) {
static const Rootedness DEF_ROOTED
bool useMidpointRooting()
void midpointRootIfNeeded()
static const string NO_NAME
sibling_iterator end() const
unsigned int number_of_children() const
sibling_iterator begin() const
pre_order_iterator iterator
sibling_iterator previous_sibling(const iterator_base &) const
sibling_iterator next_sibling(const iterator_base &) const
iter append_child(iter position)
tree reroot(iterator newRoot)
pre_order_iterator begin() const
iter insert(iter position, const T &x)
unsigned int number_of_children(const iterator_base &) const
iter reparent(iter position, sibling_iterator begin, sibling_iterator end)
unsigned int number_of_siblings(const iterator_base &) const
pre_order_iterator end() const
bool GetMaxPath(const SeqTree &atree, double &dMax, SeqTree::iterator &end1, SeqTree::iterator &end2)
void MidpointRootSeqTree(const SeqTree &oldTree, SeqTree &newTree)
const double RESET_WITH_TINY_DISTANCE
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
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