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

Go to the SVN repository for this file.

1 /* $Id: macro_util.cpp 47274 2022-12-06 16:17:02Z asztalos $
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: Andrea Asztalos
27  *
28  * File Description: Utility functions used in macros
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <corelib/ncbimisc.hpp>
35 #include <objects/seq/MolInfo.hpp>
40 
42 #include <objmgr/seq_entry_ci.hpp>
43 #include <objmgr/bioseq_ci.hpp>
44 #include <objmgr/feat_ci.hpp>
45 #include <objmgr/seqdesc_ci.hpp>
46 #include <objmgr/util/sequence.hpp>
51 
52 
53 /** @addtogroup GUI_MACRO_SCRIPTS_UTIL
54  *
55  * @{
56  */
57 
59 BEGIN_SCOPE(macro)
61 
62 namespace NMacroUtil
63 {
64  edit::EExistingText ActionTypeToExistingTextOption(const string& action_type, const string& delimiter)
65  {
67 
68  if (NStr::EqualNocase(action_type, "eLeaveOld")) {
69  exist_text = edit::eExistingText_leave_old;
70  }
71  else if (NStr::EqualNocase(action_type, "ePrepend")) {
72  if (NStr::EqualNocase(delimiter, " "))
74  else if (NStr::EqualNocase(delimiter, ";"))
76  else if (NStr::EqualNocase(delimiter, ","))
78  else if (NStr::EqualNocase(delimiter, ":"))
80  else
82  }
83  else if (NStr::EqualNocase(action_type, "eAppend")) {
84  if (NStr::EqualNocase(delimiter, " "))
86  else if (NStr::EqualNocase(delimiter, ";"))
88  else if (NStr::EqualNocase(delimiter, ","))
90  else if (NStr::EqualNocase(delimiter, ":"))
92  else
94  }
95  else if (NStr::EqualNocase(action_type, "eReplace")) {
97  }
98  else if (NStr::EqualNocase(action_type, "eAddQual")) {
99  exist_text = edit::eExistingText_add_qual;
100  }
101 
102  return exist_text;
103  }
104 
105  ECapChange ConvertStringtoCapitalOption(const string& cap_name)
106  {
107  ECapChange cap_change = eCapChange_none;
108 
109  if (NStr::EqualNocase(cap_name, "none")) {
110  return cap_change;
111  }
112 
113  if (NStr::EqualNocase(cap_name, "tolower")) {
114  cap_change = eCapChange_tolower;
115  }
116  else if (NStr::EqualNocase(cap_name, "toupper")) {
117  cap_change = eCapChange_toupper;
118  }
119  else if (NStr::EqualNocase(cap_name, "firstcap")) {
120  cap_change = eCapChange_firstcap_restlower;
121  }
122  else if (NStr::EqualNocase(cap_name, "firstcap-restnochange")) {
124  }
125  else if (NStr::EqualNocase(cap_name, "firstlower-restnochange")) {
127  }
128  else if (NStr::EqualNocase(cap_name, "cap-word-space")) {
129  cap_change = eCapChange_capword_afterspace;
130  }
131  else if (NStr::EqualNocase(cap_name, "cap-word-space-punct")) {
133  }
134 
135  return cap_change;
136  }
137 
139  {
140  for (CSeq_entry_CI entry_ci(tse, CSeq_entry_CI::fRecursive | CSeq_entry_CI::fIncludeGivenEntry); entry_ci; ++entry_ci) {
141  if (entry_ci->IsSetDescr()) {
142  ITERATE(CBioseq::TDescr::Tdata, dit, entry_ci->GetDescr().Get()) {
143  if ((*dit)->IsSource()) {
144  const CBioSource& desc_src = (*dit)->GetSource();
145  if (&desc_src == &bsrc) {
146  return *entry_ci;
147  }
148  }
149  }
150  }
151  if (entry_ci->IsSeq()) {
152  for (CFeat_CI fi(entry_ci->GetSeq(), SAnnotSelector(CSeqFeatData::e_Biosrc)); fi; ++fi) {
153  if (&(fi->GetData().GetBiosrc()) == &bsrc) {
154  return *entry_ci;
155  }
156  }
157  }
158  }
159  return CSeq_entry_Handle();
160  }
161 
163  {
164 
165  const CSeqdesc* seqdesc = dynamic_cast<const CSeqdesc*>(obj);
166  const CBioSource* bsrc = dynamic_cast<const CBioSource*>(obj);
167  const CMolInfo* molinfo = dynamic_cast<const CMolInfo*>(obj);
168 
169  for (CBioseq_CI b_iter(tse); b_iter; ++b_iter) {
170  CConstRef<CBioseq> bseq = b_iter->GetCompleteBioseq();
171  if (seqdesc) {
172  for (CSeqdesc_CI desc_it(*b_iter); desc_it; ++desc_it) {
173  if (seqdesc == &(*desc_it)) {
174  return bseq;
175  }
176  }
177 
178  }
179  else if (bsrc) {
180  for (CSeqdesc_CI desc_it(*b_iter, CSeqdesc::e_Source); desc_it; ++desc_it) {
181  if (bsrc == &(desc_it->GetSource())) {
182  return bseq;
183  }
184  }
185 
186  }
187  else if (molinfo) {
188  for (CSeqdesc_CI desc_it(*b_iter, CSeqdesc::e_Molinfo); desc_it; ++desc_it) {
189  if (molinfo == &(desc_it->GetMolinfo())) {
190  return bseq;
191  }
192  }
193  }
194 
195  }
196  return CConstRef<CBioseq>(NULL);
197  }
198 
200  {
201  if (info.GetTypeFamily() == eTypeFamilyPrimitive) {
202  return info;
203  }
204  else if (info.GetTypeFamily() == eTypeFamilyPointer) {
205  if (info.GetPointedObject().GetTypeFamily() == eTypeFamilyPrimitive) {
206  return info.GetPointedObject();
207  }
208  }
209  return CObjectInfo();
210  }
211 
213  {
214  const string dbtag_name = "Dbtag";
215  CObjectInfo obj = info.field;
216  switch (obj.GetTypeFamily()) {
218  objs.push_back(info);
219  break;
220  case eTypeFamilyPointer: {
222  objs.push_back(CMQueryNodeValue::SResolvedField(info.parent, obj.GetPointedObject()));
223  break;
224  }
225  case eTypeFamilyContainer: {
226  CObjectInfoEI elem = obj.BeginElements();
227  while (elem.Valid()) {
228  CObjectInfo elem_oi = elem.GetElement();
229  if (elem_oi.GetTypeFamily() == eTypeFamilyPrimitive) {
230  objs.push_back(CMQueryNodeValue::SResolvedField(obj, elem_oi));
231  }
232  else if (elem_oi.GetTypeFamily() == eTypeFamilyPointer) {
233  CObjectInfo pointed = elem_oi.GetPointedObject();
234  if (pointed.GetName() == dbtag_name) {
235  objs.push_back(CMQueryNodeValue::SResolvedField(obj, pointed));
236  }
237  }
238  ++elem;
239  }
240  break;
241  }
242  case eTypeFamilyClass: {
243  if (obj.GetName() == dbtag_name) {
244  objs.push_back(info);
245  }
246  }
247  default:
248  break;
249  }
250  }
251 
253  {
254  CObjectInfo obj = info.field;
255  if (obj.GetTypeFamily() == eTypeFamilyClass) {
256  if (obj.GetName() == "OrgMod") {
257  CObjectInfo subname_oi = obj.FindClassMember("subname").GetMember();
258  objs.push_back(CMQueryNodeValue::SResolvedField(obj, subname_oi));
259  }
260  else if (obj.GetName() == "SubSource") {
261  CObjectInfo subname_oi = obj.FindClassMember("name").GetMember();
262  objs.push_back(CMQueryNodeValue::SResolvedField(obj, subname_oi));
263  }
264  else if (obj.GetName() == "Gb-qual") {
265  CObjectInfo subname_oi = obj.FindClassMember("val").GetMember();
266  objs.push_back(CMQueryNodeValue::SResolvedField(obj, subname_oi));
267  }
268  }
269  else {
271  }
272  }
273 
275  {
276  if (node.IsRef()) {
277  node.Dereference();
278  }
279  return node.GetDataType();
280  }
281 
283  {
284  bool all_gbquals = true;
285  for (auto&& it : objs) {
286  if (!NStr::EqualNocase(it.field.GetName(), "Gb-qual")) {
287  all_gbquals = false;
288  break;
289  }
290  }
291 
292  if (all_gbquals && !objs.empty()) {
294  for (auto&& it : objs) {
295  auto val_member = it.field.FindClassMember("val").GetMember();
296  tmp.push_back(CMQueryNodeValue::SResolvedField(it.field, val_member));
297  }
298  swap(tmp, objs);
299  }
300  }
301 
303  {
305  if ((*it)->IsSetData() && (*it)->GetData().IsGene()) {
307  }
308  }
309  if (feat.GetXref().empty())
310  feat.ResetXref();
311  }
312 
314  {
315  if (bseq.IsNa()) {
316  EDIT_EACH_SEQDESC_ON_BIOSEQ(it, bseq) {
317  if ((*it)->IsTitle() && (*it)->GetTitle().empty()) {
318  ERASE_SEQDESC_ON_BIOSEQ(it, bseq);
319  }
320  else if ((*it)->IsComment() && (*it)->GetComment().empty()) {
321  ERASE_SEQDESC_ON_BIOSEQ(it, bseq);
322  }
323  else if ((*it)->IsGenbank() && (*it)->GetGenbank().IsEmpty()) {
324  ERASE_SEQDESC_ON_BIOSEQ(it, bseq);
325  }
326  }
327  }
328  }
329 
331  {
332  string newValue;
333  if (value->IsString()) {
334  newValue = value->GetString();
335  }
336  else if (value->IsInt()) {
337  value->SetString(NStr::Int8ToString(value->GetInt()));
338  newValue = value->GetString();
339  }
340  else if (value->IsDouble()) {
341  value->SetString(NStr::DoubleToString(value->GetDouble()));
342  newValue = value->GetString();
343  }
344  else {
345  NCBI_THROW(CMacroExecException, eWrongArguments, "Wrong type of new_value was passed to function");
346  }
347  return newValue;
348  }
349 
350  CSeqFeatData::ESubtype GetFeatSubtype(const string& feat_type)
351  {
352  if (NStr::IsBlank(feat_type)) {
354  }
355 
356  if (NStr::EqualNocase(feat_type, "any") || NStr::EqualNocase(feat_type, "all")) {
358  }
359  // handle exceptional cases first
360  if (StringsAreEquivalent(feat_type, "source") ||
361  StringsAreEquivalent(feat_type, "biosrc") ||
362  StringsAreEquivalent(feat_type, "biosource")) {
364 
365  }
366  else if (StringsAreEquivalent(feat_type, "preRNA") ||
367  StringsAreEquivalent(feat_type, "precursor_RNA")) {
369 
370  }
371  else if (StringsAreEquivalent(feat_type, "miscRNA") ||
372  StringsAreEquivalent(feat_type, "otherRNA")) {
374  }
375  else {
376  int subtype = -1;
377  const CFeatList* feat_list = CSeqFeatData::GetFeatList();
378  ITERATE(CFeatList, it, *feat_list) {
379  const CFeatListItem* f = &(*it);
380  subtype = f->GetSubtype();
381  string descr = f->GetDescription();
383  if (StringsAreEquivalent(feat_type, descr) ||
384  StringsAreEquivalent(feat_type, name)) {
385  // found the subtype
386  break;
387  }
388  }
389  if (subtype > 0) {
390  return CSeqFeatData::ESubtype(subtype);
391  }
392  }
394  }
395 
396 
397  bool StringsAreEquivalent(const string& name1, const string& name2)
398  {
399  string str1(name1), str2(name2);
400  // spaces, dashes and underscores do not count
401  NStr::ReplaceInPlace(str1, " ", "");
402  NStr::ReplaceInPlace(str1, "_", "");
403  NStr::ReplaceInPlace(str1, "-", "");
404  NStr::ReplaceInPlace(str2, " ", "");
405  NStr::ReplaceInPlace(str2, "_", "");
406  NStr::ReplaceInPlace(str2, "-", "");
407 
408  return NStr::EqualNocase(str1, str2);
409  }
410 
411  bool GetLocusTagFromGene(const CGene_ref& gene, string& locus_tag)
412  {
413  if (gene.IsSuppressed()) {
414  return false;
415  }
416 
417  if (gene.IsSetLocus_tag() && !NStr::IsBlank(gene.GetLocus_tag())) {
418  locus_tag = gene.GetLocus_tag();
419  return true;
420  }
421  else if (gene.IsSetLocus() && !NStr::IsBlank(gene.GetLocus())) {
422  locus_tag = gene.GetLocus();
423  return true;
424  }
425 
426  return false;
427  }
428 
429  bool GetLocusTagFromProtRef(const CSeq_feat& prot_feat, CScope& scope, string& locus_tag)
430  {
431  if (!prot_feat.GetData().IsProt())
432  return false;
433 
434  const CGene_ref* gene = prot_feat.GetGeneXref();
435  if (gene) {
436  return GetLocusTagFromGene(*gene, locus_tag);
437  }
438 
439  CBioseq_Handle bsh = scope.GetBioseqHandle(prot_feat.GetLocation());
440  if (bsh) {
441  const CSeq_feat* cds = sequence::GetCDSForProduct(*bsh.GetCompleteBioseq(), &scope);
442  if (cds) {
443  gene = cds->GetGeneXref();
444  if (gene) {
445  return GetLocusTagFromGene(*gene, locus_tag);
446  }
447 
449  if (gene_feat && gene_feat->GetData().IsGene()) {
450  return GetLocusTagFromGene(gene_feat->GetData().GetGene(), locus_tag);
451  }
452  }
453  }
454  return false;
455  }
456 
458  {
459  CRef<CSeqdesc> desc(new CSeqdesc);
460  CRef<CUser_object> user_obj(new CUser_object);
461  user_obj->SetType().SetStr("NcbiAutofix");
462  user_obj->SetData();
463  desc->SetUser(user_obj.GetNCObject());
464  return desc;
465  }
466 
468  {
469  for (CSeq_entry_CI entry_ci(tse, CSeq_entry_CI::fRecursive | CSeq_entry_CI::fIncludeGivenEntry); entry_ci; ++entry_ci) {
470  if (entry_ci->IsSetDescr()) {
471  for (CSeqdesc_CI desc_it(*entry_ci, CSeqdesc::e_User); desc_it; ++desc_it) {
472  const CUser_object& user_obj = desc_it->GetUser();
473  if (user_obj.IsSetType()
474  && user_obj.GetType().IsStr()
475  && NStr::EqualCase(user_obj.GetType().GetStr(), "NcbiAutofix")) {
476  return true;
477  }
478  }
479  }
480  }
481  return false;
482  }
483 
484  CRNA_ref::EType GetRNAType(const string& name)
485  {
487  if (NStr::EqualNocase(name, "preRNA"))
488  rna_type = CRNA_ref::eType_premsg;
489  else if (NStr::EqualNocase(name, "mRNA"))
490  rna_type = CRNA_ref::eType_mRNA;
491  else if (NStr::EqualNocase(name, "tRNA"))
492  rna_type = CRNA_ref::eType_tRNA;
493  else if (NStr::EqualNocase(name, "rRNA"))
494  rna_type = CRNA_ref::eType_rRNA;
495  else if (NStr::EqualNocase(name, "ncRNA"))
496  rna_type = CRNA_ref::eType_ncRNA;
497  else if (NStr::EqualNocase(name, "tmRNA"))
498  rna_type = CRNA_ref::eType_tmRNA;
499  else if (NStr::EqualNocase(name, "miscRNA"))
500  rna_type = CRNA_ref::eType_miscRNA;
501 
502  return rna_type;
503  }
504 
505  bool IsBiosourceModifier(const string& field)
506  {
509 
510  return (issubsrc || isorgmod);
511  }
512 
514  {
515  bool is_taxname = false;
516  if (res.parent.GetName() == "Org-ref") {
517  CObjectInfoMI mi = res.parent.FindClassMember("taxname");
518  // name is encoded in mi.GetItemInfo()->GetId().GetName()
519  if (mi.IsSet() && mi.GetMember() == res.field) {
520  is_taxname = true;
521  }
522  }
523  return is_taxname;
524  }
525 
527  {
529  if (bsrc) {
530  edit::RemoveTaxId(*bsrc);
531  edit::RemoveOldName(*bsrc);
532  }
533  }
534 
536  {
537  if (IsTaxname(res)) {
539  }
540  }
541 
542  void s_SetInitials(CName_std& std_name, const string& middle_init)
543  {
544  // don't add another period if one is already there
545  if (!NStr::EndsWith(middle_init, ".")) {
546  std_name.SetInitials(middle_init + ".");
547  }
548  else {
549  std_name.SetInitials(middle_init);
550  }
551  }
552 
553  bool ApplyFirstName(CName_std& std_name, const string& newValue, edit::EExistingText existing_text)
554  {
555  bool modified = false;
556  if (existing_text == edit::eExistingText_leave_old || existing_text == edit::eExistingText_cancel) {
557  return modified;
558  }
559 
560  string orig_initials = (std_name.IsSetInitials()) ? std_name.GetInitials() : kEmptyStr;
561  string first_initials = (std_name.IsSetFirst()) ?
563 
564  string new_first_init = CMacroFunction_AuthorFix::s_GetFirstNameInitials(newValue);
565 
566  if (first_initials.empty()) { // there is no first name
567  if (orig_initials.empty()) { // there is no middle initial
568  std_name.SetFirst(newValue);
569  std_name.SetInitials(new_first_init);
570  modified = true;
571  }
572  else { // there is a middle initial in the initials field
573  std_name.SetFirst(newValue);
574  string middle_init = new_first_init + orig_initials;
575  s_SetInitials(std_name, middle_init);
576  modified = true;
577  }
578  }
579  else { // there is a first name
580  if (orig_initials.empty()) { // the 'initials' field is not set
581  string first_name = std_name.GetFirst();
582  if (edit::AddValueToString(first_name, newValue, existing_text)) {
583  if (!NStr::EqualCase(std_name.GetFirst(), first_name)) {
584  std_name.SetFirst(first_name);
586  modified = true;
587  }
588  }
589  }
590  else { // the initials field is set
591  string middle_init;
592  if (NStr::StartsWith(orig_initials, first_initials, NStr::eCase)) {
593  middle_init = orig_initials.substr(first_initials.length());
594  }
595 
596  if (middle_init.empty()) { // there are no middle initials
597  string first_name = std_name.GetFirst();
598  if (edit::AddValueToString(first_name, newValue, existing_text)) {
599  if (!NStr::EqualCase(std_name.GetFirst(), first_name)) {
600  std_name.SetFirst(first_name);
602  modified = true;
603  }
604  }
605  }
606  else {
607  string first_name = std_name.GetFirst();
608  if (edit::AddValueToString(first_name, newValue, existing_text)) {
609  if (!NStr::EqualCase(std_name.GetFirst(), first_name)) {
610  std_name.SetFirst(first_name);
611  string new_init = CMacroFunction_AuthorFix::s_GetFirstNameInitials(std_name.GetFirst());
612  new_init += middle_init;
613  s_SetInitials(std_name, new_init);
614  modified = true;
615  }
616  }
617  }
618  }
619  }
620 
621  if (modified) {
623  }
624 
625  return modified;
626  }
627 
628  bool RemoveFirstName(CName_std& std_name)
629  {
630  if (!std_name.IsSetFirst())
631  return false;
632 
633  bool modified = false;
634  string first_initials = CMacroFunction_AuthorFix::s_GetFirstNameInitials(std_name.GetFirst());
635  string orig_initials = std_name.IsSetInitials() ? std_name.GetInitials() : kEmptyStr;
636 
637 
638  if (orig_initials.empty()) {
639  std_name.ResetFirst();
640  modified = true;
641  }
642  else {
643  std_name.ResetFirst();
644  modified = true;
645 
646  string middle_init;
647  if (NStr::StartsWith(orig_initials, first_initials, NStr::eCase)) {
648  middle_init = orig_initials.substr(first_initials.length());
649  }
650  if (middle_init.empty()) { // there is no middle initial
651  std_name.ResetInitials();
652  }
653  else {
654  std_name.SetInitials(middle_init);
655  }
656  }
657 
658  return modified;
659  }
660 
661  bool ApplyMiddleInitial(CName_std& std_name, const string& newValue, edit::EExistingText existing_text)
662  {
663  bool modified = false;
664  if (existing_text == edit::eExistingText_leave_old || existing_text == edit::eExistingText_cancel) {
665  return modified;
666  }
667 
668  string orig_initials = (std_name.IsSetInitials()) ? std_name.GetInitials() : kEmptyStr;
669  string first_initials = (std_name.IsSetFirst()) ?
671 
672  if (first_initials.empty()) { // there is no first name
673  if (orig_initials.empty()) { // there is no middle initial
674  std_name.SetInitials(newValue);
675  modified = true;
676  }
677  else { // there is a middle initial
678  string middle_init = orig_initials;
679  if (edit::AddValueToString(middle_init, newValue, existing_text)) {
680  if (!NStr::EqualCase(middle_init, orig_initials)) {
681  s_SetInitials(std_name, middle_init);
682  modified = true;
683  }
684  }
685  }
686  }
687  else { // there is a first name
688  if (orig_initials.empty()) { // the 'initials' field is not set
689  string inits = first_initials;
690  inits.append(newValue);
691  s_SetInitials(std_name, inits);
692  modified = true;
693  }
694  else { // the initials field is set
695  string middle_init;
696  if (NStr::StartsWith(orig_initials, first_initials, NStr::eCase)) {
697  middle_init = orig_initials.substr(first_initials.length());
698  }
699 
700  if (middle_init.empty()) { // there are no middle initials
701  middle_init = orig_initials + newValue;
702  s_SetInitials(std_name, middle_init);
703  modified = true;
704  }
705  else {
706  string orig_val = middle_init;
707  if (edit::AddValueToString(orig_val, newValue, existing_text)) {
708  if (!NStr::EqualCase(orig_val, middle_init)) {
709  s_SetInitials(std_name, orig_val);
710  modified = true;
711  }
712  }
713  }
714  }
715  }
716 
717  if (modified) {
719  }
720 
721  return modified;
722  }
723 
725  {
726  if (!std_name.IsSetInitials())
727  return false;
728 
729  bool modified = false;
730  string orig_initials = std_name.GetInitials();
731  string first_initials = (std_name.IsSetFirst()) ?
733 
734  if (first_initials.empty()) {
735  std_name.ResetInitials();
736  modified = true;
737  }
738  else {
739  if (NStr::StartsWith(orig_initials, first_initials, NStr::eCase)) {
740  string middle_init = orig_initials.substr(first_initials.length());
741  if (!middle_init.empty()) {
742  std_name.SetInitials(orig_initials.substr(0, first_initials.length()));
743  modified = true;
744  }
745  }
746  }
747 
748  return modified;
749  }
750 
751  unsigned ApplyAuthorNames(CAuth_list& auth_list, const string& newValue)
752  {
753  unsigned count = 0;
754  if (newValue.empty())
755  return count;
756 
757  vector<string> names;
758  NStr::Split(newValue, ",", names, NStr::fSplit_Tokenize);
759 
760  auth_list.ResetNames();
761  for (auto&& it : names) {
762  vector<string> full_name;
763  NStr::Split(it, " ", full_name, NStr::fSplit_Tokenize);
764  string first_name, last_name, middle_init, suffix;
765 
766  if (full_name.size() == 4) {
767  first_name = full_name[0];
768  middle_init = full_name[1];
769  last_name = full_name[2];
770  suffix = full_name[3];
771  }
772  else if (full_name.size() == 3) {
773  first_name = full_name[0];
774  middle_init = full_name[1];
775  last_name = full_name[2];
776  }
777  else if (full_name.size() == 2) {
778  first_name = full_name[0];
779  last_name = full_name[1];
780  }
781  else if (full_name.size() == 1)
782  {
783  last_name = full_name[0];
784  }
785 
786  if (!last_name.empty()) {
787  CRef<CAuthor> new_auth(new CAuthor());
788  CName_std& std_name = new_auth->SetName().SetName();
789  std_name.SetLast(last_name);
790  if (!first_name.empty())
791  std_name.SetFirst(first_name);
792 
793  string initials = (std_name.IsSetFirst()) ? CMacroFunction_AuthorFix::s_GetFirstNameInitials(std_name.GetFirst()) : kEmptyStr;
794 
795  if (!middle_init.empty()) {
796  initials.append(CMacroFunction_AuthorFix::s_GetFirstNameInitials(middle_init));
797  }
798  // don't add another period if one is already there
799  if (!initials.empty() && !NStr::EndsWith(initials, ".")) {
800  initials.append(".");
801  }
802  if (!initials.empty()) {
803  std_name.SetInitials(initials);
804  }
805 
806  if (!suffix.empty())
807  std_name.SetSuffix(suffix);
808  auth_list.SetNames().SetStd().push_back(new_auth);
809  count++;
810  }
811  }
812  return count;
813  }
814 
815  EStructVoucherPart GetSVPartFromString(const string voucher_part)
816  {
817  auto part = eSV_Error;
818  const map<string, EStructVoucherPart> part_map =
819  { {"inst", eSV_Inst}, {"coll", eSV_Coll}, {"specid", eSV_Specid} };
820 
821  auto it = part_map.find(voucher_part);
822  if (it != part_map.end()) part = it->second;
823  return part;
824  }
825 
826  bool IsStructVoucherPart(const string& field)
827  {
828  return (NStr::EndsWith(field, kColl_suffix) ||
829  NStr::EndsWith(field, kInst_suffix) ||
831  }
832 
833  void ConvertMultiSpaces(string& line, const string& delimiter)
834  {
835  string result;
836  int spaces = 0;
837  for (size_t i = 0; i < line.size(); ++i) {
838  if (line[i] != ' ' && (spaces == 0)) {
839  result += line[i];
840  }
841  else if (line[i] == ' ') {
842  spaces += 1;
843  }
844  else if (line[i] != ' ' && (spaces > 0)) {
845  if (spaces == 1) {
846  result += ' ';
847  }
848  else {
849  result += delimiter;
850  }
851  result += line[i];
852  spaces = 0;
853  }
854  }
855 
856  // handle trailing space or spaces
857  if (spaces > 1)
858  result += delimiter;
859  else if (spaces == 1)
860  result += ' ';
861  line.assign(result);
862  }
863 
864  string TransformForCSV(const string& str)
865  {
866  string escaped = str;
867  if (str.find('\n') != NPOS || str.find(',') != NPOS || str.find('"') != NPOS) {
868  escaped = NStr::Quote(str, '"', '"');
869  }
870  return escaped;
871  }
872 
875  {
876  { "", CLabel::eInvalid },
877  { "eContent", CLabel::eContent },
878  { "eContentAndProduct", CLabel::eContentAndProduct },
879  { "eDefault", CLabel::eDefault },
880  { "eDescription", CLabel::eDescription },
881  { "eDescriptionBrief", CLabel::eDescriptionBrief },
882  { "eGi", CLabel::eGi },
883  { "eSymbolAlias", CLabel::eSymbolAlias},
884  { "eType", CLabel::eType },
885  { "eUserSubtype", CLabel::eUserSubtype },
886  { "eUserType", CLabel::eUserType },
887  { "eUserTypeAndContent", CLabel::eUserTypeAndContent },
888  };
889 
892 
894  {
896  TLabelTypeToNameMap::const_iterator iter = sm_CLabelMap.find(name);
897  if (iter != sm_CLabelMap.end()) {
898  type = iter->second;
899  }
900  return type;
901  }
902 
903  bool IsSatelliteSubfield(const string& field)
904  {
906  }
907 
908  bool IsMobileElementTSubfield(const string& field)
909  {
911  }
912 
914  {
916  if (NStr::EqualNocase(value, "Features")) {
918  }
919  else if (NStr::EqualNocase(value, "Organism")) {
921  }
922  else if (NStr::EqualNocase(value, "Misassembled")) {
924  }
925  else if (NStr::EqualNocase(value, "Contaminant")) {
927  }
928  return type;
929  }
930 }
931 
932 const char* kInst_suffix = "-inst";
933 const char* kColl_suffix = "-coll";
934 const char* kSpecid_suffix = "-specid";
935 const char* kSatelliteType = "satellite-type";
936 const char* kSatelliteName = "satellite-name";
937 const char* kMobileElementTQual = "mobile_element_type";
938 const char* kMobileElementTType = "mobile-element-type-type";
939 const char* kMobileElementTName = "mobile-element-type-name";
940 const char* kStrCommFieldValue = "fieldvalue";
941 const char* kStrCommDbname = "dbname";
942 const char* kStrCommFieldName = "fieldname";
943 
944 
945 // CRemoveTextOptions
947 {
948  // examine beginning
949  size_t start_pos = string::npos;
950  size_t start_len = 0;
951 
952  switch (m_BeforeMatch) {
953  case eNone:
954  // nothing to remove
955  start_pos = 0;
956  break;
957  case eText:
959  start_len = m_BeforeText.length();
960  break;
961  case eDigits:
962  start_pos = 0;
963  while (start_pos < str.length() && !isdigit(str.c_str()[start_pos])) {
964  start_pos++;
965  }
966  if (start_pos < str.length()) {
967  start_len = 1;
968  while (start_pos + start_len < str.length() && isdigit(str.c_str()[start_pos + start_len])) {
969  start_len++;
970  }
971  }
972  break;
973  case eLetters:
974  start_pos = 0;
975  while (start_pos < str.length() && !isalpha(str.c_str()[start_pos])) {
976  start_pos++;
977  }
978  if (start_pos < str.length()) {
979  start_len = 1;
980  while (start_pos + start_len < str.length() && isalpha(str.c_str()[start_pos + start_len])) {
981  start_len++;
982  }
983  }
984  break;
985  }
986  if (start_pos == string::npos || start_pos == str.length()) {
987  // beginning not found
988  return false;
989  }
990 
991 
992  // examine end
993  size_t end_pos = string::npos;
994  size_t end_len = 0;
995 
996  switch (m_AfterMatch) {
997  case eNone:
998  // nothing to remove
999  end_pos = str.length();
1000  break;
1001  case eText:
1002  end_pos = edit::FindWithOptions(str, m_AfterText, start_pos + start_len, m_CaseInsensitive, m_WholeWord);
1003  end_len = m_AfterText.length();
1004  break;
1005  case eDigits:
1006  end_pos = start_pos + start_len;
1007  while (end_pos < str.length() && !isdigit(str.c_str()[end_pos])) {
1008  end_pos++;
1009  }
1010  if (end_pos < str.length()) {
1011  end_len = 1;
1012  while (end_pos + end_len < str.length() && isdigit(str.c_str()[end_pos + end_len])) {
1013  end_len++;
1014  }
1015  }
1016  break;
1017  case eLetters:
1018  end_pos = start_pos + start_len;
1019  while (end_pos < str.length() && !isalpha(str.c_str()[end_pos])) {
1020  end_pos++;
1021  }
1022  if (end_pos < str.length()) {
1023  end_len = 1;
1024  while (end_pos + end_len < str.length() && isalpha(str.c_str()[end_pos + end_len])) {
1025  end_len++;
1026  }
1027  }
1028  break;
1029  }
1030  if (end_pos == string::npos || (end_pos == str.length() && m_AfterMatch != eNone) || end_pos < start_pos) {
1031  // end not found
1032  return false;
1033  }
1034 
1035  bool any_change = false;
1036  // remove end first
1037  if (m_AfterMatch != eNone) {
1038  size_t stop = end_pos;
1039  if (!m_RemoveAfterMatch) {
1040  stop += end_len;
1041  }
1042  if (stop < str.length()) {
1043  str = str.substr(0, stop);
1044  any_change = true;
1045  }
1046  }
1047 
1048  if (m_BeforeMatch != eNone) {
1049  size_t start = start_pos;
1050  if (m_RemoveBeforeMatch) {
1051  start += start_len;
1052  }
1053  if (start > 0) {
1054  str = str.substr(start);
1055  any_change = true;
1056  }
1057  }
1058  return any_change;
1059 }
1060 
1061 
1062 END_SCOPE(macro)
1064 
1065 /* @} */
@Auth_list.hpp User-defined methods of the data storage class.
Definition: Auth_list.hpp:57
CAuthor –.
Definition: Author.hpp:59
CBioseq_CI –.
Definition: bioseq_ci.hpp:69
CBioseq_Handle –.
bool IsNa(void) const
Definition: Bioseq.cpp:345
CFeatListItem - basic configuration data for one "feature" type.
CConfigurableItems - a static list of items that can be configured.
CFeat_CI –.
Definition: feat_ci.hpp:64
bool IsSuppressed(void) const
Definition: Gene_ref.cpp:75
Subclass of the IQueryParseUserObject which is held as the user-defined object in each CQueryParseNod...
Definition: macro_exec.hpp:71
class CMacroExecException
Definition: macro_ex.hpp:196
@Name_std.hpp User-defined methods of the data storage class.
Definition: Name_std.hpp:56
CObjectInfoEI –.
Definition: objectiter.hpp:125
CObjectInfoMI –.
Definition: objectiter.hpp:432
CObjectInfo –.
Definition: objectinfo.hpp:597
@ eVocabulary_insdc
Definition: OrgMod.hpp:69
static bool IsValidSubtypeName(const string &str, EVocabulary vocabulary=eVocabulary_raw)
Definition: OrgMod.cpp:86
CScope –.
Definition: scope.hpp:92
static const CFeatList * GetFeatList()
@ eSubtype_bad
These no longer need to match the FEATDEF values in the C toolkit's objfdef.h.
static CTempString SubtypeValueToName(ESubtype eSubtype)
Turns a ESubtype into its string value which is NOT necessarily related to the identifier of the enum...
CSeq_entry_CI –.
CSeq_entry_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
const CGene_ref * GetGeneXref(void) const
See related function in util/feature.hpp.
Definition: Seq_feat.cpp:181
CSeqdesc_CI –.
Definition: seqdesc_ci.hpp:65
Base class for all serializable objects.
Definition: serialbase.hpp:150
class CStaticArrayMap<> is an array adaptor that provides an STLish interface to statically-defined a...
Definition: static_map.hpp:105
TBase::const_iterator const_iterator
Definition: static_map.hpp:109
static bool IsValidSubtypeName(const string &str, EVocabulary vocabulary=eVocabulary_raw)
Definition: SubSource.cpp:157
@ eVocabulary_insdc
Definition: SubSource.hpp:83
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
Definition: map.hpp:338
@ eCapChange_firstlower_restnochange
capitalize the first letter, the rest is not changed
@ eCapChange_capword_afterspacepunc
capitalize the first letter and letters after spaces
@ eCapChange_none
@ eCapChange_capword_afterspace
first letter is lower case, the rest is not changed
@ eCapChange_firstcap_restnochange
capitalize the first letter, the rest is lower case
@ eCapChange_firstcap_restlower
change each letter to upper case
@ eCapChange_tolower
no change
@ eCapChange_toupper
change each letter to lower case
static const struct name_t names[]
static int type
Definition: getdata.c:31
static const char * str(char *buf, int n)
Definition: stats.c:84
static char tmp[3200]
Definition: utf8.c:42
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
Definition: ncbimisc.hpp:1508
#define NULL
Definition: ncbistd.hpp:225
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
objects::ECapChange ConvertStringtoCapitalOption(const string &cap_name)
Definition: macro_util.cpp:105
CConstRef< objects::CBioseq > GetBioseqForSeqdescObject(const CSerialObject *obj, const objects::CSeq_entry_Handle &tse)
static string s_GetFirstNameInitials(const string &first_name)
bool StringsAreEquivalent(const string &name1, const string &name2)
Definition: macro_util.cpp:397
bool RemoveFirstName(objects::CName_std &std_name)
CLabel::ELabelType NameToLabelType(const string &name)
Definition: macro_util.cpp:893
bool ApplyMiddleInitial(objects::CName_std &std_name, const string &newValue, objects::edit::EExistingText existing_text)
DEFINE_STATIC_ARRAY_MAP(TLabelTypeToNameMap, sm_CLabelMap, s_LabelTypeToName)
void CleanupForTaxnameChange(CObjectInfo oi)
Definition: macro_util.cpp:526
void ConvertMultiSpaces(string &line, const string &delimiter)
replace any instance of 2 or more spaces with a single instance of 'delimiter'
Definition: macro_util.cpp:833
static bool s_FixInitials(objects::CName_std &name)
EMatchType m_AfterMatch
Definition: macro_util.hpp:184
const char * kColl_suffix
Definition: macro_util.cpp:933
objects::CSeqFeatData::ESubtype GetFeatSubtype(const string &feat_type)
Definition: macro_util.cpp:350
const char * kMobileElementTType
Definition: macro_util.cpp:938
CMQueryNodeValue::EType GetPrimitiveFromRef(CMQueryNodeValue &node)
Definition: macro_util.cpp:274
bool FindNcbiAutofixUserObject(const objects::CSeq_entry_Handle &tse)
void s_SetInitials(CName_std &std_name, const string &middle_init)
Definition: macro_util.cpp:542
list< SResolvedField > TObs
Definition: macro_exec.hpp:92
void Dereference()
If it is a reference it is resolved to the first non reference type in the hierarchy.
Definition: macro_exec.cpp:94
void GetPrimitiveObjInfosWithContainers(CMQueryNodeValue::TObs &objs, const CMQueryNodeValue::SResolvedField &info)
Definition: macro_util.cpp:252
const char * kStrCommFieldValue
Definition: macro_util.cpp:940
bool IsStructVoucherPart(const string &field)
Definition: macro_util.cpp:826
void RemoveGeneXref(objects::CSeq_feat &feat)
string GetStringValue(CRef< CMQueryNodeValue > &value)
converts ints and doubles into string, by changing the type of the value
Definition: macro_util.cpp:330
unsigned ApplyAuthorNames(objects::CAuth_list &auth_list, const string &newValue)
const char * kSatelliteType
Definition: macro_util.cpp:935
const char * kSatelliteName
Definition: macro_util.cpp:936
CObjectInfo GetPrimitiveObjInfo(const CObjectInfo &info)
Definition: macro_util.cpp:199
EType GetDataType() const
Definition: macro_exec.hpp:122
const char * kStrCommFieldName
Definition: macro_util.cpp:942
void GetPrimitiveObjectInfos(CMQueryNodeValue::TObs &objs, const CMQueryNodeValue::SResolvedField &info)
Definition: macro_util.cpp:212
objects::CRNA_ref::EType GetRNAType(const string &rna_type)
Definition: macro_util.cpp:484
string TransformForCSV(const string &str)
Definition: macro_util.cpp:864
EStructVoucherPart GetSVPartFromString(const string voucher_part)
Definition: macro_util.cpp:815
bool IsTaxname(CMQueryNodeValue::SResolvedField &res)
Definition: macro_util.cpp:513
bool RemoveMiddleInitial(objects::CName_std &std_name)
bool IsRef() const
Definition: macro_exec.hpp:151
const char * kInst_suffix
Definition: macro_util.cpp:932
objects::edit::EExistingText ActionTypeToExistingTextOption(const string &action_type, const string &delimiter)
Definition: macro_util.cpp:64
bool GetLocusTagFromProtRef(const objects::CSeq_feat &prot_feat, objects::CScope &scope, string &locus_tag)
bool IsSatelliteSubfield(const string &field)
Definition: macro_util.cpp:903
EMatchType m_BeforeMatch
Definition: macro_util.hpp:181
bool IsMobileElementTSubfield(const string &field)
Definition: macro_util.cpp:908
const char * kMobileElementTQual
Definition: macro_util.cpp:937
bool ApplyFirstName(objects::CName_std &std_name, const string &newValue, objects::edit::EExistingText existing_text)
bool GetLocusTagFromGene(const objects::CGene_ref &gene, string &locus_tag)
bool IsBiosourceModifier(const string &field)
Definition: macro_util.cpp:505
const char * kSpecid_suffix
Definition: macro_util.cpp:934
bool EditText(string &str) const
Definition: macro_util.cpp:946
static const TFeatLabelMap s_LabelTypeToName[]
Definition: macro_util.cpp:874
void SwapGbQualWithValues(CMQueryNodeValue::TObs &objs)
Definition: macro_util.cpp:282
CRef< objects::CSeqdesc > MakeNcbiAutofixUserObject()
Definition: macro_util.cpp:457
const char * kMobileElementTName
Definition: macro_util.cpp:939
EUnverifiedType GetUnverifiedType(const string &value)
Definition: macro_util.cpp:913
void RemoveEmptyDescriptors(objects::CBioseq &bseq)
const char * kStrCommDbname
Definition: macro_util.cpp:941
objects::CSeq_entry_Handle GetParentEntryForBioSource(const objects::CBioSource &bsrc, const objects::CSeq_entry_Handle &tse)
@ eUnVer_Misassembled
Definition: macro_util.hpp:136
@ eUnVer_Contaminant
Definition: macro_util.hpp:137
ELabelType
Definition: label.hpp:60
@ eContentAndProduct
Definition: label.hpp:71
@ eType
Definition: label.hpp:65
@ eInvalid
Definition: label.hpp:61
@ eUserSubtype
Definition: label.hpp:64
@ eDefault
Definition: label.hpp:73
@ eUserTypeAndContent
Definition: label.hpp:66
@ eContent
Definition: label.hpp:62
@ eGi
Definition: label.hpp:70
@ eDescription
Definition: label.hpp:68
@ eUserType
Definition: label.hpp:63
@ eSymbolAlias
Definition: label.hpp:69
@ eDescriptionBrief
Definition: label.hpp:67
static const TObjectType * SafeCast(TTypeInfo type)
Definition: serialutil.hpp:76
@ eTypeFamilyClass
Definition: serialdef.hpp:140
@ eTypeFamilyContainer
Definition: serialdef.hpp:142
@ eTypeFamilyPointer
Definition: serialdef.hpp:143
@ eTypeFamilyPrimitive
Definition: serialdef.hpp:139
CElementIterator BeginElements(void) const
Create container elements iterator.
CObjectInfo GetPointedObject(void) const
Get data and type information of object to which this type refers.
Definition: objectinfo.cpp:102
CObjectInfo GetElement(void) const
Get element data and type information.
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
CObjectInfo GetMember(void) const
Get class member data.
bool Valid(void) const
Is iterator valid.
ETypeFamily GetTypeFamily(void) const
Get data type family.
CMemberIterator FindClassMember(const string &memberName) const
Find class member by its name.
const string & GetName(void) const
Get type name.
Definition: objectinfo.hpp:106
bool IsSet(void) const
Is member assigned a value.
const CSeq_feat * GetCDSForProduct(const CBioseq &product, CScope *scope)
Get the encoding CDS feature of a given protein sequence.
Definition: sequence.cpp:2549
CConstRef< CSeq_feat > GetOverlappingGene(const CSeq_loc &loc, CScope &scope, ETransSplicing eTransSplicing=eTransSplicing_Auto)
Definition: sequence.cpp:1366
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
@ fIncludeGivenEntry
Include the top (given) entry.
@ fRecursive
Iterate recursively.
TObjectType & GetNCObject(void) const
Get object.
Definition: ncbiobj.hpp:1187
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define USING_SCOPE(ns)
Use the specified namespace.
Definition: ncbistl.hpp:78
#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 Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
Definition: ncbistr.hpp:5159
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
Definition: ncbistr.hpp:5187
#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 EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5430
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
#define NPOS
Definition: ncbistr.hpp:133
static bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another string.
Definition: ncbistr.hpp:5325
static string Quote(const CTempString str, char quote_char='"', char escape_char = '\\')
Quote string (generic version).
Definition: ncbistr.cpp:3897
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
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 string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
Definition: ncbistr.cpp:3405
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
Definition: ncbistr.hpp:2508
@ eCase
Case sensitive compare.
Definition: ncbistr.hpp:1205
void ResetNames(void)
Reset Names data member.
Definition: Auth_list_.cpp:139
void SetName(TName &value)
Assign a value to Name data member.
Definition: Author_.cpp:81
void SetNames(TNames &value)
Assign a value to Names data member.
Definition: Auth_list_.cpp:149
bool IsSetLocus_tag(void) const
systematic gene name (e.g., MI0001, ORF0069) Check if a value has been assigned to Locus_tag data mem...
Definition: Gene_ref_.hpp:781
bool IsSetLocus(void) const
Official gene symbol Check if a value has been assigned to Locus data member.
Definition: Gene_ref_.hpp:493
const TLocus_tag & GetLocus_tag(void) const
Get the Locus_tag member data.
Definition: Gene_ref_.hpp:793
const TLocus & GetLocus(void) const
Get the Locus member data.
Definition: Gene_ref_.hpp:505
bool IsStr(void) const
Check if variant Str is selected.
Definition: Object_id_.hpp:291
bool IsSetType(void) const
type of object within class Check if a value has been assigned to Type data member.
void SetInitials(const TInitials &value)
Assign a value to Initials data member.
Definition: Name_std_.hpp:619
void ResetInitials(void)
Reset Initials data member.
Definition: Name_std_.cpp:74
const TInitials & GetInitials(void) const
Get the Initials member data.
Definition: Name_std_.hpp:610
void ResetFirst(void)
Reset First data member.
Definition: Name_std_.cpp:56
void SetLast(const TLast &value)
Assign a value to Last data member.
Definition: Name_std_.hpp:431
void SetFirst(const TFirst &value)
Assign a value to First data member.
Definition: Name_std_.hpp:478
bool IsSetInitials(void) const
first + middle initials Check if a value has been assigned to Initials data member.
Definition: Name_std_.hpp:598
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 SetSuffix(const TSuffix &value)
Assign a value to Suffix data member.
Definition: Name_std_.hpp:666
void SetType(TType &value)
Assign a value to Type data member.
const TType & GetType(void) const
Get the Type member data.
const TFirst & GetFirst(void) const
Get the First member data.
Definition: Name_std_.hpp:469
bool IsSetFirst(void) const
Check if a value has been assigned to First data member.
Definition: Name_std_.hpp:457
EType
type of RNA feature
Definition: RNA_ref_.hpp:95
@ eType_ncRNA
non-coding RNA; subsumes snRNA, scRNA, snoRNA
Definition: RNA_ref_.hpp:104
bool IsProt(void) const
Check if variant Prot is selected.
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
bool IsGene(void) const
Check if variant Gene is selected.
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
const TGene & GetGene(void) const
Get the variant data.
const TXref & GetXref(void) const
Get the Xref member data.
Definition: Seq_feat_.hpp:1308
void ResetXref(void)
Reset Xref data member.
Definition: Seq_feat_.cpp:182
list< CRef< CSeqdesc > > Tdata
Definition: Seq_descr_.hpp:91
TUser & SetUser(void)
Select the variant.
Definition: Seqdesc_.cpp:390
@ e_User
user defined object
Definition: Seqdesc_.hpp:124
@ e_Molinfo
info on the molecule and techniques
Definition: Seqdesc_.hpp:134
@ e_Source
source of materials, includes Org-ref
Definition: Seqdesc_.hpp:133
int i
Macro exceptions.
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
int isalpha(Uchar c)
Definition: ncbictype.hpp:61
int isdigit(Uchar c)
Definition: ncbictype.hpp:64
Miscellaneous common-use basic types and functionality.
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
SIZE_TYPE FindWithOptions(const string &str, const string &pattern, SIZE_TYPE start_search, bool case_insensitive, bool whole_word)
#define fi
static const char * suffix[]
Definition: pcregrep.c:408
static const char delimiter[]
#define ERASE_SEQDESC_ON_BIOSEQ(Itr, Var)
ERASE_SEQDESC_ON_BIOSEQ.
Definition: seq_macros.hpp:231
#define EDIT_EACH_SEQDESC_ON_BIOSEQ(Itr, Var)
Definition: seq_macros.hpp:221
#define ERASE_SEQFEATXREF_ON_SEQFEAT(Itr, Var)
ERASE_SEQFEATXREF_ON_SEQFEAT.
#define EDIT_EACH_SEQFEATXREF_ON_SEQFEAT(Itr, Var)
bool RemoveOldName(objects::CBioSource &src)
bool RemoveTaxId(objects::CBioSource &src)
EExistingText
@ eExistingText_cancel
@ eExistingText_append_semi
@ eExistingText_append_space
@ eExistingText_prefix_colon
@ eExistingText_add_qual
@ eExistingText_append_none
@ eExistingText_leave_old
@ eExistingText_prefix_none
@ eExistingText_prefix_space
@ eExistingText_append_colon
@ eExistingText_prefix_comma
@ eExistingText_append_comma
@ eExistingText_prefix_semi
@ 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...
SAnnotSelector –.
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...
Definition: static_set.hpp:60
Definition: type.c:6
else result
Definition: token2.c:20
Modified on Wed Jun 19 17:04:14 2024 by modify_doxy.py rev. 669887