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

Go to the SVN repository for this file.

1 /* $Id: struc_comm_field.cpp 95788 2021-12-23 13:29:04Z 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  * Authors: Colleen Bollin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 #include <corelib/ncbistd.hpp>
33 #include <corelib/ncbistr.hpp>
34 #include <serial/enumvalues.hpp>
35 #include <serial/serialimpl.hpp>
42 
43 #include <objmgr/seqdesc_ci.hpp>
44 #include <objmgr/bioseq_ci.hpp>
45 #include <util/util_misc.hpp>
46 
49 
51 
55 
56 
57 const string kStructuredComment = "StructuredComment";
58 const string kStructuredCommentPrefix = "StructuredCommentPrefix";
59 const string kStructuredCommentSuffix = "StructuredCommentSuffix";
60 
61 bool CStructuredCommentField::SetVal(CObject& object, const string & newValue, EExistingText existing_text)
62 {
63  bool rval = false;
64  CSeqdesc* seqdesc = dynamic_cast<CSeqdesc*>(&object);
65  CUser_object* user = dynamic_cast<CUser_object*>(&object);
66 
67  if (seqdesc && seqdesc->IsUser()) {
68  user = &(seqdesc->SetUser());
69  }
70  if (user && IsStructuredCommentForThisField(*user)) {
71  bool found = false;
72  if (user->IsSetData()) {
73  CUser_object::TData::iterator it = user->SetData().begin();
74  while (it != user->SetData().end()) {
75  if ((*it)->IsSetLabel() && (*it)->GetLabel().IsStr()
76  && NStr::Equal((*it)->GetLabel().GetStr(), m_FieldName)) {
77  rval |= SetVal(**it, newValue, existing_text);
78  found = true;
79  }
80  if (!(*it)->IsSetData()) {
81  it = user->SetData().erase(it);
82  } else {
83  it++;
84  }
85  }
86  }
87  if (!found && (!NStr::Equal(m_ConstraintFieldName, m_FieldName) || !m_StringConstraint)) {
88  CRef<CUser_field> new_field(new CUser_field());
89  new_field->SetLabel().SetStr(m_FieldName);
90  if (SetVal(*new_field, newValue, eExistingText_replace_old)) {
91  x_InsertFieldAtCorrectPosition(*user, new_field);
92  rval = true;
93  }
94  }
95 
96  // if User object now has no fields, reset so it will be detected as empty
97  if (user->GetData().empty()) {
98  user->ResetData();
99  }
100  }
101  return rval;
102 }
103 
104 
105 /// Assumes that User-object fields are already mostly in order
107 {
108  if (!field) {
109  return;
110  }
111  if (!user.IsSetData()) {
112  // no fields yet, just add the field
113  user.SetData().push_back(field);
114  return;
115  }
116  string this_field_label = field->GetLabel().GetStr();
117 
118  vector<string> field_names = CComment_set::GetFieldNames(m_Prefix);
119  if (field_names.size() == 0) {
120  // no information about field order, just add to end
121  user.SetData().push_back(field);
122  return;
123  }
124 
125  vector<string>::iterator sit = field_names.begin();
126  CUser_object::TData::iterator fit = user.SetData().begin();
127  while (sit != field_names.end() && fit != user.SetData().end()) {
128  string field_label = (*fit)->GetLabel().GetStr();
130  || NStr::EqualNocase(field_label, kStructuredCommentSuffix)) {
131  // skip
132  fit++;
133  } else if (NStr::EqualNocase(*sit, (*fit)->GetLabel().GetStr())) {
134  sit++;
135  fit++;
136  } else if (NStr::EqualNocase(*sit, this_field_label)) {
137  // insert field here
138  user.SetData().insert(fit, field);
139  return;
140  } else {
141  // field is missing
142  sit++;
143  }
144  }
145  user.SetData().push_back(field);
146 }
147 
148 
149 bool CStructuredCommentField::SetVal(CUser_field& field, const string & newValue, EExistingText existing_text)
150 {
151  bool rval = false;
152 
153  if (field.IsSetData()) {
154  if (field.GetData().IsStr()) {
155  string curr_val = field.GetData().GetStr();
157  || m_StringConstraint->DoesTextMatch(curr_val)) {
158  if (AddValueToString(curr_val, newValue, existing_text)) {
159  field.SetData().SetStr(curr_val);
160  rval = true;
161  }
162  }
163  } else if (field.GetData().Which() == CUser_field::TData::e_not_set) {
165  field.SetData().SetStr(newValue);
166  rval = true;
167  }
168  }
170  field.SetData().SetStr(newValue);
171  rval = true;
172  }
173 
174  return rval;
175 }
176 
177 
179 {
180  vector<string> vals = GetVals(object);
181  if (vals.size() > 0) {
182  return vals[0];
183  } else {
184  return "";
185  }
186 
187 }
188 
189 
190 vector<string> CStructuredCommentField::GetVals(const CObject& object)
191 {
192  vector<string> vals;
193  const CSeqdesc* seqdesc = dynamic_cast<const CSeqdesc*>(&object);
194  const CUser_object* user = dynamic_cast<const CUser_object*>(&object);
195 
196  if (seqdesc && seqdesc->IsUser()) {
197  user = &(seqdesc->GetUser());
198  }
199  if (IsStructuredCommentForThisField(*user) && user->IsSetData()) {
200  CUser_object::TData::const_iterator it = user->GetData().begin();
201  while (it != user->GetData().end()) {
202  if ((*it)->IsSetLabel() && (*it)->GetLabel().IsStr() && (*it)->IsSetData()
203  && NStr::Equal((*it)->GetLabel().GetStr(), m_FieldName)) {
204  switch((*it)->GetData().Which()) {
206  vals.push_back((*it)->GetData().GetStr());
207  break;
209  ITERATE(CUser_field::TData::TStrs, s, (*it)->GetData().GetStrs()) {
210  vals.push_back(*s);
211  }
212  break;
213  default:
214  //not handling other types of fields
215  break;
216  }
217  }
218  ++it;
219  }
220  }
221  return vals;
222 }
223 
224 
225 void CStructuredCommentField::SetConstraint(const string& field_name, CConstRef<CStringConstraint> string_constraint)
226 {
227  m_ConstraintFieldName = field_name;
228  if (NStr::IsBlank(field_name)) {
229  string_constraint.Reset();
230  } else {
232  m_StringConstraint->Assign(*string_constraint);
233  }
234 }
235 
236 
237 vector<CConstRef<CObject> > CStructuredCommentField::GetObjects(CBioseq_Handle bsh)
238 {
239  vector<CConstRef<CObject> > objects;
240 
241  CSeqdesc_CI desc_ci(bsh, CSeqdesc::e_User);
242  while (desc_ci) {
243  if (IsStructuredCommentForThisField(desc_ci->GetUser())) {
244  CConstRef<CObject> object;
245  object.Reset(&(*desc_ci));
246  objects.push_back(object);
247  }
248  ++desc_ci;
249  }
250 
251  return objects;
252 }
253 
254 
256 {
257  vector<CRef<CApplyObject> > objects;
258 
259  // add existing descriptors
260  CSeqdesc_CI desc_ci(bsh, CSeqdesc::e_User);
261  while (desc_ci) {
262  if (IsStructuredCommentForThisField(desc_ci->GetUser())) {
263  CRef<CApplyObject> obj(new CApplyObject(bsh, *desc_ci));
264  objects.push_back(obj);
265  }
266  ++desc_ci;
267  }
268 
269  if (objects.empty()) {
270  CRef<CSeqdesc> desc(new CSeqdesc());
272  CRef<CApplyObject> new_obj(new CApplyObject(bsh, *desc));
273  objects.push_back(new_obj);
274  }
275 
276  return objects;
277 }
278 
279 
280 vector<CConstRef<CObject> > CStructuredCommentField::GetObjects(CSeq_entry_Handle seh, const string& constraint_field, CRef<CStringConstraint> string_constraint)
281 {
282  vector<CConstRef<CObject> > objs;
283  CRef<CScope> scope(&seh.GetScope());
284 
285  CBioseq_CI bi (seh, CSeq_inst::eMol_na);
286  while (bi) {
287  if (NStr::EqualNocase(constraint_field, kFieldTypeSeqId)) {
288  if (CSeqIdGuesser::DoesSeqMatchConstraint(*bi, string_constraint)) {
289  vector<CConstRef<CObject> > these_objs = GetObjects(*bi);
290  objs.insert(objs.end(), these_objs.begin(), these_objs.end());
291  }
292  } else {
293  vector<CConstRef<CObject> > these_objs = GetObjects(*bi);
294  ITERATE (vector<CConstRef<CObject> >, it, these_objs) {
295  if (DoesObjectMatchFieldConstraint (**it, constraint_field, string_constraint, scope)) {
296  objs.push_back (*it);
297  }
298  }
299  }
300  ++bi;
301  }
302 
303  return objs;
304 }
305 
306 
307 bool CStructuredCommentField::IsEmpty(const CObject& object) const
308 {
309  bool rval = false;
310  const CSeqdesc* seqdesc = dynamic_cast<const CSeqdesc*>(&object);
311  const CUser_object* user = dynamic_cast<const CUser_object*>(&object);
312  if (seqdesc && seqdesc->IsUser()) {
313  user = &(seqdesc->GetUser());
314  }
315  if (user && IsStructuredCommentForThisField(*user)) {
316  if (!user->IsSetData() || user->GetData().empty()) {
317  // empty if no fields
318  rval = true;
319  } else {
320  // empty if no fields other than prefix and/or suffix
321  rval = true;
322  ITERATE(CUser_object::TData, it, user->GetData()) {
323  if (!(*it)->IsSetLabel()
324  || !(*it)->GetLabel().IsStr()) {
325  // field with no label or non-string label,
326  // clearly neither prefix nor suffix
327  rval = false;
328  break;
329  } else {
330  string label = (*it)->GetLabel().GetStr();
333  rval = false;
334  break;
335  }
336  }
337  }
338  }
339  }
340 
341  return rval;
342 }
343 
344 
346 {
347  CSeqdesc* seqdesc = dynamic_cast<CSeqdesc*>(&object);
348  CUser_object* user = dynamic_cast<CUser_object*>(&object);
349 
350  if (seqdesc && seqdesc->IsUser()) {
351  user = &(seqdesc->SetUser());
352  }
353  if (user && user->IsSetData()) {
354  CUser_object::TData::iterator it = user->SetData().begin();
355  while (it != user->SetData().end()) {
356  bool do_erase = false;
357  if ((*it)->IsSetLabel() && (*it)->GetLabel().IsStr() && NStr::Equal((*it)->GetLabel().GetStr(), m_FieldName)) {
358  do_erase = true;
359  }
360  if (do_erase) {
361  it = user->SetData().erase(it);
362  } else {
363  it++;
364  }
365  }
366  if (user->GetData().empty()) {
367  user->ResetData();
368  }
369  }
370 }
371 
372 
373 vector<CConstRef<CObject> > CStructuredCommentField::GetRelatedObjects(const CObject& object, CRef<CScope> scope)
374 {
375  vector<CConstRef<CObject> > related;
376 
377  const CSeqdesc * obj_desc = dynamic_cast<const CSeqdesc *>(&object);
378  const CSeq_feat * obj_feat = dynamic_cast<const CSeq_feat *>(&object);
379 
380  if (obj_feat) {
381  // find closest related Structured Comment Objects
382  CBioseq_Handle bsh = scope->GetBioseqHandle(obj_feat->GetLocation());
383  related = GetObjects(bsh);
384  } else if (obj_desc) {
385  if (obj_desc->IsUser() && IsStructuredCommentForThisField(obj_desc->GetUser())) {
386  CConstRef<CObject> obj(obj_desc);
387  related.push_back(obj);
388  } else {
389  CSeq_entry_Handle seh = GetSeqEntryForSeqdesc(scope, *obj_desc);
391  }
392  }
393 
394  return related;
395 }
396 
397 
398 vector<CConstRef<CObject> > CStructuredCommentField::GetRelatedObjects(const CApplyObject& object)
399 {
400  vector<CConstRef<CObject> > related;
401 
402  const CSeqdesc * obj_desc = dynamic_cast<const CSeqdesc *>(&object);
403  const CSeq_feat * obj_feat = dynamic_cast<const CSeq_feat *>(&object);
404 
405  if (obj_feat) {
406  related = GetObjects(object.GetSEH(), "", CRef<CStringConstraint>());
407  } else if (obj_desc) {
408  if (obj_desc->IsUser() && IsStructuredCommentForThisField(obj_desc->GetUser())) {
409  CConstRef<CObject> obj(obj_desc);
410  related.push_back(obj);
411  } else {
412  related = GetObjects(object.GetSEH(), m_ConstraintFieldName, m_StringConstraint);
413  }
414  }
415 
416  return related;
417 }
418 
419 
421 {
423  return false;
424  }
427  return NStr::Equal(prefix, m_Prefix);
428 }
429 
430 
432 {
433  CRef<CUser_object> obj(new CUser_object());
434  obj->SetType().SetStr(kStructuredComment);
435 
436  if (!NStr::IsBlank(prefix)) {
437  string root = prefix;
440  p->SetLabel().SetStr(kStructuredCommentPrefix);
441  string pre = CComment_rule::MakePrefixFromRoot(root);
442  p->SetData().SetStr(pre);
443  obj->SetData().push_back(p);
445  s->SetLabel().SetStr(kStructuredCommentSuffix);
446  string suf = CComment_rule::MakeSuffixFromRoot(root);
447  s->SetData().SetStr(suf);
448  obj->SetData().push_back(s);
449  }
450  return obj;
451 }
452 
453 
455 {
456  if (!f1->IsSetLabel()) return true;
457  if (!f2->IsSetLabel()) return false;
458  return f1->GetLabel().Compare(f2->GetLabel()) < 0;
459 }
460 
461 
462 bool CStructuredCommentField::IsValid(const CUser_object& obj, const string& desired_prefix)
463 {
465  if (!NStr::Equal(prefix, desired_prefix)) {
466  return false;
467  }
468 
470  if (!comment_rules) {
471  return false;
472  }
473 
474  CConstRef<CComment_rule> ruler = comment_rules->FindCommentRuleEx(prefix);
475  if (ruler) {
476  const CComment_rule& rule = *ruler;
477 
478  if (rule.GetRequire_order()) {
479  CComment_rule::TErrorList errors = rule.IsValid(obj);
480  if (errors.size() == 0) {
481  return true;
482  } else {
483  return false;
484  }
485  } else {
487  tmp.Assign(obj);
488  CUser_object::TData& fields = tmp.SetData();
489  stable_sort(fields.begin(), fields.end(), s_UserFieldCompare);
490  CComment_rule::TErrorList errors = rule.IsValid(obj);
491  if (errors.size() == 0) {
492  return true;
493  } else {
494  return false;
495  }
496  }
497  }
498  return false;
499 }
500 
501 
503 {
505 
507  if (!comment_rules) {
508  return;
509  }
510 
511  CConstRef<CComment_rule> ruler = comment_rules->FindCommentRuleEx(prefix);
512  if (ruler) {
513  const CComment_rule& rule = *ruler;
514  rule.ReorderFields(obj);
515  }
516 }
517 
518 
519 
520 const string kGenomeAssemblyData = "Genome-Assembly-Data";
521 const string kAssemblyMethod = "Assembly Method";
522 const string kGenomeCoverage = "Genome Coverage";
523 const string kSequencingTechnology = "Sequencing Technology";
524 const string kExpectedFinalVersion = "Expected Final Version";
525 const string kReferenceGuidedAssembly = "Reference-guided Assembly";
526 const string kSingleCellAmplification = "Single-cell Amplification";
527 
529 {
531 }
532 
533 
535 {
536  m_User.Reset(new CUser_object());
537  m_User->Assign(user);
538 }
539 
540 
542 {
544  return obj;
545 }
546 
547 
549 {
551  field.SetVal(obj, val, existing_text);
552 }
553 
554 
556 {
557  program = val;
558  version = "";
559  size_t pos = NStr::Find(val, " v.");
560  if (pos != string::npos) {
561  program = val.substr(0, pos);
562  version = val.substr(pos + 3);
565  }
566 }
567 
568 
570 {
571  string new_val = program;
572  if (!NStr::IsBlank(version)) {
573  if (!NStr::IsBlank(program)) {
574  new_val += " ";
575  }
576  new_val += "v. ";
577  new_val += version;
578  }
579  return new_val;
580 }
581 
582 
584 {
586  string previous = field.GetVal(obj);
587  string program;
588  string version;
589  x_GetAssemblyMethodProgramAndVersion(previous, program, version);
590  if (AddValueToString(program, val, existing_text)) {
591  string new_val = x_GetAssemblyMethodFromProgramAndVersion(program, version);
592  field.SetVal(obj, new_val, eExistingText_replace_old);
593  }
594 }
595 
596 
598 {
600  string previous = field.GetVal(obj);
601  string program;
602  string version;
603  x_GetAssemblyMethodProgramAndVersion(previous, program, version);
604  if (AddValueToString(version, val, existing_text)) {
605  string new_val = x_GetAssemblyMethodFromProgramAndVersion(program, version);
606  field.SetVal(obj, new_val, eExistingText_replace_old);
607  }
608 }
609 
610 
612 {
614  field.SetVal(obj, val, existing_text);
615 }
616 
617 
619 {
621  field.SetVal(obj, val, existing_text);
622 }
623 
624 
626 {
628  field.SetVal(obj, val, existing_text);
629 }
630 
631 
633 {
635  field.SetVal(obj, val, existing_text);
636 }
637 
638 
640 {
642  field.SetVal(obj, val, existing_text);
643 }
644 
645 
647 {
649  return field.GetVal(obj);
650 }
651 
652 
654 {
656  string method = field.GetVal(obj);
657  string program;
658  string version;
660  return program;
661 }
662 
663 
665 {
667  string method = field.GetVal(obj);
668  string program;
669  string version;
671  return version;
672 }
673 
674 
676 {
678  return field.GetVal(obj);
679 }
680 
681 
683 {
685  return field.GetVal(obj);
686 }
687 
688 
690 {
692  return field.GetVal(obj);
693 }
694 
695 
697 {
699  return field.GetVal(obj);
700 }
701 
702 
704 {
706  return field.GetVal(obj);
707 }
708 
709 
711 {
712  SetAssemblyMethod(*m_User, val, existing_text);
713  return *this;
714 }
715 
716 
718 {
719  SetAssemblyMethodProgram(*m_User, val, existing_text);
720  return *this;
721 }
722 
723 
725 {
726  SetAssemblyMethodVersion(*m_User, val, existing_text);
727  return *this;
728 }
729 
730 
732 {
733  SetGenomeCoverage(*m_User, val, existing_text);
734  return *this;
735 }
736 
737 
739 {
740  SetSequencingTechnology(*m_User, val, existing_text);
741  return *this;
742 }
743 
744 
746 {
747  SetExpectedFinalVersion(*m_User, val, existing_text);
748  return *this;
749 }
750 
751 
753 {
754  SetReferenceGuidedAssembly(*m_User, val, existing_text);
755  return *this;
756 }
757 
758 
760 {
761  SetSingleCellAmplification(*m_User, val, existing_text);
762  return *this;
763 }
764 
765 
767 {
768  CRef<CUser_object> obj(new CUser_object());
769  obj->Assign(*m_User);
770  return obj;
771 }
772 
773 
775 {
777 }
778 
779 
780 const string kANI = "Taxonomic-Update-Statistics";
781 const string kANIThisGenome = "This Genome (query)";
782 const string kANICurrentName = "Current Name";
783 const string kANIPreviousName = "Previous Name";
784 const string kANIDateUpdated = "Date Updated";
785 const string kANIAnalysisType = "Analysis Type";
786 const string kANIAnalysis1 = "Analysis 1 (A1)";
787 const string kANIA1Genome = "A1 Genome (subject)";
788 const string kANIA1Name = "A1 Name";
789 const string kANIA1ANI = "A1 ANI";
790 const string kANIA1QueryCoverage = "A1 Query Coverage";
791 const string kANIA1SubjectCoverage = "A1 Subject Coverage";
792 const string kANIAnalysis2 = "Analysis 2 (A2)";
793 const string kANIA2Genome = "A2 Genome (subject)";
794 const string kANIA2Name = "A2 Name";
795 const string kANIA2ANI = "A2 ANI";
796 const string kANIA2QueryCoverage = "A2 Query Coverage";
797 const string kANIA2SubjectCoverage = "A2 Subject Coverage";
798 
800 {
802 }
803 
804 
806 {
807  m_User.Reset(new CUser_object());
808  m_User->Assign(user);
809 }
810 
811 
813 {
815  return obj;
816 }
817 
818 #define ANI_STRING_FIELD_IMPLEMENTATION(Fieldname) \
819 void CANIComment::Set##Fieldname(CUser_object& obj, string val, EExistingText existing_text) \
820 { \
821  CStructuredCommentField field(kANI, kANI##Fieldname); \
822  field.SetVal(obj, val, existing_text); \
823 } \
824 string CANIComment::Get##Fieldname(const CUser_object& obj) \
825 { \
826  CStructuredCommentField field(kANI, kANI##Fieldname); \
827  return field.GetVal(obj); \
828 } \
829 CANIComment& CANIComment::Set##Fieldname(string val, EExistingText existing_text) \
830 { \
831  Set##Fieldname(*m_User, val, existing_text); \
832  return *this; \
833 }
834 
852 
853 
854 CRef<CUser_object> CANIComment::MakeUserObject()
855 {
856  CRef<CUser_object> obj(new CUser_object());
857  obj->Assign(*m_User);
859 
860  return obj;
861 }
862 
863 
865 {
867 }
868 
869 
870 
874 
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.
CSeq_entry_Handle GetSeqEntryForSeqdesc(CRef< CScope > scope, const CSeqdesc &seq_desc)
static bool IsValid(const CUser_object &obj)
static CRef< CUser_object > MakeEmptyUserObject()
CRef< CUser_object > m_User
CBioseq_CI –.
Definition: bioseq_ci.hpp:69
CBioseq_Handle –.
vector< TError > TErrorList
static string MakeSuffixFromRoot(const string &root)
static string MakePrefixFromRoot(const string &root)
TErrorList IsValid(const CUser_object &user) const
bool ReorderFields(CUser_object &user) const
static void NormalizePrefix(string &prefix)
static string GetStructuredCommentPrefix(const CUser_object &user, bool normalize=true)
static bool IsStructuredComment(const CUser_object &user)
static vector< string > GetFieldNames(const string &prefix)
static CConstRef< CComment_set > GetCommentRules()
CConstRef –.
Definition: ncbiobj.hpp:1266
CRef< CUser_object > m_User
static string GetSingleCellAmplification(const CUser_object &obj)
static void SetAssemblyMethod(CUser_object &obj, string val, EExistingText existing_text=eExistingText_replace_old)
static void SetGenomeCoverage(CUser_object &obj, string val, EExistingText existing_text=eExistingText_replace_old)
CRef< CUser_object > MakeUserObject()
static void SetReferenceGuidedAssembly(CUser_object &obj, string val, EExistingText existing_text=eExistingText_replace_old)
static void SetAssemblyMethodProgram(CUser_object &obj, string val, EExistingText existing_text=eExistingText_replace_old)
static CRef< CUser_object > MakeEmptyUserObject()
static void SetSingleCellAmplification(CUser_object &obj, string val, EExistingText existing_text=eExistingText_replace_old)
static void SetAssemblyMethodVersion(CUser_object &obj, string val, EExistingText existing_text=eExistingText_replace_old)
static string GetAssemblyMethodProgram(const CUser_object &obj)
static void SetSequencingTechnology(CUser_object &obj, string val, EExistingText existing_text=eExistingText_replace_old)
static void x_GetAssemblyMethodProgramAndVersion(string val, string &program, string &version)
static string GetReferenceGuidedAssembly(const CUser_object &obj)
static string GetGenomeCoverage(const CUser_object &obj)
static string GetAssemblyMethodVersion(const CUser_object &obj)
static string GetExpectedFinalVersion(const CUser_object &obj)
static bool IsValid(const CUser_object &obj)
static string x_GetAssemblyMethodFromProgramAndVersion(const string &program, const string &version)
static void SetExpectedFinalVersion(CUser_object &obj, string val, EExistingText existing_text=eExistingText_replace_old)
static string GetSequencingTechnology(const CUser_object &obj)
static string GetAssemblyMethod(const CUser_object &obj)
int Compare(const CObject_id &oid2) const
Definition: Object_id.cpp:145
CObject –.
Definition: ncbiobj.hpp:180
static bool DoesSeqMatchConstraint(CBioseq_Handle bsh, CRef< CStringConstraint > string_constraint)
CSeq_entry_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CSeqdesc_CI –.
Definition: seqdesc_ci.hpp:65
bool DoesTextMatch(const string &text)
void Assign(const CStringConstraint &other)
bool IsStructuredCommentForThisField(const CUser_object &user) const
CRef< CStringConstraint > m_StringConstraint
bool IsEmpty(const CObject &object) const override
string GetVal(const CObject &object) override
vector< CConstRef< CObject > > GetRelatedObjects(const CObject &object, CRef< CScope > scope) override
static CRef< CUser_object > MakeUserObject(const string &prefix)
void SetConstraint(const string &field_name, CConstRef< CStringConstraint > string_constraint) override
vector< string > GetVals(const CObject &object) override
void x_InsertFieldAtCorrectPosition(CUser_object &user, CRef< CUser_field > field)
Assumes that User-object fields are already mostly in order.
vector< CRef< CApplyObject > > GetApplyObjects(CBioseq_Handle bsh) override
vector< CConstRef< CObject > > GetObjects(CBioseq_Handle bsh) override
bool SetVal(CObject &object, const string &newValue, EExistingText existing_text=eExistingText_replace_old) override
void ClearVal(CObject &object) override
static bool IsValid(const CUser_object &obj, const string &desired_prefix)
static void ReorderFields(CUser_object &obj)
Include a standard set of the NCBI C++ Toolkit most basic headers.
The NCBI C++ standard methods for dealing with std::string.
const char * kFieldTypeSeqId
static char tmp[3200]
Definition: utf8.c:42
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
CScope & GetScope(void) const
Get scope this handle belongs to.
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:1439
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#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 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 EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5353
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[]
const TStr & GetStr(void) const
Get the variant data.
bool IsSetData(void) const
the object itself Check if a value has been assigned to Data data member.
const TData & GetData(void) const
Get the Data member data.
bool IsStr(void) const
Check if variant Str is selected.
bool IsSetLabel(void) const
field label Check if a value has been assigned to Label data member.
TData & SetData(void)
Assign a value to Data data member.
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
void SetLabel(TLabel &value)
Assign a value to Label data member.
const TData & GetData(void) const
Get the Data member data.
void SetType(TType &value)
Assign a value to Type data member.
void ResetData(void)
Reset Data data member.
void SetData(TData &value)
Assign a value to Data data member.
const TLabel & GetLabel(void) const
Get the Label member data.
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
vector< CStringUTF8 > TStrs
vector< CRef< CUser_field > > TData
E_Choice Which(void) const
Which variant is currently selected.
@ e_not_set
No variant selected.
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
const TUser & GetUser(void) const
Get the variant data.
Definition: Seqdesc_.cpp:384
TUser & SetUser(void)
Select the variant.
Definition: Seqdesc_.cpp:390
bool IsUser(void) const
Check if variant User is selected.
Definition: Seqdesc_.hpp:1122
@ e_User
user defined object
Definition: Seqdesc_.hpp:124
@ eMol_na
just a nucleic acid
Definition: Seq_inst_.hpp:113
TRequire_order GetRequire_order(void) const
Get the Require_order member data.
static int version
Definition: mdb_load.c:29
bool DoesObjectMatchFieldConstraint(const CObject &object, const string &field_name, CRef< objects::edit::CStringConstraint > string_constraint, CRef< objects::CScope > scope)
Definition: fix_pub.hpp:45
static const char * prefix[]
Definition: pcregrep.c:405
EExistingText
@ eExistingText_replace_old
bool AddValueToString(string &str, const string &value, EExistingText existing_text)
Add text to an existing string, using the "existing_text" directive to combine new text with existing...
const string kANIPreviousName
const string kANIA1ANI
const string kANIAnalysis1
const string kANIA1SubjectCoverage
const string kANIA1QueryCoverage
const string kANIA2SubjectCoverage
const string kANIA2QueryCoverage
USING_SCOPE(ncbi::objects)
const string kExpectedFinalVersion
const string kANICurrentName
const string kAssemblyMethod
const string kGenomeAssemblyData
const string kANIA1Name
const string kANIThisGenome
const string kANIA1Genome
const string kSingleCellAmplification
const string kANIAnalysisType
const string kANIDateUpdated
const string kGenomeCoverage
const string kStructuredCommentSuffix
const string kStructuredComment
#define ANI_STRING_FIELD_IMPLEMENTATION(Fieldname)
const string kStructuredCommentPrefix
const string kANIA2ANI
const string kANIA2Name
const string kReferenceGuidedAssembly
const string kANIA2Genome
const string kANIAnalysis2
bool s_UserFieldCompare(const CRef< CUser_field > &f1, const CRef< CUser_field > &f2)
const string kANI
const string kSequencingTechnology
#define const
Definition: zconf.h:232
Modified on Wed Apr 17 13:10:26 2024 by modify_doxy.py rev. 669887