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

Go to the SVN repository for this file.

1  /* $Id: gvf_reader.hpp 99211 2023-02-27 16:15:10Z ludwigf $
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  * GVF file reader
30  *
31  */
32 
33 #ifndef OBJTOOLS_READERS___GVF_READER__HPP
34 #define OBJTOOLS_READERS___GVF_READER__HPP
35 
36 #include <corelib/ncbistd.hpp>
39 
41 
44 
45 class CGff3ReadRecord;
46 class CReaderListener;
47 
48 // ============================================================================
50 // ============================================================================
51  : public CGff3ReadRecord
52 {
53 public:
55  unsigned int lineNumber,
56  ILineErrorListener* pEC = nullptr):
57  mLineNumber(lineNumber),
59  {};
61 
62  bool AssignFromGff(
63  const string& ) override;
64 
65  bool SanityCheck() const;
66 
67 protected:
69  const string&,
70  const string& ) override;
71 
72  unsigned int mLineNumber;
74 };
75 
76 // ----------------------------------------------------------------------------
78 // ----------------------------------------------------------------------------
79  : public CGff3Reader
80 {
81 public:
82  CGvfReader(
83  TReaderFlags uFlags,
84  const string& name = "",
85  const string& title = "",
86  CReaderListener* = nullptr);
87 
88  virtual ~CGvfReader();
89 
92  ILineReader&,
93  ILineErrorListener* = nullptr ) override;
94 
95 protected:
96  void xGetData(
97  ILineReader&,
98  TReaderData&) override;
99 
100  void xProcessData(
101  const TReaderData&,
102  CSeq_annot&) override;
103 
105  const string&) override;
106 
107  bool xParseFeature(
108  const string&,
109  CSeq_annot&,
110  ILineErrorListener*) override;
111 
112  void xPostProcessAnnot(
113  CSeq_annot&) override;
114 
115  virtual bool xMergeRecord(
116  const CGvfReadRecord&,
117  CSeq_annot&,
119 
120  bool xFeatureSetLocation(
121  const CGff2Record&,
122  CSeq_feat&);
123 
124  bool xFeatureSetLocationInterval(
125  const CGff2Record&,
126  CSeq_feat&);
127 
128  bool xFeatureSetLocationPoint(
129  const CGff2Record&,
130  CSeq_feat&);
131 
132  bool xFeatureSetVariation(
133  const CGvfReadRecord&,
134  CSeq_feat&);
135 
136  virtual bool xFeatureSetExt(
137  const CGvfReadRecord&,
138  CSeq_feat&,
140 
141  bool xVariationMakeSNV(
142  const CGvfReadRecord&,
143  CVariation_ref&);
144 
145  bool xVariationMakeCNV(
146  const CGvfReadRecord&,
147  CVariation_ref&);
148 
149  bool xVariationMakeInsertions(
150  const CGvfReadRecord&,
151  CVariation_ref&);
152 
153  bool xVariationMakeDeletions(
154  const CGvfReadRecord&,
155  CVariation_ref&);
156 
157  bool xVariationMakeIndels(
158  const CGvfReadRecord&,
159  CVariation_ref&);
160 
161  bool xVariationMakeInversions(
162  const CGvfReadRecord&,
163  CVariation_ref&);
164 
165  bool xVariationMakeEversions(
166  const CGvfReadRecord&,
167  CVariation_ref&);
168 
169  bool xVariationMakeTranslocations(
170  const CGvfReadRecord&,
171  CVariation_ref&);
172 
173  bool xVariationMakeComplex(
174  const CGvfReadRecord&,
175  CVariation_ref&);
176 
177  bool xVariationMakeUnknown(
178  const CGvfReadRecord&,
179  CVariation_ref&);
180 
181  bool xVariationSetInsertions(
182  const CGvfReadRecord&,
183  CVariation_ref&);
184 
185  bool xVariationSetDeletions(
186  const CGvfReadRecord&,
187  CVariation_ref&);
188 
189  bool xVariationSetCommon(
190  const CGvfReadRecord&,
191  CVariation_ref&);
192 
193  virtual bool xVariationSetId(
194  const CGvfReadRecord&,
195  CVariation_ref&);
196 
197  virtual bool xVariationSetParent(
198  const CGvfReadRecord&,
199  CVariation_ref&);
200 
201  virtual bool xVariationSetName(
202  const CGvfReadRecord&,
203  CVariation_ref&);
204 
205  virtual bool xVariationSetSnvs(
206  const CGvfReadRecord&,
207  CVariation_ref&);
208 
209  virtual bool xVariationSetProperties(
210  const CGvfReadRecord&,
211  CVariation_ref&);
212 
213  CGff3ReadRecord* x_CreateRecord() override { return new CGvfReadRecord(m_uLineNumber); };
214 
215  bool xIsDbvarCall(
216  const string& nameAttr) const;
217 
218  bool xGetNameAttribute(
219  const CGvfReadRecord& record,
220  string& name) const;
221 
222 protected:
224 };
225 
228 
229 #endif // OBJTOOLS_READERS___GVF_READER__HPP
User-defined methods of the data storage class.
void xGetData(ILineReader &, TReaderData &) override
virtual bool xParseStructuredComment(const string &)
void xPostProcessAnnot(CSeq_annot &) override
CRef< CSeq_annot > ReadSeqAnnot(ILineReader &lr, ILineErrorListener *pErrors=nullptr) override
Read an object from a given line reader, render it as a single Seq-annot, if possible.
bool xParseFeature(const string &, CSeq_annot &, ILineErrorListener *) override
void xProcessData(const TReaderData &, CSeq_annot &) override
bool AssignFromGff(const string &) override
Definition: gvf_reader.cpp:77
ILineErrorListener * mpMessageListener
Definition: gvf_reader.hpp:73
CGvfReadRecord(unsigned int lineNumber, ILineErrorListener *pEC=nullptr)
Definition: gvf_reader.hpp:54
bool xAssignAttributesFromGff(const string &, const string &) override
Definition: gvf_reader.cpp:106
bool SanityCheck() const
Definition: gvf_reader.cpp:144
unsigned int mLineNumber
Definition: gvf_reader.hpp:72
CGff3ReadRecord * x_CreateRecord() override
Definition: gvf_reader.hpp:213
CRef< CAnnotdesc > m_Pragmas
Definition: gvf_reader.hpp:223
long TReaderFlags
Definition: reader_base.hpp:84
vector< TReaderLine > TReaderData
Definition: reader_base.hpp:70
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
Abstract base class for lightweight line-by-line reading.
Definition: line_reader.hpp:54
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_XOBJREAD_EXPORT
Definition: ncbi_export.h:1315
Modified on Thu Feb 29 12:24:26 2024 by modify_doxy.py rev. 669887