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

Go to the SVN repository for this file.

1 #ifndef VALIDATOR___VALIDERROR_FORMAT__HPP
2 #define VALIDATOR___VALIDERROR_FORMAT__HPP
3 
4 /* $Id: validerror_format.hpp 101317 2023-11-29 15:55:03Z stakhovv $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Author: Jonathan Kans, Clifford Clausen, Aaron Ucko......
30  *
31  * File Description:
32  * Validates CSeq_entries and CSeq_submits
33  * .......
34  *
35  */
36 #include <corelib/ncbistd.hpp>
37 #include <corelib/ncbidiag.hpp>
38 #include <serial/objectinfo.hpp>
39 #include <serial/serialbase.hpp>
42 #include <objmgr/scope.hpp>
43 
44 #include <map>
45 
46 
49 
50 class CSeq_entry;
51 class CSeq_entry_Handle;
52 class CSeq_submit;
53 class CSeq_annot;
54 class CSeq_annot_Handle;
55 class CUser_object;
56 class CSeq_feat;
57 class CBioSource;
58 class CPubdesc;
59 class CBioseq;
60 class CSeqdesc;
61 class CObjectManager;
62 class CScope;
63 
64 BEGIN_SCOPE(validator)
65 
66 struct SValidatorContext;
67 
77 };
78 
79 
81 {
82 public:
83 
84  // Constructor / Destructor
87 
88  ESubmitterFormatErrorGroup GetSubmitterFormatErrorGroup(CValidErrItem::TErrIndex err_code) const;
89  string GetSubmitterFormatErrorGroupTitle(CValidErrItem::TErrIndex err_code) const;
90  string FormatForSubmitterReport(const CValidErrItem& error, CScope& scope) const;
91  string FormatForSubmitterReport(const CValidError& errors, CScope& scope, CValidErrItem::TErrIndex err_code) const;
92  string FormatCategoryForSubmitterReport(const CValidError& errors, CScope& scope, ESubmitterFormatErrorGroup grp) const;
93  vector<CValidErrItem::TErrIndex> GetListOfErrorCodes(const CValidError& errors) const;
94  vector<string> FormatCompleteSubmitterReport(const CValidError& errors, CScope& scope) const;
95 
96  // for formatting the objects as presented by the validator
97  static string GetFeatureContentLabel (const CSeq_feat& feat, CRef<CScope> scope);
98  static string GetFeatureBioseqLabel(const CSeq_feat& ft, CRef<CScope> scope, bool suppress_context);
99  static string GetFeatureProductLocLabel(const CSeq_feat& ft, CRef<CScope> scope, bool suppress_context);
100  static string GetFeatureIdLabel(const CSeq_feat& ft);
101  static string GetFeatureIdLabel (const CFeat_id& feat_id);
102  static string GetFeatureLocationLabel(const CSeq_feat& ft, CRef<CScope> scope, bool suppress_context);
103  static string GetFeatureLabel(const CSeq_feat& ft, CRef<CScope> scope, bool suppress_context);
104  static string GetDescriptorContent (const CSeqdesc& ds);
105  static string GetDescriptorLabel(const CSeqdesc& ds, const CSeq_entry& ctx, CRef<CScope> scope, bool suppress_context);
106  static string GetBioseqLabel (CBioseq_Handle bh);
107  static string GetBioseqSetLabel(const CBioseq_set& st, CRef<CScope> scope, bool suppress_context);
108  static string GetBioseqSetLabel(const CBioseq_set& st, bool suppress_context);
109  static string GetBioseqSetLabel(const string& accession, CBioseq_set::EClass setClass, bool suppress_context);
110  static string GetObjectLabel(const CObject& obj, const CSeq_entry& ctx, CRef<CScope> scope, bool suppress_context);
111 
112  // for suppressing error collection during runtime
113  static void SetSuppressionRules(const CUser_object& user, CValidError& errors);
114  static void SetSuppressionRules(const CSeq_entry& se, CValidError& errors);
115  static void SetSuppressionRules(const CSeq_entry_Handle& se, CValidError& errors);
116  static void SetSuppressionRules(const CSeq_submit& ss, CValidError& errors);
117  static void SetSuppressionRules(const CBioseq& seq, CValidError& errors);
118  static void AddSuppression(CUser_object& user, CValidErrItem::TErrIndex err_code);
119 
120  static void AddLocusTags(CValidError& errors, CScope& scope);
121 
122 private:
123  // Prohibit copy constructor & assignment operator
126 
127  string x_FormatConsensusSpliceForSubmitterReport(const CValidErrItem& error) const;
128  string x_FormatECNumberForSubmitterReport(const CValidErrItem& error, CScope& scope) const;
129  string x_FormatBadSpecificHostForSubmitterReport(const CValidErrItem& error) const;
130  string x_FormatBadInstCodeForSubmitterReport(const CValidErrItem& error) const;
131  string x_FormatLatLonCountryForSubmitterReport(const CValidErrItem& error) const;
132  string x_FormatGenericForSubmitterReport(const CValidErrItem& error, CScope& scope) const;
133 
134  static const string& x_GetLocusTag(const CSeq_feat& sf, CScope& scope);
135 
137  SValidatorContext* m_pContext=nullptr;
138 };
139 
140 
141 // Inline Functions:
142 
143 
144 END_SCOPE(validator)
147 
148 #endif /* VALIDATOR___VALIDERROR_FORMAT__HPP */
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CBioseq_Handle –.
CFeat_id –.
Definition: Feat_id.hpp:66
CObjectManager –.
CObject –.
Definition: ncbiobj.hpp:180
@Pubdesc.hpp User-defined methods of the data storage class.
Definition: Pubdesc.hpp:54
CScope –.
Definition: scope.hpp:92
CSeq_annot_Handle –.
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CValidErrorFormat & operator=(const CValidErrorFormat &)=delete
CValidErrorFormat(const CValidErrorFormat &)=delete
CRef< CObjectManager > m_ObjMgr
Include a standard set of the NCBI C++ Toolkit most basic headers.
CS_CONTEXT * ctx
Definition: t0006.c:12
#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 NCBI_VALIDATOR_EXPORT
Definition: ncbi_export.h:913
unsigned int TErrIndex
Defines NCBI C++ diagnostic APIs, classes, and macros.
ESubmitterFormatErrorGroup
@ eSubmitterFormatErrorGroup_BadInstitutionCode
@ eSubmitterFormatErrorGroup_BadEcNumberValue
@ eSubmitterFormatErrorGroup_ConsensusSplice
@ eSubmitterFormatErrorGroup_BadEcNumberProblem
@ eSubmitterFormatErrorGroup_BadEcNumberFormat
@ eSubmitterFormatErrorGroup_Default
@ eSubmitterFormatErrorGroup_LatLonCountry
@ eSubmitterFormatErrorGroup_BadSpecificHost
Modified on Mon Jul 22 05:05:31 2024 by modify_doxy.py rev. 669887