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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_SEQ_GRAPHIC___VCF_DS__HPP
2 #define GUI_WIDGETS_SEQ_GRAPHIC___VCF_DS__HPP
3 
4 /* $Id: vcf_ds.hpp 46780 2021-10-06 23:01:50Z evgeniev $
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 <mutex>
36 #include <corelib/ncbimtx.hpp>
41 
43 
45  public CObject,
46  public INonAsnTrackData
47 {
48 public:
49  CVcfTrackData(const string &title, const string &annot_name, const TDataBlob &vcf_blob)
50  : m_Title{ title }
51  , m_Annots{ annot_name }
52  , m_Blob{ vcf_blob }
53  {}
54 
55  const string& GetKey() const { return m_Key; }
56 
57  const string& GetSubkey() const { return m_Subkey; }
58 
59  const string& GetDisplayName() const { return m_Title; }
60 
61  bool GetShown() const { return true; }
62 
63  const string& GetCategory() const { return m_Categoty; }
64 
65  const string& GetSubcategory() const { return m_Subcategoty; }
66 
67  const TAnnots& GetAnnots() const { return m_Annots; }
68 
69  // Returns the actual data
70  const TDataBlob& GetBlob() const { return m_Blob; }
71 
72  const string GetDataSourceTypeName() const;
73  // performs some sort of a search in data and place results into a list of objects
74  virtual void DoSearch(const objects::CSeq_id* seq_id, const string& sSearchTerm, list<CRef<CObject>>& results) const;
75 
76 private:
77  const string m_Key{ "vcf_track" };
78  const string m_Subkey{ "VcfVariation" };
79  const string m_Title;
81  const string m_Categoty{"Variations"};
82  const string m_Subcategoty{ "External Data" };
83  const TDataBlob &m_Blob;
84 };
85 
87  public CObject,
89  public IExtension
90 {
91 public:
92  /// @name INonAsnTrackDataFactory interface implementation
93  /// @{
94  INonAsnTrackData* CreateTrackData(const objects::CSeq_id &seq_id, const objects::CProjectItem &prj_item) const;
95  /// @}
96 
97  /// @name IExtension interface implementation
98  /// @{
99  string GetExtensionIdentifier() const;
100  string GetExtensionLabel() const;
101  /// @}
102 };
103 
104 ///////////////////////////////////////////////////////////////////////////////
105 /// CVcfFeatureDS
106 ///
108  public CSGFeatureDS,
109  public INonAsnDataSource
110 {
111 public:
114 
115  CVcfFeatureDS(objects::CScope& scope, const objects::CSeq_id& id);
116 
117  virtual void LoadFeatures(objects::SAnnotSelector& sel,
118  const TSeqRange& range, TModelUnit window,
119  TJobToken token = -1, int max_feat = -1,
121  const string& = "");
122 
123  virtual void LoadFeatures(const TSeqRange& range, TModelUnit window,
124  TJobToken token, const TFeatBatchJobRequests& requests) { NCBI_THROW(CException, eUnknown, "Batch loading not implemented for VCF datasource"); }
125 
126  virtual void LoadMainFeatures(
127  objects::SAnnotSelector& lm_feat_sel,
128  objects::SAnnotSelector& m_feat_sel,
129  TJobToken lm_token, TJobToken main_token,
130  int merge_style, bool landmark_feat,
131  int min_overview_feat, const TSeqRange& range,
132  TModelUnit window, int max_feat,
133  bool show_histogram, int highlight_mode) { NCBI_THROW(CException, eUnknown, "Loading main features not implemented for VCF datasource"); }
134 
135  /// @name INonAsnDataSource implementation
136  /// @{
137  void SetNonAsnDataRegistry(const INonAsnDataRegistry *registry);
138  bool HasNonAsnData(const string &annot_name) const;
139  const TDataBlob& GetNonAsnDataBlob(const string &annot_name) const;
140  virtual void DoSearch(const string &annot_name, const string& sSearchTerm, list<CRef<CObject>>& results) const;
141  /// @}
142 
143  void ShowOnlyPathogenic(bool show = true) { m_ShowOnlyPathogenic = show; };
144  size_t GetFeaturesCountInRange(const string& annot_name, const TSeqRange& range);
145 private:
147  bool m_ShowOnlyPathogenic = false;
148 };
149 
150 
151 ///////////////////////////////////////////////////////////////////////////////
152 /// CSGFeatureDSType
153 ///
155  public CObject,
156  public ISGDataSourceType,
157  public IExtension
158 {
159 public:
160  /// create an instance of the layout track type using default settings.
161  virtual ISGDataSource* CreateDS(SConstScopedObject& object) const;
162 
163  /// @name IExtension interface implementation
164  /// @{
165  virtual string GetExtensionIdentifier() const;
166  virtual string GetExtensionLabel() const;
167  /// @}
168 
169  /// check if the data source can be shared.
170  virtual bool IsSharable() const;
171 };
172 
173 
175 
176 #endif /* GUI_WIDGETS_SEQ_GRAPHIC___VCF_DS__HPP */
CObject –.
Definition: ncbiobj.hpp:180
CSGFeatureDS.
Definition: feature_ds.hpp:49
CSGFeatureDSType.
Definition: vcf_ds.hpp:158
CVcfFeatureDS.
Definition: vcf_ds.hpp:110
CConstIRef< INonAsnDataRegistry > m_DataRegistry
Definition: vcf_ds.hpp:146
virtual void LoadFeatures(objects::SAnnotSelector &sel, const TSeqRange &range, TModelUnit window, TJobToken token=-1, int max_feat=-1, ELinkedFeatDisplay LinkedFeatDisplay=ELinkedFeatDisplay::eLFD_Default, const string &="")
void ShowOnlyPathogenic(bool show=true)
Definition: vcf_ds.hpp:143
virtual void LoadFeatures(const TSeqRange &range, TModelUnit window, TJobToken token, const TFeatBatchJobRequests &requests)
Definition: vcf_ds.hpp:123
virtual void LoadMainFeatures(objects::SAnnotSelector &lm_feat_sel, objects::SAnnotSelector &m_feat_sel, TJobToken lm_token, TJobToken main_token, int merge_style, bool landmark_feat, int min_overview_feat, const TSeqRange &range, TModelUnit window, int max_feat, bool show_histogram, int highlight_mode)
Definition: vcf_ds.hpp:126
bool GetShown() const
Definition: vcf_ds.hpp:61
CVcfTrackData(const string &title, const string &annot_name, const TDataBlob &vcf_blob)
Definition: vcf_ds.hpp:49
const string & GetSubkey() const
Definition: vcf_ds.hpp:57
const string & GetKey() const
Definition: vcf_ds.hpp:55
const string & GetCategory() const
Definition: vcf_ds.hpp:63
const TAnnots & GetAnnots() const
Definition: vcf_ds.hpp:67
const TDataBlob & m_Blob
Definition: vcf_ds.hpp:83
const string m_Title
Definition: vcf_ds.hpp:79
const string & GetSubcategory() const
Definition: vcf_ds.hpp:65
const string & GetDisplayName() const
Definition: vcf_ds.hpp:59
const TDataBlob & GetBlob() const
Definition: vcf_ds.hpp:70
const TAnnots m_Annots
Definition: vcf_ds.hpp:80
IExtension IExtension interface represents an abstract pluggable component.
Definition: extension.hpp:57
ISGDataSourceFactory.
File Description:
static CMemoryRegistry registry
Definition: cn3d_tools.cpp:81
ELinkedFeatDisplay
@ eLFD_Default
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
virtual const string GetDataSourceTypeName() const =0
vector< string > TAnnots
vector< char > TDataBlob
virtual void DoSearch(const objects::CSeq_id *seq_id, const string &sSearchTerm, list< CRef< CObject >> &results) const =0
INonAsnTrackData::TDataBlob TDataBlob
GLdouble TModelUnit
Definition: gltypes.hpp:48
#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 >
Multi-threading – mutexes; rw-locks; semaphore.
vector< SFeatBatchJobRequest > TFeatBatchJobRequests
Modified on Mon Apr 22 04:05:58 2024 by modify_doxy.py rev. 669887