73 m_loaded = (nAdded == taxids.size());
86 if (forceClearAncestorMap || (inputType && !(
m_inputType & *inputType))) {
101 m_err =
"Failed to read preferred Taxonomy nodes from file '" + prefTaxnodeFileName +
"'.\n";
141 const list< CRef< CCdd_org_ref > >& orgList = orgRefs.
Get();
142 list< CRef< CCdd_org_ref > >::const_iterator cit = orgList.begin();
144 for (; cit != orgList.end(); cit++)
183 unsigned int nAdded = 0, nTaxa = taxids.size();
186 if (notAddedTaxids) notAddedTaxids->clear();
188 for (
unsigned int i = 0;
i < nTaxa; ++
i) {
196 cddOrgRefList.push_back(cddOrgRef);
198 }
else if (notAddedTaxids) {
199 notAddedTaxids->push_back(taxids[
i]);
201 }
else if (notAddedTaxids) {
202 notAddedTaxids->push_back(taxids[
i]);
211 unsigned int taxaIndex = 0, nAdded = 0;
213 CCdd_org_ref_set::Tdata::const_iterator cddOrgRefListCit = cddOrgRefList.begin(), citEnd = cddOrgRefList.end();
215 if (notAddedIndices) notAddedIndices->clear();
217 for (; cddOrgRefListCit != citEnd; ++cddOrgRefListCit ) {
218 taxId =
getTaxId(*cddOrgRefListCit);
220 taxids.push_back(taxId);
222 }
else if (notAddedIndices) {
223 notAddedIndices->push_back(taxaIndex);
244 if (taxClient && tit == titEnd) {
278 priorityTaxid = taxidIn;
284 priorityTaxid = it->first;
305 orgNode = &(it->second);
306 return it->second.
order;
313 orgNode = &(it->second);
314 return it->second.
order;
329 return orgNode->
order;
User-defined methods of the data storage class.
bool LoadFromFile(const string &prefTaxnodeFileName, bool doReset=false)
bool ReadPreferredTaxnodes(const string &fileName, bool reset=false)
TaxNodeInputType m_inputType
int GetPriorityTaxnode(TTaxId taxid, string &nodeName, TaxClient *taxClient=NULL)
bool GetPriorityTaxid(TTaxId taxidIn, TTaxId &priorityTaxid, TaxClient &taxClient)
virtual ~CPriorityTaxNodes()
bool IsPriorityTaxnode(TTaxId taxid)
static TTaxId getTaxId(const CRef< CCdd_org_ref > &orgRef)
static string getTaxName(const CRef< CCdd_org_ref > &orgRef)
unsigned int Load(const CCdd_pref_nodes &prefNodes, bool doReset=false)
static unsigned int CddOrgRefSetToTaxIds(const CCdd_org_ref_set &cddOrgRefSet, vector< TTaxId > &taxids, vector< int > *notAddedIndices=NULL)
CPriorityTaxNodes(TaxNodeInputType inputType)
static const string PREF_TAXNODE_FILE
static unsigned int TaxIdsToCddOrgRefSet(const vector< TTaxId > &taxids, CCdd_org_ref_set &cddOrgRefSet, TaxClient &taxClient, vector< TTaxId > *notAddedTaxids=NULL)
void BuildMap(const CCdd_pref_nodes &prefNodes, bool reset=false)
TaxidToOrgMap::iterator findAncestor(TTaxId taxid, TaxClient *taxClient)
void Reset(TaxNodeInputType *inputType=NULL, bool forceClearAncestorMap=false)
static bool isActive(const CRef< CCdd_org_ref > &orgRef)
bool GetPriorityTaxidAndName(TTaxId taxidIn, TTaxId &priorityTaxid, string &nodeName, TaxClient &taxClient)
TAncestorMap m_ancestralTaxNodeMap
TaxidToOrgMap m_selectedTaxNodesMap
void putIntoMap(const CCdd_org_ref_set &orgRefs)
virtual bool GetOrgRef(TTaxId taxId, COrg_ref &orgRef)
virtual bool IsTaxDescendant(TTaxId tax1, TTaxId tax2)
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
static bool ReadASNFromFile(const char *filename, ASNClass *ASNobject, bool isBinary, std::string *err)
SStrictId_Tax::TId TTaxId
Taxon id type.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
#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 SetActive(TActive value)
Assign a value to Active data member.
const Tdata & Get(void) const
Get the member data.
const TModel_organisms & GetModel_organisms(void) const
Get the Model_organisms member data.
bool CanGetOptional_nodes(void) const
Check if it is safe to call GetOptional_nodes method.
TActive GetActive(void) const
Get the Active member data.
list< CRef< CCdd_org_ref > > Tdata
void SetReference(TReference &value)
Assign a value to Reference data member.
bool CanGetReference(void) const
Check if it is safe to call GetReference method.
bool CanGetModel_organisms(void) const
Check if it is safe to call GetModel_organisms method.
bool CanGetPreferred_nodes(void) const
Check if it is safe to call GetPreferred_nodes method.
const TPreferred_nodes & GetPreferred_nodes(void) const
Get the Preferred_nodes member data.
Tdata & Set(void)
Assign a value to data member.
const TReference & GetReference(void) const
Get the Reference member data.
const TOptional_nodes & GetOptional_nodes(void) const
Get the Optional_nodes member data.
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
bool IsSetTaxname(void) const
preferred formal name Check if a value has been assigned to Taxname data member.
const CRef< CCdd_org_ref > orgRef