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

Go to the SVN repository for this file.

1 #ifndef _SEQID_VALIDATE_HPP_
2 #define _SEQID_VALIDATE_HPP_
3 
4 /*
5  * $Id: seqid_validate.hpp 93579 2021-05-01 20:54:52Z stakhovv $
6  *
7  * ===========================================================================
8  *
9  * PUBLIC DOMAIN NOTICE
10  * National Center for Biotechnology Information
11  *
12  * This software/database is a "United States Government Work" under the
13  * terms of the United States Copyright Act. It was written as part of
14  * the author's official duties as a United States Government employee and
15  * thus cannot be copyrighted. This software/database is freely available
16  * to the public for use. The National Library of Medicine and the U.S.
17  * Government have not placed any restriction on its use or reproduction.
18  *
19  * Although all reasonable efforts have been taken to ensure the accuracy
20  * and reliability of the software and data, the NLM and the U.S.
21  * Government do not and cannot warrant the performance or results that
22  * may be obtained by using this software or data. The NLM and the U.S.
23  * Government disclaim all warranties, express or implied, including
24  * warranties of performance, merchantability or fitness for any particular
25  * purpose.
26  *
27  * Please cite the author in any work or product based on this material.
28  *
29  * ===========================================================================
30  *
31  * Authors: Frank Ludwig
32  *
33  */
34 #include <corelib/ncbistd.hpp>
35 
38 
39 class CSeq_id;
40 struct SLineInfo;
41 class CAlnErrorReporter;
42 
43 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
46 {
47 public:
48  virtual ~CSeqIdValidate(void) = default;
49 
50 
51  virtual void operator()(const CSeq_id& seqId,
52  int lineNum,
53  CAlnErrorReporter* pErrorReporter);
54 
55  virtual void operator()(const list<CRef<CSeq_id>>& seqIds,
56  int lineNum,
57  CAlnErrorReporter* pErrorReporter);
58 };
59 
60 // ----------------------------------------------------------------------------
62 // ----------------------------------------------------------------------------
63 {
64 public:
65  using TFastaFlags = long;
66 
68 
69  virtual ~CFastaIdValidate() = default;
70 
71  enum EErrCode {
76  eOther
77  };
78 
79  using FReportError =
80  function<void(EDiagSev severity,
81  int lineNum,
82  const string& idString,
83  EErrCode errCode,
84  const string& msg)>;
85 
86  using TIds = list<CRef<CSeq_id>>;
87 
88  virtual void operator()(
89  const TIds& ids,
90  int lineNum,
91  FReportError fReportError);
92 
93  void SetMaxLocalIDLength(size_t length);
94  void SetMaxGeneralTagLength(size_t length);
95  void SetMaxAccessionLength(size_t length);
96 protected:
97  void CheckIDLength(const CSeq_id& id,
98  int lineNum,
99  FReportError fReportError) const;
100 
101  bool IsValidLocalID(const CSeq_id& id) const;
102 
103  virtual bool IsValidLocalString(const CTempString& idString) const;
104 
106  const CSeq_id& id,
107  int lineNum,
108  FReportError fReportError) const;
109 
110  static size_t CountPossibleNucResidues(
111  const string& idString);
112 
114  const CSeq_id& id,
115  int lineNum,
116  FReportError fReportError) const;
117 
118  static size_t CountPossibleAminoAcids(
119  const string& idString);
120 
121 protected:
123  size_t kErrNumNucCharsAtEnd = 25;
128 
130 };
131 
134 
135 #endif // _SEQID_VALIDATE_HPP_
CAlnErrorReporter.
void SetMaxLocalIDLength(size_t length)
virtual void operator()(const TIds &ids, int lineNum, FReportError fReportError)
function< void(EDiagSev severity, int lineNum, const string &idString, EErrCode errCode, const string &msg)> FReportError
CFastaIdValidate(TFastaFlags flags)
void CheckForExcessiveNucData(const CSeq_id &id, int lineNum, FReportError fReportError) const
size_t kWarnNumAminoAcidCharsAtEnd
static size_t CountPossibleNucResidues(const string &idString)
void SetMaxAccessionLength(size_t length)
virtual ~CFastaIdValidate()=default
list< CRef< CSeq_id > > TIds
virtual bool IsValidLocalString(const CTempString &idString) const
void CheckForExcessiveProtData(const CSeq_id &id, int lineNum, FReportError fReportError) const
static size_t CountPossibleAminoAcids(const string &idString)
bool IsValidLocalID(const CSeq_id &id) const
void SetMaxGeneralTagLength(size_t length)
void CheckIDLength(const CSeq_id &id, int lineNum, FReportError fReportError) const
virtual void operator()(const CSeq_id &seqId, int lineNum, CAlnErrorReporter *pErrorReporter)
virtual ~CSeqIdValidate(void)=default
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
Include a standard set of the NCBI C++ Toolkit most basic headers.
static uch flags
EDiagSev
Severity level for the posted diagnostics.
Definition: ncbidiag.hpp:650
static const size_t kMaxAccessionLength
Definition: Seq_id.hpp:844
static const size_t kMaxLocalIDLength
ID length restrictions.
Definition: Seq_id.hpp:841
static const size_t kMaxGeneralTagLength
Definition: Seq_id.hpp:843
#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
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
Modified on Fri Sep 20 14:57:07 2024 by modify_doxy.py rev. 669887