47 orgName(rhs.orgName), rankId(rhs.rankId), rowId(rhs.rowId), cd(rhs.cd), seqName(rhs.seqName),
48 numLeaves(rhs.numLeaves),selectedLeaves(rhs.selectedLeaves)
96 return node.
rowId >= 0;
106 m_rowToTaxNode(), m_rankNameToId(), m_failedRows()
123 vector<TaxTreeIterator> nodes;
125 for (
unsigned int i = 0;
i < nodes.size();
i++)
135 nodes.push_back(taxNode);
139 while (sib != taxNode.
end())
149 for (
unsigned int i = 0;
i < rowIDs.size();
i ++)
167 if (taxIt->selectedLeaves > 0)
168 rows.push_back(taxIt->rowId);
181 while (sib != cursor.
end())
192 cursor->selectedLeaves = 1;
194 cursor->selectedLeaves = 0;
196 else if (cursor->cd == cd)
199 cursor->selectedLeaves = 1;
201 cursor->selectedLeaves = 0;
207 cursor->selectedLeaves = 1;
209 cursor->selectedLeaves = 0;
249 insert(begin(), *root);
261 for (
int i = 0;
i < num;
i++)
278 cursor->numLeaves = 0;
279 cursor->selectedLeaves = 0;
283 while (sib != cursor.
end())
289 if (cursor != begin())
292 parentIt->numLeaves += cursor->numLeaves;
293 parentIt->selectedLeaves += cursor->selectedLeaves;
299 stack<TaxNode*> lineage;
316 while (pos != end() && !(*pos == *top) ) {
333 lineage.push(parentTax);
341 while(!lineage.empty())
343 TaxNode* topNode = lineage.top();
344 cursor = append_child(cursor,*topNode);
352 vector<RowSource> rss;
356 for (
unsigned int i = 0;
i < rss.size();
i++)
362 append_child(cursor,*subSeqNode);
389 bool gotGI = aligns.
GetGI(rowID, gi,
false);
397 if (seqEntry->
IsSeq())
400 if(localTaxid != taxid)
419 if (seqDescr.
IsSet())
421 list< CRef< CSeqdesc > >& descrList = seqDescr.
Set();
422 list< CRef< CSeqdesc > >::iterator cit = descrList.begin();
424 while (cit != descrList.end())
426 if ((*cit)->IsSource())
428 cit = descrList.erase(cit);
439 descrList.push_back(
source);
450 std::ofstream fout(
".\\SeqTree\\ranks");
455 fout<<mit->first<<
' '<<mit->second<<endl;
462 ofstream os(fname.c_str());
475 ofstream os(fname.c_str());
486 if (number_of_children(cursor) > 1)
488 os <<cursor->taxId<<
","<<branchingNode->taxId<<
"\n";
489 sibling_iterator sib = cursor.begin();
490 while (sib != cursor.end())
496 else if (number_of_children(cursor) == 1)
498 sibling_iterator onlychild = child(cursor,0);
503 os<<cursor->seqName<<
","<<branchingNode->taxId<<
"\n";
513 if (cursor->rowId >= 0)
520 if (number_of_children(cursor) > 1)
523 sibling_iterator sib = cursor.begin();
524 while (sib != cursor.end())
530 if (number_of_children(cursor) > 1)
536 if (cursor == begin())
539 else if (number_of_siblings(cursor) > 1)
556 while (parentNode != begin())
558 if (parentNode->rankId == rank)
562 oneBeforeParentNode = parentNode;
563 parentNode = parent(parentNode);
567 return oneBeforeParentNode;
bool GetGI(int row, TGi &gi, bool ignorePDBs=true) const
bool GetSeqEntryForRow(int row, CRef< CSeq_entry > &seqEntry) const
bool Get_GI_or_PDB_String_FromAlignment(int row, std::string &result) const
const RowSourceTable & GetRowSourceTable() const
bool isCDInScope(CCdCore *cd) const
string GetAccession(int &Version) const
TTaxId SetTaxId(TTaxId tax_id)
@Seq_descr.hpp User-defined methods of the data storage class.
int findEntries(int row, vector< RowSource > &src, bool scopedOnly=false) const
virtual short GetRankID(TTaxId taxId, string &rankName)
virtual TTaxId GetTaxIDFromBioseq(const CBioseq &bioseq, bool lookInBioseq)
virtual TTaxId GetParentTaxID(TTaxId taxid)
virtual TTaxId GetTaxIDForGI(TGi gi)
virtual string GetTaxNameForTaxID(TTaxId taxid)
static bool isSubSeqLeaf(const TaxNode &node)
static TaxNode * makeTaxNode(TTaxId taxID, std::string taxName, short rankId=-1)
static bool isSeqLeaf(const TaxNode &node)
static TaxNode * makeSeqLeaf(int rowID, std::string sequenceName)
static TaxNode * makeSubSeqLeaf(int rowID, CCdCore *cd, int rowInCd)
bool writeToFile(string fname) const
short getRankId(string rankName)
void growAndInsertLineage(stack< TaxNode * > &lineage)
RankNameToId m_rankNameToId
void addTaxToBioseq(CBioseq &bioseq, TTaxId taxid, string &taxName)
bool writeToFileAsTable(string fname) const
TaxTreeData(const AlignmentCollection &ac)
const AlignmentCollection & m_ac
TaxClient * m_taxDataSource
int getAllLeafNodes(const TaxTreeIterator &taxNode, vector< TaxTreeIterator > &nodes) const
vector< int > m_failedRows
void fillLeafCount(const TaxTreeIterator &cursor)
void setSelections(const vector< int > &rowIDs, CCdCore *cd=0)
bool write(std::ostream &os, const iterator &cursor) const
RowToTaxNode m_rowToTaxNode
void addSeqTax(int rowID, string seqName, TTaxId taxid)
TTaxId GetTaxIDForSequence(const AlignmentCollection &aligns, int rowID)
void selectTaxTreeLeaf(const TaxTreeIterator &cursor, bool select, CCdCore *cd=0)
TaxTreeIterator getParentAtRank(int row, string rankName)
void selectTaxNode(TaxTreeIterator &taxNode, bool select)
void insertLineage(TaxTreeIterator &pos, stack< TaxNode * > &lineage)
int getSelections(vector< int > &rows)
bool writeAsTable(std::ostream &os, const iterator &cursor, const iterator &branchingNode) const
void cacheRank(short rank, string rankName)
void deselectAllTaxNodes()
void addRows(const AlignmentCollection &ac)
container_type::iterator iterator
const_iterator begin() const
const_iterator end() const
iterator_bool insert(const value_type &val)
container_type::value_type value_type
const_iterator find(const key_type &key) const
sibling_iterator end() const
unsigned int number_of_children() const
sibling_iterator begin() const
static void DLIST_NAME() init(DLIST_LIST_TYPE *list)
SStrictId_Tax::TId TTaxId
Taxon id type.
#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.
void SetTaxname(const TTaxname &value)
Assign a value to Taxname data member.
const TSeq & GetSeq(void) const
Get the variant data.
bool IsSeq(void) const
Check if variant Seq is selected.
TSeq & SetSeq(void)
Select the variant.
bool IsSet(void) const
Check if a value has been assigned to data member.
void SetDescr(TDescr &value)
Assign a value to Descr data member.
Tdata & Set(void)
Assign a value to data member.
const CharType(& source)[N]
#define row(bind, expected)