89 if (cDIterator ==
end())
116 if (it->cd->GetAccession() == acc) {
126 if (it->cd->GetAccession() == acc) {
149 while (sit != pit.
end())
151 cds.push_back(sit->cd);
161 while (sit != pit.
end())
170 vector<CCdCore*> tmpCds;
172 for (
unsigned int i = 0;
i < tmpCds.size(); ++
i) {
173 cds.push_back(tmpCds[
i]);
179 vector<CCdCore*> tmpCds;
182 for (
unsigned int i = 0;
i < tmpCds.size(); ++
i) {
189 vector<CCdCore*> cds;
190 cds.push_back(cit->cd);
195 vector<CDFamily*> families;
197 subfam = families[0];
216 if (find(cds.begin(), cds.end(), fit->cd) != cds.end())
217 fit->selected =
true;
219 fit->selected =
false;
227 fit->selected =
true;
236 cds.push_back(fit->cd);
250 for (; cit !=
end(); ++cit)
251 cds.push_back(cit->cd);
267 currentCd = parentCd;
268 path.push_back(currentCd);
278 vector<CCdCore*> pathToRoot1, pathToRoot2;
281 vector<CCdCore*>::reverse_iterator rit1 = pathToRoot1.rbegin();
282 vector<CCdCore*>::reverse_iterator rit2 = pathToRoot2.rbegin();
283 vector<CCdCore*>::reverse_iterator lastConvergedIt1, lastConvergedIt2;
284 if( (rit1 == pathToRoot1.rend()) || (rit2 == pathToRoot2.rend()))
286 assert((*rit1) = (*rit2));
287 CCdCore* lastConvergedPoint = *rit1;
288 for (; rit1 != pathToRoot1.rend() && rit2 != pathToRoot2.rend(); rit1++, rit2++)
290 if (*rit1 == *rit2) {
291 lastConvergedPoint = *rit1;
292 lastConvergedIt1 = rit1;
293 lastConvergedIt2 = rit2;
301 for (rit1 = lastConvergedIt1; rit1 != pathToRoot1.rend(); ++rit1) {
302 path1.push_back(*rit1);
305 reverse(path1.begin(), path1.end());
308 for (rit2 = lastConvergedIt2; rit2 != pathToRoot2.rend(); ++rit2) {
309 path2.push_back(*rit2);
312 reverse(path2.begin(), path2.end());
314 return findCD(lastConvergedPoint);
320 vector<CCdCore*> path1, path2;
323 vector<CCdCore*>::reverse_iterator rit1 = path1.rbegin();
324 vector<CCdCore*>::reverse_iterator rit2 = path2.rbegin();
325 if( (rit1 == path1.rend()) || (rit2 == path2.rend()))
327 assert((*rit1) = (*rit2));
328 CCdCore* lastConvergedPoint = *rit1;
329 for (; rit1 != path1.rend() && rit2 != path2.rend(); rit1++, rit2++)
331 if ((!byAccession && *rit1 == *rit2) || (byAccession && (*rit1)->GetAccession() == (*rit2)->GetAccession()))
332 lastConvergedPoint = *rit1;
344 CCdCore* lastConvergedPoint = *cit;
349 for (; cit != cds.
end(); cit++)
351 fit =
convergeTo(lastConvergedPoint, *cit, byAccession);
354 lastConvergedPoint = fit->cd;
371 notOnPath.push_back(cit->cd);
374 notOnPath.push_back(cit->cd);
378 return notOnPath.size();
384 bool isAncestor =
false;
386 if (cd && potentialAncestorCd && cd != potentialAncestorCd) {
387 if (potentialAncestorCd ==
getRootCD()) {
391 while (
parent && !isAncestor) {
392 if (
parent == potentialAncestorCd) {
409 bool hasError =
false;
411 err.append(
"Null CDFamily Object.\n");
415 err.append(
"CDFamily Object Has No Root.\n");
418 err.append(
"CDFamily Object With No CDs.\n");
429 for(; fit !=
end(); ++fit)
432 acc = fit->cd->GetAccession();
444 for (
unsigned int i = 0;
i <
all.size();
i++)
449 return occurrence > 1;
454 for (
unsigned int i = 0;
i < families.size();
i++)
457 return &(families[
i]);
466 vector<CCdCore*>::iterator cdIterator = cds.begin();
467 while(cdIterator != cds.end())
473 cds.erase(cdIterator);
475 families.push_back(cdFamily);
476 cdIterator = cds.begin();
481 return families.size();
493 cdFamily.
addChild(cds[*sit], parentCD);
496 vector<CCdCore*>
tmp(cds);
498 for (
unsigned int i = 0;
i <
tmp.size();
i++)
500 if (children.
find(
i) == children.
end())
502 cds.push_back(
tmp[
i]);
516 for (
unsigned int i = 0;
i < cds.size();
i++)
519 if (acc.compare(cds[
i]->GetAccession()) == 0)
528 for (
int i = 0;
i < (
int) cds.size();
i++)
531 if (acc.compare(cds[
i]->GetClassicalParentAccession()) == 0)
534 return children.
size() > 0;
546 static const string underscore(
"_");
547 static unsigned int n;
553 bool isRoot = (cursor ==
begin());
570 while (sib != cursor.
end()) {
string GetAccession(int &Version) const
string GetClassicalParentAccession(int &Version) const
CCdCore * getClassicalParent(CCdCore *childCD) const
static bool findParent(CCdCore *cd, vector< CCdCore * > &cds)
bool isDescendant(CCdCore *cd, CCdCore *potentialDescendantCd) const
int getCdsNotOnPathToRoot(CCdCore *initialCD, vector< CCdCore * > ¬OnPath) const
CDFamilyIterator convergeTo(CCdCore *cd1, CCdCore *cd2, bool byAccession=false) const
void getDescendants(vector< CCdCore * > &cds, CCdCore *parentCD) const
int getPathToRoot(CCdCore *initialCD, vector< CCdCore * > &path) const
int getAllCD(vector< CCdCore * > &cds) const
string getNewickRepresentation() const
static void extractFamily(CCdCore *parentCD, CDFamily &cdFamily, vector< CCdCore * > &cds)
CDFamilyIterator setRootCD(CCdCore *rootCD)
static bool findChildren(CCdCore *cd, vector< CCdCore * > &cds, set< int > &children)
CCdCore * getRootCD() const
static int createFamilies(vector< CCdCore * > &cds, vector< CDFamily * > &families)
CDFamilyIterator findCDByAccession(CCdCore *cd) const
void selectCDs(const vector< CCdCore * > &cds)
void subfamily(CDFamilyIterator cit, CDFamily *&subfam, bool childrenOnly=false)
CDFamilyIterator findCD(CCdCore *cd) const
bool removeChild(CCdCore *cd)
int getSelectedCDs(vector< CCdCore * > &cds)
CDFamilyIterator addChild(CCdCore *cd, CCdCore *parentCD)
bool isDirectAncestor(CCdCore *cd, CCdCore *potentialAncestorCd) const
static bool IsFamilyValid(const CDFamily *family, string &err)
static CDFamily * findFamily(CCdCore *cd, vector< CDFamily > &families)
static bool isDup(CDFamily &one, vector< CDFamily > &all)
void getChildren(vector< CCdCore * > &cds, CCdCore *parentCD) const
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator find(const key_type &key) const
const_iterator end() const
sibling_iterator end() const
unsigned int number_of_children() const
sibling_iterator begin() const
iter append_child(iter position)
pre_order_iterator begin() const
iter insert(iter position, const T &x)
unsigned int number_of_siblings(const iterator_base &) const
pre_order_iterator end() const
CDFamilyBase::iterator CDFamilyIterator
#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.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
static const char label[]
unsigned int
A callback function used to compare two keys in a database.
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is smart and slim</td> n<td> orig</td> n</tr> n<tr> n<td> last_modified</td> n<td> optional</td> n<td> Integer</td> n<td class=\"description\"> The blob last modification If provided then the exact match will be requested with n the Cassandra storage corresponding field value</td> n<td> Positive integer Not provided means that the most recent match will be selected</td> n<td></td> n</tr> n<tr> n<td> use_cache</td> n<td> optional</td> n<td> String</td> n<td class=\"description\"> The option controls if the Cassandra LMDB cache and or database should be used It n affects the seq id resolution step and the blob properties lookup step The following n options are BIOSEQ_INFO and BLOB_PROP at all