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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_SEQ_GRAPHIC___EPIGENOMICS_TRACK__HPP
2 #define GUI_WIDGETS_SEQ_GRAPHIC___EPIGENOMICS_TRACK__HPP
3 
4 /* $Id: epigenomics_track.hpp 36620 2016-10-14 20:34:56Z katargir $
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: Liangshou Wu
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbiobj.hpp>
36 #include <gui/utils/extension.hpp>
41 
42 
44 
45 class CTranslationConfig;
46 
47 ///////////////////////////////////////////////////////////////////////////////
48 /// CEpigenomicsDS - Epigenomics data source
49 ///
51 {
52 public:
53  CEpigenomicsDS(objects::CScope& scope, const objects::CSeq_id& id);
54 
55  void GetAnnotNames(const TSeqRange& range, TAnnotNameTitleMap& annots,
56  const vector<string>& annots_allowed);
57 
58  void LoadData(const TSeqRange& range, TModelUnit scale,
59  bool calc_min = false, bool fixed_scale = false);
60 
61  void SetAnnot(const string& annot);
62  const string& GetAnnot() const;
63 
64 private:
65  string m_Annot;
66 };
67 
68 
69 ///////////////////////////////////////////////////////////////////////////////
70 /// CEpigenomicsDSType - Epigenomics data source type
71 ///
73  public CObject,
74  public ISGDataSourceType,
75  public IExtension
76 {
77 public:
78  /// create an instance of the layout track type using default settings.
79  virtual ISGDataSource* CreateDS(SConstScopedObject& object) const;
80 
81  /// @name IExtension interface implementation
82  /// @{
83  virtual string GetExtensionIdentifier() const;
84  virtual string GetExtensionLabel() const;
85  /// @}
86 
87  /// check if the data source can be shared.
88  virtual bool IsSharable() const;
89 };
90 
91 
92 ///////////////////////////////////////////////////////////////////////////////
93 /// CEpigenomicsTrack -- A special track for showing epigenomics map.
94 /// The data can be stored at multiple scale levels as seq-graph or
95 /// seq-table. The graph renderer is differnt from the regular graph
96 /// renderer. It needs to show max, min and average.
97 ///
98 
100  public CDataTrack
101 {
103 
104 public:
106  virtual ~CEpigenomicsTrack();
107 
108  /// @name CLayoutTrack public methods.
109  /// @{
110  virtual const CTrackTypeInfo& GetTypeInfo() const;
111  virtual string GetFullTitle() const;
112  /// @}
113 
114  /// @name CDataTrack interface implementation
115  /// @{
116  virtual CRef<CSGGenBankDS> GetDataSource();
117  virtual CConstRef<CSGGenBankDS> GetDataSource() const;
118  /// @}
119 
120 protected:
121  /// @name CLayoutTrack virtual methods overloading.
122  /// @{
123  virtual void x_LoadSettings(const string& preset_style,
124  const TKeyValuePairs& settings);
125 
126  /// save part of settings to a profile string.
127  /// Only the potential settings changed by users will be saved.
128  virtual void x_SaveSettings(const string& preset_style);
129  virtual void x_OnIconClicked(TIconID id);
130  /// @}
131 
132  /// @name CDataTrack pure virtual interfaces
133  /// @{
134  virtual void x_UpdateData();
135  virtual void x_OnJobCompleted(CAppJobNotification& notify);
136  /// @}
137 
138  void x_AddGraphs(const CSGJobResult& result);
139 
140 private:
141  /// @name prohibited copy constructor and assignment operator.
142  /// @{
145  /// @}
146 
147  void x_OnSettingsIconClicked();
148 
149 private:
150  string m_AnnotDesc; ///< detailed track title
153 
154  /// Superinpose min graph on top of max graph?.
155  bool m_CalcMin;
156 
157  /// Dynamic or fixed graph scale.
158  /// By default, the graph scale is a dynamic value which
159  /// is updated within the visible range.
161 
162 };
163 
164 ///////////////////////////////////////////////////////////////////////////////
165 /// CEpigenomicsTrackFactory
166 ///
168  public CObject,
169  public ILayoutTrackFactory,
170  public IExtension
171 {
172 public:
174 
175  /// create a layout track based on the input objects and extra parameters.
176  virtual TTrackMap CreateTracks(
177  SConstScopedObject& object,
178  ISGDataSourceContext* ds_context,
179  CRenderingContext* r_cntx,
180  const SExtraParams& params = SExtraParams(),
181  const TAnnotMetaDataList& src_annots = TAnnotMetaDataList()) const;
182 
183  virtual void GetMatchedAnnots(
184  const TAnnotMetaDataList& src_annots,
185  const ILayoutTrackFactory::SExtraParams& params,
186  TAnnotNameTitleMap& out_annots) const;
187 
188  virtual bool UnderstandLevel() const
189  { return true; }
190 
191  virtual bool NeedBackgroundInit() const
192  { return true; }
193 
194  virtual const CTrackTypeInfo& GetThisTypeInfo() const
195  { return GetTypeInfo(); }
196 
197  static const CTrackTypeInfo& GetTypeInfo()
199 
200  /// @name IExtension interface implementation
201  /// @{
202  virtual string GetExtensionIdentifier() const;
203  virtual string GetExtensionLabel() const;
204  /// @}
205 };
206 
207 
208 ///////////////////////////////////////////////////////////////////////////////
209 /// CEpigenomicsDS inline methods
210 ///
211 inline
212 void CEpigenomicsDS::SetAnnot(const string& annot)
213 { m_Annot = annot; }
214 
215 inline
216 const string& CEpigenomicsDS::GetAnnot() const
217 { return m_Annot; }
218 
219 
220 ///////////////////////////////////////////////////////////////////////////////
221 /// CEpigenomicsTrack inline methods
222 ///
223 inline /*virtual*/
225 {
227 }
228 
229 inline /*virtual*/
231 {
233 }
234 
235 
237 
238 #endif // GUI_WIDGETS_SEQ_GRAPHIC___EPIGENOMICS_TRACK__HPP
CAppJobNotification Notification send by CAppJobEventTranslator.
CConstRef –.
Definition: ncbiobj.hpp:1266
CDataTrack - a abstract base class for layout tracks which need to deal with background data retrieva...
Definition: data_track.hpp:55
CEpigenomicsDSType - Epigenomics data source type.
CEpigenomicsDS - Epigenomics data source.
const string & GetAnnot() const
void SetAnnot(const string &annot)
CEpigenomicsDS inline methods.
CEpigenomicsTrackFactory.
static const CTrackTypeInfo & GetTypeInfo()
virtual bool UnderstandLevel() const
Have any concept of level.
virtual bool NeedBackgroundInit() const
Background track initialization.
virtual const CTrackTypeInfo & GetThisTypeInfo() const
CEpigenomicsTrack – A special track for showing epigenomics map.
virtual CRef< CSGGenBankDS > GetDataSource()
CEpigenomicsTrack inline methods.
CRef< CEpigenomicsDS > m_DS
CEpigenomicsTrack(const CEpigenomicsTrack &)
string m_AnnotDesc
detailed track title
bool m_CalcMin
Superinpose min graph on top of max graph?.
static CTrackTypeInfo m_TypeInfo
CEpigenomicsTrack.
CEpigenomicsTrack & operator=(const CEpigenomicsTrack &)
bool m_FixedScale
Dynamic or fixed graph scale.
int TIconID
use int as TIconID instead of EIconID.
CObject –.
Definition: ncbiobj.hpp:180
CRef –.
Definition: ncbiobj.hpp:618
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
CSGJobResult – the data structure holding the seqgraphic job results.
CTrackTypeInfo - holds description of a layout track type.
IExtension IExtension interface represents an abstract pluggable component.
Definition: extension.hpp:57
ILayoutTrackFactory.
ISGDSManager is seqgraphic data source manage that serves as an data source context.
ISGDataSourceFactory.
File Description:
GLdouble TModelUnit
Definition: gltypes.hpp:48
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
#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_SEQGRAPHIC_EXPORT
Definition: gui_export.h:536
range(_Ty, _Ty) -> range< _Ty >
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
extra parameter for initializing a track.
else result
Definition: token2.c:20
Modified on Sat Mar 02 10:54:46 2024 by modify_doxy.py rev. 669887