NCBI C++ ToolKit
Org_ref.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: Org_ref.cpp 95873 2022-01-08 17:43:20Z stakhovv $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: NCBI Staff
27  *
28  * File Description:
29  * Convenience methods for COrg_ref object
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using specifications from the ASN data definition file
34  * 'seqfeat.asn'.
35  */
36 
37 // standard includes
38 
39 // generated includes
40 #include <ncbi_pch.hpp>
44 
45 // generated classes
46 
48 
49 BEGIN_objects_SCOPE // namespace ncbi::objects::
50 
51 // destructor
53 {
54 }
55 
56 // Appends a label to "label" based on content
57 void COrg_ref::GetLabel(string* label) const
58 {
59  if (IsSetTaxname()) {
60  *label += GetTaxname();
61  } else if (IsSetCommon()) {
62  *label += GetCommon();
63  } else if (IsSetDb()) {
64  GetDb().front()->GetLabel(label);
65  }
66 }
67 
68 static const char* const s_taxonName = "taxon" ;
69 static const string s_nomenclature = "nomenclature=";
70 
71 TTaxId
73 {
74  if( ! IsSetDb() ) {
75  return ZERO_TAX_ID;
76  }
77  const TDb& lDbTags = GetDb();
78 
79  for(TDb::const_iterator i = lDbTags.begin();
80  i != lDbTags.end();
81  ++i) {
82  if( i->GetPointer()
83  && i->GetObject().GetDb().compare(s_taxonName) == 0 ) {
84  const CObject_id& id = i->GetObject().GetTag();
85  if( id.IsId() )
86  return TAX_ID_FROM(CObject_id::TId, id.GetId());
87  }
88  }
89  return ZERO_TAX_ID;
90 }
91 
92 TTaxId
94 {
95  TTaxId old_id = ZERO_TAX_ID;
96 
97  TDb& lDbTags = SetDb();
98  // Try to update existing tax id first
99  for(TDb::iterator i = lDbTags.begin();
100  i != lDbTags.end();
101  ++i) {
102  if( *i && i->GetObject().GetDb() == s_taxonName ) {
103  CObject_id& id = i->GetObject().SetTag();
104  if( id.IsId() )
105  old_id = TAX_ID_FROM(CObject_id::TId, id.GetId());
106  id.SetId() = TAX_ID_TO(CObject_id::TId, tax_id);
107  return old_id;
108  }
109  }
110  // Add new tag
111  CRef< CDbtag > ref( new CDbtag() );
112  ref->SetDb( s_taxonName );
113  ref->SetTag().SetId(TAX_ID_TO(CObject_id::TId, tax_id) );
114  SetDb().push_back( ref );
115 
116  return old_id;
117 }
118 
119 bool COrg_ref::IsSetLineage(void) const
120 {
121  return IsSetOrgname () && GetOrgname ().IsSetLineage ();
122 }
123 
124 const string& COrg_ref::GetLineage(void) const
125 {
126  return GetOrgname ().GetLineage ();
127 }
128 
129 bool COrg_ref::IsSetGcode(void) const
130 {
131  return IsSetOrgname () && GetOrgname ().IsSetGcode ();
132 }
133 
134 int COrg_ref::GetGcode(void) const
135 {
136  return GetOrgname ().GetGcode ();
137 }
138 
139 bool COrg_ref::IsSetMgcode(void) const
140 {
141  return IsSetOrgname () && GetOrgname ().IsSetMgcode ();
142 }
143 
144 int COrg_ref::GetMgcode(void) const
145 {
146  return GetOrgname ().GetMgcode ();
147 }
148 
149 bool COrg_ref::IsSetPgcode(void) const
150 {
151  return IsSetOrgname () && GetOrgname ().IsSetPgcode ();
152 }
153 
154 int COrg_ref::GetPgcode(void) const
155 {
156  return GetOrgname ().GetPgcode ();
157 }
158 
159 bool COrg_ref::IsSetDivision(void) const
160 {
161  return IsSetOrgname () && GetOrgname ().IsSetDiv ();
162 }
163 
164 const string& COrg_ref::GetDivision(void) const
165 {
166  return GetOrgname ().GetDiv ();
167 }
168 
169 bool COrg_ref::IsSetOrgMod(void) const
170 {
171  return IsSetOrgname () && GetOrgname ().IsSetMod ();
172 }
173 
174 
176 {
177  string taxname = "";
178  if (IsSetTaxname()) {
179  taxname = GetTaxname();
180  }
181  // Look for modifiers in taxname after first two words
182  size_t pos = NStr::Find (taxname, " ");
183  if (pos == string::npos) {
184  taxname = "";
185  } else {
186  taxname = taxname.substr(pos + 1);
188  pos = NStr::Find (taxname, " ");
189  if (pos == string::npos) {
190  taxname = "";
191  } else {
192  taxname = taxname.substr(pos + 1);
194  }
195  }
196  return taxname;
197 }
198 
199 
200 bool s_FindWholeWord (string taxname, string value)
201 {
202  if (NStr::IsBlank(taxname) || NStr::IsBlank(value)) {
203  return false;
204  }
205  size_t pos = NStr::Find (taxname, value);
206  size_t value_len = value.length();
207  while (pos != string::npos
208  && ( ( (pos != 0 && isalpha (taxname.c_str()[pos - 1]))
209  || isalpha (taxname.c_str()[pos + value_len])))) {
210  pos = NStr::Find(taxname, value, pos + value_len);
211  }
212  if (pos == string::npos) {
213  return false;
214  } else {
215  return true;
216  }
217 }
218 
219 
220 bool COrg_ref::IsVarietyValid(const string& variety) const
221 {
222  if (NStr::IsBlank(variety)) {
223  return true;
224  }
225  string taxname = x_GetTaxnameAfterFirstTwoWords();
226  return s_FindWholeWord(taxname, variety);
227 }
228 
229 
231 {
232  if (!IsSetOrgname() || !GetOrgname().IsSetMod()) {
233  return false;
234  }
236  if ((*it)->IsSetSubtype() && (*it)->GetSubtype() == COrgMod::eSubtype_variety
237  && (*it)->IsSetSubname() && !NStr::IsBlank((*it)->GetSubname())
238  && IsVarietyValid((*it)->GetSubname())) {
239  return true;
240  }
241  }
242  return false;
243 }
244 
245 
246 bool COrg_ref::IsSubspeciesValid(const string& subspecies) const
247 {
248  if (NStr::IsBlank(subspecies)) {
249  return true;
250  }
251  string taxname = x_GetTaxnameAfterFirstTwoWords();
252  if (s_FindWholeWord(taxname, subspecies)) {
253  return true;
254  } else {
255  return HasValidVariety();
256  }
257 
258 }
259 
260 
261 #define MAKE_COMMON(o1,o2,o3,Field) if (o1.IsSet##Field() && o2.IsSet##Field() && NStr::Equal(o1.Get##Field(), o2.Get##Field())) o3.Set##Field(o1.Get##Field());
262 
263 void s_MakeCommonStringList(const list< string >& list1, const list< string >& list2, list< string >& list3)
264 {
265  ITERATE(list< string >, it1, list1) {
266  bool found = false;
267  ITERATE(list< string >, it2, list2) {
268  if (NStr::Equal(*it1, *it2)) {
269  found = true;
270  break;
271  }
272  }
273  if (found) {
274  list3.push_back(*it1);
275  }
276  }
277 }
278 
279 
281 {
282  TTaxId taxid1 = GetTaxId();
283  TTaxId taxid2 = other.GetTaxId();
284  if (taxid1 != taxid2) {
285  return CRef<COrg_ref>();
286  }
287 
288  CRef<COrg_ref> common(new COrg_ref());
289  if (Equals(other)) {
290  common->Assign(*this);
291  } else {
292  MAKE_COMMON((*this), other, (*common), Taxname);
293  MAKE_COMMON((*this), other, (*common), Common);
294 
295  // common mods
296  if (IsSetMod() && other.IsSetMod()) {
297  s_MakeCommonStringList(GetMod(), other.GetMod(), common->SetMod());
298  if (common->GetMod().empty()) {
299  common->ResetMod();
300  }
301  }
302 
303  // common synonyms
304  if (IsSetSyn() && other.IsSetSyn()) {
305  s_MakeCommonStringList(GetSyn(), other.GetSyn(), common->SetSyn());
306  if (common->GetSyn().empty()) {
307  common->ResetSyn();
308  }
309  }
310 
311  // common dbtags
312  if (IsSetDb() && other.IsSetDb()) {
313  ITERATE(TDb, it1, GetDb()) {
314  bool found = false;
315  ITERATE(TDb, it2, GetDb()) {
316  if ((*it1)->Equals(**it2)) {
317  found = true;
318  break;
319  }
320  }
321  if (found) {
322  CRef<CDbtag> add(new CDbtag());
323  add->Assign(**it1);
324  common->SetDb().push_back(add);
325  }
326  }
327  }
328 
329  // common orgname
330  if (IsSetOrgname() && other.IsSetOrgname()) {
331  CRef<COrgName> orgname = GetOrgname().MakeCommon(other.GetOrgname());
332  if (orgname) {
333  common->SetOrgname().Assign(*orgname);
334  }
335  }
336  }
337 
338  return common;
339 }
340 
341 
344 static vector<string> s_CommonTaxnameList;
345 static bool s_OrgRefMapInitialized = false;
346 DEFINE_STATIC_FAST_MUTEX(s_OrgRefMapMutex);
347 
348 // automatically generated include file
349 #include "common_tax.inc"
350 
351 static void s_ProcessOrgRefMapLine(const CTempString& line)
352 {
353  vector<string> tokens;
354  NStr::Split(line, "\t", tokens);
355  if (tokens.size() != 8) {
356  // ERR_POST_X(1, Warning << "Bad format in common_tax.txt entry " << line
357  // << "; disregarding");
358  } else {
359  NON_CONST_ITERATE(vector<string>, t, tokens) {
361  if (NStr::Equal(*t, "-")) {
362  *t = kEmptyStr;
363  }
364  }
365 
366  s_CommonTaxnameList.push_back(tokens[0]);
367  CRef<COrg_ref> org(new COrg_ref());
368  org->SetTaxname(tokens[0]);
369  if (!NStr::IsBlank(tokens[1])) {
370  org->SetCommon(tokens[1]);
371  }
372 
373  if (!NStr::IsBlank(tokens[2])) {
374  try {
375  org->SetOrgname().SetGcode(NStr::StringToNonNegativeInt(tokens[2]));
376  } catch (CException&) {
377  }
378  }
379  if (!NStr::IsBlank(tokens[3])) {
380  try {
381  org->SetOrgname().SetMgcode(NStr::StringToNonNegativeInt(tokens[3]));
382  } catch (CException&) {
383  }
384  }
385  if (!NStr::IsBlank(tokens[4])) {
386  try {
387  org->SetOrgname().SetPgcode(NStr::StringToNonNegativeInt(tokens[4]));
388  } catch (CException&) {
389  }
390  }
391 
392  if (!NStr::IsBlank(tokens[5])) {
393  try {
394  CRef<CDbtag>taxon(new CDbtag());
395  taxon->SetDb("taxon");
396  taxon->SetTag().SetId(NStr::StringToNonNegativeInt(tokens[5]));
397  org->SetDb().push_back(taxon);
398  } catch (CException&) {
399  }
400  }
401 
402  if (!NStr::IsBlank(tokens[6])) {
403  org->SetOrgname().SetDiv(tokens[6]);
404  }
405 
406  if (!NStr::IsBlank(tokens[7])) {
407  org->SetOrgname().SetLineage(tokens[7]);
408  }
409 
410  s_OrgRefMap[tokens[0]] = org;
411  }
412 }
413 
414 
415 static void s_InitializeOrgRefMap(void)
416 {
417  CFastMutexGuard GUARD(s_OrgRefMapMutex);
419  return;
420  }
421  string file = g_FindDataFile("common_tax.txt");
423  if (!file.empty()) {
424  LOG_POST("Reading from " + file + " for popular organisms.");
425  try {
426  lr = ILineReader::New(file);
427  } NCBI_CATCH("s_InitializeOrgRefMap")
428  } else {
429  LOG_POST("Falling back on built-in data for popular organisms.");
430  }
431 
432  if (lr.Empty()) {
433  size_t num_orgrefs = sizeof(kOrgRefList) / sizeof(char *);
434  for (size_t i = 0; i < num_orgrefs; i++) {
435  const char *p = kOrgRefList[i];
437  }
438  } else {
439  do {
440  s_ProcessOrgRefMapLine(*++*lr);
441  } while (!lr->AtEOF());
442  }
443 
444  s_OrgRefMapInitialized = true;
445 }
446 
447 
449 {
451  TOrgrefMap::iterator it = s_OrgRefMap.find(taxname);
452  if (it != s_OrgRefMap.end()) {
453  return CConstRef<COrg_ref>(it->second.GetPointer());
454  }
455  return CConstRef<COrg_ref>();
456 }
457 
458 
460 {
461  if (!IsSetTaxname() || NStr::IsBlank(GetTaxname())) {
462  return false;
463  }
465  if (lookup) {
466  if (lookup->IsSetCommon() && !NStr::IsBlank(lookup->GetCommon())) {
467  SetCommon(lookup->GetCommon());
468  }
469  if (lookup->IsSetGcode()) {
470  SetOrgname().SetGcode(lookup->GetGcode());
471  }
472  if (lookup->IsSetMgcode()) {
473  SetOrgname().SetMgcode(lookup->GetMgcode());
474  }
475  if (lookup->IsSetDivision()) {
476  SetOrgname().SetDiv(lookup->GetDivision());
477  }
478  if (lookup->IsSetDb()) {
479  CObject_id::TId taxid = 0;
480  ITERATE(TDb, it, lookup->GetDb()) {
481  if ((*it)->IsSetDb() &&
482  (*it)->IsSetTag() &&
483  (*it)->GetTag().IsId() &&
484  NStr::Equal((*it)->GetDb(), "taxon")) {
485  taxid = (*it)->GetTag().GetId();
486  break;
487  }
488  }
489  if (taxid > 0) {
491  }
492  }
493  if (lookup->IsSetLineage()) {
494  SetOrgname().SetLineage(lookup->GetOrgname().GetLineage());
495  }
496  return true;
497  } else {
498  return false;
499  }
500 }
501 
502 
503 const vector<string>& COrg_ref::GetTaxnameList()
504 {
506  return s_CommonTaxnameList;
507 }
508 
509 
511 {
512  ResetSyn();
513 }
514 
515 #define NO_FLAG(a,f) (( a & f ) == 0)
516 
518 {
519  if( to_remain == eOrgref_all ) {
520  return;
521  } else if( to_remain == eOrgref_nothing ) {
522  Reset();
523  } else {
524  if( NO_FLAG( to_remain, eOrgref_taxname ) && IsSetTaxname() ) {
525  ResetTaxname();
526  }
527  if( NO_FLAG( to_remain, eOrgref_common ) && IsSetCommon() ) {
528  ResetCommon();
529  }
530  if( NO_FLAG( to_remain, eOrgref_mod ) && IsSetMod() ) {
531  ResetMod();
532  }
533  if( IsSetDb() ) {
534  if( NO_FLAG( to_remain, eOrgref_db_all ) ) {
535  ResetDb();
536  } else {
537  if( NO_FLAG( to_remain, eOrgref_db_taxid ) ) {
538  TDb& lDbTags = SetDb();
539  for(TDb::iterator i = lDbTags.begin(); i != lDbTags.end(); ) {
540  if( *i && i->GetObject().GetDb() == s_taxonName ) {
541  i = lDbTags.erase( i );
542  } else {
543  ++i;
544  }
545  }
546  }
547  }
548  }
549  if( NO_FLAG( to_remain, eOrgref_syn ) && IsSetSyn() ) {
550  ResetSyn();
551  }
552  if( IsSetOrgname() ) {
553  if( NO_FLAG( to_remain, eOrgref_on_all ) ) {
554  ResetOrgname();
555  } else {
556  COrgName& on = SetOrgname();
557  if( NO_FLAG( to_remain, eOrgref_on_name ) && on.IsSetName() ) {
558  on.ResetName();
559  }
560  if( on.IsSetMod() ) {
561  if( NO_FLAG( to_remain, eOrgref_on_mod ) && on.IsSetMod() ) {
562  on.ResetMod();
563  } else { // Filter out the rest mods
564  if( NO_FLAG( to_remain, eOrgref_on_mod_nom ) ) {
565  on.ResetNomenclature();
566  }
567  if( NO_FLAG( to_remain, eOrgref_on_mod_oldname ) ) {
569  }
570  if( NO_FLAG( to_remain, eOrgref_on_mod_tm ) ) {
572  }
573  }
574  }
575  if( on.IsSetAttrib() ) {
576  if( NO_FLAG( to_remain, eOrgref_on_attr_all ) ) {
577  on.ResetAttrib();
578  } else {
579  if( NO_FLAG( to_remain, eOrgref_on_attr_nofwd ) && on.IsModifierForwardingDisabled() ) {
581  }
582  }
583  }
584  if( NO_FLAG( to_remain, eOrgref_on_lin ) && on.IsSetLineage() ) {
585  on.ResetLineage();
586  }
587  if( NO_FLAG( to_remain, eOrgref_on_gc ) && on.IsSetGcode() ) {
588  on.ResetGcode();
589  }
590  if( NO_FLAG( to_remain, eOrgref_on_mgc ) && on.IsSetMgcode() ) {
591  on.ResetMgcode();
592  }
593  if( NO_FLAG( to_remain, eOrgref_on_pgc ) && on.IsSetPgcode() ) {
594  on.ResetPgcode();
595  }
596  if( NO_FLAG( to_remain, eOrgref_on_div ) && on.IsSetDiv() ) {
597  on.ResetDiv();
598  }
599 
600  }
601  }
602  }
603 }
604 
605 
606 END_objects_SCOPE // namespace ncbi::objects::
607 
609 
610 /* Original file checksum: lines: 61, chars: 1882, CRC32: c3300cc2 */
bool s_FindWholeWord(string taxname, string value)
Definition: Org_ref.cpp:200
static const string s_nomenclature
Definition: Org_ref.cpp:69
static TOrgrefMap s_OrgRefMap
Definition: Org_ref.cpp:343
static void s_ProcessOrgRefMapLine(const CTempString &line)
Definition: Org_ref.cpp:351
static bool s_OrgRefMapInitialized
Definition: Org_ref.cpp:345
void s_MakeCommonStringList(const list< string > &list1, const list< string > &list2, list< string > &list3)
Definition: Org_ref.cpp:263
#define NO_FLAG(a, f)
Definition: Org_ref.cpp:515
static vector< string > s_CommonTaxnameList
Definition: Org_ref.cpp:344
static void s_InitializeOrgRefMap(void)
Definition: Org_ref.cpp:415
map< string, CRef< COrg_ref >, PNocase > TOrgrefMap
Definition: Org_ref.cpp:342
DEFINE_STATIC_FAST_MUTEX(s_OrgRefMapMutex)
static const char *const s_taxonName
Definition: Org_ref.cpp:68
#define MAKE_COMMON(o1, o2, o3, Field)
Definition: Org_ref.cpp:261
CConstRef –.
Definition: ncbiobj.hpp:1266
Definition: Dbtag.hpp:53
unsigned int RemoveModBySubtype(COrgMod::ESubtype to_remove)
Definition: OrgName.cpp:428
CRef< COrgName > MakeCommon(const COrgName &other) const
Definition: OrgName.cpp:323
void EnableModifierForwarding()
Definition: OrgName.cpp:315
bool IsModifierForwardingDisabled() const
Definition: OrgName.cpp:305
void ResetNomenclature()
Definition: OrgName.cpp:422
TTaxId GetTaxId() const
Definition: Org_ref.cpp:72
void CleanForGenBank()
Definition: Org_ref.cpp:510
void GetLabel(string *label) const
Definition: Org_ref.cpp:57
const string & GetLineage(void) const
Definition: Org_ref.cpp:124
static CConstRef< COrg_ref > TableLookup(const string &taxname)
Definition: Org_ref.cpp:448
unsigned int fOrgref_parts
Definition: Org_ref.hpp:94
const string & GetDivision(void) const
Definition: Org_ref.cpp:164
TTaxId SetTaxId(TTaxId tax_id)
Definition: Org_ref.cpp:93
CRef< COrg_ref > MakeCommon(const COrg_ref &other) const
Definition: Org_ref.cpp:280
bool UpdateFromTable()
Definition: Org_ref.cpp:459
int GetPgcode(void) const
Definition: Org_ref.cpp:154
bool IsSetDivision(void) const
Definition: Org_ref.cpp:159
bool HasValidVariety() const
Definition: Org_ref.cpp:230
bool IsSetPgcode(void) const
Definition: Org_ref.cpp:149
bool IsSetGcode(void) const
Definition: Org_ref.cpp:129
bool IsSetMgcode(void) const
Definition: Org_ref.cpp:139
~COrg_ref(void)
Definition: Org_ref.cpp:52
int GetMgcode(void) const
Definition: Org_ref.cpp:144
void FilterOutParts(fOrgref_parts to_remain)
Definition: Org_ref.cpp:517
string x_GetTaxnameAfterFirstTwoWords() const
Definition: Org_ref.cpp:175
@ eOrgref_mod
Definition: Org_ref.hpp:58
@ eOrgref_on_mod_nom
Definition: Org_ref.hpp:74
@ eOrgref_taxname
Definition: Org_ref.hpp:56
@ eOrgref_on_mod
Definition: Org_ref.hpp:73
@ eOrgref_on_all
Definition: Org_ref.hpp:83
@ eOrgref_on_lin
Definition: Org_ref.hpp:78
@ eOrgref_nothing
Definition: Org_ref.hpp:55
@ eOrgref_on_div
Definition: Org_ref.hpp:82
@ eOrgref_on_mod_oldname
Definition: Org_ref.hpp:75
@ eOrgref_on_name
Definition: Org_ref.hpp:67
@ eOrgref_all
Definition: Org_ref.hpp:86
@ eOrgref_db_taxid
Definition: Org_ref.hpp:61
@ eOrgref_db_all
Definition: Org_ref.hpp:62
@ eOrgref_on_attr_all
Definition: Org_ref.hpp:72
@ eOrgref_on_mgc
Definition: Org_ref.hpp:80
@ eOrgref_on_attr_nofwd
Definition: Org_ref.hpp:70
@ eOrgref_on_pgc
Definition: Org_ref.hpp:81
@ eOrgref_common
Definition: Org_ref.hpp:57
@ eOrgref_syn
Definition: Org_ref.hpp:64
@ eOrgref_on_mod_tm
Definition: Org_ref.hpp:76
@ eOrgref_on_gc
Definition: Org_ref.hpp:79
static const vector< string > & GetTaxnameList()
Definition: Org_ref.cpp:503
COrg_ref(void)
Definition: Org_ref.hpp:156
int GetGcode(void) const
Definition: Org_ref.cpp:134
bool IsVarietyValid(const string &variety) const
Definition: Org_ref.cpp:220
bool IsSetOrgMod(void) const
Definition: Org_ref.cpp:169
bool IsSubspeciesValid(const string &subspecies) const
Definition: Org_ref.cpp:246
bool IsSetLineage(void) const
Definition: Org_ref.cpp:119
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
container_type::iterator iterator
Definition: map.hpp:54
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
Definition: map.hpp:338
static int lookup(const char *name, const struct lookup_int *table)
Definition: attributes.c:50
#define ZERO_TAX_ID
Definition: ncbimisc.hpp:1115
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define TAX_ID_TO(T, tax_id)
Definition: ncbimisc.hpp:1110
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
SStrictId_Tax::TId TTaxId
Taxon id type.
Definition: ncbimisc.hpp:1048
#define TAX_ID_FROM(T, value)
Definition: ncbimisc.hpp:1111
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
Definition: ncbiexpt.hpp:580
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
Definition: line_reader.cpp:49
virtual bool AtEOF(void) const =0
Indicates (negatively) whether there is any more input.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:719
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static int StringToNonNegativeInt(const CTempString str, TStringToNumFlags flags=0)
Convert string to non-negative integer value.
Definition: ncbistr.cpp:457
#define kEmptyStr
Definition: ncbistr.hpp:123
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
Definition: ncbistr.cpp:3461
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3201
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
Definition: ncbistr.cpp:2891
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
Definition: ncbistr.hpp:5384
static const char label[]
void SetTag(TTag &value)
Assign a value to Tag data member.
Definition: Dbtag_.cpp:66
void SetDb(const TDb &value)
Assign a value to Db data member.
Definition: Dbtag_.hpp:229
void ResetDiv(void)
Reset Div data member.
Definition: OrgName_.cpp:280
void ResetMod(void)
Reset Mod data member.
Definition: OrgName_.cpp:268
void ResetAttrib(void)
Reset Attrib data member.
Definition: OrgName_.cpp:262
bool IsSetDb(void) const
ids in taxonomic or culture dbases Check if a value has been assigned to Db data member.
Definition: Org_ref_.hpp:479
TCommon & SetCommon(void)
Assign a value to Common data member.
Definition: Org_ref_.hpp:442
const TLineage & GetLineage(void) const
Get the Lineage member data.
Definition: OrgName_.hpp:864
bool IsSetPgcode(void) const
plastid genetic code Check if a value has been assigned to Pgcode data member.
Definition: OrgName_.hpp:1040
const TDiv & GetDiv(void) const
Get the Div member data.
Definition: OrgName_.hpp:1005
void ResetMgcode(void)
Reset Mgcode data member.
Definition: OrgName_.hpp:958
void ResetLineage(void)
Reset Lineage data member.
Definition: OrgName_.cpp:274
TMgcode GetMgcode(void) const
Get the Mgcode member data.
Definition: OrgName_.hpp:965
TGcode GetGcode(void) const
Get the Gcode member data.
Definition: OrgName_.hpp:918
void SetCommon(const TCommon &value)
Assign a value to Common data member.
Definition: Org_ref_.hpp:428
bool IsSetCommon(void) const
common name Check if a value has been assigned to Common data member.
Definition: Org_ref_.hpp:407
TDb & SetDb(void)
Assign a value to Db data member.
Definition: Org_ref_.hpp:497
virtual void Reset(void)
Reset the whole object.
Definition: Org_ref_.cpp:99
void ResetSyn(void)
Reset Syn data member.
Definition: Org_ref_.cpp:76
bool IsSetLineage(void) const
lineage with semicolon separators Check if a value has been assigned to Lineage data member.
Definition: OrgName_.hpp:852
vector< CRef< CDbtag > > TDb
Definition: Org_ref_.hpp:101
bool IsSetMod(void) const
unstructured modifiers Check if a value has been assigned to Mod data member.
Definition: Org_ref_.hpp:454
void SetDiv(const TDiv &value)
Assign a value to Div data member.
Definition: OrgName_.hpp:1014
TSyn & SetSyn(void)
Assign a value to Syn data member.
Definition: Org_ref_.hpp:522
TOrgname & SetOrgname(void)
Assign a value to Orgname data member.
Definition: Org_ref_.cpp:92
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
Definition: Org_ref_.hpp:372
bool IsSetMgcode(void) const
mitochondrial genetic code Check if a value has been assigned to Mgcode data member.
Definition: OrgName_.hpp:946
void ResetGcode(void)
Reset Gcode data member.
Definition: OrgName_.hpp:911
void ResetTaxname(void)
Reset Taxname data member.
Definition: Org_ref_.cpp:52
const TCommon & GetCommon(void) const
Get the Common member data.
Definition: Org_ref_.hpp:419
const TDb & GetDb(void) const
Get the Db member data.
Definition: Org_ref_.hpp:491
void ResetPgcode(void)
Reset Pgcode data member.
Definition: OrgName_.hpp:1052
const TSyn & GetSyn(void) const
Get the Syn member data.
Definition: Org_ref_.hpp:516
bool IsSetDiv(void) const
GenBank division code Check if a value has been assigned to Div data member.
Definition: OrgName_.hpp:993
void SetTaxname(const TTaxname &value)
Assign a value to Taxname data member.
Definition: Org_ref_.hpp:381
bool IsSetMod(void) const
Check if a value has been assigned to Mod data member.
Definition: OrgName_.hpp:827
void ResetCommon(void)
Reset Common data member.
Definition: Org_ref_.cpp:58
void ResetMod(void)
Reset Mod data member.
Definition: Org_ref_.cpp:64
list< CRef< COrgMod > > TMod
Definition: OrgName_.hpp:332
void ResetOrgname(void)
Reset Orgname data member.
Definition: Org_ref_.cpp:82
void SetGcode(TGcode value)
Assign a value to Gcode data member.
Definition: OrgName_.hpp:927
void SetMgcode(TMgcode value)
Assign a value to Mgcode data member.
Definition: OrgName_.hpp:974
bool IsSetAttrib(void) const
attribution of name Check if a value has been assigned to Attrib data member.
Definition: OrgName_.hpp:780
void ResetDb(void)
Reset Db data member.
Definition: Org_ref_.cpp:70
bool IsSetOrgname(void) const
Check if a value has been assigned to Orgname data member.
Definition: Org_ref_.hpp:529
bool IsSetTaxname(void) const
preferred formal name Check if a value has been assigned to Taxname data member.
Definition: Org_ref_.hpp:360
void ResetName(void)
Reset Name data member.
Definition: OrgName_.cpp:245
TMod & SetMod(void)
Assign a value to Mod data member.
Definition: Org_ref_.hpp:472
bool IsSetGcode(void) const
genetic code (see CdRegion) Check if a value has been assigned to Gcode data member.
Definition: OrgName_.hpp:899
void SetOrgname(TOrgname &value)
Assign a value to Orgname data member.
Definition: Org_ref_.cpp:87
const TMod & GetMod(void) const
Get the Mod member data.
Definition: Org_ref_.hpp:466
bool IsSetSyn(void) const
synonyms for taxname or common Check if a value has been assigned to Syn data member.
Definition: Org_ref_.hpp:504
TPgcode GetPgcode(void) const
Get the Pgcode member data.
Definition: OrgName_.hpp:1059
bool IsSetName(void) const
Check if a value has been assigned to Name data member.
Definition: OrgName_.hpp:759
void SetLineage(const TLineage &value)
Assign a value to Lineage data member.
Definition: OrgName_.hpp:873
const TOrgname & GetOrgname(void) const
Get the Orgname member data.
Definition: Org_ref_.hpp:541
@ eSubtype_variety
Definition: OrgMod_.hpp:89
@ eSubtype_old_name
Definition: OrgMod_.hpp:124
@ eSubtype_type_material
Definition: OrgMod_.hpp:121
FILE * file
int i
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
EIPRangeType t
Definition: ncbi_localip.c:101
int isalpha(Uchar c)
Definition: ncbictype.hpp:61
string g_FindDataFile(const CTempString &name, CDirEntry::EType type=CDirEntry::eFile)
Look for an NCBI application data file or directory of the given name and type; in general,...
Definition: util_misc.cpp:139
Modified on Thu Apr 25 08:22:08 2024 by modify_doxy.py rev. 669887