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

Go to the SVN repository for this file.

1 /* $Id: gff_base_record.hpp 99713 2023-05-02 14:29:48Z foleyjp $
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: Frank Ludwig
27  *
28  * File Description:
29  * GFF record structure
30  *
31  */
32 
33 #ifndef OBJTOOLS_WRITERS___GFF_BASE_RECORD__HPP
34 #define OBJTOOLS_WRITERS___GFF_BASE_RECORD__HPP
35 
39 #include <optional>
40 
42 BEGIN_objects_SCOPE // namespace ncbi::objects::
43 
44 // ============================================================================
46 // ============================================================================
47  : public CObject
48 {
49 public:
53 
57 
59  const string& id="");
61  const CGffBaseRecord&);
62  virtual ~CGffBaseRecord();
63 
64 public: //attribute management
65  const TAttributes& Attributes() const {
66  return mAttributes;
67  };
68  bool AddAttribute(
69  const string&,
70  const string&);
71  bool AddAttributes(
72  const string&,
73  const vector<string>&);
74  bool SetAttribute(
75  const string&,
76  const string&);
77  bool SetAttributes(
78  const string&,
79  const vector<string>&);
80  bool GetAttributes(
81  const string&,
82  vector<string>&) const;
83  bool DropAttributes(
84  const string& );
85 
86 public:
87  void SetSeqId(
88  const string&);
89  void SetMethod(
90  const string&);
91  void SetType(
92  const string&);
93  void SetLocation(
94  unsigned int, //0-based seqstart
95  unsigned int, //0-based seqstop
97  void SetStrand(
98  ENa_strand);
99  void SetScore(
100  const CScore&);
101  void SetScore(
102  const std::string&);
103  void SetPhase(
104  unsigned int);
105 
106  virtual string StrSeqId() const;
107  virtual string StrMethod() const;
108  virtual string StrType() const;
109  virtual string StrSeqStart() const;
110  virtual string StrSeqStop() const;
111  virtual string StrStrand() const;
112  virtual string StrScore() const;
113  virtual string StrPhase() const;
114  virtual string StrAttributes() const;
115 
116  bool CanGetLocation() const { return m_pLoc != nullptr; }
117  const CSeq_loc& GetLocation() const {
118  return *m_pLoc; };
119  unsigned int SeqStart() const {return mSeqStart; };
120  unsigned int SeqStop() const {return mSeqStop; };
121  objects::ENa_strand SeqStrand() const;
122 
123 protected:
124  // xEscapedValue returns either reference to unmodified string
125  // or the reference to thread local storage of escaped string
126  // next call within the same thread will return the same reference
127  // effectively making previus call invalid
128  // its safe to call the method concurently in multiple threads
129  const string& xEscapedValue(const string& key, const string& value) const;
130  const string& xEscapedString(const string& value) const
131  {
132  return xEscapedValue(kEmptyStr, value);
133  }
134 
135  static const char* ATTR_SEPARATOR;
137 
138  string mSeqId;
139  string mType;
140  string mMethod;
141  unsigned int mSeqStart;
142  unsigned int mSeqStop;
143  string mScore;
144  string mStrand;
145  optional<int> mPhase;
148 };
149 
150 END_objects_SCOPE
152 
153 #endif // OBJTOOLS_WRITERS___GFF_BASE_RECORD__HPP
User-defined methods of the data storage class.
TScores::const_iterator TScoreCit
void SetScore(const std::string &)
TScores::iterator TScoreIt
const CSeq_loc & GetLocation() const
const TAttributes & Attributes() const
CRef< CSeq_loc > m_pLoc
map< string, vector< string > > TAttributes
optional< int > mPhase
unsigned int SeqStop() const
unsigned int SeqStart() const
TAttributes::iterator TAttrIt
TAttributes::const_iterator TAttrCit
map< string, string > TScores
const string & xEscapedString(const string &value) const
static const char * ATTR_SEPARATOR
bool CanGetLocation() const
unsigned int mSeqStart
TAttributes mAttributes
unsigned int mSeqStop
CObject –.
Definition: ncbiobj.hpp:180
Definition: Score.hpp:57
Definition: map.hpp:338
string
Definition: cgiapp.hpp:687
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define kEmptyStr
Definition: ncbistr.hpp:123
#define NCBI_XOBJWRITE_EXPORT
Definition: ncbi_export.h:1347
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri May 24 14:50:50 2024 by modify_doxy.py rev. 669887