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

Go to the SVN repository for this file.

1 #ifndef OBJTOOLS_FORMAT_ITEMS___LOCUS_ITEM__HPP
2 #define OBJTOOLS_FORMAT_ITEMS___LOCUS_ITEM__HPP
3 
4 /* $Id: locus_item.hpp 99549 2023-04-17 14:20:00Z gotvyans $
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 * Author: Aaron Ucko, NCBI
30 * Mati Shomrat
31 *
32 * File Description:
33 * Locus item for flat-file generator
34 *
35 */
36 #include <corelib/ncbistd.hpp>
37 #include <objects/seq/MolInfo.hpp>
38 #include <objects/seq/Seq_inst.hpp>
39 
41 
42 
45 
46 
47 class CBioseq_Handle;
48 class CDate;
49 class CBioseqContext;
50 class IFormatter;
51 
52 
53 ///////////////////////////////////////////////////////////////////////////
54 //
55 // Locus
56 
58 {
59 public:
63 
65  void Format(IFormatter& formatter, IFlatTextOStream& text_os) const override;
66 
67  const string& GetName (void) const;
68  const string& GetFullName (void) const;
69  size_t GetLength (void) const;
70  TStrand GetStrand (void) const;
71  TBiomol GetBiomol (void) const;
72  TTopology GetTopology (void) const;
73  const string& GetDivision (void) const;
74  const string& GetDate (void) const;
75 
76  EItem GetItemType() const override;
77 
78  static string GetDivision(const CBioseq_Handle& bsh, const CBioseqContext* ctx = 0);
79 
80 private:
81 
82  void x_GatherInfo(CBioseqContext& ctx) override;
83  void x_SetName(CBioseqContext& ctx);
84  void x_SetLength(CBioseqContext& ctx);
85  void x_SetStrand(CBioseqContext& ctx);
86  void x_SetBiomol(CBioseqContext& ctx);
87  void x_SetTopology(CBioseqContext& ctx);
88  void x_SetDivision(CBioseqContext& ctx);
89  void x_SetDate(CBioseqContext& ctx);
90 
91  const CDate* x_GetDateForBioseq(const CBioseq_Handle& bsh) const;
92  const CDate* x_GetLaterDate(const CDate* d1, const CDate* d2) const;
93 
94  bool x_NameHasBadChars(const string& name) const;
95 
96  // data
97  string m_Name;
98  string m_FullName;
99  size_t m_Length;
103  string m_Division;
104  string m_Date;
105 };
106 
107 
108 /////////////////////////////////////////////////////////////////////////////
109 //
110 // inline methods
111 
112 inline
113 const string& CLocusItem::GetName(void) const
114 {
115  return m_Name;
116 }
117 
118 
119 inline
120 const string& CLocusItem::GetFullName(void) const
121 {
122  return m_FullName;
123 }
124 
125 
126 inline
127 size_t CLocusItem::GetLength(void) const
128 {
129  return m_Length;
130 }
131 
132 
133 inline
135 {
136  return m_Strand;
137 }
138 
139 
140 inline
142 {
143  return m_Biomol;
144 }
145 
146 
147 inline
149 {
150  return m_Topology;
151 }
152 
153 
154 inline
155 const string& CLocusItem::GetDivision(void) const
156 {
157  return m_Division;
158 }
159 
160 
161 inline
162 const string& CLocusItem::GetDate(void) const
163 {
164  return m_Date;
165 }
166 
167 
170 
171 #endif /* OBJTOOLS_FORMAT_ITEMS___LOCUS_ITEM__HPP */
CBioseq_Handle –.
Definition: Date.hpp:53
virtual void Format(IFormatter &formatter, IFlatTextOStream &text_os) const =0
virtual void x_GatherInfo(CBioseqContext &)
Definition: item_base.hpp:71
CSeq_inst::TStrand TStrand
Definition: locus_item.hpp:61
const string & GetName(void) const
Definition: locus_item.hpp:113
size_t m_Length
Definition: locus_item.hpp:99
string m_Division
Definition: locus_item.hpp:103
string m_Name
Definition: locus_item.hpp:97
size_t GetLength(void) const
Definition: locus_item.hpp:127
TBiomol m_Biomol
Definition: locus_item.hpp:101
CMolInfo::TBiomol TBiomol
Definition: locus_item.hpp:60
CSeq_inst::TTopology TTopology
Definition: locus_item.hpp:62
TBiomol GetBiomol(void) const
Definition: locus_item.hpp:141
TTopology m_Topology
Definition: locus_item.hpp:102
const string & GetDate(void) const
Definition: locus_item.hpp:162
TTopology GetTopology(void) const
Definition: locus_item.hpp:148
string m_FullName
Definition: locus_item.hpp:98
const string & GetDivision(void) const
Definition: locus_item.hpp:155
TStrand GetStrand(void) const
Definition: locus_item.hpp:134
string m_Date
Definition: locus_item.hpp:104
TStrand m_Strand
Definition: locus_item.hpp:100
const string & GetFullName(void) const
Definition: locus_item.hpp:120
virtual EItem GetItemType(void) const =0
Include a standard set of the NCBI C++ Toolkit most basic headers.
CS_CONTEXT * ctx
Definition: t0006.c:12
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
#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_FORMAT_EXPORT
Definition: ncbi_export.h:496
ETopology
topology of molecule
Definition: Seq_inst_.hpp:121
EStrand
strandedness in living organism
Definition: Seq_inst_.hpp:133
Modified on Fri May 24 14:52:10 2024 by modify_doxy.py rev. 669887