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

Go to the SVN repository for this file.

1 /* $Id: validerror_feat.hpp 101299 2023-11-28 18:18:38Z stakhovv $
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: Colleen Bollin, Jonathan Kans, Clifford Clausen, Aaron Ucko......
27  *
28  * File Description:
29  * For validating individual features
30  * .......
31  *
32  */
33 
34 #ifndef VALIDATOR___VALIDERROR_FEAT__HPP
35 #define VALIDATOR___VALIDERROR_FEAT__HPP
36 
37 #include <corelib/ncbistd.hpp>
39 
40 #include <objmgr/scope.hpp>
41 #include <objmgr/feat_ci.hpp> // for CMappedFeat
44 
52 
53 #include <objmgr/util/feature.hpp>
54 
57 
58 class CSeq_entry;
59 class CCit_sub;
60 class CCit_art;
61 class CCit_gen;
62 class CSeq_feat;
63 class CBioseq;
64 class CSeqdesc;
65 class CSeq_annot;
66 class CTrna_ext;
67 class CProt_ref;
68 class CSeq_loc;
69 class CFeat_CI;
70 class CPub_set;
71 class CAuth_list;
72 class CTitle;
73 class CMolInfo;
74 class CUser_object;
75 class CSeqdesc_CI;
76 class CDense_diag;
77 class CDense_seg;
78 class CSeq_align_set;
79 class CPubdesc;
80 class CBioSource;
81 class COrg_ref;
82 class CDelta_seq;
83 class CGene_ref;
84 class CCdregion;
85 class CRNA_ref;
86 class CImp_feat;
87 class CSeq_literal;
88 class CBioseq_Handle;
89 class CSeq_feat_Handle;
90 class CCountries;
92 class CComment_set;
93 class CTaxon3_reply;
94 class ITaxon3;
95 class CT3Error;
96 
97 BEGIN_SCOPE(validator)
98 
99 class CValidError_imp;
101 class CGeneCache;
102 class CValidError_base;
103 
104 // ============================= Validate SeqFeat ============================
105 
106 
107 
108 class NCBI_VALIDATOR_EXPORT CValidError_feat : private validator::CValidError_base
109 {
110 public:
112  ~CValidError_feat() override;
113 
114  void SetScope(CScope& scope) { m_Scope = &scope; }
115  void SetTSE(CSeq_entry_Handle seh);
116 
117  void ValidateSeqFeat(
118  const CSeq_feat& feat);
119  void ValidateSeqFeatContext(const CSeq_feat& feat, const CBioseq& seq);
120 
122  eInferenceValidCode_valid = 0,
134  eInferenceValidCode_unrecognized_database
135  };
136 
137  static vector<string> GetAccessionsFromInferenceString (string inference, string &prefix, string &remainder, bool &same_species);
138  static bool GetPrefixAndAccessionFromInferenceAccession (string inf_accession, string &prefix, string &accession);
139  static EInferenceValidCode ValidateInferenceAccession (string accession, bool fetch_accession, bool is_similar_to, CScope* scope = nullptr);
140  static EInferenceValidCode ValidateInference(string inference, bool fetch_accession, CScope* scope = nullptr);
141 
142  // functions expected to be used in Discrepancy Report
143  bool DoesCDSHaveShortIntrons(const CSeq_feat& feat);
144  bool IsIntronShort(const CSeq_feat& feat);
145  bool GetTSACDSOnMinusStrandErrors(const CSeq_feat& feat, const CBioseq& seq);
146 
147 private:
148 
152 
153  CBioseq_Handle x_GetCachedBsh(const CSeq_loc& loc);
154 
155  void ValidateSeqFeatXref(const CSeq_feat& feat);
156  void ValidateSeqFeatXref (const CSeqFeatXref& xref, const CSeq_feat& feat);
157  void x_ValidateSeqFeatExceptXref(const CSeq_feat& feat);
158 
159  // does feat have an xref to a feature other than the one specified by id with the same subtype
160  static bool HasNonReciprocalXref(const CSeq_feat& feat,
161  const CFeat_id& id, CSeqFeatData::ESubtype subtype,
162  const CTSE_Handle& tse);
163  void ValidateOneFeatXrefPair(const CSeq_feat& feat, const CSeq_feat& far_feat);
164  bool IsOverlappingGenePseudo(const CSeq_feat& feat);
165  bool x_HasNonReciprocalXref(const CSeq_feat& feat, const CFeat_id& id, CSeqFeatData::ESubtype subtype);
166 
167 };
168 
169 
170 END_SCOPE(validator)
173 
174 #endif /* VALIDATOR___VALIDERROR_FEAT__HPP */
static CRef< CScope > m_Scope
@Auth_list.hpp User-defined methods of the data storage class.
Definition: Auth_list.hpp:57
CBioseq_Handle –.
CCdregion –.
Definition: Cdregion.hpp:66
CDelta_seq –.
Definition: Delta_seq.hpp:66
CFeat_CI –.
Definition: feat_ci.hpp:64
CFeat_id –.
Definition: Feat_id.hpp:66
@Imp_feat.hpp User-defined methods of the data storage class.
Definition: Imp_feat.hpp:54
@Pubdesc.hpp User-defined methods of the data storage class.
Definition: Pubdesc.hpp:54
@RNA_ref.hpp User-defined methods of the data storage class.
Definition: RNA_ref.hpp:54
CScope –.
Definition: scope.hpp:92
CSeqFeatXref –.
Definition: SeqFeatXref.hpp:66
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
CSeq_feat_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CSeqdesc_CI –.
Definition: seqdesc_ci.hpp:65
CTaxon3_reply –.
Definition: Title.hpp:51
CSeq_entry_Handle m_TSE
static bool HasNonReciprocalXref(const CSeq_feat &feat, const CFeat_id &id, CSeqFeatData::ESubtype subtype, const CTSE_Handle &tse)
void SetScope(CScope &scope)
@ eInferenceValidCode_bad_accession_version
@ eInferenceValidCode_same_species_misused
@ eInferenceValidCode_accession_version_not_public
Cache various information for one validation run.
Definition: cache_impl.hpp:126
Include a standard set of the NCBI C++ Toolkit most basic headers.
#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
Modified on Fri Sep 20 14:58:03 2024 by modify_doxy.py rev. 669887