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

Go to the SVN repository for this file.

1 /* $Id: gff2_data.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  * GFF3 transient data structures
30  *
31  */
32 
33 #ifndef OBJTOOLS_READERS___GFF2DATA__HPP
34 #define OBJTOOLS_READERS___GFF2DATA__HPP
35 
37 
39 BEGIN_objects_SCOPE // namespace ncbi::objects::
40 
41 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
44  public CGffBaseColumns
45 {
46 public:
50 
51 
52 public:
55  const CGff2Record& rhs):
56  CGffBaseColumns(rhs)
57  {
59  };
60 
61  virtual ~CGff2Record() {};
62 
63  //
64  // Input/output:
65  //
66  virtual bool AssignFromGff(
67  const string& );
68 
69  //
70  // Accessors:
71  //
72  bool IsAlignmentRecord() const {
73  if (NStr::StartsWith(Type(), "match") ||
74  NStr::EndsWith(Type(), "_match")) {
75  return true;
76  }
77  return false;
78  };
79 
80  const TAttributes& Attributes() const {
81  return m_Attributes;
82  };
83 
84  bool GetAttribute(
85  const string&,
86  string& ) const;
87 
88  bool GetAttribute(
89  const string&,
90  list<string>& ) const;
91 
92  virtual bool InitializeFeature(
95  SeqIdResolver = nullptr ) const;
96 
97  virtual bool UpdateFeature(
100  SeqIdResolver = nullptr ) const;
101 
102  bool IsMultiParent() const;
103 
104  static void TokenizeGFF(
105  vector<CTempStringEx>& columns,
106  const CTempStringEx& line);
107 
108 protected:
109  virtual bool xAssignAttributesFromGff(
110  const string&,
111  const string& );
112 
113  bool xSplitGffAttributes(
114  const string&,
115  vector< string >& ) const;
116 
117  virtual bool xMigrateAttributes(
118  TReaderFlags,
119  CRef<CSeq_feat> ) const;
120 
121  virtual bool xInitFeatureData(
122  TReaderFlags,
123  CRef<CSeq_feat>) const;
124 
125  virtual bool xUpdateFeatureData(
126  TReaderFlags,
128  SeqIdResolver = nullptr ) const;
129 
130  virtual bool xMigrateAttributesSubSource(
131  TReaderFlags,
133  TAttributes& ) const;
134 
135  virtual bool xMigrateAttributesOrgName(
136  TReaderFlags,
138  TAttributes& ) const;
139 
140  virtual bool xMigrateAttributesGo(
141  TReaderFlags,
143  TAttributes& ) const;
144 
145  //utility helpers:
146  //
147  static string xNormalizedAttributeKey(
148  const CTempString&);
149 
150  static string xNormalizedAttributeValue(
151  const CTempString&);
152 
153  static bool xMigrateAttributeDefault(
154  TAttributes&,
155  const string&,
157  const string&,
158  TReaderFlags);
159 
160  static bool xMigrateAttributeSingle(
161  TAttributes&,
162  const string&,
164  const string&,
165  TReaderFlags);
166 
167  //
168  // Data:
169  //
172 };
173 
174 END_objects_SCOPE
176 
177 #endif // OBJTOOLS_READERS___GFF2DATA__HPP
virtual bool xUpdateFeatureData(TReaderFlags, CRef< CSeq_feat >, SeqIdResolver=nullptr) const
Definition: gff2_data.cpp:546
bool IsMultiParent() const
Definition: gff2_data.cpp:1171
TAttributes::const_iterator TAttrCit
Definition: gff2_data.hpp:49
static string xNormalizedAttributeValue(const CTempString &)
Definition: gff2_data.cpp:343
virtual bool xMigrateAttributes(TReaderFlags, CRef< CSeq_feat >) const
Definition: gff2_data.cpp:589
TAttributes::iterator TAttrIt
Definition: gff2_data.hpp:48
bool GetAttribute(const string &, string &) const
Definition: gff2_data.cpp:305
map< string, string > TAttributes
Definition: gff2_data.hpp:47
virtual bool UpdateFeature(TReaderFlags, CRef< CSeq_feat >, SeqIdResolver=nullptr) const
Definition: gff2_data.cpp:521
virtual bool AssignFromGff(const string &)
Definition: gff2_data.cpp:214
virtual bool InitializeFeature(TReaderFlags, CRef< CSeq_feat >, SeqIdResolver=nullptr) const
Definition: gff2_data.cpp:508
static void TokenizeGFF(vector< CTempStringEx > &columns, const CTempStringEx &line)
Definition: gff2_data.cpp:165
const TAttributes & Attributes() const
Definition: gff2_data.hpp:80
CGff2Record(const CGff2Record &rhs)
Definition: gff2_data.hpp:54
string m_strAttributes
Definition: gff2_data.hpp:170
virtual bool xInitFeatureData(TReaderFlags, CRef< CSeq_feat >) const
Definition: gff2_data.cpp:1130
static bool xMigrateAttributeDefault(TAttributes &, const string &, CRef< CSeq_feat >, const string &, TReaderFlags)
Definition: gff2_data.cpp:936
static bool xMigrateAttributeSingle(TAttributes &, const string &, CRef< CSeq_feat >, const string &, TReaderFlags)
Definition: gff2_data.cpp:914
virtual ~CGff2Record()
Definition: gff2_data.hpp:61
virtual bool xMigrateAttributesGo(TReaderFlags, CRef< CSeq_feat >, TAttributes &) const
Definition: gff2_data.cpp:1033
virtual bool xMigrateAttributesOrgName(TReaderFlags, CRef< CSeq_feat >, TAttributes &) const
Definition: gff2_data.cpp:966
virtual bool xMigrateAttributesSubSource(TReaderFlags, CRef< CSeq_feat >, TAttributes &) const
Definition: gff2_data.cpp:1056
bool IsAlignmentRecord() const
Definition: gff2_data.hpp:72
bool xSplitGffAttributes(const string &, vector< string > &) const
Definition: gff2_data.cpp:471
static string xNormalizedAttributeKey(const CTempString &)
Definition: gff2_data.cpp:335
virtual bool xAssignAttributesFromGff(const string &, const string &)
Definition: gff2_data.cpp:452
TAttributes m_Attributes
Definition: gff2_data.hpp:171
const string & Type() const
CRef< CSeq_id >(*)(const string &, TReaderFlags, bool) SeqIdResolver
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
container_type::const_iterator const_iterator
Definition: map.hpp:53
const_iterator begin() const
Definition: map.hpp:151
const_iterator end() const
Definition: map.hpp:152
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
static const column_t columns[]
Definition: utf8_2.c:22
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5430
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
Modified on Sat May 18 11:41:46 2024 by modify_doxy.py rev. 669887