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

Go to the SVN repository for this file.

1 /* $Id: validator.cpp 102946 2024-08-08 16:18:28Z kans $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * 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>
36 #include <objects/seq/Bioseq.hpp>
37 #include <objects/seq/Seqdesc.hpp>
39 #include <objmgr/util/sequence.hpp>
41 #include <util/static_map.hpp>
42 #include <util/sgml_entity.hpp>
46 
51 
52 
55 BEGIN_SCOPE(validator)
56 USING_SCOPE(sequence);
57 
58 
59 // *********************** CValidator implementation *******************
60 //
62  CValidator(objmgr, make_shared<SValidatorContext>())
63 {
64  SetTaxon3(make_shared<CTaxon3>());
65 }
66 
68  shared_ptr<SValidatorContext> pContext):
69  m_ObjMgr{&objmgr},
70  m_pContext{pContext}
71 {
72 }
73 
74 
75 void CValidator::SetTaxon3(shared_ptr<ITaxon3> pTaxon)
76 {
77  m_pOwnTaxon = pTaxon;
78  if (m_pOwnTaxon)
79  m_pContext->m_taxon_update = MakeTaxUpdateFunction(m_pOwnTaxon);
80 }
81 
83 {}
84 
86 {
87  taxon->Init();
88  return [remote = taxon](const vector< CRef<COrg_ref> >& query) -> CRef<CTaxon3_reply>
89  { // we need to make a copy of record to prevent changes put back to cache
90  if (!query.empty() && remote) {
91  CConstRef<CTaxon3_reply> res = remote->SendOrgRefList(query);
93  copied->Assign(*res);
94  return copied;
95  } else {
96  return {};
97  }
98  };
99 }
100 
102  const CSeq_entry& se,
103  CScope* scope,
104  Uint4 options)
105 {
106  CRef<CValidError> errors(new CValidError(&se));
108  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
110  if ( !imp.Validate(se, nullptr, scope) ) {
111  errors.Reset();
112  }
115  ctx.NumGenes += imp.GetGeneCount();
116  ctx.NumGeneXrefs += imp.GetGeneXrefCount();
117  ctx.CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
118  return errors;
119 }
120 
121 
122 
124  const CSeq_entry& se,
125  CScope* scope,
126  Uint4 options,
127  IValidError& errors,
128  const CValidator::TSuppressed* pSuppressed)
129 {
130  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
131  if (pSuppressed) {
132  imp.SetSuppressed() = *pSuppressed;
133  }
135  imp.Validate(se, nullptr, scope);
137  m_pContext->NumGenes += imp.GetGeneCount();
138  m_pContext->NumGeneXrefs += imp.GetGeneXrefCount();
139  m_pContext->CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
140 }
141 
142 
144  const CSeq_entry_Handle& seh,
145  Uint4 options)
146 {
149  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
151  if ( !imp.Validate(seh) ) {
152  errors.Reset();
153  }
156  ctx.NumGenes += imp.GetGeneCount();
157  ctx.NumGeneXrefs += imp.GetGeneXrefCount();
158  ctx.CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
159  return errors;
160 }
161 
162 
164  const CSeq_entry_Handle& seh,
165  Uint4 options,
166  IValidError& errors,
167  const CValidator::TSuppressed* pSuppressed)
168 {
169  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
170  if (pSuppressed) {
171  imp.SetSuppressed() = *pSuppressed;
172  }
174  imp.Validate(seh);
177  ctx.NumGenes += imp.GetGeneCount();
178  ctx.NumGeneXrefs += imp.GetGeneXrefCount();
179  ctx.CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
180 }
181 
182 
183 
184 //LCOV_EXCL_START
185 // not used by asnvalidate, used by external programs
187 {
190  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
192  if ( !imp.GetTSANStretchErrors(se) ) {
193  errors.Reset();
194  }
195  return errors;
196 }
197 
198 
200 {
203  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
205  if ( !imp.GetTSACDSOnMinusStrandErrors(se) ) {
206  errors.Reset();
207  }
208  return errors;
209 }
210 
211 
213 {
216  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
218  if ( !imp.GetTSAConflictingBiomolTechErrors(se) ) {
219  errors.Reset();
220  }
221  return errors;
222 }
223 
224 
226 {
227 
228  CRef<CValidError> errors(new CValidError(&seq));
230  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
232  if ( !imp.GetTSANStretchErrors(seq) ) {
233  errors.Reset();
234  }
235  return errors;
236 }
237 
238 
240 {
241  CRef<CValidError> errors(new CValidError(&f));
243  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
245  if ( !imp.GetTSACDSOnMinusStrandErrors(f, seq) ) {
246  errors.Reset();
247  }
248  return errors;
249 }
250 
251 
253 {
254  CRef<CValidError> errors(new CValidError(&seq));
256  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
258  if ( !imp.GetTSAConflictingBiomolTechErrors(seq) ) {
259  errors.Reset();
260  }
261  return errors;
262 }
263 //LCOV_EXCL_STOP
264 
265 
267  const CSeq_submit& ss,
268  CScope* scope,
269  Uint4 options)
270 {
272  CRef<CValidError> errors(new CValidError(&ss));
274  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
275  imp.Validate(ss, scope);
276 
278 
279  return errors;
280 }
281 
282 
284  const CSeq_submit& ss,
285  CScope* scope,
286  Uint4 options,
287  IValidError& errors,
288  const CValidator::TSuppressed* pSuppressed)
289 {
291  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
292  if (pSuppressed) {
293  imp.SetSuppressed() = *pSuppressed;
294  }
295  imp.Validate(ss, scope);
297  m_pContext->NumGenes += imp.GetGeneCount();
298  m_pContext->NumGeneXrefs += imp.GetGeneXrefCount();
299  m_pContext->CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
300 }
301 
302 
304  const CSeq_annot_Handle& sah,
305  Uint4 options)
306 {
307  auto errors = Ref(new CValidError(&*(sah.GetCompleteSeq_annot())));
308  Validate(sah, options, *errors);
309  return errors;
310 }
311 
312 
314  const CSeq_annot_Handle& sah,
315  Uint4 options,
316  CValidError& errors)
317 {
318  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
319  imp.Validate(sah);
320 }
321 
322 
324  const CSeq_annot_Handle& sah,
325  Uint4 options,
326  IValidError& errors)
327 {
328  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
329  imp.Validate(sah);
330 }
331 
332 
334  const CSeq_feat& feat,
335  CScope* scope,
336  Uint4 options)
337 {
338  CRef<CValidError> errors(new CValidError(&feat));
339  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
340  imp.Validate(feat, scope);
341  return errors;
342 }
343 
344 
346  const CSeq_feat& feat,
347  CScope* scope,
348  Uint4 options,
349  IValidError& errors)
350 {
351  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
352  imp.Validate(feat, scope);
353 }
354 
355 
356 
358  const CBioSource& src,
359  CScope* scope,
360  Uint4 options)
361 {
362  CRef<CValidError> errors(new CValidError(&src));
363  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
364  imp.Validate(src, scope);
365  return errors;
366 }
367 
368 
370  const CBioSource& src,
371  CScope* scope,
372  Uint4 options,
373  IValidError& errors)
374 {
375  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
376  imp.Validate(src, scope);
377 }
378 
379 
380 
381 
383  const CPubdesc& pubdesc,
384  CScope* scope,
385  Uint4 options)
386 {
387  CRef<CValidError> errors(new CValidError(&pubdesc));
388  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
389  imp.Validate(pubdesc, scope);
390  return errors;
391 }
392 
394  const CPubdesc& pubdesc,
395  CScope* scope,
396  Uint4 options,
397  IValidError& errors)
398 {
399  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
400  imp.Validate(pubdesc, scope);
401 }
402 
404  const CSeqdesc& desc,
405  const CSeq_entry& ctx,
406  Uint4 options)
407 {
408  CRef<CValidError> errors(new CValidError(&desc));
409  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
410  imp.Validate(desc, ctx);
411  return errors;
412 }
413 
415  const CSeqdesc& desc,
416  const CSeq_entry& ctx,
417  Uint4 options,
418  IValidError& errors)
419 {
420  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
421  imp.Validate(desc, ctx);
422 }
423 
425  const CSeqdesc& desc) const
426 {
427  if (!desc.IsUser()) {
428  return false;
429  }
430 
431  CValidError_imp imp(const_cast<CObjectManager&>(*m_ObjMgr), m_pContext, nullptr);
432  return CValidError_desc(imp).IsValidStructuredComment(desc);
433 }
434 
435 
436 void CValidator::SetProgressCallback(TProgressCallback callback, void* user_data)
437 {
438  m_PrgCallback = callback;
439  m_UserData = user_data;
440 }
441 
442 
443 bool CValidator::BadCharsInAuthorName(const string& str, bool allowcomma, bool allowperiod, bool last)
444 {
445  if (NStr::IsBlank(str)) {
446  return false;
447  }
448 
449 
450  size_t stp = string::npos;
451  if (last) {
452  if (NStr::StartsWith(str, "St.")) {
453  stp = 2;
454  }
455  else if (NStr::StartsWith(str, "de M.")) {
456  stp = 4;
457  }
458  }
459 
460  size_t pos = 0;
461  const char *ptr = str.c_str();
462 
463  while (*ptr != 0) {
464  if (isalpha(*ptr)
465  || *ptr == '-'
466  || *ptr == '\''
467  || *ptr == ' '
468  || (*ptr == ',' && allowcomma)
469  || (*ptr == '.' && (allowperiod || pos == stp))) {
470  // all these are ok
471  ptr++;
472  pos++;
473  } else {
474  string tail = str.substr(pos);
475  if (NStr::Equal(tail, "2nd") ||
476  NStr::Equal(tail, "3rd") ||
477  NStr::Equal(tail, "4th") ||
478  NStr::Equal(tail, "5th") ||
479  NStr::Equal(tail, "6th")) {
480  return false;
481  }
482  return true;
483  }
484  }
485  return false;
486 }
487 
488 
490 {
491  if (NStr::EqualNocase(str, "et al.")) {
492  // this is ok
493  return false;
494  } else {
495  return BadCharsInAuthorName(str, false, false, true);
496  }
497 }
498 
500 {
501  return BadCharsInAuthorName(str, false, true, false);
502 }
503 
504 
506 {
507  return BadCharsInAuthorName(str, false, true, false);
508 }
509 
510 
512 {
513  return BadCharsInAuthorName(str, false, true, false);
514 }
515 
516 
517 string CValidator::BadCharsInAuthor(const CName_std& author, bool& last_is_bad)
518 {
519  string badauthor;
520  last_is_bad = false;
521 
522  if (author.IsSetLast() && BadCharsInAuthorLastName(author.GetLast())) {
523  last_is_bad = true;
524  badauthor = author.GetLast();
525  } else if (author.IsSetFirst() && BadCharsInAuthorFirstName(author.GetFirst())) {
526  badauthor = author.GetFirst();
527  }
528  else if (author.IsSetInitials() && BadCharsInAuthorInitials(author.GetInitials())) {
529  badauthor = author.GetInitials();
530  } else if (author.IsSetSuffix() && BadCharsInAuthorSuffix(author.GetSuffix())) {
531  badauthor = author.GetSuffix();
532  }
533  return badauthor;
534 }
535 
536 
537 string CValidator::BadCharsInAuthor(const CAuthor& author, bool& last_is_bad)
538 {
539  last_is_bad = false;
540  if (author.IsSetName() && author.GetName().IsName()) {
541  return BadCharsInAuthor(author.GetName().GetName(), last_is_bad);
542  } else {
543  return kEmptyStr;
544  }
545 }
546 
547 
548 typedef bool(*CompareConsecutiveIntervalProc) (const CSeq_interval& int1, const CSeq_interval& int2, CScope *scope);
549 
551  const CPacked_seqint& packed_int,
552  CConstRef<CSeq_interval>& int_cur,
553  CConstRef<CSeq_interval>& int_prv,
554  CScope* scope,
556 {
557  bool ok = true;
558  ITERATE(CPacked_seqint::Tdata, it, packed_int.Get()) {
559  int_cur = (*it);
560  if (int_prv && !compar(*int_cur, *int_prv, scope)) {
561  ok = false;
562  break;
563  }
564 
565  int_prv = int_cur;
566  }
567  return ok;
568 }
569 
570 
572 {
573  bool ok = true;
574  const CSeq_interval *int_cur = nullptr, *int_prv = nullptr;
575 
577  for (; lit && ok; ++lit) {
578  CSeq_loc::E_Choice loc_choice = lit->Which();
579  switch (loc_choice) {
580  case CSeq_loc::e_Int: {
581  int_cur = &lit->GetInt();
582  if (int_prv) {
583  ok = compar(*int_cur, *int_prv, &scope);
584  }
585  int_prv = int_cur;
586  } break;
587  case CSeq_loc::e_Pnt:
588  int_prv = nullptr;
589  break;
591  int_prv = nullptr;
592  break;
593  case CSeq_loc::e_Packed_int: {
594  CConstRef<CSeq_interval> this_int_cur(int_cur);
595  CConstRef<CSeq_interval> this_int_prv(int_prv);
597  (lit->GetPacked_int(), this_int_cur, this_int_prv, &scope, compar);
598  } break;
599  case CSeq_loc::e_Null:
600  break;
601  default:
602  int_prv = nullptr;
603  break;
604  }
605  }
606  return ok;
607 }
608 
609 
611  const CSeq_interval& int_cur,
612  const CSeq_interval& int_prv,
613  CScope* scope)
614 {
615  ENa_strand strand_cur = int_cur.IsSetStrand() ?
616  int_cur.GetStrand() : eNa_strand_unknown;
617 
618  if (IsSameBioseq(int_prv.GetId(), int_cur.GetId(), scope)) {
619  if (strand_cur == eNa_strand_minus) {
620  if (int_prv.GetTo() < int_cur.GetTo()) {
621  return false;
622  }
623  }
624  else {
625  if (int_prv.GetTo() > int_cur.GetTo()) {
626  return false;
627  }
628  }
629  }
630  return true;
631 }
632 
633 
635 {
636  CBioseq_Handle seq;
637  try {
638  CBioseq_Handle seq = scope.GetBioseqHandle(loc);
639  } catch (CObjMgrException& ) {
640  // no way to tell
641  return true;
642  } catch (const exception& ) {
643  // no way to tell
644  return true;
645  }
646  if (seq && seq.GetInst_Topology() == CSeq_inst::eTopology_circular) {
647  // no way to check if topology is circular
648  return true;
649  }
650 
652 }
653 
654 
656  const CSeq_interval& int_cur,
657  const CSeq_interval& int_prv,
658  CScope* scope)
659 {
660  ENa_strand strand_cur = int_cur.IsSetStrand() ?
661  int_cur.GetStrand() : eNa_strand_unknown;
662 
663  bool ok = true;
664  if (IsSameBioseq(int_prv.GetId(), int_cur.GetId(), scope)) {
665  if (strand_cur == eNa_strand_minus) {
666  if (int_cur.GetTo() + 1 == int_prv.GetFrom()) {
667  ok = false;
668  }
669  }
670  else {
671  if (int_prv.GetTo() + 1 == int_cur.GetFrom()) {
672  ok = false;
673  }
674  }
675  }
676  return ok;
677 }
678 
679 
681 (const CSeq_loc& loc, CScope &scope)
682 {
683  return !CheckConsecutiveIntervals(loc, scope, x_IsNotAdjacent);
684 }
685 
686 
687 bool x_SameStrand(const CSeq_interval& int1, const CSeq_interval& int2)
688 {
689  ENa_strand strand1 = int1.IsSetStrand() ?
690  int1.GetStrand() : eNa_strand_unknown;
691  ENa_strand strand2 = int2.IsSetStrand() ?
692  int2.GetStrand() : eNa_strand_unknown;
693  return (strand1 == strand2);
694 }
695 
696 
697 bool IsNotDuplicateInterval(const CSeq_interval& int1, const CSeq_interval& int2, CScope* scope)
698 {
699  if (IsSameBioseq(int1.GetId(), int2.GetId(), scope) &&
700  x_SameStrand(int1, int2) &&
701  int1.GetFrom() == int2.GetFrom() &&
702  int1.GetTo() == int2.GetTo()) {
703  return false;
704  }
705  return true;
706 }
707 
709 {
711 }
712 
713 
715 {
716  EErrType rval = eErr_UNKNOWN;
717  switch (errcode) {
719  {
720  bool use_geo_loc_name = CSubSource::NCBI_UseGeoLocNameForCountry();
721  if (use_geo_loc_name) {
723  } else {
725  }
726  }
727  break;
730  break;
733  break;
736  break;
737  default:
738  break;
739  }
740  return rval;
741 }
742 
743 
744 CValidator::TDbxrefValidFlags CValidator::IsValidDbxref(const CDbtag& xref, bool is_biosource, bool is_refseq_or_gps)
745 {
747 
748  if (xref.IsSetTag() && xref.GetTag().IsStr()) {
749  if (ContainsSgml(xref.GetTag().GetStr())) {
750  flags |= eTagHasSgml;
751  }
752 
753  if (xref.GetTag().GetStr().find(' ') != string::npos) {
755  }
756  }
757 
758  if (!xref.IsSetDb()) {
759  return flags;
760  }
761  const string& db = xref.GetDb();
762  string dbv;
763  if (xref.IsSetTag() && xref.GetTag().IsStr()) {
764  dbv = xref.GetTag().GetStr();
765  }
766  else if (xref.IsSetTag() && xref.GetTag().IsId()) {
767  dbv = NStr::NumericToString(xref.GetTag().GetId());
768  }
769 
770  if (ContainsSgml(db)) {
771  flags |= eDbHasSgml;
772  }
773 
774  bool src_db = false;
775  bool refseq_db = false;
776  string correct_caps;
777 
778  if (xref.GetDBFlags(refseq_db, src_db, correct_caps)) {
779  if (!NStr::EqualCase(correct_caps, db)) {
780  // capitalization is bad
782  }
783 
784  if (is_biosource && !src_db) {
785  flags |= eNotForSource;
786  if (refseq_db && is_refseq_or_gps) {
788  }
789  } else if (!is_biosource && src_db && NStr::EqualNocase(db, "taxon")) {
791  }
792  if (refseq_db && !is_refseq_or_gps) {
794  }
795  } else {
796  flags |= eUnrecognized;
797  }
798  return flags;
799 }
800 
802 {
803  m_pEntryInfo.reset(new TEntryInfo(info));
804 }
805 
806 
808 {
809  return m_pEntryInfo.get() != nullptr;
810 }
811 
812 
814 {
815  return *m_pEntryInfo;
816 }
817 
818 
819 //LCOV_EXCL_START
820 //code is not used
822 {
823  m_impl = new CCacheImpl;
824 }
825 
827 {
828  delete m_impl;
829 }
830 
833 {
834  return Ref(new CCache);
835 }
836 //LCOV_EXCL_STOP
837 
838 END_SCOPE(validator)
User-defined methods of the data storage class.
EErrType
@ eErr_SEQ_DESCR_LatLonWater
@ eErr_SEQ_DESCR_LatLonCountry
@ eErr_SEQ_DESCR_LatLonValue
@ eErr_SEQ_DESCR_LatLonGeoLocName
@ eErr_SEQ_DESCR_LatLonState
@ eErr_UNKNOWN
CValidator::CCacheImpl CCacheImpl
Definition: cache_impl.hpp:264
CAuthor –.
Definition: Author.hpp:59
CBioseq_Handle –.
CConstRef –.
Definition: ncbiobj.hpp:1266
Definition: Dbtag.hpp:53
bool GetDBFlags(bool &is_refseq, bool &is_src, string &correct_caps) const
Definition: Dbtag.cpp:327
@Name_std.hpp User-defined methods of the data storage class.
Definition: Name_std.hpp:56
Base class for all object manager exceptions.
CObjectManager –.
@Pubdesc.hpp User-defined methods of the data storage class.
Definition: Pubdesc.hpp:54
CRef –.
Definition: ncbiobj.hpp:618
CScope –.
Definition: scope.hpp:92
CSeq_annot_Handle –.
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
static bool NCBI_UseGeoLocNameForCountry(void)
Definition: SubSource.cpp:92
@ eLatLonCountryErr_Value
Definition: SubSource.hpp:196
@ eLatLonCountryErr_State
Definition: SubSource.hpp:194
@ eLatLonCountryErr_Water
Definition: SubSource.hpp:195
@ eLatLonCountryErr_Country
Definition: SubSource.hpp:193
CTaxon3_reply –.
Template class for iteration on objects of class C (non-medifiable version)
Definition: iterator.hpp:767
static void SetSuppressionRules(const CUser_object &user, CValidError &errors)
bool IsValidStructuredComment(const CSeqdesc &desc)
size_t GetGeneCount(void) const
TSuppressed & SetSuppressed()
Definition: validatorp.cpp:195
bool GetTSAConflictingBiomolTechErrors(const CSeq_entry_Handle &se)
bool Validate(const CSeq_entry &se, const CCit_sub *cs=nullptr, CScope *scope=nullptr)
const CValidatorEntryInfo & GetEntryInfo() const
size_t GetCumulativeInferenceCount(void) const
SValidatorContext & SetContext()
Definition: validatorp.cpp:200
void SetProgressCallback(CValidator::TProgressCallback callback, void *user_data)
bool GetTSACDSOnMinusStrandErrors(const CSeq_entry_Handle &se)
bool GetTSANStretchErrors(const CSeq_entry_Handle &se)
size_t GetGeneXrefCount(void) const
CRef< CValidError > Validate(const CSeq_entry &se, CScope *scope=nullptr, Uint4 options=0)
Definition: validator.cpp:101
CRef< CObjectManager > m_ObjMgr
Definition: validator.hpp:316
CConstRef< CValidError > GetTSANStretchErrors(const CSeq_entry_Handle &se)
Definition: validator.cpp:186
void x_SetEntryInfo(const TEntryInfo &info)
Definition: validator.cpp:801
CConstRef< CValidError > GetTSACDSOnMinusStrandErrors(const CSeq_entry_Handle &se)
Definition: validator.cpp:199
unique_ptr< CValidatorEntryInfo > m_pEntryInfo
Definition: validator.hpp:322
static CRef< CCache > MakeEmptyCache()
Definition: validator.cpp:832
TProgressCallback m_PrgCallback
Definition: validator.hpp:319
@ eVal_seqsubmit_parent
Definition: validator.hpp:85
static TDbxrefValidFlags IsValidDbxref(const CDbtag &xref, bool is_biosource, bool is_refseq_or_gps)
Definition: validator.cpp:744
int TDbxrefValidFlags
Definition: validator.hpp:304
static bool BadCharsInAuthorFirstName(const string &str)
Definition: validator.cpp:499
@ eRefSeqNotForSource
Definition: validator.hpp:300
@ eBadCapitalization
Definition: validator.hpp:301
shared_ptr< SValidatorContext > m_pContext
Definition: validator.hpp:321
static bool DoesSeqLocContainDuplicateIntervals(const CSeq_loc &loc, CScope &scope)
Definition: validator.cpp:708
void SetProgressCallback(TProgressCallback callback, void *user_data=nullptr)
Definition: validator.cpp:436
CConstRef< CValidError > GetTSAConflictingBiomolTechErrors(const CSeq_entry_Handle &se)
Definition: validator.cpp:212
const TEntryInfo & GetEntryInfo() const
Definition: validator.cpp:813
void * m_UserData
Definition: validator.hpp:320
static bool BadCharsInAuthorInitials(const string &str)
Definition: validator.cpp:505
static EErrType ConvertCode(CSubSource::ELatLonCountryErr errcode)
Definition: validator.cpp:714
static bool DoesSeqLocContainAdjacentIntervals(const CSeq_loc &loc, CScope &scope)
Definition: validator.cpp:681
static bool BadCharsInAuthorName(const string &str, bool allowcomma, bool allowperiod, bool last)
Definition: validator.cpp:443
bool IsValidStructuredComment(const CSeqdesc &desc) const
Definition: validator.cpp:424
shared_ptr< ITaxon3 > m_pOwnTaxon
Definition: validator.hpp:317
CValidatorEntryInfo TEntryInfo
Definition: validator.hpp:309
static string BadCharsInAuthor(const CName_std &author, bool &last_is_bad)
Definition: validator.cpp:517
static bool IsSeqLocCorrectlyOrdered(const CSeq_loc &loc, CScope &scope)
Definition: validator.cpp:634
static bool BadCharsInAuthorLastName(const string &str)
Definition: validator.cpp:489
void SetTaxon3(shared_ptr< ITaxon3 > taxon)
Definition: validator.cpp:75
bool IsSetEntryInfo() const
Definition: validator.cpp:807
static taxupdate_func_t MakeTaxUpdateFunction(shared_ptr< ITaxon3 > taxon)
Definition: validator.cpp:85
static bool BadCharsInAuthorSuffix(const string &str)
Definition: validator.cpp:511
CValidator(CObjectManager &objmgr)
Definition: validator.cpp:61
Include a standard set of the NCBI C++ Toolkit most basic headers.
static uch flags
CS_CONTEXT * ctx
Definition: t0006.c:12
#define bool
Definition: bool.h:34
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:51
static const char * str(char *buf, int n)
Definition: stats.c:84
static FILE * f
Definition: readconf.c:23
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
~CCache(void)
Definition: ncbi_cache.hpp:338
CCache(TSizeType capacity, THandler *handler=NULL)
Create cache object with the given capacity.
Definition: ncbi_cache.hpp:326
CConstBeginInfo ConstBegin(const C &obj)
Get starting point of non-modifiable object hierarchy.
Definition: iterator.hpp:1012
bool IsSameBioseq(const CSeq_id &id1, const CSeq_id &id2, CScope *scope, CScope::EGetBioseqFlag get_flag=CScope::eGetBioseq_All)
Determines if two CSeq_ids represent the same CBioseq.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
CConstRef< CSeq_annot > GetCompleteSeq_annot(void) const
Complete and return const reference to the current seq-annot.
TInst_Topology GetInst_Topology(void) const
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
Definition: ncbiobj.hpp:2015
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#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
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:5319
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:5406
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:5347
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:5378
const TName & GetName(void) const
Get the Name member data.
Definition: Author_.hpp:352
bool IsSetName(void) const
Author, Primary or Secondary Check if a value has been assigned to Name data member.
Definition: Author_.hpp:340
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
const TTag & GetTag(void) const
Get the Tag member data.
Definition: Dbtag_.hpp:267
bool IsSetSuffix(void) const
Jr, Sr, III Check if a value has been assigned to Suffix data member.
Definition: Name_std_.hpp:645
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 TInitials & GetInitials(void) const
Get the Initials member data.
Definition: Name_std_.hpp:610
bool IsName(void) const
Check if variant Name is selected.
Definition: Person_id_.hpp:359
const TDb & GetDb(void) const
Get the Db member data.
Definition: Dbtag_.hpp:220
bool IsSetInitials(void) const
first + middle initials Check if a value has been assigned to Initials data member.
Definition: Name_std_.hpp:598
bool IsSetLast(void) const
Check if a value has been assigned to Last data member.
Definition: Name_std_.hpp:410
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
const TSuffix & GetSuffix(void) const
Get the Suffix member data.
Definition: Name_std_.hpp:657
const TFirst & GetFirst(void) const
Get the First member data.
Definition: Name_std_.hpp:469
const TLast & GetLast(void) const
Get the Last member data.
Definition: Name_std_.hpp:422
const TName & GetName(void) const
Get the variant data.
Definition: Person_id_.cpp:137
bool IsSetFirst(void) const
Check if a value has been assigned to First data member.
Definition: Name_std_.hpp:457
TId GetId(void) const
Get the variant data.
Definition: Object_id_.hpp:270
list< CRef< CSeq_interval > > Tdata
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
const Tdata & Get(void) const
Get the member data.
const TId & GetId(void) const
Get the Id member data.
TFrom GetFrom(void) const
Get the From member data.
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
TStrand GetStrand(void) const
Get the Strand member data.
TTo GetTo(void) const
Get the To member data.
E_Choice
Choice variants.
Definition: Seq_loc_.hpp:96
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
@ e_Null
not placed
Definition: Seq_loc_.hpp:98
@ e_Int
from to
Definition: Seq_loc_.hpp:101
bool IsUser(void) const
Check if variant User is selected.
Definition: Seqdesc_.hpp:1122
function< CRef< CTaxon3_reply >(const vector< CRef< COrg_ref > > &list)> taxupdate_func_t
Definition: itaxon3.hpp:60
static MDB_envinfo info
Definition: mdb_load.c:37
int isalpha(Uchar c)
Definition: ncbictype.hpp:61
The Object manager core.
bool ContainsSgml(const string &str)
static string query
bool x_CompareConsecutiveIntervals(const CPacked_seqint &packed_int, CConstRef< CSeq_interval > &int_cur, CConstRef< CSeq_interval > &int_prv, CScope *scope, CompareConsecutiveIntervalProc compar)
Definition: validator.cpp:550
bool x_IsNotAdjacent(const CSeq_interval &int_cur, const CSeq_interval &int_prv, CScope *scope)
Definition: validator.cpp:655
bool x_IsCorrectlyOrdered(const CSeq_interval &int_cur, const CSeq_interval &int_prv, CScope *scope)
Definition: validator.cpp:610
bool CheckConsecutiveIntervals(const CSeq_loc &loc, CScope &scope, CompareConsecutiveIntervalProc compar)
Definition: validator.cpp:571
bool(* CompareConsecutiveIntervalProc)(const CSeq_interval &int1, const CSeq_interval &int2, CScope *scope)
Definition: validator.cpp:548
bool IsNotDuplicateInterval(const CSeq_interval &int1, const CSeq_interval &int2, CScope *scope)
Definition: validator.cpp:697
USING_SCOPE(sequence)
bool x_SameStrand(const CSeq_interval &int1, const CSeq_interval &int2)
Definition: validator.cpp:687
Modified on Fri Sep 20 14:57:38 2024 by modify_doxy.py rev. 669887