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

Go to the SVN repository for this file.

1 /* $Id: validerror_format.cpp 97442 2022-07-18 22:14:50Z gotvyans $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Jonathan Kans, Clifford Clausen, Aaron Ucko.......
27  *
28  * File Description:
29  * Validates CSeq_entries and CSeq_submits
30  *
31  */
32 #include <ncbi_pch.hpp>
33 #include <corelib/ncbistd.hpp>
34 #include <serial/serialbase.hpp>
38 #include <objects/seq/Bioseq.hpp>
39 #include <objects/seq/Pubdesc.hpp>
40 #include <objects/seq/Seqdesc.hpp>
48 #include <objmgr/util/sequence.hpp>
50 //#include <objtools/validator/validatorp.hpp>
52 #include <util/static_map.hpp>
53 
54 
55 
58 BEGIN_SCOPE(validator)
59 USING_SCOPE(sequence);
60 
61 
62 // *********************** CValidErrorFormat implementation **********************
63 
64 
65 //LCOV_EXCL_START
66 //used by Genome Workbench to create submitter report,
67 //not used by asnvalidate
69  m_ObjMgr(&objmgr)
70 {
71 }
72 
73 
75 {
76 }
77 
78 
80 {
82 
83  switch(err_code) {
91  break;
94  break;
100  break;
103  break;
106  break;
109  break;
113  break;
114  default:
115  break;
116  }
117  return rval;
118 }
119 
120 
122 {
123  string rval;
124  switch(err_code) {
129  rval = "Not Splice Consensus";
130  break;
132  rval = "EC Number Format";
133  break;
138  rval = "EC Number Value";
139  break;
141  rval = "EC Number Problem";
142  break;
144  rval = "Bad Specific-host Values";
145  break;
147  rval = "Bad Institution Codes";
148  break;
151  rval = "LatLonCountry Errors";
152  break;
153  default:
154  rval = CValidErrItem::ConvertErrCode(err_code);
155  break;
156  }
157 
158  return rval;
159 }
160 
161 
163 {
164  string rval;
165 
166  switch (error.GetErrIndex()) {
174  break;
182  break;
185  break;
188  break;
192  break;
193  default:
195  break;
196  }
197 
198  return rval;
199 }
200 
201 
203 {
204  string rval;
205  if (!error.IsSetMsg() || NStr::IsBlank(error.GetMsg())) {
206  return rval;
207  }
208  string msg = error.GetMsg();
209  if (NStr::Find(msg, "(AG) not found") != string::npos) {
210  rval = "AG";
211  }
212  else if (NStr::Find(msg, "(GT) not found") != string::npos) {
213  rval = "GT";
214  } else if (NStr::Find(msg, "(AT-AC) found instead of (GT-AG)") != string::npos) {
215  rval = "(AT-AC) instead of (GT-AG)";
216  } else if (NStr::Find(msg, "(GC-AG) found instead of (GT-AG)") != string::npos) {
217  rval = "(GC-AG) instead of (GT-AG)";
218  }
219  if (NStr::IsBlank(rval)) {
220  return rval;
221  }
222 
223  size_t position_pos = NStr::Find(msg, "ending at position ");
224  size_t other_clue = NStr::Find(msg, "and before exon");
225  if (position_pos == string::npos || other_clue == string::npos) {
226  position_pos = NStr::Find(msg, "position ");
227  if (position_pos != string::npos) {
228  string pos_str = msg.substr(position_pos);
229  long int pos;
230  if (sscanf(pos_str.c_str(), "position %ld of ", &pos) == 1) {
231  rval += " at " + NStr::NumericToString(pos);
232  size_t seq_pos = NStr::Find(pos_str, " of ");
233  if (seq_pos != string::npos) {
234  rval = pos_str.substr(seq_pos + 4) + "\t" + rval;
235  }
236  }
237  }
238  } else {
239  string pos_str = msg.substr(position_pos);
240  long int pos1, pos2;
241  if (sscanf(pos_str.c_str(), "ending at position %ld and before exon starting at position %ld of ", &pos1, &pos2) == 2) {
242  rval += " at " + NStr::NumericToString(pos1) + ", " + NStr::NumericToString(pos2);
243  size_t seq_pos = NStr::Find(pos_str, " of ");
244  if (seq_pos != string::npos) {
245  rval = pos_str.substr(seq_pos + 4) + "\t" + rval;
246  }
247  }
248  }
249 
250  string obj_desc = error.GetObjDesc();
251  size_t type_pos = NStr::Find(obj_desc, "FEATURE: ");
252  if (type_pos != string::npos) {
253  obj_desc = obj_desc.substr(type_pos + 9);
254  size_t space_pos = NStr::Find(obj_desc, ":");
255  if (space_pos != string::npos) {
256  obj_desc = obj_desc.substr(0, space_pos);
257  }
258  }
259 
260  rval = obj_desc + "\t" + rval;
261 
262  return rval;
263 }
264 
265 
266 void RemovePrefix(string& str, const string& prefix)
267 {
268  size_t type_pos = NStr::Find(str, prefix);
269  if (type_pos != string::npos) {
270  str = str.substr(type_pos + prefix.length());
271  }
272 }
273 
274 void RemoveSuffix(string& str, const string& suffix)
275 {
276  size_t type_pos = NStr::Find(str, suffix);
277  if (type_pos != string::npos) {
278  str = str.substr(0, type_pos);
279  }
280 }
281 
282 
284 {
285  string obj_desc = error.GetObjDesc();
286  if (NStr::StartsWith(obj_desc, "FEATURE") && error.IsSetObj_content()) {
287  obj_desc = error.GetObj_content();
288  NStr::ReplaceInPlace(obj_desc, ":", "\t", 0, 1);
289  // Add feature location part of label
290  if (error.IsSetLocation()) {
291  obj_desc += "\t" + error.GetLocation();
292  }
293  if (error.IsSetLocus_tag()) {
294  obj_desc += "\t" + error.GetLocus_tag();
295  } else if (error.IsSetObject() && error.GetObject().GetThisTypeInfo() == CSeq_feat:: GetTypeInfo()) {
296  const CSeq_feat* sf = static_cast<const CSeq_feat*>(&(error.GetObject()));
297  if (sf) {
298  obj_desc += "\t" + x_GetLocusTag(*sf, scope);
299  }
300  }
301  } else {
302  RemovePrefix(obj_desc, "DESCRIPTOR: ");
303  RemovePrefix(obj_desc, "BioSrc: ");
304  RemoveSuffix(obj_desc, " BIOSEQ: ");
305  RemoveSuffix(obj_desc, " BIOSEQ-SET: ");
306 
307  NStr::ReplaceInPlace(obj_desc, ":", "\t", 0, 1);
308  size_t close_pos = NStr::Find(obj_desc, "]");
309  if (close_pos != string::npos) {
310  obj_desc = obj_desc.substr(0, close_pos);
311  NStr::ReplaceInPlace(obj_desc, "[", "\t");
312  }
313  }
314  string rval = error.GetAccession() + ":" + obj_desc;
315 
316  return rval;
317 }
318 
319 
321 {
322  string rval;
323  string ec_numbers;
324  string prot_name;
325  string locus_tag;
326 
327  // want: accession number for sequence, ec numbers, locus tag, protein name
328 
329  if (error.GetObject().GetThisTypeInfo() != CSeq_feat::GetTypeInfo()) {
330  return rval;
331  }
332  const CSeq_feat* feat = static_cast<const CSeq_feat*>(&(error.GetObject()));
333  if (!feat) {
334  return rval;
335  }
336 
337  // look for EC number in quals
338  if (feat->IsSetQual()) {
339  ITERATE(CSeq_feat::TQual, it, feat->GetQual()) {
340  if ((*it)->IsSetQual() &&
341  NStr::EqualNocase((*it)->GetQual(), "EC_number") &&
342  (*it)->IsSetVal() &&
343  !NStr::IsBlank((*it)->GetVal())) {
344  if (!NStr::IsBlank(ec_numbers)) {
345  ec_numbers += ";";
346  }
347  ec_numbers += (*it)->GetVal();
348  }
349  }
350  }
351  // look for EC number in prot-ref
352  if (feat->IsSetData() && feat->GetData().IsProt() &&
353  feat->GetData().GetProt().IsSetEc()) {
354  ITERATE(CProt_ref::TEc, it, feat->GetData().GetProt().GetEc()) {
355  if (!NStr::IsBlank(ec_numbers)) {
356  ec_numbers += ";";
357  }
358  ec_numbers += *it;
359  }
360  }
361 
362  if (NStr::IsBlank(ec_numbers)) {
363  ec_numbers = "Blank EC number";
364  }
365 
366  // look for protein name
367  if (feat->IsSetData() && feat->GetData().IsProt() &&
368  feat->GetData().GetProt().IsSetName() &&
369  !feat->GetData().GetProt().GetName().empty()) {
370  prot_name = feat->GetData().GetProt().GetName().front();
371  }
372 
373  // get locus tag
375  if (gene && gene->GetData().GetGene().IsSetLocus_tag()) {
376  locus_tag = gene->GetData().GetGene().GetLocus_tag();
377  }
378 
379  rval = error.GetAccnver() + "\t" + ec_numbers + "\t" + locus_tag + "\t" + prot_name;
380  return rval;
381 }
382 
383 
385 {
386  string rval;
387 
388  if (biosrc.IsSetOrg() &&
389  biosrc.GetOrg().IsSetOrgname() &&
390  biosrc.GetOrg().GetOrgname().IsSetMod()) {
391  ITERATE(COrgName::TMod, it, biosrc.GetOrg().GetOrgname().GetMod()) {
392  if ((*it)->IsSetSubtype() &&
393  (*it)->GetSubtype() == COrgMod::eSubtype_nat_host &&
394  (*it)->IsSetSubname() &&
395  !NStr::IsBlank((*it)->GetSubname())) {
396  if (!NStr::IsBlank(rval)) {
397  rval += ";";
398  }
399  rval += (*it)->GetSubname();
400  }
401  }
402  }
403  return rval;
404 }
405 
406 
408 {
409  string rval;
410  string spec_host;
411  const string kAlternateName = "Specific host value is alternate name: ";
412  if (NStr::StartsWith(error.GetMsg(), kAlternateName)) {
413  spec_host = error.GetMsg().substr(kAlternateName.length());
414  } else if (error.GetObject().GetThisTypeInfo() == CSeqdesc::GetTypeInfo()) {
415  const CSeqdesc* desc = static_cast<const CSeqdesc *>(&(error.GetObject()));
416  if (desc && desc->IsSource()) {
417  spec_host = s_GetSpecificHostFromBioSource(desc->GetSource());
418  }
419  } else if (error.GetObject().GetThisTypeInfo() == CSeq_feat::GetTypeInfo()) {
420  const CSeq_feat* feat = static_cast<const CSeq_feat *>(&(error.GetObject()));
421  if (feat && feat->IsSetData() && feat->GetData().IsBiosrc()) {
422  spec_host = s_GetSpecificHostFromBioSource(feat->GetData().GetBiosrc());
423  }
424  }
425 
426  if (!NStr::IsBlank(spec_host)) {
427  rval = error.GetAccession() + "\t" + spec_host;
428  }
429 
430  return rval;
431 }
432 
433 
435 {
436  string rval;
437 
438  if (biosrc.IsSetOrg() &&
439  biosrc.GetOrg().IsSetOrgname() &&
440  biosrc.GetOrg().GetOrgname().IsSetMod()) {
441  ITERATE(COrgName::TMod, it, biosrc.GetOrg().GetOrgname().GetMod()) {
442  if ((*it)->IsSetSubtype() &&
443  ((*it)->GetSubtype() == COrgMod::eSubtype_bio_material ||
444  (*it)->GetSubtype() == COrgMod::eSubtype_culture_collection ||
445  (*it)->GetSubtype() == COrgMod::eSubtype_specimen_voucher) &&
446  (*it)->IsSetSubname() &&
447  !NStr::IsBlank((*it)->GetSubname())) {
448  size_t pos = NStr::Find((*it)->GetSubname(), ":");
449  if (pos != string::npos) {
450  string code = (*it)->GetSubname().substr(0, pos);
451  if (!NStr::IsBlank(code)) {
452  if (!NStr::IsBlank(rval)) {
453  rval += ";";
454  }
455  rval += code;
456  }
457  }
458  }
459  }
460  }
461  return rval;
462 }
463 
464 
466 {
467  string rval;
468 
469  string codes;
470  if (error.GetObject().GetThisTypeInfo() == CSeqdesc::GetTypeInfo()) {
471  const CSeqdesc* desc = static_cast<const CSeqdesc *>(&(error.GetObject()));
472  if (desc && desc->IsSource()) {
473  codes = s_GetInstCodeFromBioSource(desc->GetSource());
474  }
475  }
476  else if (error.GetObject().GetThisTypeInfo() == CSeq_feat::GetTypeInfo()) {
477  const CSeq_feat* feat = static_cast<const CSeq_feat *>(&(error.GetObject()));
478  if (feat && feat->IsSetData() && feat->GetData().IsBiosrc()) {
479  codes = s_GetInstCodeFromBioSource(feat->GetData().GetBiosrc());
480  }
481  }
482 
483  if (!NStr::IsBlank(codes)) {
484  rval = error.GetAccession() + "\t" + codes;
485  }
486 
487  return rval;
488 }
489 
490 
492 {
493  string rval;
494  for ( CValidError_CI vit(errors); vit; ++vit) {
495  if (err_code == vit->GetErrIndex()) {
496  string this_val = FormatForSubmitterReport(*vit, scope);
497  if (!NStr::IsBlank(this_val)) {
498  if (NStr::IsBlank(rval)) {
499  rval += GetSubmitterFormatErrorGroupTitle(err_code) + "\n";
500  }
501  rval += this_val + "\n";
502  }
503  }
504  }
505  return rval;
506 }
507 
508 
510  (const CValidError& errors, CScope& scope, ESubmitterFormatErrorGroup grp) const
511 {
512  string rval;
513  for ( CValidError_CI vit(errors); vit; ++vit) {
514  CValidErrItem::TErrIndex err_code = vit->GetErrIndex();
515  if (GetSubmitterFormatErrorGroup(err_code) == grp) {
516  string this_val = FormatForSubmitterReport(*vit, scope);
517  if (!NStr::IsBlank(this_val)) {
518  if (NStr::IsBlank(rval)) {
519  rval += GetSubmitterFormatErrorGroupTitle(err_code) + "\n";
520  }
521  rval += this_val + "\n";
522  }
523  }
524  }
525  return rval;
526 }
527 
528 
530 {
531  string rval = error.GetAccession() + ":" + error.GetMsg();
532  return rval;
533 }
534 
535 
536 vector<unsigned int> CValidErrorFormat::GetListOfErrorCodes(const CValidError& errors) const
537 {
538  vector<unsigned int> list;
539 
540  for ( CValidError_CI vit(errors); vit; ++vit) {
541  list.push_back(vit->GetErrIndex());
542  }
543  sort(list.begin(), list.end());
544  list.erase(unique(list.begin(), list.end()), list.end());
545  return list;
546 }
547 
548 
549 vector<string> CValidErrorFormat::FormatCompleteSubmitterReport(const CValidError& errors, CScope& scope) const
550 {
551  vector<string> list;
552 
553  // first, do special categories
555  string this_val = FormatCategoryForSubmitterReport(errors, scope, (ESubmitterFormatErrorGroup)t);
556  if (!NStr::IsBlank(this_val)) {
557  list.push_back(this_val);
558  }
559  }
560 
561  // now do errors not in special categories
562  vector<unsigned int> codes = GetListOfErrorCodes(errors);
563  ITERATE(vector<unsigned int>, it, codes) {
565  string this_val = FormatForSubmitterReport(errors, scope, *it);
566  if (!NStr::IsBlank(this_val)) {
567  list.push_back(this_val);
568  }
569  }
570  }
571  return list;
572 }
573 //LCOV_EXCL_STOP
574 
575 
576 static string s_GetFeatureIdLabel (const CObject_id& object_id)
577 {
578  string feature_id;
579  if (object_id.IsId()) {
580  feature_id = NStr::IntToString(object_id.GetId());
581  } else if (object_id.IsStr()) {
582  feature_id = object_id.GetStr();
583  }
584  return feature_id;
585 }
586 
587 
589 {
590  string feature_id;
591  if (feat_id.IsLocal()) {
592  feature_id = s_GetFeatureIdLabel(feat_id.GetLocal());
593  } else if (feat_id.IsGeneral()) {
594  if (feat_id.GetGeneral().IsSetDb()) {
595  feature_id += feat_id.GetGeneral().GetDb();
596  }
597  feature_id += ":";
598  if (feat_id.GetGeneral().IsSetTag()) {
599  feature_id += s_GetFeatureIdLabel (feat_id.GetGeneral().GetTag());
600  }
601  }
602  return feature_id;
603 }
604 
605 
607 {
608  string feature_id;
609  if (ft.IsSetId()) {
610  feature_id = CValidErrorFormat::GetFeatureIdLabel(ft.GetId());
611  } else if (ft.IsSetIds()) {
612  ITERATE(CSeq_feat::TIds, id_it, ft.GetIds()) {
613  feature_id = CValidErrorFormat::GetFeatureIdLabel((**id_it));
614  if (!NStr::IsBlank(feature_id)) {
615  break;
616  }
617  }
618  }
619  return feature_id;
620 }
621 
622 
623 static void s_FixBioseqLabelProblems (string& str)
624 {
625  size_t pos = NStr::Find(str, ",");
626  if (pos != string::npos && str.c_str()[pos + 1] != 0 && str.c_str()[pos + 1] != ' ') {
627  str = str.substr(0, pos + 1) + " " + str.substr(pos + 1);
628  }
629  pos = NStr::Find(str, "=");
630  if (pos != string::npos && str.c_str()[pos + 1] != 0 && str.c_str()[pos + 1] != ' ') {
631  str = str.substr(0, pos + 1) + " " + str.substr(pos + 1);
632  }
633 }
634 
635 
636 
637 static string s_GetOrgRefContentLabel (const COrg_ref& org)
638 {
639  string content;
640  if (org.IsSetTaxname()) {
641  content = org.GetTaxname();
642  } else if (org.IsSetCommon()) {
643  content = org.GetCommon();
644  } else if (org.IsSetDb() && !org.GetDb().empty()) {
645  org.GetDb().front()->GetLabel(&content);
646  }
647  return content;
648 }
649 
650 
651 static string s_GetBioSourceContentLabel (const CBioSource& bsrc)
652 {
653  string content;
654  if (bsrc.IsSetOrg()) {
655  content = s_GetOrgRefContentLabel(bsrc.GetOrg());
656  }
657  return content;
658 }
659 
660 
661 static string s_GetFeatureContentLabelExtras (const CSeq_feat& feat)
662 {
663  string tlabel;
664 
665  // Put Seq-feat qual into label
666  if (feat.IsSetQual()) {
667  string prefix("/");
668  ITERATE(CSeq_feat::TQual, it, feat.GetQual()) {
669  tlabel += prefix + (**it).GetQual();
670  prefix = " ";
671  if (!(**it).GetVal().empty()) {
672  tlabel += "=" + (**it).GetVal();
673  }
674  }
675  }
676 
677  // Put Seq-feat comment into label
678  if (feat.IsSetComment()) {
679  if (tlabel.empty()) {
680  tlabel = feat.GetComment();
681  } else {
682  tlabel += "; " + feat.GetComment();
683  }
684  }
685  return tlabel;
686 }
687 
688 
689 static string s_GetCdregionContentLabel (const CSeq_feat& feat, CRef<CScope> scope)
690 {
691  string content;
692 
693  // Check that feature data is Cdregion
694  if (!feat.GetData().IsCdregion()) {
695  return content;
696  }
697 
698  const CGene_ref* gref = nullptr;
699  const CProt_ref* pref = nullptr;
700 
701  // Look for CProt_ref object to create a label from
702  if (feat.IsSetXref()) {
703  ITERATE ( CSeq_feat::TXref, it, feat.GetXref()) {
704  const CSeqFeatXref& xref = **it;
705  if ( !xref.IsSetData() ) {
706  continue;
707  }
708 
709  switch (xref.GetData().Which()) {
711  pref = &xref.GetData().GetProt();
712  break;
714  gref = &xref.GetData().GetGene();
715  break;
716  default:
717  break;
718  }
719  }
720  }
721 
722  // Try and create a label from a CProt_ref in CSeqFeatXref in feature
723  if (pref) {
724  pref->GetLabel(&content);
725  return content;
726  }
727 
728  // Try and create a label from a CProt_ref in the feat product and
729  // return if found
730  if (feat.IsSetProduct() && scope) {
731  try {
732  const CSeq_id& id = GetId(feat.GetProduct(), scope);
733  CBioseq_Handle hnd = scope->GetBioseqHandle(id);
734  if (hnd) {
735  const CBioseq& seq = *hnd.GetCompleteBioseq();
736 
737  // Now look for a CProt_ref feature in seq and
738  // if found call GetLabel() on the CProt_ref
740  for (;it; ++it) {
741  if (it->IsProt()) {
742  it->GetProt().GetLabel(&content);
743  return content;
744  }
745  }
746  }
747  } catch (CObjmgrUtilException&) {}
748  }
749 
750  // Try and create a label from a CGene_ref in CSeqFeatXref in feature
751  if (gref) {
752  gref->GetLabel(&content);
753  }
754 
755  if (NStr::IsBlank(content)) {
756  content = s_GetFeatureContentLabelExtras(feat);
757  }
758 
759  return content;
760 }
761 
762 
764 {
765  string content_label;
766 
767  switch (feat.GetData().Which()) {
768  case CSeqFeatData::e_Pub:
769  content_label = "Cit: ";
770  feat.GetData().GetPub().GetPub().GetLabel(&content_label);
771  break;
773  content_label = "Src: " + s_GetBioSourceContentLabel (feat.GetData().GetBiosrc());
774  break;
775  case CSeqFeatData::e_Imp:
776  {
777  feature::GetLabel(feat, &content_label, feature::fFGL_Both, scope);
778  if (feat.GetData().GetImp().IsSetKey()) {
779  string key = feat.GetData().GetImp().GetKey();
780  string tmp = "[" + key + "]";
781  if (NStr::StartsWith(content_label, tmp)) {
782  content_label = key + content_label.substr(tmp.length());
783  }
784  }
785  }
786  break;
787  case CSeqFeatData::e_Rna:
788  feature::GetLabel(feat, &content_label, feature::fFGL_Both, scope);
790  && NStr::Equal(content_label, "tRNA: tRNA")) {
791  content_label = "tRNA: ";
792  }
793  break;
795  content_label = "CDS: " + s_GetCdregionContentLabel(feat, scope);
796  break;
798  feature::GetLabel(feat, &content_label, feature::fFGL_Both, scope);
799  if (feat.GetData().GetProt().IsSetProcessed()) {
800  switch (feat.GetData().GetProt().GetProcessed()) {
802  content_label = "mat_peptide: " + content_label.substr(6);
803  break;
805  content_label = "sig_peptide: " + content_label.substr(6);
806  break;
808  content_label = "trans_peptide: " + content_label.substr(6);
809  break;
810  default:
811  break;
812  }
813  }
814  break;
815  default:
816  feature::GetLabel(feat, &content_label, feature::fFGL_Both, scope);
817  break;
818  }
819  return content_label;
820 }
821 
822 
823 string CValidErrorFormat::GetFeatureBioseqLabel(const CSeq_feat& ft, CRef<CScope> scope, bool suppress_context)
824 {
825  string desc;
826  // Append label for bioseq of feature location
827  if (!suppress_context && scope) {
828  bool find_failed = false;
829  try {
830  CBioseq_Handle hnd;
831  try {
832  hnd = scope->GetBioseqHandle(ft.GetLocation());
833  } catch (CException&) {
834  CSeq_loc_CI li(ft.GetLocation());
835  while (li && !hnd) {
836  hnd = scope->GetBioseqHandle(li.GetSeq_id());
837  ++li;
838  }
839  }
840  if (hnd) {
842  }
843  } catch (CObjMgrException& ex) {
845  find_failed = true;
846  }
847  } catch (const CException&) {
848  } catch (const std::exception&) {
849  };
850  if (find_failed) {
851  try {
852  CSeq_loc_CI li(ft.GetLocation());
853  CBioseq_Handle hnd = scope->GetBioseqHandle(li.GetSeq_id());
854  if (hnd) {
856  }
857 
858  } catch (const CException&) {
859  } catch (const std::exception&) {
860  };
861  }
862  }
863  return desc;
864 }
865 
866 
867 string CValidErrorFormat::GetFeatureProductLocLabel(const CSeq_feat& ft, CRef<CScope> scope, bool suppress_context)
868 {
869  string desc;
870  // Append label for product of feature
871  if (ft.IsSetProduct() && scope) {
872  string loc_label;
873  if (suppress_context) {
874  CSeq_loc loc;
875  loc.Assign(ft.GetProduct());
876  ChangeSeqLocId(&loc, false, scope);
877  loc_label = GetValidatorLocationLabel(loc, *scope);
878  } else {
879  loc_label = GetValidatorLocationLabel(ft.GetProduct(), *scope);
880  }
881  if (loc_label.size() > 800) {
882  loc_label.replace(797, NPOS, "...");
883  }
884  if (!loc_label.empty()) {
885  desc += "[";
886  desc += loc_label;
887  desc += "]";
888  }
889  }
890  return desc;
891 }
892 
893 
894 string CValidErrorFormat::GetFeatureLocationLabel(const CSeq_feat& ft, CRef<CScope> scope, bool suppress_context)
895 {
896  string loc_label;
897  // Add feature location part of label
898  if (ft.IsSetLocation() && scope) {
899  if (suppress_context) {
900  CSeq_loc loc;
901  loc.Assign(ft.GetLocation());
902  ChangeSeqLocId(&loc, false, scope);
903  loc_label = GetValidatorLocationLabel(loc, *scope);
904  } else {
905  loc_label = GetValidatorLocationLabel(ft.GetLocation(), *scope);
906  }
907  if (loc_label.size() > 800) {
908  loc_label.replace(795, NPOS, "...");
909  }
910  }
911  return loc_label;
912 }
913 
914 //LCOV_EXCL_START
915 //not used
916 string CValidErrorFormat::GetFeatureLabel(const CSeq_feat& ft, CRef<CScope> scope, bool suppress_context)
917 {
918  // Add feature part of label
919  string desc = "FEATURE: ";
920  string content_label = CValidErrorFormat::GetFeatureContentLabel(ft, scope);
921  desc += content_label;
922 
923  // Add feature ID part of label (if present)
924  string feature_id = GetFeatureIdLabel(ft);
925  if (!NStr::IsBlank(feature_id)) {
926  desc += " <" + feature_id + "> ";
927  }
928 
929  // Add feature location part of label
930  string loc_label = GetFeatureLocationLabel(ft, scope, suppress_context);
931  if (!NStr::IsBlank(loc_label)) {
932  desc += " [" + loc_label + "]";
933  }
934 
935  // Append label for bioseq of feature location
936  string bioseq_label = GetFeatureBioseqLabel(ft, scope, suppress_context);
937  if (!NStr::IsBlank(bioseq_label)) {
938  desc += bioseq_label;
939  }
940 
941  // Append label for product of feature
942  string product_label = GetFeatureProductLocLabel(ft, scope, suppress_context);
943  if (!NStr::IsBlank(product_label)) {
944  desc += product_label;
945  }
946  return desc;
947 }
948 //LCOV_EXCL_STOP
949 
950 
952 {
953  string content;
954 
955  switch (ds.Which()) {
956  case CSeqdesc::e_Pub:
957  content = "Pub: ";
958  ds.GetPub().GetPub().GetLabel(&content);
959  break;
960  case CSeqdesc::e_Source:
961  content = "BioSource: " + s_GetBioSourceContentLabel(ds.GetSource());
962  break;
963  case CSeqdesc::e_Modif:
964  ds.GetLabel(&content, CSeqdesc::eBoth);
965  if (NStr::StartsWith(content, "modif: ,")) {
966  content = "Modifier: " + content.substr(8);
967  }
968  break;
969  case CSeqdesc::e_Molinfo:
970  ds.GetLabel(&content, CSeqdesc::eBoth);
971  if (NStr::StartsWith(content, "molinfo: ,")) {
972  content = "molInfo: " + content.substr(10);
973  }
974  break;
975  case CSeqdesc::e_Comment:
976  ds.GetLabel(&content, CSeqdesc::eBoth);
977  if (NStr::StartsWith(content, "comment: ") && NStr::IsBlank(content.substr(9))) {
978  content = "comment: ";
979  }
980  break;
981  case CSeqdesc::e_User:
982  content = "UserObj: ";
983  if (ds.GetUser().IsSetClass()) {
984  content += ds.GetUser().GetClass();
985  } else if (ds.GetUser().IsSetType() && ds.GetUser().GetType().IsStr()) {
986  content += ds.GetUser().GetType().GetStr();
987  }
988  break;
989  default:
990  ds.GetLabel(&content, CSeqdesc::eBoth);
991  break;
992  }
993  // fix descriptor type names
994  string first = content.substr(0, 1);
996  content = first + content.substr(1);
997  size_t colon_pos = NStr::Find(content, ":");
998  if (colon_pos != string::npos) {
999  size_t dash_pos = NStr::Find(content.substr(0, colon_pos), "-");
1000  if (dash_pos != string::npos) {
1001  string after_dash = content.substr(dash_pos + 1, 1);
1002  NStr::ToUpper (after_dash);
1003  content = content.substr(0, dash_pos) + after_dash + content.substr(dash_pos + 2);
1004  }
1005  }
1006  if (NStr::StartsWith(content, "BioSource:")) {
1007  content = "BioSrc:" + content.substr(10);
1008  } else if (NStr::StartsWith(content, "Modif:")) {
1009  content = "Modifier:" + content.substr(6);
1010  } else if (NStr::StartsWith(content, "Embl:")) {
1011  content = "EMBL:" + content.substr(5);
1012  } else if (NStr::StartsWith(content, "Pir:")) {
1013  content = "PIR:" + content.substr(4);
1014  }
1015  return content;
1016 }
1017 
1018 
1019 string CValidErrorFormat::GetDescriptorLabel(const CSeqdesc& ds, const CSeq_entry& ctx, CRef<CScope> scope, bool suppress_context)
1020 {
1021  string desc("DESCRIPTOR: ");
1022 
1023  string content = CValidErrorFormat::GetDescriptorContent (ds);
1024 
1025  desc += content;
1026 
1027  desc += " ";
1028  if (ctx.IsSeq()) {
1029  AppendBioseqLabel(desc, ctx.GetSeq(), suppress_context);
1030  } else {
1031  desc += CValidErrorFormat::GetBioseqSetLabel(ctx.GetSet(), scope, suppress_context);
1032  }
1033  return desc;
1034 }
1035 
1036 
1038 {
1039  string desc;
1040 
1042  desc += " [";
1043  string bc_label;
1044  bc->GetLabel(&bc_label, CBioseq::eBoth);
1045  s_FixBioseqLabelProblems(bc_label);
1046  desc += bc_label;
1047  desc += "]";
1048  return desc;
1049 }
1050 
1051 
1052 string CValidErrorFormat::GetBioseqSetLabel(const CBioseq_set& st, CRef<CScope> /*dummy*/, bool suppress_context)
1053 {
1054  return GetBioseqSetLabel(st, suppress_context);
1055 }
1056 
1057 
1058 string CValidErrorFormat::GetBioseqSetLabel(const CBioseq_set& st, bool suppress_context)
1059 {
1060  const auto isSetClass = st.IsSetClass();
1061  suppress_context = suppress_context || !isSetClass;
1062 
1063  int version = 0;
1064  const string& accession = GetAccessionFromBioseqSet(st, &version);
1065  return GetBioseqSetLabel(accession, isSetClass ? st.GetClass() : CBioseq_set::eClass_not_set, suppress_context);
1066 }
1067 
1068 
1069 string CValidErrorFormat::GetBioseqSetLabel(const string& accession, CBioseq_set::EClass setClass, bool suppress_context)
1070 {
1071  string str = "BIOSEQ-SET: ";
1072  if (!suppress_context) {
1073  const auto* tv = CBioseq_set::GetTypeInfo_enum_EClass();
1074  const string& context = tv->FindName(setClass, true);
1075  str += context;
1076  str += ": ";
1077  }
1078 
1079  if(NStr::IsBlank(accession)) {
1080  str += "(No Bioseqs)";
1081  return str;
1082  }
1083 
1084  string temporary(accession); // create modifiable copy of accession
1085  s_FixBioseqLabelProblems(temporary);
1086  str += temporary;
1087  return str;
1088 }
1089 
1090 //LCOV_EXCL_START
1091 //not used
1092 string CValidErrorFormat::GetObjectLabel(const CObject& obj, const CSeq_entry& ctx, CRef<CScope> scope, bool suppress_context)
1093 {
1094  string label = "Unknown object";
1095 
1096  const CSeq_feat* ft = dynamic_cast<const CSeq_feat*>(&obj);
1097  const CSeqdesc* ds = dynamic_cast<const CSeqdesc*>(&obj);
1098  const CBioseq* b = dynamic_cast<const CBioseq*>(&obj);
1099  const CBioseq_set* set = dynamic_cast<const CBioseq_set*>(&obj);
1100 
1101  if (ft) {
1102  label = GetFeatureLabel(*ft, scope, suppress_context);
1103  } else if (ds) {
1104  label = GetDescriptorLabel(*ds, ctx, scope, suppress_context);
1105  } else if (b) {
1106  label = GetBioseqLabel(scope->GetBioseqHandle(*b));
1107  } else if (set) {
1108  label = GetBioseqSetLabel(*set, suppress_context);
1109  }
1110  return label;
1111 }
1112 //LCOV_EXCL_STOP
1113 
1114 
1115 //LCOV_EXCL_START
1116 //added for GPIPE, not used for asnvalidate
1117 const string kSuppressFieldLabel = "Suppress";
1118 
1119 bool s_IsSuppressField (const CUser_field& field)
1120 {
1121  if (field.IsSetLabel() &&
1122  field.GetLabel().IsStr() &&
1124  return true;
1125  } else {
1126  return false;
1127  }
1128 }
1129 
1130 
1131 void CValidErrorFormat::AddSuppression(CUser_object& user, unsigned int error_code)
1132 {
1133  bool found = false;
1134  if (user.IsSetData()) {
1136  if (s_IsSuppressField(**it)) {
1137  if ((*it)->IsSetData()) {
1138  if ((*it)->GetData().IsInt()) {
1139  unsigned int old_val = (*it)->GetData().GetInt();
1140  if (old_val == error_code) {
1141  // do nothing, already there
1142  } else {
1143  (*it)->SetData().SetInts().push_back(old_val);
1144  (*it)->SetData().SetInts().push_back(error_code);
1145  }
1146  found = true;
1147  break;
1148  } else if ((*it)->GetData().IsInts()) {
1149  ITERATE(CUser_field::TData::TInts, ii, (*it)->GetData().GetInts()) {
1150  if (*ii == error_code) {
1151  found = true;
1152  break;
1153  }
1154  }
1155  if (!found) {
1156  (*it)->SetData().SetInts().push_back(error_code);
1157  found = true;
1158  }
1159  break;
1160  }
1161  }
1162  }
1163  }
1164  }
1165  if (!found) {
1166  CRef<CUser_field> field(new CUser_field());
1167  field->SetLabel().SetStr(kSuppressFieldLabel);
1168  field->SetData().SetInts().push_back(error_code);
1169  user.SetData().push_back(field);
1170  }
1171 }
1172 
1173 
1175 {
1176  if (!user.IsSetData()) {
1177  return;
1178  }
1179  ITERATE(CUser_object::TData, it, user.GetData()) {
1180  if ((*it)->IsSetData() && s_IsSuppressField(**it)) {
1181  if ((*it)->GetData().IsInt()) {
1182  errors.SuppressError((*it)->GetData().GetInt());
1183  } else if ((*it)->GetData().IsInts()) {
1184  ITERATE(CUser_field::TData::TInts, ii, (*it)->GetData().GetInts()) {
1185  errors.SuppressError(*ii);
1186  }
1187  } else if ((*it)->GetData().IsStr()) {
1188  unsigned int ec = CValidErrItem::ConvertToErrCode((*it)->GetData().GetStr());
1189  if (ec != eErr_MAX) {
1190  errors.SuppressError(ec);
1191  }
1192  } else if ((*it)->GetData().IsStrs()) {
1193  ITERATE(CUser_field::TData::TStrs, si, (*it)->GetData().GetStrs()) {
1194  unsigned int ec = CValidErrItem::ConvertToErrCode(*si);
1195  if (ec != eErr_MAX) {
1196  errors.SuppressError(ec);
1197  }
1198  }
1199  }
1200  }
1201  }
1202 }
1203 
1204 
1206 {
1207  if (se.IsSeq()) {
1208  SetSuppressionRules(se.GetSeq(), errors);
1209  } else if (se.IsSet()) {
1210  const CBioseq_set& set = se.GetSet();
1211  if (set.IsSetDescr()) {
1212  ITERATE(CBioseq_set::TDescr::Tdata, it, set.GetDescr().Get()) {
1213  if ((*it)->IsUser() &&
1214  (*it)->GetUser().GetObjectType() == CUser_object::eObjectType_ValidationSuppression) {
1215  SetSuppressionRules((*it)->GetUser(), errors);
1216  }
1217  }
1218  }
1219  if (set.IsSetSeq_set()) {
1220  ITERATE(CBioseq_set::TSeq_set, it, set.GetSeq_set()) {
1221  SetSuppressionRules(**it, errors);
1222  }
1223  }
1224  }
1225 }
1226 
1227 
1229 {
1230  SetSuppressionRules(*(se.GetCompleteSeq_entry()), errors);
1231 }
1232 
1233 
1235 {
1236  if (ss.IsEntrys()) {
1238  SetSuppressionRules(**it, errors);
1239  }
1240  }
1241 }
1242 
1243 
1245 {
1246  if (seq.IsSetDescr()) {
1247  ITERATE(CBioseq::TDescr::Tdata, it, seq.GetDescr().Get()) {
1248  if ((*it)->IsUser() &&
1249  (*it)->GetUser().GetObjectType() == CUser_object::eObjectType_ValidationSuppression) {
1250  SetSuppressionRules((*it)->GetUser(), errors);
1251  }
1252  }
1253  }
1254 }
1255 //LCOV_EXCL_STOP
1256 
1257 
1258 //LCOV_EXCL_START
1259 //not used by asnvalidate but may be useful for other clients of validator library
1261 {
1262  for (auto it : errors.SetErrs()) {
1263  if (it->IsSetLocus_tag()) {
1264  continue;
1265  }
1266  if (it->IsSetObjectType() &&
1267  it->GetObjectType() == CValidErrItem::eObjectType_seqfeat &&
1268  it->IsSetObject() &&
1269  it->GetObject().GetThisTypeInfo() == CSeq_feat::GetTypeInfo()) {
1270  const CSeq_feat* sf = static_cast<const CSeq_feat *>(&(it->GetObject()));
1271  if (sf && sf->IsSetData()) {
1272  it->SetLocus_tag(x_GetLocusTag(*sf, scope));
1273  }
1274  }
1275  }
1276 }
1277 
1278 
1279 const string& CValidErrorFormat::x_GetLocusTag(const CSeq_feat& sf, CScope& scope)
1280 {
1281  const string* rval = &kEmptyStr;
1282 
1283  if (sf.GetData().IsGene()) {
1284  if (sf.GetData().GetGene().IsSetLocus_tag()) {
1285  rval = &sf.GetData().GetGene().GetLocus_tag();
1286  }
1287  } else {
1288  const CGene_ref* g = sf.GetGeneXref();
1289  if (g && g->IsSetLocus_tag()) {
1290  rval = &g->GetLocus_tag();
1291  } else {
1293  if (gene && gene->GetData().GetGene().IsSetLocus_tag()) {
1294  rval = &gene->GetData().GetGene().GetLocus_tag();
1295  }
1296  }
1297  }
1298  return *rval;
1299 }
1300 //LCOV_EXCL_STOP
1301 
1302 
1303 END_SCOPE(validator)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eErr_SEQ_FEAT_NotSpliceConsensusAcceptor
@ eErr_SEQ_FEAT_EcNumberProblem
@ eErr_SEQ_FEAT_NotSpliceConsensusDonor
@ eErr_SEQ_DESCR_LatLonWater
@ eErr_SEQ_DESCR_LatLonCountry
@ eErr_MAX
@ eErr_SEQ_FEAT_NotSpliceConsensusAcceptorTerminalIntron
@ eErr_SEQ_FEAT_ReplacedEcNumber
@ eErr_SEQ_FEAT_NotSpliceConsensusDonorTerminalIntron
@ eErr_SEQ_FEAT_BadEcNumberValue
@ eErr_SEQ_DESCR_BadInstitutionCode
@ eErr_SEQ_FEAT_NotSpliceConsensus
@ eErr_SEQ_FEAT_SplitEcNumber
@ eErr_SEQ_FEAT_RareSpliceConsensusDonor
@ eErr_SEQ_FEAT_DeletedEcNumber
@ eErr_SEQ_FEAT_BadEcNumberFormat
@ eErr_SEQ_DESCR_BadSpecificHost
CBioseq_Handle –.
@ eBoth
Definition: Bioseq.hpp:104
void GetLabel(string *label, ELabelType type, bool worst=false) const
Definition: Bioseq.cpp:202
CFeat_id –.
Definition: Feat_id.hpp:66
void GetLabel(string *label) const
Definition: Gene_ref.cpp:57
Base class for all object manager exceptions.
CObjectManager –.
CObject –.
Definition: ncbiobj.hpp:180
Exceptions for objmgr/util library.
void GetLabel(string *label) const
Definition: Prot_ref.cpp:62
bool GetLabel(string *label, TLabelFlags flags=0, ELabelVersion version=eLabel_DefaultVersion) const override
Append a label to "label" based on content.
Definition: Pub_equiv.cpp:56
CScope –.
Definition: scope.hpp:92
ESubtype GetSubtype(void) const
CSeqFeatXref –.
Definition: SeqFeatXref.hpp:66
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
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
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
Definition: Seq_loc.hpp:453
bool IsEntrys(void) const
Definition: Seq_submit.cpp:54
void GetLabel(string *const label, ELabelType label_type) const
Definition: Seqdesc.cpp:134
Template class for iteration on objects of class C (non-medifiable version)
Definition: iterator.hpp:767
@ eObjectType_ValidationSuppression
static const string ConvertErrCode(unsigned int)
static unsigned int ConvertToErrCode(const string &str)
string x_FormatBadSpecificHostForSubmitterReport(const CValidErrItem &error) const
string FormatCategoryForSubmitterReport(const CValidError &errors, CScope &scope, ESubmitterFormatErrorGroup grp) const
string x_FormatBadInstCodeForSubmitterReport(const CValidErrItem &error) const
ESubmitterFormatErrorGroup GetSubmitterFormatErrorGroup(CValidErrItem::TErrIndex err_code) const
static string GetFeatureBioseqLabel(const CSeq_feat &ft, CRef< CScope > scope, bool suppress_context)
static string GetDescriptorContent(const CSeqdesc &ds)
static string GetFeatureLocationLabel(const CSeq_feat &ft, CRef< CScope > scope, bool suppress_context)
static string GetFeatureProductLocLabel(const CSeq_feat &ft, CRef< CScope > scope, bool suppress_context)
vector< unsigned int > GetListOfErrorCodes(const CValidError &errors) const
static string GetDescriptorLabel(const CSeqdesc &ds, const CSeq_entry &ctx, CRef< CScope > scope, bool suppress_context)
static void AddSuppression(CUser_object &user, unsigned int error_code)
string x_FormatLatLonCountryForSubmitterReport(const CValidErrItem &error) const
string GetSubmitterFormatErrorGroupTitle(CValidErrItem::TErrIndex err_code) const
vector< string > FormatCompleteSubmitterReport(const CValidError &errors, CScope &scope) const
static void SetSuppressionRules(const CUser_object &user, CValidError &errors)
static string GetFeatureContentLabel(const CSeq_feat &feat, CRef< CScope > scope)
static string GetObjectLabel(const CObject &obj, const CSeq_entry &ctx, CRef< CScope > scope, bool suppress_context)
string x_FormatECNumberForSubmitterReport(const CValidErrItem &error, CScope &scope) const
static const string & x_GetLocusTag(const CSeq_feat &sf, CScope &scope)
static string GetFeatureLabel(const CSeq_feat &ft, CRef< CScope > scope, bool suppress_context)
static void AddLocusTags(CValidError &errors, CScope &scope)
static string GetFeatureIdLabel(const CSeq_feat &ft)
string FormatForSubmitterReport(const CValidErrItem &error, CScope &scope) const
string x_FormatConsensusSpliceForSubmitterReport(const CValidErrItem &error, CScope &scope) const
static string GetBioseqLabel(CBioseq_Handle bh)
static string GetBioseqSetLabel(const CBioseq_set &st, CRef< CScope > scope, bool suppress_context)
string x_FormatGenericForSubmitterReport(const CValidErrItem &error, CScope &scope) const
void SuppressError(unsigned int ec)
Definition: ValidError.cpp:181
Definition: set.hpp:45
Include a standard set of the NCBI C++ Toolkit most basic headers.
CS_CONTEXT * ctx
Definition: t0006.c:12
static const char si[8][64]
Definition: des.c:146
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
TErrCode GetErrCode(void) const
Get error code.
Definition: ncbiexpt.cpp:453
string GetLabel(const CSeq_id &id)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
Definition: Seq_loc.cpp:337
const CSeq_id & GetSeq_id(void) const
Get seq_id of the current location.
Definition: Seq_loc.hpp:1028
CConstBeginInfo ConstBegin(const C &obj)
Get starting point of non-modifiable object hierarchy.
Definition: iterator.hpp:1012
@ fFGL_Both
Definition: feature.hpp:74
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
void ChangeSeqLocId(CSeq_loc *loc, bool best, CScope *scope)
Change each of the CSeq_ids embedded in a CSeq_loc to the best or worst CSeq_id accoring to the value...
CConstRef< CSeq_feat > GetGeneForFeature(const CSeq_feat &feat, CScope &scope)
Finds gene for feature, but obeys SeqFeatXref directives.
Definition: sequence.cpp:1529
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
@ eFindFailed
The data requested can not be found.
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
#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
#define kEmptyStr
Definition: ncbistr.hpp:123
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 string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5083
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:2887
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:5411
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:5352
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 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:5383
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:3401
static string & ToUpper(string &str)
Convert string to upper case – string& version.
Definition: ncbistr.cpp:424
static const char label[]
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
Definition: BioSource_.hpp:497
const TOrg & GetOrg(void) const
Get the Org member data.
Definition: BioSource_.hpp:509
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
const TLocus_tag & GetLocus_tag(void) const
Get the Locus_tag member data.
Definition: Gene_ref_.hpp:793
bool IsSetData(void) const
the object itself Check if a value has been assigned to Data data member.
bool IsStr(void) const
Check if variant Str is selected.
Definition: Object_id_.hpp:291
bool IsSetDb(void) const
name of database or system Check if a value has been assigned to Db data member.
Definition: Dbtag_.hpp:208
bool IsSetType(void) const
type of object within class Check if a value has been assigned to Type data member.
const TTag & GetTag(void) const
Get the Tag member data.
Definition: Dbtag_.hpp:267
bool IsId(void) const
Check if variant Id is selected.
Definition: Object_id_.hpp:264
bool IsSetTag(void) const
appropriate tag Check if a value has been assigned to Tag data member.
Definition: Dbtag_.hpp:255
const TDb & GetDb(void) const
Get the Db member data.
Definition: Dbtag_.hpp:220
bool IsSetClass(void) const
endeavor which designed this object Check if a value has been assigned to Class data member.
const TClass & GetClass(void) const
Get the Class member data.
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 SetData(TData &value)
Assign a value to Data data member.
const TLabel & GetLabel(void) const
Get the Label member data.
const TType & GetType(void) const
Get the Type member data.
vector< CStringUTF8 > TStrs
vector< CRef< CUser_field > > TData
TId GetId(void) const
Get the variant data.
Definition: Object_id_.hpp:270
const TMod & GetMod(void) const
Get the Mod member data.
Definition: OrgName_.hpp:839
bool IsSetDb(void) const
ids in taxonomic or culture dbases Check if a value has been assigned to Db data member.
Definition: Org_ref_.hpp:479
bool IsSetCommon(void) const
common name Check if a value has been assigned to Common data member.
Definition: Org_ref_.hpp:407
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
Definition: Org_ref_.hpp:372
const TCommon & GetCommon(void) const
Get the Common member data.
Definition: Org_ref_.hpp:419
const TDb & GetDb(void) const
Get the Db member data.
Definition: Org_ref_.hpp:491
bool IsSetMod(void) const
Check if a value has been assigned to Mod data member.
Definition: OrgName_.hpp:827
list< CRef< COrgMod > > TMod
Definition: OrgName_.hpp:332
bool IsSetOrgname(void) const
Check if a value has been assigned to Orgname data member.
Definition: Org_ref_.hpp:529
bool IsSetTaxname(void) const
preferred formal name Check if a value has been assigned to Taxname data member.
Definition: Org_ref_.hpp:360
const TOrgname & GetOrgname(void) const
Get the Orgname member data.
Definition: Org_ref_.hpp:541
@ eSubtype_nat_host
natural host of this specimen
Definition: OrgMod_.hpp:104
@ eSubtype_specimen_voucher
Definition: OrgMod_.hpp:106
@ eSubtype_bio_material
Definition: OrgMod_.hpp:119
@ eSubtype_culture_collection
Definition: OrgMod_.hpp:118
const TName & GetName(void) const
Get the Name member data.
Definition: Prot_ref_.hpp:378
bool IsSetEc(void) const
E.C.
Definition: Prot_ref_.hpp:438
list< string > TEc
Definition: Prot_ref_.hpp:110
TProcessed GetProcessed(void) const
Get the Processed member data.
Definition: Prot_ref_.hpp:538
bool IsSetProcessed(void) const
Check if a value has been assigned to Processed data member.
Definition: Prot_ref_.hpp:513
bool IsSetName(void) const
protein name Check if a value has been assigned to Name data member.
Definition: Prot_ref_.hpp:366
const TEc & GetEc(void) const
Get the Ec member data.
Definition: Prot_ref_.hpp:450
@ eProcessed_signal_peptide
Definition: Prot_ref_.hpp:99
@ eProcessed_transit_peptide
Definition: Prot_ref_.hpp:100
const TKey & GetKey(void) const
Get the Key member data.
Definition: Imp_feat_.hpp:259
bool IsSetComment(void) const
Check if a value has been assigned to Comment data member.
Definition: Seq_feat_.hpp:1037
const TData & GetData(void) const
Get the Data member data.
const TPub & GetPub(void) const
Get the variant data.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
Definition: Seq_feat_.hpp:913
bool IsSetQual(void) const
qualifiers Check if a value has been assigned to Qual data member.
Definition: Seq_feat_.hpp:1135
E_Choice Which(void) const
Which variant is currently selected.
bool IsProt(void) const
Check if variant Prot is selected.
const TIds & GetIds(void) const
Get the Ids member data.
Definition: Seq_feat_.hpp:1452
bool IsCdregion(void) const
Check if variant Cdregion is selected.
const TQual & GetQual(void) const
Get the Qual member data.
Definition: Seq_feat_.hpp:1147
bool IsSetKey(void) const
Check if a value has been assigned to Key data member.
Definition: Imp_feat_.hpp:247
const TId & GetId(void) const
Get the Id member data.
Definition: Seq_feat_.hpp:904
const TLocal & GetLocal(void) const
Get the variant data.
Definition: Feat_id_.cpp:134
bool IsSetXref(void) const
cite other relevant features Check if a value has been assigned to Xref data member.
Definition: Seq_feat_.hpp:1296
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
bool IsLocal(void) const
Check if variant Local is selected.
Definition: Feat_id_.hpp:353
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
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
const TGeneral & GetGeneral(void) const
Get the variant data.
Definition: Feat_id_.cpp:156
list< CRef< CFeat_id > > TIds
Definition: Seq_feat_.hpp:126
bool IsSetIds(void) const
set of Ids; will replace 'id' field Check if a value has been assigned to Ids data member.
Definition: Seq_feat_.hpp:1440
const TBiosrc & GetBiosrc(void) const
Get the variant data.
bool IsSetId(void) const
Check if a value has been assigned to Id data member.
Definition: Seq_feat_.hpp:892
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
const TComment & GetComment(void) const
Get the Comment member data.
Definition: Seq_feat_.hpp:1049
bool IsBiosrc(void) const
Check if variant Biosrc is selected.
const TGene & GetGene(void) const
Get the variant data.
const TProt & GetProt(void) const
Get the variant data.
const TXref & GetXref(void) const
Get the Xref member data.
Definition: Seq_feat_.hpp:1308
vector< CRef< CSeqFeatXref > > TXref
Definition: Seq_feat_.hpp:122
vector< CRef< CGb_qual > > TQual
Definition: Seq_feat_.hpp:117
bool IsGeneral(void) const
Check if variant General is selected.
Definition: Feat_id_.hpp:359
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
Definition: Seq_feat_.hpp:1084
const TImp & GetImp(void) const
Get the variant data.
bool IsSetLocation(void) const
feature made from Check if a value has been assigned to Location data member.
Definition: Seq_feat_.hpp:1105
@ e_Pub
publication applies to this seq
const TSeq & GetSeq(void) const
Get the variant data.
Definition: Seq_entry_.cpp:102
bool IsSetClass(void) const
Check if a value has been assigned to Class data member.
TClass GetClass(void) const
Get the Class member data.
const TSet & GetSet(void) const
Get the variant data.
Definition: Seq_entry_.cpp:124
bool IsSeq(void) const
Check if variant Seq is selected.
Definition: Seq_entry_.hpp:257
bool IsSet(void) const
Check if variant Set is selected.
Definition: Seq_entry_.hpp:263
list< CRef< CSeq_entry > > TSeq_set
list< CRef< CSeqdesc > > Tdata
Definition: Seq_descr_.hpp:91
const TUser & GetUser(void) const
Get the variant data.
Definition: Seqdesc_.cpp:384
const TSource & GetSource(void) const
Get the variant data.
Definition: Seqdesc_.cpp:566
const TPub & GetPub(void) const
Get the variant data.
Definition: Seqdesc_.cpp:356
bool IsSource(void) const
Check if variant Source is selected.
Definition: Seqdesc_.hpp:1190
const Tdata & Get(void) const
Get the member data.
Definition: Seq_descr_.hpp:166
bool IsSetDescr(void) const
descriptors Check if a value has been assigned to Descr data member.
Definition: Bioseq_.hpp:303
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seqdesc_.hpp:903
const TPub & GetPub(void) const
Get the Pub member data.
Definition: Pubdesc_.hpp:605
const TDescr & GetDescr(void) const
Get the Descr member data.
Definition: Bioseq_.hpp:315
@ e_User
user defined object
Definition: Seqdesc_.hpp:124
@ e_Pub
a reference to the publication
Definition: Seqdesc_.hpp:122
@ e_Comment
a more extensive comment
Definition: Seqdesc_.hpp:117
@ e_Molinfo
info on the molecule and techniques
Definition: Seqdesc_.hpp:134
@ e_Modif
modifiers
Definition: Seqdesc_.hpp:112
@ e_Source
source of materials, includes Org-ref
Definition: Seqdesc_.hpp:133
list< CRef< CSeq_entry > > TEntrys
const TEntrys & GetEntrys(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
unsigned int TErrIndex
TErrs & SetErrs(void)
Assign a value to Errs data member.
static int version
Definition: mdb_load.c:29
constexpr auto sort(_Init &&init)
const struct ncbi::grid::netcache::search::fields::KEY key
EIPRangeType t
Definition: ncbi_localip.c:101
The Object manager core.
void AppendBioseqLabel(string &str, const CBioseq &sq, bool supress_context)
Definition: utilities.cpp:1068
string GetAccessionFromBioseqSet(const CBioseq_set &bsst, int *version)
Definition: utilities.cpp:436
string GetValidatorLocationLabel(const CSeq_loc &loc, CScope &scope)
Definition: utilities.cpp:961
static char tmp[2048]
Definition: utf8.c:42
static const char * suffix[]
Definition: pcregrep.c:408
static const char * prefix[]
Definition: pcregrep.c:405
static const char * str(char *buf, int n)
Definition: stats.c:84
Definition: inftrees.h:24
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
Definition: thrddgri.c:44
static string s_GetFeatureIdLabel(const CObject_id &object_id)
string s_GetInstCodeFromBioSource(const CBioSource &biosrc)
static void s_FixBioseqLabelProblems(string &str)
const string kSuppressFieldLabel
void RemoveSuffix(string &str, const string &suffix)
void RemovePrefix(string &str, const string &prefix)
static string s_GetOrgRefContentLabel(const COrg_ref &org)
string s_GetSpecificHostFromBioSource(const CBioSource &biosrc)
static string s_GetFeatureContentLabelExtras(const CSeq_feat &feat)
static string s_GetCdregionContentLabel(const CSeq_feat &feat, CRef< CScope > scope)
static string s_GetBioSourceContentLabel(const CBioSource &bsrc)
USING_SCOPE(sequence)
bool s_IsSuppressField(const CUser_field &field)
ESubmitterFormatErrorGroup
@ eSubmitterFormatErrorGroup_BadInstitutionCode
@ eSubmitterFormatErrorGroup_BadEcNumberValue
@ eSubmitterFormatErrorGroup_ConsensusSplice
@ eSubmitterFormatErrorGroup_BadEcNumberProblem
@ eSubmitterFormatErrorGroup_BadEcNumberFormat
@ eSubmitterFormatErrorGroup_Default
@ eSubmitterFormatErrorGroup_LatLonCountry
@ eSubmitterFormatErrorGroup_BadSpecificHost
Modified on Sat Sep 30 23:15:36 2023 by modify_doxy.py rev. 669887