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

Go to the SVN repository for this file.

1 /* $Id: sesame_street.cpp 101739 2024-02-05 19:02:40Z kans $
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  * Authors: Sema Kachalo
27  *
28  */
29 
30 #include <ncbi_pch.hpp>
31 #include "discrepancy_core.hpp"
32 #include "utils.hpp"
42 #include <objmgr/util/sequence.hpp>
43 
47 
48 // Some animals are more equal than others...
49 
50 
51 static string OrderQual(const string& s)
52 {
53  static string names[] = {
54  "collected-by",
55  "collection-date",
56  "country",
57  "identified-by",
58  "fwd-primer-name",
59  "fwd-primer-seq",
60  "isolate",
61  "isolation-source",
62  "host",
63  "rev-primer-name",
64  "rev-primer-seq",
65  "culture-collection",
66  "plasmid-name",
67  "isolation-source"
68  "strain",
69  "note-subsrc",
70  "note-orgmod",
71  "specimen-voucher",
72  "taxname",
73  "tissue-type",
74  "taxid",
75  "altitude",
76  "location"
77  };
78  const size_t sz = ArraySize(names);
79  size_t n;
80  for (n = 0; n < sz; n++) {
81  if (names[n] == s) {
82  break;
83  }
84  }
85  if (n == sz) {
86  return s;
87  }
88  string r;
89  for (size_t i = sz; i > n; i--) {
90  r += " ";
91  }
92  return r + s;
93 }
94 
95 static void ConvertDuplicates(CReportNode& node)
96 {
97  auto& all = node["all"];
98  for (auto& qual_it: node.GetMap() ) {
99  if (qual_it.first == "all") continue;
100 
101  //cerr << qual_it.first << "\n";
102  auto& all_qual = all[qual_it.first];
103  for (auto& val_it: qual_it.second->GetMap())
104  {
105  //cerr << " " << val_it.first << ":" << val_it.second->GetObjects().size() << "\n";
106  for (auto obj: val_it.second->GetObjects())
107  {
108  if (all_qual.Exist(*obj))
109  all_qual["*"].Add(*obj, false); // duplicated
110  else
111  all_qual.Add(*obj, false);
112  }
113  }
114  }
115 }
116 
117 static void AddObjToQualMap(const string& qual, const string& val, CReportObj& obj, CReportNode& node)
118 {
119 #if 0
120  if (node["all"][qual].Exist(obj)) {
121  node["all"][qual]["*"].Add(obj, false); // duplicated
122  }
123  else {
124  node["all"][qual].Add(obj, false);
125  }
126  node[qual][val].Add(obj);
127 #else
128  //std::cerr << "Add:" << qual << ":" << val << "\n";
129  node[qual][val].Add(obj);
130 #endif
131 }
132 
133 template<>
134 class CDiscrepancyPrivateData<eTestNames::SOURCE_QUALS>
135 {
136 public:
137  void* m_UserData = nullptr;
138 };
139 
140 
141 DISCREPANCY_CASE1(SOURCE_QUALS, BIOSRC, eDisc | eOncaller | eSubmitter | eSmart | eBig | eFatal, "Some animals are more equal than others...",
142  "SOURCE_QUALS_ASNDISC",
143  "SRC_QUAL_PROBLEM",
144  "MISSING_SRC_QUAL"
145 )
146 {
147  for (const CBioSource* biosrc : context.GetBiosources()) {
148  CRef<CDiscrepancyObject> disc_obj(context.BiosourceObjRef(*biosrc));
149  m_Objs["all"].Add(*disc_obj);
150  if (biosrc->CanGetGenome() && biosrc->GetGenome() != CBioSource::eGenome_unknown) {
151  AddObjToQualMap("location", context.GetGenomeName(biosrc->GetGenome()), *disc_obj, m_Objs);
152  }
153  if (biosrc->CanGetOrg()) {
154  const COrg_ref& org_ref = biosrc->GetOrg();
155  if (org_ref.CanGetTaxname()) {
156  AddObjToQualMap("taxname", org_ref.GetTaxname(), *disc_obj, m_Objs);
157  }
158  if (org_ref.GetTaxId() != ZERO_TAX_ID) {
159  AddObjToQualMap("taxid", NStr::NumericToString(org_ref.GetTaxId()), *disc_obj, m_Objs);
160  }
161  }
162  if (biosrc->CanGetSubtype()) {
163  for (auto& it : biosrc->GetSubtype()) {
164  const CSubSource::TSubtype& subtype = it->GetSubtype();
165  if (it->CanGetName()) {
166  const string& qual = subtype == CSubSource::eSubtype_other ? "note-subsrc" : it->GetSubtypeName(subtype, CSubSource::eVocabulary_raw);
167  AddObjToQualMap(qual, it->GetName(), *disc_obj, m_Objs);
168  }
169  }
170  }
171  if (biosrc->IsSetOrgMod()) {
172  for (auto& it : biosrc->GetOrgname().GetMod()) {
173  const COrgMod::TSubtype& subtype = it->GetSubtype();
175  const string& qual = subtype == COrgMod::eSubtype_other ? "note-orgmod" : subtype == COrgMod::eSubtype_nat_host ? "host" : it->GetSubtypeName(subtype, COrgMod::eVocabulary_raw);
176  AddObjToQualMap(qual, it->GetSubname(), *disc_obj, m_Objs);
177  }
178  }
179  }
180  if (biosrc->CanGetPcr_primers()) {
181  for (auto& it : biosrc->GetPcr_primers().Get()) {
182  if (it->CanGetForward()) {
183  for (auto& pr : it->GetForward().Get()) {
184  if (pr->CanGetName()) {
185  AddObjToQualMap("fwd-primer-name", pr->GetName(), *disc_obj, m_Objs);
186  }
187  if (pr->CanGetSeq()) {
188  AddObjToQualMap("fwd-primer-seq", pr->GetSeq(), *disc_obj, m_Objs);
189  }
190  }
191  }
192  if (it->CanGetReverse()) {
193  for (auto& pr : it->GetReverse().Get()) {
194  if (pr->CanGetName()) {
195  AddObjToQualMap("rev-primer-name", pr->GetName(), *disc_obj, m_Objs);
196  }
197  if (pr->CanGetSeq()) {
198  AddObjToQualMap("rev-primer-seq", pr->GetSeq(), *disc_obj, m_Objs);
199  }
200  }
201  }
202  }
203  }
204  }
205 
206 #if 0
207  CConstRef<CSeqdesc> desc = context.GetCurrentSeqdesc();
208  if (desc.IsNull()) {
209  return;
210  }
211  CRef<CDiscrepancyObject> disc_obj(context.SeqdescObj(*desc));
212 
213  m_Objs["all"].Add(*disc_obj);
214  if (obj.CanGetGenome() && obj.GetGenome() != CBioSource::eGenome_unknown) {
215 
216  AddObjToQualMap("location", context.GetGenomeName(obj.GetGenome()), *disc_obj, m_Objs);
217  }
218  if (obj.CanGetOrg()) {
219  const COrg_ref& org_ref = obj.GetOrg();
220  if (org_ref.CanGetTaxname()) {
221 
222  AddObjToQualMap("taxname", org_ref.GetTaxname(), *disc_obj, m_Objs);
223  }
224  if (org_ref.GetTaxId()) {
225 
226  AddObjToQualMap("taxid", NStr::IntToString(org_ref.GetTaxId()), *disc_obj, m_Objs);
227  }
228  }
229  if (obj.CanGetSubtype()) {
230  ITERATE (CBioSource::TSubtype, it, obj.GetSubtype()) {
231  const CSubSource::TSubtype& subtype = (*it)->GetSubtype();
232  if ((*it)->CanGetName()) {
233 
234  const string& qual = subtype == CSubSource::eSubtype_other ? "note-subsrc" : (*it)->GetSubtypeName(subtype, CSubSource::eVocabulary_raw);
235  AddObjToQualMap(qual, (*it)->GetName(), *disc_obj, m_Objs);
236  }
237  }
238  }
239  if (obj.IsSetOrgMod()) {
240  ITERATE (list<CRef<COrgMod> >, it, obj.GetOrgname().GetMod()) {
241  const COrgMod::TSubtype& subtype = (*it)->GetSubtype();
242  if (subtype != COrgMod::eSubtype_old_name &&
243  subtype != COrgMod::eSubtype_old_lineage &&
244  subtype != COrgMod::eSubtype_gb_acronym &&
245  subtype != COrgMod::eSubtype_gb_anamorph &&
246  subtype != COrgMod::eSubtype_gb_synonym) {
247 
248  const string& qual = subtype == COrgMod::eSubtype_other ? "note-orgmod" : subtype == COrgMod::eSubtype_nat_host ? "host" : (*it)->GetSubtypeName(subtype, COrgMod::eVocabulary_raw);
249  AddObjToQualMap(qual, (*it)->GetSubname(), *disc_obj, m_Objs);
250  }
251  }
252  }
253  if (obj.CanGetPcr_primers()) {
254  ITERATE (list<CRef<CPCRReaction> >, it, obj.GetPcr_primers().Get()) {
255  if ((*it)->CanGetForward()) {
256  ITERATE (list<CRef<CPCRPrimer> >, pr, (*it)->GetForward().Get()) {
257  if ((*pr)->CanGetName()) {
258  AddObjToQualMap("fwd-primer-name", (*pr)->GetName(), *disc_obj, m_Objs);
259  }
260  if ((*pr)->CanGetSeq()) {
261  AddObjToQualMap("fwd-primer-seq", (*pr)->GetSeq(), *disc_obj, m_Objs);
262  }
263  }
264  }
265  if ((*it)->CanGetReverse()) {
266  ITERATE (list<CRef<CPCRPrimer> >, pr, (*it)->GetReverse().Get()) {
267  if ((*pr)->CanGetName()) {
268  AddObjToQualMap("rev-primer-name", (*pr)->GetName(), *disc_obj, m_Objs);
269  }
270  if ((*pr)->CanGetSeq()) {
271  AddObjToQualMap("rev-primer-seq", (*pr)->GetSeq(), *disc_obj, m_Objs);
272  }
273  }
274  }
275  }
276  }
277 #endif
278 }
279 
280 
282 {
283 public:
284  string m_Qualifier;
285  mutable string m_Value;
286  vector<string> m_Choice;
287  mutable bool m_Ask;
288  void* m_User;
290 };
294 
295 
296 static bool GetSubtypeStr(const string& qual, const string& val, const TReportObjectList& objs, string& subtype)
297 {
298  bool unique = objs.size() == 1;
299  if (unique) {
300  subtype = "[n] source[s] [has] unique value[s] for " + qual;
301  }
302  else {
303  subtype = "[n] source[s] [has] " + qual + " = " + val;
304  }
305 
306  return unique;
307 }
308 
309 
310 static void AddObjectToReport(const string& subtype, const string& qual, const string& val, bool unique, CReportObj& obj, CReportNode& report)
311 {
312  if (unique) {
313  report[subtype]["1 source has " + qual + " = " + val].Add(obj);
314  }
315  else {
316  report[subtype].Add(obj);
317  }
318 }
319 
320 
321 static void AddObjsToReport(const string& diagnosis, CReportNode::TNodeMap& all_objs, const string& qual, CReportNode& report)
322 {
323  for (auto& objs : all_objs) {
324  string subtype;
325  bool unique = GetSubtypeStr(qual, objs.first, objs.second->GetObjects(), subtype);
326  for (auto& obj : objs.second->GetObjects()) {
327  AddObjectToReport(subtype, qual, objs.first, unique, obj.GetNCObject(), report[diagnosis]);
328  }
329  }
330 }
331 
332 
333 static void AddObjsToReport(const string& diagnosis, const TStringObjVectorMap& all_objs, const string& qual, CReportNode& report)
334 {
335  for (auto& objs : all_objs) {
336  string subtype;
337  bool unique = GetSubtypeStr(qual, objs.first, objs.second, subtype);
338  for (auto& obj : objs.second) {
339  AddObjectToReport(subtype, qual, objs.first, unique, obj.GetNCObject(), report[diagnosis]);
340  }
341  }
342 }
343 
344 
345 static size_t GetNumOfObjects(CReportNode& root)
346 {
347  size_t ret = root.GetObjects().size();
348  for (auto& child : root.GetMap()) {
349  ret += GetNumOfObjects(*child.second);
350  }
351  return ret;
352 }
353 
354 
355 static size_t GetSortOrderId(const string& subitem, CReportNode& node)
356 {
357  static const size_t CEILING_VALUE = 1000000000;
358  size_t ret = NStr::Find(subitem, "[has] missing") != NPOS ||
359  NStr::Find(subitem, "isolate") != NPOS ?
360  GetNumOfObjects(node) : CEILING_VALUE - GetNumOfObjects(node);
361 
362  return ret;
363 }
364 
366 {
367  float g_SesameStreetCutoff = 0.75;
368  return g_SesameStreetCutoff;
369 }
370 
372 {
373  bool use_geo_loc_name = CSubSource::NCBI_UseGeoLocNameForCountry();
374 
375  ConvertDuplicates(m_Objs);
376 
377  CReportNode report, final_report;
378  CReportNode::TNodeMap& the_map = m_Objs.GetMap();
379  TReportObjectList& all = m_Objs["all"].GetObjects();
380  size_t total = all.size();
381  TReportObjPtrMap all_missing;
382  for (auto it: all) {
383  all_missing[it] = it;
384  }
385 
386  for (auto it: the_map) {
387  if (it.first == "all") {
388  continue;
389  }
390  string qual = it.first;
391  size_t bins = 0;
392  size_t uniq = 0;
393  size_t num = 0;
394  size_t pres = m_Objs["all"][qual].GetObjects().size();
395  size_t mul = m_Objs["all"][qual]["*"].GetObjects().size();
396  TReportObjPtrMap missing = all_missing;
397  CReportNode::TNodeMap& sub = it.second->GetMap();
399  for (auto jj: sub) {
400  TReportObjectList& obj = jj.second->GetObjects();
401  bins++;
402  num += obj.size();
403  uniq += obj.size() == 1 ? 1 : 0;
404  string upper = jj.first;
405  upper = NStr::ToUpper(upper);
406  for (auto o: obj) {
407  missing.erase(o);
408  capital[upper][jj.first].push_back(o);
409  }
410  }
411  string itfirst = it.first;
412  if (itfirst == "country" && use_geo_loc_name) {
413  itfirst = "geo_loc_name";
414  }
415  string diagnosis = OrderQual(itfirst);
416  diagnosis += " (";
417  diagnosis += pres == total ? "all present" : "some missing";
418  diagnosis += ", ";
419  diagnosis += uniq == num ? "all unique" : bins == 1 ? "all same" : "some duplicates";
420  diagnosis += mul ? ", some multi)" : ")";
421  report[diagnosis];
422 
423  if ((num != total || bins != 1)
424  && (itfirst == "collection-date" || itfirst == "country" || itfirst == "isolation-source" || itfirst == "strain" || itfirst == "isolate"
425  || itfirst == "taxname" || itfirst == "breed" || itfirst == "cultivar" || itfirst == "sex")) {
426  final_report[diagnosis].Fatal();
427  }
428 
429  if ((bins > capital.size() || (num < total && capital.size() == 1))
430  && (it.first == "country" || it.first == "collection-date" || it.first == "isolation-source")) { // autofixable
432  if (bins > capital.size()) { // capitalization
433  for (auto cap: capital) {
434  const TStringObjVectorMap& objs = cap.second;
435  if (objs.size() < 2) {
436  AddObjsToReport(diagnosis, objs, itfirst, report);
437  continue;
438  }
439  size_t best_count = 0;
441  fix->m_Qualifier = itfirst;
442  fix->m_User = m_private.m_UserData;
443  for (auto x: objs) {
444  fix->m_Choice.push_back(x.first);
445  if (best_count < x.second.size()) {
446  best_count = x.second.size();
447  fix->m_Value = x.first;
448  }
449  }
450  for (auto x: objs) {
451  for (auto o: x.second) {
452  report[diagnosis]["[n] source[s] [has] inconsistent capitalization: " + itfirst + " (" + x.first + ")"].Add(*((const CDiscrepancyObject&)*o).Clone(true, CRef<CObject>(fix.GetNCPointer())));
453  }
454  }
455  }
456  }
457  else {
458  AddObjsToReport(diagnosis, sub, itfirst, report);
459  }
460 
461  if (num < total) { // some missing
462  if (capital.size() == 1 && num / (float)total >= g_GetSesameStreetCutoff()) { // all same and autofixable
463  if (fix.IsNull()) {
465  fix->m_Qualifier = itfirst;
466  fix->m_Value = sub.begin()->first;
467  fix->m_User = m_private.m_UserData;
468  }
469  for (auto o: missing) {
470  report[diagnosis]["[n] source[s] [has] missing " + itfirst + " (" + sub.begin()->first + ")"].Add(*((const CDiscrepancyObject&)*o.second).Clone(true, CRef<CObject>(fix.GetNCPointer())));
471  }
472  }
473  else {
474  for (auto o: missing) {
475  CRef<CReportObj> r = o.second;
476  report[diagnosis]["[n] source[s] [has] missing " + itfirst].Add(*r);
477  }
478  }
479  }
480  }
481  else { // not autofixable
482  AddObjsToReport(diagnosis, sub, itfirst, report);
483  for (auto o: missing) {
484  CRef<CReportObj> r = o.second;
485  report[diagnosis]["[n] source[s] [has] missing " + it.first].Add(*r);
486  }
487  }
488 
489  static const size_t MAX_NUM_STR_LEN = 20;
490  for (auto item: report[diagnosis].GetMap()) {
491  // It builds a key for map to be looked like "[*00000000000000000123*]<old_key>" to keep a required sort order
492  size_t sort_order_id = GetSortOrderId(item.first, *item.second);
493  string sort_order_str = NStr::SizetToString(sort_order_id);
494  string leading_zeros(MAX_NUM_STR_LEN - sort_order_str.size(), '0');
495  string subitem = "[*" + leading_zeros + sort_order_str + "*]" + item.first;
496  if (!CDiscrepancySet::IsGui()) {
497  final_report[diagnosis];
498  if (item.second->GetCount()) {
499  final_report[diagnosis][subitem].SetCount(item.second->GetCount());
500  final_report[diagnosis].Incr();
501  }
502  }
503  else {
504  final_report[diagnosis][subitem] = *item.second;
505  }
506  }
507  }
508  m_ReportItems = final_report.Export(*this)->GetSubitems();
509 }
510 
511 
512 static void SetSubsource(CRef<CBioSource> bs, CSubSource::ESubtype st, const string& s, size_t& added, size_t& changed)
513 {
514  for (auto& it : bs->GetSubtype()) {
515  if (it->GetSubtype() == st) {
516  CRef<CSubSource> ss(it);
517  if (ss->GetName() != s) {
518  ss->SetName(s);
519  changed++;
520  }
521  return;
522  }
523  }
524  bs->SetSubtype().push_back(CRef<CSubSource>(new CSubSource(st, s)));
525  added++;
526 }
527 
528 
529 static void SetOrgMod(CRef<CBioSource> bs, COrgMod::ESubtype st, const string& s, size_t& added, size_t& changed)
530 {
531  for (auto& it : bs->GetOrgname().GetMod()) {
532  if (it->GetSubtype() == st) {
533  CRef<COrgMod> ss(it);
534  if (ss->GetSubname() != s) {
535  ss->SetSubname(s);
536  changed++;
537  }
538  return;
539  }
540  }
541  bs->SetOrg().SetOrgname().SetMod().push_back(CRef<COrgMod>(new COrgMod(st, s)));
542  added++;
543 }
544 
545 
546 DISCREPANCY_AUTOFIX(SOURCE_QUALS)
547 {
548  CSeqdesc* desc = const_cast<CSeqdesc*>(dynamic_cast<const CSeqdesc*>(context.FindObject(*obj)));
549  CRef<CBioSource> bs(&desc->SetSource());
550  auto* fix = dynamic_cast<const CSourseQualsAutofixData*>(obj->GetMoreInfo().GetPointer());
551  string qual = fix->m_Qualifier;
552  string val = fix->m_Value;
553  size_t added = 0;
554  size_t changed = 0;
555 
556  if (qual == "host") {
557  SetOrgMod(bs, COrgMod::eSubtype_nat_host, val, added, changed);
558  obj->SetFixed();
559  }
560  else if (qual == "strain") {
561  SetOrgMod(bs, COrgMod::eSubtype_strain, val, added, changed);
562  obj->SetFixed();
563  }
564  else if (qual == "country") {
565  SetSubsource(bs, CSubSource::eSubtype_country, val, added, changed);
566  obj->SetFixed();
567  }
568  else if (qual == "isolation-source") {
570  obj->SetFixed();
571  }
572  else if (qual == "collection-date") {
574  obj->SetFixed();
575  }
576 
577  if (changed) {
578  return CRef<CAutofixReport>(new CAutofixReport("SOURCE_QUALS: [n] qualifier[s] " + qual + " (" + val + ") fixed", (unsigned)(added + changed)));
579  }
580  else if (added) {
581  return CRef<CAutofixReport>(new CAutofixReport("SOURCE_QUALS: [n] missing qualifier[s] " + qual + " (" + val + ") added", (unsigned)added));
582  }
583  return CRef<CAutofixReport>();
584 
585 #if 0
586  TReportObjectList list = item->GetDetails();
587  const CSourseQualsAutofixData* fix = nullptr;
588  size_t added = 0;
589  size_t changed = 0;
590  string qual;
591  string val;
592  for (auto& it : list) {
593  if (it->CanAutofix()) {
594  CDiscrepancyObject& obj = *dynamic_cast<CDiscrepancyObject*>(it.GetNCPointer());
595  CSeqdesc* desc = const_cast<CSeqdesc*>(dynamic_cast<const CSeqdesc*>(obj.GetObject().GetPointer()));
596  CRef<CBioSource> bs(&desc->SetSource());
597  fix = dynamic_cast<const CSourseQualsAutofixData*>(obj.GetMoreInfo().GetPointer());
598  if (!fix) {
599  continue;
600  }
601  qual = fix->m_Qualifier;
602  val = fix->m_Value;
603 
604  //CAutofixHookRegularArguments arg;
605  //arg.m_User = fix->m_User;
606  //if (m_Hook) {
607  // m_Hook(&arg);
608  //}
609 
610  if (qual == "host") {
611  SetOrgMod(bs, COrgMod::eSubtype_nat_host, val, added, changed);
612  dynamic_cast<CDiscrepancyObject*>(it.GetNCPointer())->SetFixed();
613  }
614  else if (qual == "strain") {
615  SetOrgMod(bs, COrgMod::eSubtype_strain, val, added, changed);
616  dynamic_cast<CDiscrepancyObject*>(it.GetNCPointer())->SetFixed();
617  }
618  else if (qual == "country") {
619  SetSubsource(bs, CSubSource::eSubtype_country, val, added, changed);
620  dynamic_cast<CDiscrepancyObject*>(it.GetNCPointer())->SetFixed();
621  }
622  else if (qual == "isolation-source") {
624  dynamic_cast<CDiscrepancyObject*>(it.GetNCPointer())->SetFixed();
625  }
626  else if (qual == "collection-date") {
628  dynamic_cast<CDiscrepancyObject*>(it.GetNCPointer())->SetFixed();
629  }
630  }
631  }
632  if (changed) {
633  return CRef<CAutofixReport>(new CAutofixReport("SOURCE_QUALS: [n] qualifier[s] " + qual + " (" + val + ") fixed", added + changed));
634  }
635  else {
636  return CRef<CAutofixReport>(new CAutofixReport("SOURCE_QUALS: [n] missing qualifier[s] " + qual + " (" + val + ") added", added));
637  }
638 #endif
639  return CRef<CAutofixReport>();
640 }
641 
642 
#define static
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
void uniq(C &container)
Definition: chainer.cpp:1932
const COrgName & GetOrgname(void) const
Definition: BioSource.cpp:410
CConstRef< CObject > GetMoreInfo()
static bool IsGui()
CObject –.
Definition: ncbiobj.hpp:180
@OrgMod.hpp User-defined methods of the data storage class.
Definition: OrgMod.hpp:54
@ eVocabulary_raw
Definition: OrgMod.hpp:68
TTaxId GetTaxId() const
Definition: Org_ref.cpp:72
CRef –.
Definition: ncbiobj.hpp:618
virtual vector< CRef< CReportItem > > GetSubitems() const =0
static void Add(TReportObjectList &list, TReportObjectSet &hash, CReportObj &obj, bool unique=true)
TReportObjectList & GetObjects()
CReportNode & Fatal()
void SetCount(size_t n)
TNodeMap & GetMap()
CRef< CReportItem > Export(CDiscrepancyCore &test, bool unique=true) const
CReportNode & Incr()
vector< string > m_Choice
static bool NCBI_UseGeoLocNameForCountry(void)
Definition: SubSource.cpp:94
@ eVocabulary_raw
Definition: SubSource.hpp:82
void erase(iterator pos)
Definition: map.hpp:167
size_type size() const
Definition: map.hpp:148
const_iterator begin() const
Definition: map.hpp:151
Definition: map.hpp:338
vector< CRef< CReportObj > > TReportObjectList
@ eFatal
@ eBig
@ eDisc
@ eOncaller
@ eSubmitter
@ eSmart
#define DISCREPANCY_AUTOFIX(name)
#define DISCREPANCY_CASE1(name, type, group, descr,...)
#define DISCREPANCY_SUMMARIZE(name)
static const struct name_t names[]
#define false
Definition: bool.h:36
#define ZERO_TAX_ID
Definition: ncbimisc.hpp:1115
constexpr size_t ArraySize(const Element(&)[Size])
Definition: ncbimisc.hpp:1532
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1684
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
Definition: ncbiobj.hpp:1401
TObjectType * GetNCPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1174
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
Definition: ncbiobj.hpp:735
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
Definition: ncbistr.cpp:2751
#define NPOS
Definition: ncbistr.hpp:133
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
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 enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
static string & ToUpper(string &str)
Convert string to upper case – string& version.
Definition: ncbistr.cpp:424
const TSubtype & GetSubtype(void) const
Get the Subtype member data.
Definition: BioSource_.hpp:539
list< CRef< CSubSource > > TSubtype
Definition: BioSource_.hpp:145
void SetOrg(TOrg &value)
Assign a value to Org data member.
Definition: BioSource_.cpp:108
void SetName(const TName &value)
Assign a value to Name data member.
Definition: SubSource_.hpp:359
const TName & GetName(void) const
Get the Name member data.
Definition: SubSource_.hpp:350
TSubtype & SetSubtype(void)
Assign a value to Subtype data member.
Definition: BioSource_.hpp:545
@ eSubtype_collection_date
DD-MMM-YYYY format.
Definition: SubSource_.hpp:114
const TMod & GetMod(void) const
Get the Mod member data.
Definition: OrgName_.hpp:839
const TSubname & GetSubname(void) const
Get the Subname member data.
Definition: OrgMod_.hpp:347
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
Definition: Org_ref_.hpp:372
bool CanGetTaxname(void) const
Check if it is safe to call GetTaxname method.
Definition: Org_ref_.hpp:366
void SetSubname(const TSubname &value)
Assign a value to Subname data member.
Definition: OrgMod_.hpp:356
@ eSubtype_gb_acronym
used by taxonomy database
Definition: OrgMod_.hpp:115
@ eSubtype_gb_synonym
used by taxonomy database
Definition: OrgMod_.hpp:117
@ eSubtype_other
ASN5: old-name (254) will be added to next spec.
Definition: OrgMod_.hpp:125
@ eSubtype_nat_host
natural host of this specimen
Definition: OrgMod_.hpp:104
@ eSubtype_strain
Definition: OrgMod_.hpp:85
@ eSubtype_old_name
Definition: OrgMod_.hpp:124
@ eSubtype_gb_anamorph
used by taxonomy database
Definition: OrgMod_.hpp:116
@ eSubtype_old_lineage
Definition: OrgMod_.hpp:123
TSource & SetSource(void)
Select the variant.
Definition: Seqdesc_.cpp:572
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
int i
yy_size_t n
#define nullptr
Definition: ncbimisc.hpp:45
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
USING_SCOPE(objects)
static void AddObjectToReport(const string &subtype, const string &qual, const string &val, bool unique, CReportObj &obj, CReportNode &report)
static void AddObjToQualMap(const string &qual, const string &val, CReportObj &obj, CReportNode &node)
map< const CReportObj *, CRef< CReportObj > > TReportObjPtrMap
static bool GetSubtypeStr(const string &qual, const string &val, const TReportObjectList &objs, string &subtype)
static void SetSubsource(CRef< CBioSource > bs, CSubSource::ESubtype st, const string &s, size_t &added, size_t &changed)
map< string, TStringObjVectorMap > TStringStringObjVectorMap
static void ConvertDuplicates(CReportNode &node)
map< string, vector< CRef< CReportObj > > > TStringObjVectorMap
static void SetOrgMod(CRef< CBioSource > bs, COrgMod::ESubtype st, const string &s, size_t &added, size_t &changed)
static float g_GetSesameStreetCutoff()
static size_t GetSortOrderId(const string &subitem, CReportNode &node)
static string OrderQual(const string &s)
static size_t GetNumOfObjects(CReportNode &root)
static void AddObjsToReport(const string &diagnosis, CReportNode::TNodeMap &all_objs, const string &qual, CReportNode &report)
static CS_CONTEXT * context
Definition: will_convert.c:21
#define const
Definition: zconf.h:232
Modified on Wed Apr 17 13:08:46 2024 by modify_doxy.py rev. 669887