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

Go to the SVN repository for this file.

1 /* $Id: group_alignments_params_panel.cpp 39666 2017-10-25 16:01:13Z katargir $
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 // Generated by DialogBlocks (unregistered), 17/07/2008 12:36:52
33 
34 #include <ncbi_pch.hpp>
35 
36 ////@begin includes
37 #include "wx/imaglist.h"
38 ////@end includes
39 
40 
43 
44 #include <wx/sizer.h>
45 #include <wx/checkbox.h>
46 #include <wx/statbox.h>
47 
48 
51 
53 
55 
56 ////@begin CGroupAlignmentsParamsPanel event table entries
57 ////@end CGroupAlignmentsParamsPanel event table entries
58 
60 
61 
63 {
64  Init();
65 }
66 
68 {
69  m_GroupBySeqId = false;
70  m_GroupByStrand = false;
71  m_GroupByTaxId = false;
72  m_GroupByLikeTaxId = true;
73  m_GroupByRefSeq = true;
75  m_GroupByEST = true;
76  m_GroupByGenBank = true;
77  m_GroupByWGS = false;
78  m_GroupByHTGS = false;
79  m_GroupByPatent = false;
80 }
81 
83 {
84  m_RegPath = path; // store for later use
85 }
86 
87 static const char* kGroupByEST = "GroupByEST";
88 static const char* kGroupByHTGS = "GroupByHTGS";
89 static const char* kGroupByLikeTaxId = "GroupByLikeTaxId";
90 static const char* kGroupByPatent = "GroupByPatent";
91 static const char* kGroupByPredictedRefSeq = "GroupByPredictedRefSeq";
92 static const char* kGroupByRefSeq = "GroupByRefSeq";
93 static const char* kGroupBySeqId = "GroupBySeqId";
94 static const char* kGroupByStrand = "GroupByStrand";
95 static const char* kGroupByTaxId = "GroupByTaxId";
96 static const char* kGroupByWGS = "GroupByWGS";
97 
99 {
100  if( ! m_RegPath.empty()) {
102  CRegistryWriteView view = gui_reg.GetWriteView(m_RegPath);
103 
114  }
115 }
116 
117 
119 {
120  if( ! m_RegPath.empty()) {
122  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
123 
134  }
135 }
136 
137 
138 
139 
140 
141 
142 
144 {
145  Init();
146 }
147 
148 CGroupAlignmentsParamsPanel::CGroupAlignmentsParamsPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
149 {
150  Init();
151  Create(parent, id, pos, size, style);
152 }
153 
154 bool CGroupAlignmentsParamsPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
155 {
156 ////@begin CGroupAlignmentsParamsPanel creation
157  CAlgoToolManagerParamsPanel::Create( parent, id, pos, size, style );
158 
159  CreateControls();
160  if (GetSizer())
161  {
162  GetSizer()->SetSizeHints(this);
163  }
164  Centre();
165 ////@end CGroupAlignmentsParamsPanel creation
166  return true;
167 }
168 
170 {
171 ////@begin CGroupAlignmentsParamsPanel destruction
172 ////@end CGroupAlignmentsParamsPanel destruction
173 }
174 
176 {
177 ////@begin CGroupAlignmentsParamsPanel member initialisation
178  m_ObjectList = NULL;
184  m_GroupByEST = NULL;
187  m_GroupByWGS = NULL;
190 ////@end CGroupAlignmentsParamsPanel member initialisation
191  m_Params = NULL;
193  m_InputListDirty = true;
194 }
195 
197 {
198 ////@begin CGroupAlignmentsParamsPanel content construction
199  CGroupAlignmentsParamsPanel* itemCAlgoToolManagerParamsPanel1 = this;
200 
201  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
202  itemCAlgoToolManagerParamsPanel1->SetSizer(itemBoxSizer2);
203 
204  wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemCAlgoToolManagerParamsPanel1, wxID_ANY, _("Choose a set of alignments"));
205  wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
206  itemBoxSizer2->Add(itemStaticBoxSizer3, 1, wxGROW|wxALL, 5);
207 
208  m_ObjectList = new CObjectListWidget( itemStaticBoxSizer3->GetStaticBox(), ID_LISTCTRL, wxDefaultPosition, wxSize(100, 200), wxLC_REPORT );
209  itemStaticBoxSizer3->Add(m_ObjectList, 1, wxGROW|wxALL, 5);
210 
211  wxFlexGridSizer* itemFlexGridSizer5 = new wxFlexGridSizer(0, 2, 0, 0);
212  itemBoxSizer2->Add(itemFlexGridSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
213 
214  m_GroupBySeqId = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_SEQID, _("Group by sequence identifier"), wxDefaultPosition, wxDefaultSize, 0 );
215  m_GroupBySeqId->SetValue(false);
216  itemFlexGridSizer5->Add(m_GroupBySeqId, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
217 
218  m_GroupByStrand = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_STRAND, _("Group by sequence strand"), wxDefaultPosition, wxDefaultSize, 0 );
219  m_GroupByStrand->SetValue(false);
220  itemFlexGridSizer5->Add(m_GroupByStrand, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
221 
222  m_GroupByTaxId = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_TAXID, _("Group by taxonomic ID"), wxDefaultPosition, wxDefaultSize, 0 );
223  m_GroupByTaxId->SetValue(false);
224  itemFlexGridSizer5->Add(m_GroupByTaxId, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
225 
226  m_GroupByLikeTaxId = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_SIMILAR_TAXID, _("Separate 'like' taxonomic IDs"), wxDefaultPosition, wxDefaultSize, 0 );
227  m_GroupByLikeTaxId->SetValue(true);
228  itemFlexGridSizer5->Add(m_GroupByLikeTaxId, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
229 
230  m_GroupByRefSeq = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_REFSEQ, _("Group RefSeq alignments"), wxDefaultPosition, wxDefaultSize, 0 );
231  m_GroupByRefSeq->SetValue(true);
232  itemFlexGridSizer5->Add(m_GroupByRefSeq, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
233 
234  m_GroupByEST = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_EST, _("Group EST alignments"), wxDefaultPosition, wxDefaultSize, 0 );
235  m_GroupByEST->SetValue(true);
236  itemFlexGridSizer5->Add(m_GroupByEST, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
237 
238  m_GroupByPredictedRefSeq = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_REFSEQ_PREDICTED, _("Group Predicted RefSeq alignments"), wxDefaultPosition, wxDefaultSize, 0 );
239  m_GroupByPredictedRefSeq->SetValue(false);
240  itemFlexGridSizer5->Add(m_GroupByPredictedRefSeq, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
241 
242  m_GroupByGenBank = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_GENBANK, _("Group GenBank/EMBL/DDBJ alignments"), wxDefaultPosition, wxDefaultSize, 0 );
243  m_GroupByGenBank->SetValue(true);
244  itemFlexGridSizer5->Add(m_GroupByGenBank, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
245 
246  m_GroupByWGS = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_WGS, _("Group Whole Genome Shotgun alignments"), wxDefaultPosition, wxDefaultSize, 0 );
247  m_GroupByWGS->SetValue(false);
248  itemFlexGridSizer5->Add(m_GroupByWGS, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
249 
250  m_GroupByHTGS = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_HTGS, _("Group HTGS sequence alignments"), wxDefaultPosition, wxDefaultSize, 0 );
251  m_GroupByHTGS->SetValue(false);
252  itemFlexGridSizer5->Add(m_GroupByHTGS, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
253 
254  m_GroupByPatent = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX_PATENT, _("Group patent sequence alignments"), wxDefaultPosition, wxDefaultSize, 0 );
255  m_GroupByPatent->SetValue(false);
256  itemFlexGridSizer5->Add(m_GroupByPatent, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
257 
258 ////@end CGroupAlignmentsParamsPanel content construction
259 }
260 
262 {
263  return true;
264 }
265 wxBitmap CGroupAlignmentsParamsPanel::GetBitmapResource( const wxString& name )
266 {
267  // Bitmap retrieval
268 ////@begin CGroupAlignmentsParamsPanel bitmap retrieval
269  wxUnusedVar(name);
270  return wxNullBitmap;
271 ////@end CGroupAlignmentsParamsPanel bitmap retrieval
272 }
273 wxIcon CGroupAlignmentsParamsPanel::GetIconResource( const wxString& name )
274 {
275  // Icon retrieval
276 ////@begin CGroupAlignmentsParamsPanel icon retrieval
277  wxUnusedVar(name);
278  return wxNullIcon;
279 ////@end CGroupAlignmentsParamsPanel icon retrieval
280 }
281 
282 
284 {
285  m_RegPath = path; // store for later use
286 }
287 
288 
289 static const char* kTableTag = "Table";
290 
292 {
293  if( ! m_RegPath.empty()) {
295  string reg_path = CGuiRegistryUtil::MakeKey(m_RegPath, kTableTag);
296 
297  CRegistryWriteView table_view = gui_reg.GetWriteView(reg_path);
298  m_ObjectList->SaveTableSettings(table_view);
299  }
300 }
301 
302 
304 {
305  if( ! m_RegPath.empty()) {
307  string reg_path = CGuiRegistryUtil::MakeKey(m_RegPath, kTableTag);
308 
309  CRegistryReadView table_view = gui_reg.GetReadView(reg_path);
310  m_ObjectList->LoadTableSettings(table_view);
311  }
312 }
313 
314 
315 
318 {
319  m_Params = params;
321 }
322 
323 
325 {
326  if (m_InputListDirty) {
329  m_InputListDirty = false;
330  }
331 
336  m_GroupByEST->SetValue(m_Params->m_GroupByEST);
339  m_GroupByWGS->SetValue(m_Params->m_GroupByWGS);
342 
343  return wxPanel::TransferDataToWindow();
344 }
345 
346 
348 {
349  if(wxPanel::TransferDataFromWindow()) {
351 
352  m_Params->m_GroupBySeqId = m_GroupBySeqId->GetValue();
356  m_Params->m_GroupByEST = m_GroupByEST->GetValue();
357  m_Params->m_GroupByTaxId = m_GroupByTaxId->GetValue();
359  m_Params->m_GroupByWGS = m_GroupByWGS->GetValue();
360  m_Params->m_GroupByHTGS = m_GroupByHTGS->GetValue();
362  return true;
363  }
364  return false;
365 }
366 
368 {
369  if (!m_Params)
370  return;
371  m_Params->Init();
373 }
374 
CAlgoToolManagerParamsPanel.
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
bool GetBool(const string &key, bool default_val=false) const
Definition: reg_view.cpp:241
void Set(const string &key, int val)
access a named key at this level, with no recursion
Definition: reg_view.cpp:533
void LoadTableSettings(const CRegistryReadView &view, bool byName=false)
void SaveTableSettings(CRegistryWriteView &view, bool saveSorting=true) const
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
wxIcon GetIconResource(const wxString &name)
wxBitmap GetBitmapResource(const wxString &name)
void SetParams(SGroupAlignmentsParams *params, TConstScopedObjects *objects)
virtual void SetRegistryPath(const string &path)
CAlgoToolManagerParamsPanel.
void RestoreDefaults()
override in derived classes
virtual void SetRegistryPath(const string &reg_path)
virtual void SaveSettings() const
override in derived classes
bool Create(wxWindow *parent, wxWindowID id=ID_CGROUPALIGNMENTSPARAMSPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
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
USING_SCOPE(objects)
static const char * kGroupByStrand
static const char * kGroupBySeqId
static const char * kGroupByPatent
static const char * kGroupByTaxId
static const char * kGroupByEST
static const char * kGroupByRefSeq
static const char * kGroupByLikeTaxId
static const char * kGroupByWGS
static const char * kGroupByPredictedRefSeq
static const char * kTableTag
static const char * kGroupByHTGS
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
Modified on Mon Mar 04 05:11:13 2024 by modify_doxy.py rev. 669887