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

Go to the SVN repository for this file.

1 /* $Id: validator.cpp 102426 2024-05-03 16:57:51Z 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 void CValidator::SetTaxon3(shared_ptr<ITaxon3> pTaxon)
75 {
76  m_pOwnTaxon = pTaxon;
77  if (m_pOwnTaxon)
78  m_pContext->m_taxon_update = MakeTaxUpdateFunction(m_pOwnTaxon);
79 }
80 
82 {}
83 
85 {
86  taxon->Init();
87  return [remote = taxon](const vector< CRef<COrg_ref> >& query) -> CRef<CTaxon3_reply>
88  { // we need to make a copy of record to prevent changes put back to cache
89  if (!query.empty() && remote) {
90  CConstRef<CTaxon3_reply> res = remote->SendOrgRefList(query);
92  copied->Assign(*res);
93  return copied;
94  } else {
95  return {};
96  }
97  };
98 }
99 
101  const CSeq_entry& se,
102  CScope* scope,
103  Uint4 options)
104 {
105  CRef<CValidError> errors(new CValidError(&se));
107  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
109  if ( !imp.Validate(se, nullptr, scope) ) {
110  errors.Reset();
111  }
114  ctx.NumGenes += imp.GetGeneCount();
115  ctx.NumGeneXrefs += imp.GetGeneXrefCount();
116  ctx.CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
117  return errors;
118 }
119 
120 
121 
123  const CSeq_entry& se,
124  CScope* scope,
125  Uint4 options,
126  IValidError& errors,
127  const CValidator::TSuppressed* pSuppressed)
128 {
129  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
130  if (pSuppressed) {
131  imp.SetSuppressed() = *pSuppressed;
132  }
134  imp.Validate(se, nullptr, scope);
136  m_pContext->NumGenes += imp.GetGeneCount();
137  m_pContext->NumGeneXrefs += imp.GetGeneXrefCount();
138  m_pContext->CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
139 }
140 
141 
143  const CSeq_entry_Handle& seh,
144  Uint4 options)
145 {
148  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
150  if ( !imp.Validate(seh) ) {
151  errors.Reset();
152  }
155  ctx.NumGenes += imp.GetGeneCount();
156  ctx.NumGeneXrefs += imp.GetGeneXrefCount();
157  ctx.CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
158  return errors;
159 }
160 
161 
163  const CSeq_entry_Handle& seh,
164  Uint4 options,
165  IValidError& errors,
166  const CValidator::TSuppressed* pSuppressed)
167 {
168  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
169  if (pSuppressed) {
170  imp.SetSuppressed() = *pSuppressed;
171  }
173  imp.Validate(seh);
176  ctx.NumGenes += imp.GetGeneCount();
177  ctx.NumGeneXrefs += imp.GetGeneXrefCount();
178  ctx.CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
179 }
180 
181 
182 
183 //LCOV_EXCL_START
184 // not used by asnvalidate, used by external programs
186 {
189  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
191  if ( !imp.GetTSANStretchErrors(se) ) {
192  errors.Reset();
193  }
194  return errors;
195 }
196 
197 
199 {
202  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
204  if ( !imp.GetTSACDSOnMinusStrandErrors(se) ) {
205  errors.Reset();
206  }
207  return errors;
208 }
209 
210 
212 {
215  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
217  if ( !imp.GetTSAConflictingBiomolTechErrors(se) ) {
218  errors.Reset();
219  }
220  return errors;
221 }
222 
223 
225 {
226 
227  CRef<CValidError> errors(new CValidError(&seq));
229  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
231  if ( !imp.GetTSANStretchErrors(seq) ) {
232  errors.Reset();
233  }
234  return errors;
235 }
236 
237 
239 {
240  CRef<CValidError> errors(new CValidError(&f));
242  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
244  if ( !imp.GetTSACDSOnMinusStrandErrors(f, seq) ) {
245  errors.Reset();
246  }
247  return errors;
248 }
249 
250 
252 {
253  CRef<CValidError> errors(new CValidError(&seq));
255  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), 0);
257  if ( !imp.GetTSAConflictingBiomolTechErrors(seq) ) {
258  errors.Reset();
259  }
260  return errors;
261 }
262 //LCOV_EXCL_STOP
263 
264 
266  const CSeq_submit& ss,
267  CScope* scope,
268  Uint4 options)
269 {
271  CRef<CValidError> errors(new CValidError(&ss));
273  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
274  imp.Validate(ss, scope);
275 
277 
278  return errors;
279 }
280 
281 
283  const CSeq_submit& ss,
284  CScope* scope,
285  Uint4 options,
286  IValidError& errors,
287  const CValidator::TSuppressed* pSuppressed)
288 {
290  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
291  if (pSuppressed) {
292  imp.SetSuppressed() = *pSuppressed;
293  }
294  imp.Validate(ss, scope);
296  m_pContext->NumGenes += imp.GetGeneCount();
297  m_pContext->NumGeneXrefs += imp.GetGeneXrefCount();
298  m_pContext->CumulativeInferenceCount = imp.GetCumulativeInferenceCount();
299 }
300 
301 
303  const CSeq_annot_Handle& sah,
304  Uint4 options)
305 {
306  auto errors = Ref(new CValidError(&*(sah.GetCompleteSeq_annot())));
307  Validate(sah, options, *errors);
308  return errors;
309 }
310 
311 
313  const CSeq_annot_Handle& sah,
314  Uint4 options,
315  CValidError& errors)
316 {
317  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
318  imp.Validate(sah);
319 }
320 
321 
323  const CSeq_annot_Handle& sah,
324  Uint4 options,
325  IValidError& errors)
326 {
327  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
328  imp.Validate(sah);
329 }
330 
331 
333  const CSeq_feat& feat,
334  CScope* scope,
335  Uint4 options)
336 {
337  CRef<CValidError> errors(new CValidError(&feat));
338  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
339  imp.Validate(feat, scope);
340  return errors;
341 }
342 
343 
345  const CSeq_feat& feat,
346  CScope* scope,
347  Uint4 options,
348  IValidError& errors)
349 {
350  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
351  imp.Validate(feat, scope);
352 }
353 
354 
355 
357  const CBioSource& src,
358  CScope* scope,
359  Uint4 options)
360 {
361  CRef<CValidError> errors(new CValidError(&src));
362  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
363  imp.Validate(src, scope);
364  return errors;
365 }
366 
367 
369  const CBioSource& src,
370  CScope* scope,
371  Uint4 options,
372  IValidError& errors)
373 {
374  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
375  imp.Validate(src, scope);
376 }
377 
378 
379 
380 
382  const CPubdesc& pubdesc,
383  CScope* scope,
384  Uint4 options)
385 {
386  CRef<CValidError> errors(new CValidError(&pubdesc));
387  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
388  imp.Validate(pubdesc, scope);
389  return errors;
390 }
391 
393  const CPubdesc& pubdesc,
394  CScope* scope,
395  Uint4 options,
396  IValidError& errors)
397 {
398  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
399  imp.Validate(pubdesc, scope);
400 }
401 
403  const CSeqdesc& desc,
404  const CSeq_entry& ctx,
405  Uint4 options)
406 {
407  CRef<CValidError> errors(new CValidError(&desc));
408  CValidError_imp imp(*m_ObjMgr, m_pContext, &(*errors), options);
409  imp.Validate(desc, ctx);
410  return errors;
411 }
412 
414  const CSeqdesc& desc,
415  const CSeq_entry& ctx,
416  Uint4 options,
417  IValidError& errors)
418 {
419  CValidError_imp imp(*m_ObjMgr, m_pContext, &errors, options);
420  imp.Validate(desc, ctx);
421 }
422 
424  const CSeqdesc& desc) const
425 {
426  if (!desc.IsUser()) {
427  return false;
428  }
429 
430  CValidError_imp imp(const_cast<CObjectManager&>(*m_ObjMgr), m_pContext, nullptr);
431  return CValidError_desc(imp).IsValidStructuredComment(desc);
432 }
433 
434 
435 void CValidator::SetProgressCallback(TProgressCallback callback, void* user_data)
436 {
437  m_PrgCallback = callback;
438  m_UserData = user_data;
439 }
440 
441 
442 bool CValidator::BadCharsInAuthorName(const string& str, bool allowcomma, bool allowperiod, bool last)
443 {
444  if (NStr::IsBlank(str)) {
445  return false;
446  }
447 
448 
449  size_t stp = string::npos;
450  if (last) {
451  if (NStr::StartsWith(str, "St.")) {
452  stp = 2;
453  }
454  else if (NStr::StartsWith(str, "de M.")) {
455  stp = 4;
456  }
457  }
458 
459  size_t pos = 0;
460  const char *ptr = str.c_str();
461 
462  while (*ptr != 0) {
463  if (isalpha(*ptr)
464  || *ptr == '-'
465  || *ptr == '\''
466  || *ptr == ' '
467  || (*ptr == ',' && allowcomma)
468  || (*ptr == '.' && (allowperiod || pos == stp))) {
469  // all these are ok
470  ptr++;
471  pos++;
472  } else {
473  string tail = str.substr(pos);
474  if (NStr::Equal(tail, "2nd") ||
475  NStr::Equal(tail, "3rd") ||
476  NStr::Equal(tail, "4th") ||
477  NStr::Equal(tail, "5th") ||
478  NStr::Equal(tail, "6th")) {
479  return false;
480  }
481  return true;
482  }
483  }
484  return false;
485 }
486 
487 
489 {
490  if (NStr::EqualNocase(str, "et al.")) {
491  // this is ok
492  return false;
493  } else {
494  return BadCharsInAuthorName(str, false, false, true);
495  }
496 }
497 
499 {
500  return BadCharsInAuthorName(str, false, true, false);
501 }
502 
503 
505 {
506  return BadCharsInAuthorName(str, false, true, false);
507 }
508 
509 
511 {
512  return BadCharsInAuthorName(str, false, true, false);
513 }
514 
515 
516 string CValidator::BadCharsInAuthor(const CName_std& author, bool& last_is_bad)
517 {
518  string badauthor;
519  last_is_bad = false;
520 
521  if (author.IsSetLast() && BadCharsInAuthorLastName(author.GetLast())) {
522  last_is_bad = true;
523  badauthor = author.GetLast();
524  } else if (author.IsSetFirst() && BadCharsInAuthorFirstName(author.GetFirst())) {
525  badauthor = author.GetFirst();
526  }
527  else if (author.IsSetInitials() && BadCharsInAuthorInitials(author.GetInitials())) {
528  badauthor = author.GetInitials();
529  } else if (author.IsSetSuffix() && BadCharsInAuthorSuffix(author.GetSuffix())) {
530  badauthor = author.GetSuffix();
531  }
532  return badauthor;
533 }
534 
535 
536 string CValidator::BadCharsInAuthor(const CAuthor& author, bool& last_is_bad)
537 {
538  last_is_bad = false;
539  if (author.IsSetName() && author.GetName().IsName()) {
540  return BadCharsInAuthor(author.GetName().GetName(), last_is_bad);
541  } else {
542  return kEmptyStr;
543  }
544 }
545 
546 
547 typedef bool(*CompareConsecutiveIntervalProc) (const CSeq_interval& int1, const CSeq_interval& int2, CScope *scope);
548 
550  const CPacked_seqint& packed_int,
551  CConstRef<CSeq_interval>& int_cur,
552  CConstRef<CSeq_interval>& int_prv,
553  CScope* scope,
555 {
556  bool ok = true;
557  ITERATE(CPacked_seqint::Tdata, it, packed_int.Get()) {
558  int_cur = (*it);
559  if (int_prv && !compar(*int_cur, *int_prv, scope)) {
560  ok = false;
561  break;
562  }
563 
564  int_prv = int_cur;
565  }
566  return ok;
567 }
568 
569 
571 {
572  bool ok = true;
573  const CSeq_interval *int_cur = nullptr, *int_prv = nullptr;
574 
576  for (; lit && ok; ++lit) {
577  CSeq_loc::E_Choice loc_choice = lit->Which();
578  switch (loc_choice) {
579  case CSeq_loc::e_Int: {
580  int_cur = &lit->GetInt();
581  if (int_prv) {
582  ok = compar(*int_cur, *int_prv, &scope);
583  }
584  int_prv = int_cur;
585  } break;
586  case CSeq_loc::e_Pnt:
587  int_prv = nullptr;
588  break;
590  int_prv = nullptr;
591  break;
592  case CSeq_loc::e_Packed_int: {
593  CConstRef<CSeq_interval> this_int_cur(int_cur);
594  CConstRef<CSeq_interval> this_int_prv(int_prv);
596  (lit->GetPacked_int(), this_int_cur, this_int_prv, &scope, compar);
597  } break;
598  case CSeq_loc::e_Null:
599  break;
600  default:
601  int_prv = nullptr;
602  break;
603  }
604  }
605  return ok;
606 }
607 
608 
610  const CSeq_interval& int_cur,
611  const CSeq_interval& int_prv,
612  CScope* scope)
613 {
614  ENa_strand strand_cur = int_cur.IsSetStrand() ?
615  int_cur.GetStrand() : eNa_strand_unknown;
616 
617  if (IsSameBioseq(int_prv.GetId(), int_cur.GetId(), scope)) {
618  if (strand_cur == eNa_strand_minus) {
619  if (int_prv.GetTo() < int_cur.GetTo()) {
620  return false;
621  }
622  }
623  else {
624  if (int_prv.GetTo() > int_cur.GetTo()) {
625  return false;
626  }
627  }
628  }
629  return true;
630 }
631 
632 
634 {
635  CBioseq_Handle seq;
636  try {
637  CBioseq_Handle seq = scope.GetBioseqHandle(loc);
638  } catch (CObjMgrException& ) {
639  // no way to tell
640  return true;
641  } catch (const exception& ) {
642  // no way to tell
643  return true;
644  }
645  if (seq && seq.GetInst_Topology() == CSeq_inst::eTopology_circular) {
646  // no way to check if topology is circular
647  return true;
648  }
649 
651 }
652 
653 
655  const CSeq_interval& int_cur,
656  const CSeq_interval& int_prv,
657  CScope* scope)
658 {
659  ENa_strand strand_cur = int_cur.IsSetStrand() ?
660  int_cur.GetStrand() : eNa_strand_unknown;
661 
662  bool ok = true;
663  if (IsSameBioseq(int_prv.GetId(), int_cur.GetId(), scope)) {
664  if (strand_cur == eNa_strand_minus) {
665  if (int_cur.GetTo() + 1 == int_prv.GetFrom()) {
666  ok = false;
667  }
668  }
669  else {
670  if (int_prv.GetTo() + 1 == int_cur.GetFrom()) {
671  ok = false;
672  }
673  }
674  }
675  return ok;
676 }
677 
678 
680 (const CSeq_loc& loc, CScope &scope)
681 {
682  return !CheckConsecutiveIntervals(loc, scope, x_IsNotAdjacent);
683 }
684 
685 
686 bool x_SameStrand(const CSeq_interval& int1, const CSeq_interval& int2)
687 {
688  ENa_strand strand1 = int1.IsSetStrand() ?
689  int1.GetStrand() : eNa_strand_unknown;
690  ENa_strand strand2 = int2.IsSetStrand() ?
691  int2.GetStrand() : eNa_strand_unknown;
692  return (strand1 == strand2);
693 }
694 
695 
696 bool IsNotDuplicateInterval(const CSeq_interval& int1, const CSeq_interval& int2, CScope* scope)
697 {
698  if (IsSameBioseq(int1.GetId(), int2.GetId(), scope) &&
699  x_SameStrand(int1, int2) &&
700  int1.GetFrom() == int2.GetFrom() &&
701  int1.GetTo() == int2.GetTo()) {
702  return false;
703  }
704  return true;
705 }
706 
708 {
710 }
711 
712 
714 {
715  EErrType rval = eErr_UNKNOWN;
716  switch (errcode) {
719  break;
722  break;
725  break;
728  break;
729  default:
730  break;
731  }
732  return rval;
733 }
734 
735 
736 CValidator::TDbxrefValidFlags CValidator::IsValidDbxref(const CDbtag& xref, bool is_biosource, bool is_refseq_or_gps)
737 {
739 
740  if (xref.IsSetTag() && xref.GetTag().IsStr()) {
741  if (ContainsSgml(xref.GetTag().GetStr())) {
742  flags |= eTagHasSgml;
743  }
744 
745  if (xref.GetTag().GetStr().find(' ') != string::npos) {
747  }
748  }
749 
750  if (!xref.IsSetDb()) {
751  return flags;
752  }
753  const string& db = xref.GetDb();
754  string dbv;
755  if (xref.IsSetTag() && xref.GetTag().IsStr()) {
756  dbv = xref.GetTag().GetStr();
757  }
758  else if (xref.IsSetTag() && xref.GetTag().IsId()) {
759  dbv = NStr::NumericToString(xref.GetTag().GetId());
760  }
761 
762  if (ContainsSgml(db)) {
763  flags |= eDbHasSgml;
764  }
765 
766  bool src_db = false;
767  bool refseq_db = false;
768  string correct_caps;
769 
770  if (xref.GetDBFlags(refseq_db, src_db, correct_caps)) {
771  if (!NStr::EqualCase(correct_caps, db)) {
772  // capitalization is bad
774  }
775 
776  if (is_biosource && !src_db) {
777  flags |= eNotForSource;
778  if (refseq_db && is_refseq_or_gps) {
780  }
781  } else if (!is_biosource && src_db && NStr::EqualNocase(db, "taxon")) {
783  }
784  if (refseq_db && !is_refseq_or_gps) {
786  }
787  } else {
788  flags |= eUnrecognized;
789  }
790  return flags;
791 }
792 
794 {
795  m_pEntryInfo.reset(new TEntryInfo(info));
796 }
797 
798 
800 {
801  return m_pEntryInfo.get() != nullptr;
802 }
803 
804 
806 {
807  return *m_pEntryInfo;
808 }
809 
810 
811 //LCOV_EXCL_START
812 //code is not used
814 {
815  m_impl = new CCacheImpl;
816 }
817 
819 {
820  delete m_impl;
821 }
822 
825 {
826  return Ref(new CCache);
827 }
828 //LCOV_EXCL_STOP
829 
830 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_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
@ eLatLonCountryErr_Value
Definition: SubSource.hpp:194
@ eLatLonCountryErr_State
Definition: SubSource.hpp:192
@ eLatLonCountryErr_Water
Definition: SubSource.hpp:193
@ eLatLonCountryErr_Country
Definition: SubSource.hpp:191
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:194
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:199
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:100
CRef< CObjectManager > m_ObjMgr
Definition: validator.hpp:316
CConstRef< CValidError > GetTSANStretchErrors(const CSeq_entry_Handle &se)
Definition: validator.cpp:185
void x_SetEntryInfo(const TEntryInfo &info)
Definition: validator.cpp:793
CConstRef< CValidError > GetTSACDSOnMinusStrandErrors(const CSeq_entry_Handle &se)
Definition: validator.cpp:198
unique_ptr< CValidatorEntryInfo > m_pEntryInfo
Definition: validator.hpp:322
static CRef< CCache > MakeEmptyCache()
Definition: validator.cpp:824
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:736
int TDbxrefValidFlags
Definition: validator.hpp:304
static bool BadCharsInAuthorFirstName(const string &str)
Definition: validator.cpp:498
@ 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:707
void SetProgressCallback(TProgressCallback callback, void *user_data=nullptr)
Definition: validator.cpp:435
CConstRef< CValidError > GetTSAConflictingBiomolTechErrors(const CSeq_entry_Handle &se)
Definition: validator.cpp:211
const TEntryInfo & GetEntryInfo() const
Definition: validator.cpp:805
void * m_UserData
Definition: validator.hpp:320
static bool BadCharsInAuthorInitials(const string &str)
Definition: validator.cpp:504
static EErrType ConvertCode(CSubSource::ELatLonCountryErr errcode)
Definition: validator.cpp:713
static bool DoesSeqLocContainAdjacentIntervals(const CSeq_loc &loc, CScope &scope)
Definition: validator.cpp:680
static bool BadCharsInAuthorName(const string &str, bool allowcomma, bool allowperiod, bool last)
Definition: validator.cpp:442
bool IsValidStructuredComment(const CSeqdesc &desc) const
Definition: validator.cpp:423
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:516
static bool IsSeqLocCorrectlyOrdered(const CSeq_loc &loc, CScope &scope)
Definition: validator.cpp:633
static bool BadCharsInAuthorLastName(const string &str)
Definition: validator.cpp:488
void SetTaxon3(shared_ptr< ITaxon3 > taxon)
Definition: validator.cpp:74
bool IsSetEntryInfo() const
Definition: validator.cpp:799
static taxupdate_func_t MakeTaxUpdateFunction(shared_ptr< ITaxon3 > taxon)
Definition: validator.cpp:84
static bool BadCharsInAuthorSuffix(const string &str)
Definition: validator.cpp:510
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
#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:5325
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 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:5384
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
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
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:549
bool x_IsNotAdjacent(const CSeq_interval &int_cur, const CSeq_interval &int_prv, CScope *scope)
Definition: validator.cpp:654
bool x_IsCorrectlyOrdered(const CSeq_interval &int_cur, const CSeq_interval &int_prv, CScope *scope)
Definition: validator.cpp:609
bool CheckConsecutiveIntervals(const CSeq_loc &loc, CScope &scope, CompareConsecutiveIntervalProc compar)
Definition: validator.cpp:570
bool(* CompareConsecutiveIntervalProc)(const CSeq_interval &int1, const CSeq_interval &int2, CScope *scope)
Definition: validator.cpp:547
bool IsNotDuplicateInterval(const CSeq_interval &int1, const CSeq_interval &int2, CScope *scope)
Definition: validator.cpp:696
USING_SCOPE(sequence)
bool x_SameStrand(const CSeq_interval &int1, const CSeq_interval &int2)
Definition: validator.cpp:686
Modified on Fri May 24 14:50:37 2024 by modify_doxy.py rev. 669887