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

Go to the SVN repository for this file.

1 #ifndef PKG_SEQUENCE___BAM_UI_DATA_SOURCE__HPP
2 #define PKG_SEQUENCE___BAM_UI_DATA_SOURCE__HPP
3 
4 /* $Id: bam_ui_data_source.hpp 45702 2020-10-27 15:13:28Z shkeda $
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/ncbistl.hpp>
36 
39 
41 #include <gui/core/pt_item.hpp>
43 
44 #include <gui/utils/extension.hpp>
45 #include <gui/utils/ui_object.hpp>
47 
49 
51 
52 
54 
55 
56 /** @addtogroup GUI_PKG_NCBI_INTERNAL
57 *
58 * @{
59 */
60 
61 /// commands introduced by BAM data source
63  eCmdLoadBamFile = 12350,
64 };
65 
67 
68 ///////////////////////////////////////////////////////////////////////////////
69 /// CBamUIDataSource
70 
72  public CObject,
73  public IExtension,
75  public IUIDataSource,
76  public IDataLoaderProvider,
78 {
79 public:
82 
83  /// @name IExtension interface implementation
84  /// @{
85  virtual string GetExtensionIdentifier() const;
86  virtual string GetExtensionLabel() const;
87  /// @}
88 
89  /// @name IServiceLocatorConsumer implementation
90  /// @{
91  virtual void SetServiceLocator(IServiceLocator* locator);
92  /// @}
93 
94  /// @name IUIDataSource interface implementation
95  /// @{
96  virtual IUIDataSourceType& GetType() const;
97 
98  virtual const IUIObject& GetDescr();
99 
100  virtual bool IsOpen();
101  virtual bool Open();
102  virtual bool Close();
103 
104  virtual void EditProperties();
105 
106  virtual IUIToolManager* GetLoadManager();
107 
108  virtual int GetDefaultCommand();
109  virtual wxEvtHandler* CreateEvtHandler();
110  /// @}
111 
112  /// @name IDataLoaderProvider implementation
113  /// @{
114  virtual string AddDataLoader(const objects::CUser_object& obj);
115 
116  virtual string GetLoaderName(const objects::CUser_object& obj) const;
117  /// @}
118 
119  /// @name IExplorerItemCmdContributor implementation
120  /// @{
121  virtual IExplorerItemCmdContributor::TContribution GetMenu(wxTreeCtrl& treeCtrl, PT::TItems& items);
122  /// @}
123 
124 private:
125  bool x_GetBamInputs(const objects::CUser_object& obj,
126  string& path, string& files,
127  string& idx, string& target_assm) const;
128 
129  bool x_GetSrzAccession(const objects::CUser_object& obj, string& srz) const;
130  bool x_GetCSraInputs(const objects::CUser_object& obj, string& file) const;
131  bool x_GetSraAccession(const objects::CUser_object& obj, string& sra) const;
132 
133 protected:
135 
137 
139 
140  bool m_Open;
141 };
142 
143 
144 ///////////////////////////////////////////////////////////////////////////////
145 /// CBamUIDataSourceType
146 
148  public CObject,
149  public IUIDataSourceType,
150  public IExtension
151 {
152 public:
154 
155  /// @name IUIDataSourceType interface implementation
156  /// @{
157  virtual const IUIObject& GetDescr();
158  virtual IUIDataSource* CreateDataSource();
159  virtual bool AutoCreateDefaultDataSource();
160  /// @}
161 
162  /// @name IExtension interface implementation
163  /// @{
164  virtual string GetExtensionIdentifier() const;
165  virtual string GetExtensionLabel() const;
166  /// @}
167 
168 protected:
170 };
171 
172 
173 ///////////////////////////////////////////////////////////////////////////////
174 /// CBamUILoadManager
175 
176 class CBamIndexingPanel;
179 class CBamIdMappingPanel;
180 
182  public CObject,
183  public IUIToolManager,
184  public IRegSettings
185 {
186 public:
188 
189  /// @name IUIToolManager interface implementation
190  /// @{
191  virtual void SetServiceLocator(IServiceLocator* srv_locator);
192  virtual void SetParentWindow(wxWindow* parent);
193  virtual const IUIObject& GetDescriptor() const;
194  virtual void InitUI();
195  virtual void CleanUI();
196  virtual wxPanel* GetCurrentPanel();
197  virtual bool CanDo(EAction action);
198  virtual bool IsFinalState();
199  virtual bool IsCompletedState();
200  virtual bool DoTransition(EAction action);
201  virtual IAppTask* GetTask();
202  /// @}
203 
204  /// @name IRegSettings interface implementation
205  /// @{
206  virtual void SetRegistryPath(const string& path);
207  virtual void LoadSettings();
208  virtual void SaveSettings() const;
209  /// @}
210 
211 protected:
212  enum EState {
213  eInvalid = -1,
219  eCompleted
220  };
221 
222 protected:
223  void x_GetBamRefSeqs(const CBamLoadOptionPanel::TBamWithIndexFiles &files, const string &mappedAcc);
224  void x_GetCSraRefSeqs(const CBamLoadOptionPanel::TBamFiles &accessions);
225  void x_GetSrzRefSeqs(const CBamLoadOptionPanel::TBamFiles &accessions);
226 
227 protected:
229  wxWindow* m_ParentWindow;
230 
233 
234  string m_RegPath;
235  mutable string m_SavedInput; // input saved in the registry
236  mutable string m_SamtoolsPath; // samtools path saved in the registry
237  string m_AssmAcc;
238  vector<CConstRef<objects::CSeq_id> > m_RefSeqIds;
239 
246 };
247 
248 
249 /* @} */
250 
252 
253 #endif // PKG_SEQUENCE___BAM_UI_DATA_SOURCE__HPP
CBamLoadOptionPanel.
CBamUIDataSourceType.
CBamUIDataSource.
CObject –.
Definition: ncbiobj.hpp:180
CProjectSelectorPanel - a panel that allows the user to specify how the project items created by a pl...
CUIObject - default mix-in implementation of IUIObject.
Definition: ui_object.hpp:81
IAppTask.
Definition: app_task.hpp:83
IDataLoaderProvider - an interface representing a Data Source.
IExplorerItemCmdContributor - interface representing a component that contributes commands applicable...
Definition: pt_item.hpp:149
pair< wxMenu *, wxEvtHandler * > TContribution
Contribution consists of a Menu object and event handler.
Definition: pt_item.hpp:152
IExtension IExtension interface represents an abstract pluggable component.
Definition: extension.hpp:57
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
IServiceLocatorConsumer - classes that need IServiceLocator should implement this interface.
Definition: service.hpp:103
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
IUIDataSourceType - defines a type of a Data Source, can serve as a Data Source factory.
IUIDataSource - an interface representing a Data Source.
IUIObject - object that provides basic properties often required in a UI object.
Definition: ui_object.hpp:63
void x_GetSrzRefSeqs(const CBamLoadOptionPanel::TBamFiles &accessions)
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual bool IsCompletedState()
Manager goes into "Complete" state when "Finish" button is pressed and all input data is gatherred an...
bool x_GetCSraInputs(const objects::CUser_object &obj, string &file) const
virtual bool DoTransition(EAction action)
Performs transition if possible and returns true, otherwise the function shall warn the user about th...
bool x_GetSraAccession(const objects::CUser_object &obj, string &sra) const
virtual bool Open()
Prepares Data Source for use, any initialization that can be potentially time-consuming or may requir...
IServiceLocator * m_SrvLocator
virtual void SetServiceLocator(IServiceLocator *locator)
virtual int GetDefaultCommand()
virtual bool AutoCreateDefaultDataSource()
returns "true" if this type needs to create a default instance of the Data Source at start-up
virtual IUIDataSource * CreateDataSource()
factory method; create an Data Source instance
virtual wxPanel * GetCurrentPanel()
Return the panel corresponding to the current state of Tool Manager.
virtual bool IsFinalState()
True if Tool Manager has reached its final state, i.e.
CProjectSelectorPanel * m_ProjectSelPanel
SProjectSelectorParams m_ProjectParams
CBamLoadOptionPanel * m_OptionPanel
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
CBamUIDataSourceType()
CBamUIDataSourceType.
CBamRefSequencesPanel * m_RefSequencesPanel
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual void InitUI()
Initializes the Manager before using it in UI.
virtual string GetLoaderName(const objects::CUser_object &obj) const
Get the data loader's name based on input object.
CBamUILoadManager()
CBamUILoadManager.
virtual void CleanUI()
CleanUI() is called after the host finished using the manager.
virtual void SetParentWindow(wxWindow *parent)
CBamIndexingPanel * m_IndexingPanel
virtual const IUIObject & GetDescriptor() const
Returns the object describing this tool (UI meta data).
virtual void EditProperties()
virtual IExplorerItemCmdContributor::TContribution GetMenu(wxTreeCtrl &treeCtrl, PT::TItems &items)
for the given set of items returns a contribution
virtual IAppTask * GetTask()
Once parameters are gathered and validated this function is called to produce the final Task object t...
virtual IUIToolManager * GetLoadManager()
virtual void LoadSettings()
virtual bool IsOpen()
a Data source needs to be open before use and closed after.
virtual IUIDataSourceType & GetType() const
vector< pair< string, string > > TBamWithIndexFiles
virtual bool CanDo(EAction action)
Indicates whether given transition is possible in the current state.
CBamCoverageGraphPanel * m_GraphPanel
CRef< CBamUIDataSourceType > m_Type
vector< CConstRef< objects::CSeq_id > > m_RefSeqIds
IServiceLocator * m_SrvLocator
void x_GetCSraRefSeqs(const CBamLoadOptionPanel::TBamFiles &accessions)
virtual void SaveSettings() const
virtual const IUIObject & GetDescr()
returns UI description of the object (label, icon etc.)
virtual void SetRegistryPath(const string &path)
virtual string AddDataLoader(const objects::CUser_object &obj)
Add a new data loader to object manager.
EBamCommands
commands introduced by BAM data source
virtual wxEvtHandler * CreateEvtHandler()
bool x_GetSrzAccession(const objects::CUser_object &obj, string &srz) const
virtual void SetServiceLocator(IServiceLocator *srv_locator)
Sets / unsets Service Locator.
void x_GetBamRefSeqs(const CBamLoadOptionPanel::TBamWithIndexFiles &files, const string &mappedAcc)
virtual const IUIObject & GetDescr()
returns UI description of the type (label, icon etc.)
CBamUIDataSource(CBamUIDataSourceType &type)
bool x_GetBamInputs(const objects::CUser_object &obj, string &path, string &files, string &idx, string &target_assm) const
@ eCmdLoadBamFile
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
FILE * file
vector< CItem * > TItems
Definition: pt_item.hpp:113
The NCBI C++/STL use hints.
SProjectSelectorParams - holds data for CProjectSelectorPanel.
Definition: type.c:6
Modified on Wed May 01 14:22:53 2024 by modify_doxy.py rev. 669887