NCBI C++ ToolKit
create_gene_model_params_panel.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: create_gene_model_params_panel.cpp 42821 2019-04-18 19:32:56Z joukovv $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Andrey Yazhuk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
36 ////@begin includes
37 #include "wx/imaglist.h"
38 ////@end includes
39 
40 #include <wx/sizer.h>
41 #include <wx/statbox.h>
42 #include <wx/checkbox.h>
43 
45 
46 
48 {
49  Init();
50 }
51 
53 {
54  m_CreateGene = true;
55  m_CreateMrna = true;
56  m_CreateCds = true;
57  m_PropagateNcrnaFeats = true;
58  m_GroupByGeneId = true;
59  m_TranscribeMrna = false;
60  m_TranslateCds = false;
61  m_MergeResults = false;
62  m_PropagateLocalIds = false;
63 }
64 
65 void SCreateGeneModelParams::SetRegistryPath( const string& reg_path )
66 {
67  m_RegPath = reg_path;
68 }
69 
71 {
72 }
73 
75 {
76 }
77 
78 ////@begin XPM images
79 ////@end XPM images
80 
82 
84 
85 ////@begin CCreateGeneModelParamsPanel event table entries
87 
89 
91 
93 
94 ////@end CCreateGeneModelParamsPanel event table entries
95 
97 
99  : m_Params(NULL)
100  , m_InputObjects(NULL)
101  , m_InputListDirty(true)
102 {
103  Init();
104 }
105 
106 CCreateGeneModelParamsPanel::CCreateGeneModelParamsPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
107 {
108  Init();
109  Create(parent, id, pos, size, style);
110 }
111 
112 bool CCreateGeneModelParamsPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
113 {
114 ////@begin CCreateGeneModelParamsPanel creation
115  CAlgoToolManagerParamsPanel::Create( parent, id, pos, size, style );
116 
117  CreateControls();
118  if (GetSizer())
119  {
120  GetSizer()->SetSizeHints(this);
121  }
122  Centre();
123 ////@end CCreateGeneModelParamsPanel creation
124  return true;
125 }
126 
128 {
129 ////@begin CCreateGeneModelParamsPanel destruction
130 ////@end CCreateGeneModelParamsPanel destruction
131 }
132 
134 {
135 ////@begin CCreateGeneModelParamsPanel member initialisation
136  m_Params = NULL;
137  m_ObjectList = NULL;
138  m_CreateGene = NULL;
140  m_CreateMrna = NULL;
142  m_CreateCds = NULL;
147 ////@end CCreateGeneModelParamsPanel member initialisation
148 }
149 
151 {
152 ////@begin CCreateGeneModelParamsPanel content construction
153  CCreateGeneModelParamsPanel* itemCAlgoToolManagerParamsPanel1 = this;
154 
155  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
156  itemCAlgoToolManagerParamsPanel1->SetSizer(itemBoxSizer2);
157 
158  wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemCAlgoToolManagerParamsPanel1, wxID_ANY, _("Choose Alignments"));
159  wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
160  itemBoxSizer2->Add(itemStaticBoxSizer3, 0, wxGROW|wxALL, 5);
161 
162  m_ObjectList = new CObjectListWidget( itemStaticBoxSizer3->GetStaticBox(), ID_OBJLISTCTRL, wxDefaultPosition, wxSize(100, 200), wxLC_REPORT );
163  itemStaticBoxSizer3->Add(m_ObjectList, 1, wxGROW|wxALL, 5);
164 
165  wxFlexGridSizer* itemFlexGridSizer5 = new wxFlexGridSizer(0, 2, 0, 16);
166  itemBoxSizer2->Add(itemFlexGridSizer5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
167 
168  m_CreateGene = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECK_GENE, _("Create Gene Feature"), wxDefaultPosition, wxDefaultSize, 0 );
169  m_CreateGene->SetValue(true);
170  itemFlexGridSizer5->Add(m_CreateGene, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
171 
172  m_PropagateNcrnaFeats = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_PROPAGATE_NCRNA, _("Propagate ncRNA Features"), wxDefaultPosition, wxDefaultSize, 0 );
173  m_PropagateNcrnaFeats->SetValue(true);
174  itemFlexGridSizer5->Add(m_PropagateNcrnaFeats, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
175 
176  m_CreateMrna = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECK_MRNA, _("Create mRNA Feature"), wxDefaultPosition, wxDefaultSize, 0 );
177  m_CreateMrna->SetValue(true);
178  itemFlexGridSizer5->Add(m_CreateMrna, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
179 
180  m_TranscribeMrna = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECK_TRANSCRIPT, _("Copy Transcript from Genome"), wxDefaultPosition, wxDefaultSize, 0 );
181  m_TranscribeMrna->SetValue(false);
182  itemFlexGridSizer5->Add(m_TranscribeMrna, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
183 
184  m_CreateCds = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECK_CDS, _("Create CDS Feature"), wxDefaultPosition, wxDefaultSize, 0 );
185  m_CreateCds->SetValue(true);
186  itemFlexGridSizer5->Add(m_CreateCds, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
187 
188  m_TranslateCds = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECK_TRANSLATE, _("Translate CDS from Genome"), wxDefaultPosition, wxDefaultSize, 0 );
189  m_TranslateCds->SetValue(false);
190  itemFlexGridSizer5->Add(m_TranslateCds, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
191 
192  m_GroupByGeneId = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECK_GROUP, _("Group features by gene ID"), wxDefaultPosition, wxDefaultSize, 0 );
193  m_GroupByGeneId->SetValue(true);
194  itemFlexGridSizer5->Add(m_GroupByGeneId, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
195 
196  m_MergeToGenome = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECK_MERGE, _("Merge features to Genome"), wxDefaultPosition, wxDefaultSize, 0 );
197  m_MergeToGenome->SetValue(false);
198  itemFlexGridSizer5->Add(m_MergeToGenome, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
199 
200  m_PropagateLocalIds = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_PROPAGATE_LOCAL_IDS, _("Generate Local IDs"), wxDefaultPosition, wxDefaultSize, 0 );
201  m_PropagateLocalIds->SetValue(false);
202  itemFlexGridSizer5->Add(m_PropagateLocalIds, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
203 
204 ////@end CCreateGeneModelParamsPanel content construction
205 }
206 
207 wxBitmap CCreateGeneModelParamsPanel::GetBitmapResource( const wxString& name )
208 {
209  // Bitmap retrieval
210 ////@begin CCreateGeneModelParamsPanel bitmap retrieval
211  wxUnusedVar(name);
212  return wxNullBitmap;
213 ////@end CCreateGeneModelParamsPanel bitmap retrieval
214 }
215 wxIcon CCreateGeneModelParamsPanel::GetIconResource( const wxString& name )
216 {
217  // Icon retrieval
218 ////@begin CCreateGeneModelParamsPanel icon retrieval
219  wxUnusedVar(name);
220  return wxNullIcon;
221 ////@end CCreateGeneModelParamsPanel icon retrieval
222 }
223 
224 
227 ){
228  m_Params = params;
230 }
231 
232 
234 {
235  if( m_InputListDirty ){
238  m_InputListDirty = false;
239  }
240 
241  if( m_Params ){
242  m_CreateGene->SetValue( m_Params->m_CreateGene );
244  m_GroupByGeneId->Enable( m_CreateGene->IsChecked() );
245  m_CreateMrna->SetValue( m_Params->m_CreateMrna );
248  m_CreateCds->SetValue( m_Params->m_CreateCds );
249  m_TranslateCds->SetValue( m_Params->m_TranslateCds );
252  }
253 
254  return CAlgoToolManagerParamsPanel::TransferDataToWindow();
255 }
256 
257 
259 {
260  if( CAlgoToolManagerParamsPanel::TransferDataFromWindow() ){
261  if( m_Params ){
263 
264  m_Params->m_CreateGene = m_CreateGene->GetValue();
266  m_Params->m_CreateMrna = m_CreateMrna->GetValue();
269  m_Params->m_CreateCds = m_CreateCds->GetValue();
270  m_Params->m_TranslateCds = m_TranslateCds->GetValue();
271  m_Params->m_MergeResults = m_MergeToGenome->GetValue();
273  }
274 
275  return true;
276  }
277 
278  return false;
279 }
280 
282 {
283  m_RegPath = reg_path;
284 }
285 
286 static const char* kTableTag = "Table";
287 
289 {
290  if( ! m_RegPath.empty()) {
292  string reg_path = CGuiRegistryUtil::MakeKey(m_RegPath, kTableTag);
293 
294  CRegistryReadView table_view = gui_reg.GetReadView(reg_path);
295  m_ObjectList->LoadTableSettings(table_view);
296  }
297 }
298 
299 
301 {
302  if( ! m_RegPath.empty()) {
304  string reg_path = CGuiRegistryUtil::MakeKey(m_RegPath, kTableTag);
305 
306  CRegistryWriteView table_view = gui_reg.GetWriteView(reg_path);
307  m_ObjectList->SaveTableSettings(table_view);
308  }
309 }
310 
312 {
313  m_GroupByGeneId->Enable( event.IsChecked() );
314 }
315 
317 {
318  m_TranscribeMrna->Enable( event.IsChecked() );
319 }
320 
322 {
323  m_TranslateCds->Enable( event.IsChecked() );
324 }
325 
327 {
328  if (!m_Params)
329  return;
330  m_Params->Init();
332 }
333 
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
#define true
Definition: bool.h:35
CAlgoToolManagerParamsPanel.
void RestoreDefaults()
override in derived classes
void OnCreateCdsClick(wxCommandEvent &event)
bool Create(wxWindow *parent, wxWindowID id=ID_GENEMODELPARAMSPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
virtual void SetRegistryPath(const string &path)
CAlgoToolManagerParamsPanel.
void OnCreateMrnaClick(wxCommandEvent &event)
virtual void SaveSettings() const
override in derived classes
void SetParams(SCreateGeneModelParams *params, TConstScopedObjects *objects)
wxIcon GetIconResource(const wxString &name)
wxBitmap GetBitmapResource(const wxString &name)
void OnCreateGeneClick(wxCommandEvent &event)
static string MakeKey(const string &section, const string &key, const string &delim=CGuiRegistry::kDecimalDot)
create a key from a section and a subkey
Definition: registry.cpp:504
CRegistryWriteView GetWriteView(const string &section)
get a read-write view at a particular level.
Definition: registry.cpp:462
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
CObjectListWidget - mediator widget.
void SetObjects(TConstScopedObjects &objects)
void GetSelection(TConstScopedObjects &objects)
ISelection-style API.
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
void LoadTableSettings(const CRegistryReadView &view, bool byName=false)
void SaveTableSettings(CRegistryWriteView &view, bool saveSorting=true) const
virtual void SetRegistryPath(const string &reg_path)
static const char * kTableTag
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
Modified on Tue Dec 05 02:20:02 2023 by modify_doxy.py rev. 669887