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

Go to the SVN repository for this file.

1 #ifndef OBJMGR_GC_ASSEMBLY_PARSER__HPP
2 #define OBJMGR_GC_ASSEMBLY_PARSER__HPP
3 
4 /* $Id: gc_assembly_parser.hpp 84612 2018-11-21 14:24:48Z ucko $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Authors:
30 * Aleksey Grichenko
31 *
32 * File Description:
33 * GC-Assembly parser used by CScope and CSeq_loc_Mapper to
34 * convert assemblies to seq-entries.
35 *
36 */
37 
41 #include <corelib/ncbiobj.hpp>
42 #include <set>
43 
46 
47 /** @addtogroup ObjectManagerCore
48  *
49  * @{
50  */
51 
52 
53 // fwd decl
54 class CGC_AssemblyDesc;
55 
56 
57 /////////////////////////////////////////////////////////////////////////////
58 ///
59 /// CGC_Assembly_Parser --
60 ///
61 /// GC-Assembly parser used by CScope and CSeq_loc_Mapper to
62 /// convert assemblies to seq-entries.
63 ///
64 
66 {
67 public:
68  /// Parser options.
69  enum FParserFlags {
70  /// Do not add local private and external ids to bioseqs.
71  fIgnoreLocalIds = 1 << 0,
72  /// Do not add external ids to bioseqs.
73  fIgnoreExternalIds = 1 << 1,
74  /// Do not add annotations to seq-entries and bioseqs.
75  fIgnoreAnnots = 1 << 2,
76  /// Do not add descriptions to seq-entries and bioseqs.
77  fIgnoreDescr = 1 << 3,
78  /// Skip duplicate sequences (all synonyms are checked).
79  fSkipDuplicates = 1 << 4,
80 
81  fDefault = fIgnoreLocalIds | fIgnoreAnnots | fIgnoreDescr | fSkipDuplicates
82  };
83  typedef int TParserFlags;
84 
85  /// Parse the assembly, convert it to seq-entry, collect additional
86  /// information (top-level sequences etc).
87  CGC_Assembly_Parser(const CGC_Assembly& assembly,
88  TParserFlags flags = fDefault);
89 
90  virtual ~CGC_Assembly_Parser(void);
91 
92  /// Create seq-entry with all parsed sequences, annotations etc.
93  CRef<CSeq_entry> GetTSE(void) const { return m_TSE; }
94 
96 
97  /// Get seq-ids for all top-level sequences in the assembly.
98  const TSeqIds& GetTopLevelSequences(void) const { return m_TopSeqs; }
99 
100 private:
101  void x_ParseGCAssembly(const CGC_Assembly& gc_assembly,
102  CRef<CSeq_entry> parent_entry);
103  void x_ParseGCSequence(const CGC_Sequence& gc_seq,
104  const CGC_Sequence* parent_seq,
105  CRef<CSeq_entry> parent_entry,
106  CRef<CSeq_id> override_id);
107  void x_AddBioseq(CRef<CSeq_entry> parent_entry,
108  const TSeqIds& synonyms,
109  const CGC_Sequence& gc_seq);
110  void x_InitSeq_entry(CRef<CSeq_entry> entry,
111  CRef<CSeq_entry> parent);
112  void x_CopyData(const CGC_AssemblyDesc& assm_desc,
113  CSeq_entry& entry);
114 
119 };
120 
121 
122 /// Seq-loc and seq-align mapper exceptions
124 {
125 public:
126  enum EErrCode {
127  eUnsupported, ///< Unsupported type/flag.
128  eOtherError
129  };
130  virtual const char* GetErrCodeString(void) const override;
132 };
133 
134 
135 /////////////////////////////////////////////////////////////////////////////
136 // CGC_Assembly_Parser inline methods
137 /////////////////////////////////////////////////////////////////////////////
138 
139 
140 
141 
142 /* @} */
143 
144 
147 
148 #endif//OBJMGR_GC_ASSEMBLY_PARSER__HPP
User-defined methods of the data storage class.
Seq-loc and seq-align mapper exceptions.
CGC_AssemblyDesc –.
CGC_Assembly_Parser –.
CObject –.
Definition: ncbiobj.hpp:180
Definition: Seq_entry.hpp:56
Definition: set.hpp:45
static uch flags
EErrCode
Error types that an application can generate.
Definition: ncbiexpt.hpp:884
CRef< CSeq_entry > m_TSE
CRef< CSeq_entry > GetTSE(void) const
Create seq-entry with all parsed sequences, annotations etc.
const TSeqIds & GetTopLevelSequences(void) const
Get seq-ids for all top-level sequences in the assembly.
FParserFlags
Parser options.
set< CSeq_id_Handle > TSeqIds
NCBI_EXCEPTION_DEFAULT(CAssemblyParserException, CException)
@ eUnsupported
Unsupported type/flag.
#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_XOBJMGR_EXPORT
Definition: ncbi_export.h:1307
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Sun May 19 04:47:08 2024 by modify_doxy.py rev. 669887