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

Go to the SVN repository for this file.

1 #ifndef __GUI_WIDGETS_ALNMULTI___TRACE_DATA__HPP
2 #define __GUI_WIDGETS_ALNMULTI___TRACE_DATA__HPP
3 
4 /* $Id: trace_data.hpp 14562 2007-05-18 11:48:21Z dicuccio $
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: Andrey Yazhuk
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistl.hpp>
36 #include <gui/gui_export.h>
37 
38 #include <objmgr/bioseq_handle.hpp>
39 
41 
42 class CTraceData;
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// CTraceDataProxy - an object controlling availability and creation of
46 /// CTraceData instance.
48 {
49 public:
51 
52  CTraceDataProxy(const objects::CBioseq_Handle& handle, bool b_neg_strand);
53  bool HasData() const;
54  CTraceData* LoadData();
55 private:
56  enum EStatus {
59  eHasData
60  };
61  const objects::CBioseq_Handle& m_Handle; /// handle to Bioseq with traces
63  mutable EStatus m_Status;
64 
66 };
67 
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// CTraceData
72 {
73 public:
74  typedef float TConfidence;
75  typedef double TFloatSeqPos;
76  typedef float TSignalValue;
77 
78  typedef vector<TFloatSeqPos> TPositions;
79  typedef vector<TSignalValue> TValues;
80 
81  enum EChannel {
82  eA,
83  eC,
84  eT,
85  eG
86  };
87 public:
89  : m_From(0), m_To(-1)
90  {
91  }
92  void Init(TSignedSeqPos from, TSignedSeqPos to, int samples, bool negative);
93 
94  /// Sequence related information
95 
96  inline TSignedSeqPos GetSeqFrom() const;
97  inline TSignedSeqPos GetSeqTo() const;
98  inline TSignedSeqPos GetSeqLength() const;
99  inline bool IsNegative() const;
100 
101  inline TConfidence GetConfidence(TSignedSeqPos pos) const;
102  inline void SetConfidence(TSignedSeqPos pos, TConfidence conf);
103 
104  // signal related information
105 
106  inline int GetSamplesCount() const;
107  inline TPositions& GetPositions();
108  inline TValues& GetA();
109  inline TValues& GetC();
110  inline TValues& GetT();
111  inline TValues& GetG();
112  TValues& GetValues(EChannel signal);
113 
114  inline const TPositions& GetPositions() const;
115  inline const TValues& GetA() const;
116  inline const TValues& GetC() const;
117  inline const TValues& GetT() const;
118  inline const TValues& GetG() const;
119  const TValues& GetValues(EChannel signal) const;
120 
121  void CalculateMax();
123  TSignalValue GetMax(EChannel signal) const;
124 
125 protected:
129 
130  vector<TConfidence> m_Confs;
136 
142 };
143 
144 
145 /// Sequence related information
146 
148 {
149  return m_From;
150 }
152 {
153  return m_To;
154 }
156 {
157  return m_To - m_From + 1;
158 }
159 inline bool CTraceData::IsNegative() const
160 {
161  return m_bNegative;
162 }
164 {
165  return m_Confs[pos - m_From];
166 }
168 {
169  m_Confs[pos - m_From] = conf;
170 }
171 
172 // signal related information
173 
175 {
176  return (int) m_Positions.size();
177 }
178 
180 {
181  return m_Positions;
182 }
184 {
185  return m_ASig;
186 }
188 {
189  return m_CSig;
190 }
192 {
193  return m_TSig;
194 }
196 {
197  return m_GSig;
198 }
200 {
201  return m_Positions;
202 }
204 {
205  return m_ASig;
206 }
208 {
209  return m_CSig;
210 }
212 {
213  return m_TSig;
214 }
216 {
217  return m_GSig;
218 }
219 
221 
222 #endif // __GUI_WIDGETS_ALNMULTI___TRACE_DATA__HPP
CTraceDataProxy - an object controlling availability and creation of CTraceData instance.
Definition: trace_data.hpp:48
EStatus m_Status
Definition: trace_data.hpp:63
const objects::CBioseq_Handle & m_Handle
Definition: trace_data.hpp:61
bool m_bNegativeStrand
handle to Bioseq with traces
Definition: trace_data.hpp:62
TTitleToType m_TitleToType
Definition: trace_data.hpp:65
map< string, int > TTitleToType
Definition: trace_data.hpp:50
CTraceData.
Definition: trace_data.hpp:72
TValues & GetA()
Definition: trace_data.hpp:183
TSignalValue m_MaxA
Definition: trace_data.hpp:138
TValues & GetG()
Definition: trace_data.hpp:195
TSignalValue m_MaxG
Definition: trace_data.hpp:141
TSignedSeqPos GetSeqFrom() const
Sequence related information.
Definition: trace_data.hpp:147
double TFloatSeqPos
Definition: trace_data.hpp:75
float TConfidence
Definition: trace_data.hpp:74
TValues m_CSig
Definition: trace_data.hpp:133
bool IsNegative() const
Definition: trace_data.hpp:159
TConfidence GetConfidence(TSignedSeqPos pos) const
Definition: trace_data.hpp:163
TSignalValue m_MaxC
Definition: trace_data.hpp:139
void Init(TSignedSeqPos from, TSignedSeqPos to, int samples, bool negative)
CTraceData.
Definition: trace_data.cpp:215
TSignedSeqPos m_To
Definition: trace_data.hpp:127
float TSignalValue
Definition: trace_data.hpp:76
TSignalValue GetMax(EChannel signal) const
Definition: trace_data.cpp:277
TValues m_ASig
Definition: trace_data.hpp:132
int GetSamplesCount() const
Definition: trace_data.hpp:174
TConfidence m_MaxConfidence
Definition: trace_data.hpp:137
TValues m_TSig
Definition: trace_data.hpp:134
TValues & GetValues(EChannel signal)
Definition: trace_data.cpp:243
TConfidence GetMaxConfidence() const
Definition: trace_data.cpp:272
TSignedSeqPos GetSeqTo() const
Definition: trace_data.hpp:151
vector< TConfidence > m_Confs
Definition: trace_data.hpp:130
TSignedSeqPos m_From
Definition: trace_data.hpp:126
TPositions & GetPositions()
Definition: trace_data.hpp:179
TValues m_GSig
Definition: trace_data.hpp:135
vector< TFloatSeqPos > TPositions
Definition: trace_data.hpp:78
void CalculateMax()
Definition: trace_data.cpp:255
vector< TSignalValue > TValues
Definition: trace_data.hpp:79
TValues & GetT()
Definition: trace_data.hpp:191
bool m_bNegative
Definition: trace_data.hpp:128
TSignedSeqPos GetSeqLength() const
Definition: trace_data.hpp:155
TValues & GetC()
Definition: trace_data.hpp:187
TPositions m_Positions
Definition: trace_data.hpp:131
TSignalValue m_MaxT
Definition: trace_data.hpp:140
void SetConfidence(TSignedSeqPos pos, TConfidence conf)
Definition: trace_data.hpp:167
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:887
#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 NCBI_GUIWIDGETS_ALNMULTIPLE_EXPORT
Definition: gui_export.h:520
Defines to provide correct exporting from DLLs in Windows.
The NCBI C++/STL use hints.
T negative(T x_)
Modified on Wed Jun 12 11:14:28 2024 by modify_doxy.py rev. 669887