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

Go to the SVN repository for this file.

1 /* $Id: merge_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 #include <ncbi_pch.hpp>
33 
35 
39 
40 #include <wx/sizer.h>
41 #include <wx/button.h>
42 #include <wx/image.h>
43 #include <wx/statbox.h>
44 #include <wx/stattext.h>
45 #include <wx/checkbox.h>
46 
47 ////@begin XPM images
48 ////@end XPM images
49 
52 
53 ///////////////////////////////////////////////////////////////////////////////
54 /// SMergeAlignmentsParams
55 
57 {
58  Init();
59 }
60 
62 {
65  m_MergeFlags = 0;
66  m_FillUnaligned = false;
67 }
68 
70 {
71  m_RegPath = path; // store for later use
72 }
73 
74 static const char* kDirectionTag = "Direction";
75 static const char* kMergeAlgoTag = "MergeAlgo";
76 static const char* kMergeFlagsTag = "MergeFlags";
77 static const char* kFillUnalignedTag = "FillUnaligned";
78 
80 {
81  if( ! m_RegPath.empty()) {
84 
89  }
90 }
91 
92 
94 {
95  if( ! m_RegPath.empty()) {
97  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
98 
103  }
104 }
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 /// CMergeAlignmentsParamsPanel
108 
110 
111 BEGIN_EVENT_TABLE( CMergeAlignmentsParamsPanel, wxPanel )
112 ////@begin CNetBLASTLoadOptionPanel event table entries
113 ////@end CNetBLASTLoadOptionPanel event table entries
115 
116 
117 
119 {
120  Init();
121 }
122 
123 
124 CMergeAlignmentsParamsPanel::CMergeAlignmentsParamsPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
125 {
126  Init();
127  Create(parent, id, pos, size, style);
128 }
129 
130 
131 bool CMergeAlignmentsParamsPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
132 {
133 ////@begin CMergeAlignmentsParamsPanel creation
134  CAlgoToolManagerParamsPanel::Create( parent, id, pos, size, style );
135 
136  CreateControls();
137  if (GetSizer())
138  {
139  GetSizer()->SetSizeHints(this);
140  }
141  Centre();
142 ////@end CMergeAlignmentsParamsPanel creation
143  return true;
144 }
145 
146 
148 {
149 ////@begin CMergeAlignmentsParamsPanel destruction
150 ////@end CMergeAlignmentsParamsPanel destruction
151 }
152 
153 
155 {
156 ////@begin CMergeAlignmentsParamsPanel member initialisation
161  m_SortInput = NULL;
163 ////@end CMergeAlignmentsParamsPanel member initialisation
164 
165  m_Params = NULL;
166  m_InputListDirty = true;
167 }
168 
170 {
171 ////@begin CMergeAlignmentsParamsPanel content construction
172  CMergeAlignmentsParamsPanel* itemCAlgoToolManagerParamsPanel1 = this;
173 
174  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
175  itemCAlgoToolManagerParamsPanel1->SetSizer(itemBoxSizer2);
176 
177  wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemCAlgoToolManagerParamsPanel1, wxID_ANY, _("Alignments to Merge"));
178  wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
179  itemBoxSizer2->Add(itemStaticBoxSizer3, 1, wxGROW|wxALL, 5);
180 
181  m_ObjectListCtrl = new CObjectListWidget( itemCAlgoToolManagerParamsPanel1, ID_LISTCTRL1, wxDefaultPosition, itemCAlgoToolManagerParamsPanel1->ConvertDialogToPixels(wxSize(100, 100)), wxLC_REPORT );
182  itemStaticBoxSizer3->Add(m_ObjectListCtrl, 1, wxGROW|wxALL, 5);
183 
184  wxFlexGridSizer* itemFlexGridSizer5 = new wxFlexGridSizer(0, 2, 0, 0);
185  itemFlexGridSizer5->AddGrowableCol(1);
186  itemBoxSizer2->Add(itemFlexGridSizer5, 0, wxGROW|wxALL, 5);
187 
188  m_MergeQuerySeqOnly = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX6, _("Merge query sequence only"), wxDefaultPosition, wxDefaultSize, 0 );
189  m_MergeQuerySeqOnly->SetValue(false);
190  itemFlexGridSizer5->Add(m_MergeQuerySeqOnly, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
191 
192  m_AssumeNegStrand = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX7, _("Assume all on negative strand"), wxDefaultPosition, wxDefaultSize, 0 );
193  m_AssumeNegStrand->SetValue(false);
194  itemFlexGridSizer5->Add(m_AssumeNegStrand, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
195 
196  m_TruncateOverlap = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX8, _("Truncate overlapping segments"), wxDefaultPosition, wxDefaultSize, 0 );
197  m_TruncateOverlap->SetValue(false);
198  itemFlexGridSizer5->Add(m_TruncateOverlap, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
199 
200  m_SortInput = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX9, _("Sort inputs by source alignments"), wxDefaultPosition, wxDefaultSize, 0 );
201  m_SortInput->SetValue(false);
202  itemFlexGridSizer5->Add(m_SortInput, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
203 
204  m_FillUnaligned = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX10, _("Fill unaligned regions"), wxDefaultPosition, wxDefaultSize, 0 );
205  m_FillUnaligned->SetValue(false);
206  itemFlexGridSizer5->Add(m_FillUnaligned, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
207 
208 ////@end CMergeAlignmentsParamsPanel content construction
209 }
210 
212 {
213  return true;
214 }
215 
216 wxBitmap CMergeAlignmentsParamsPanel::GetBitmapResource( const wxString& name )
217 {
218  // Bitmap retrieval
219 ////@begin CMergeAlignmentsParamsPanel bitmap retrieval
220  wxUnusedVar(name);
221  return wxNullBitmap;
222 ////@end CMergeAlignmentsParamsPanel bitmap retrieval
223 }
224 
225 wxIcon CMergeAlignmentsParamsPanel::GetIconResource( const wxString& name )
226 {
227  // Icon retrieval
228 ////@begin CMergeAlignmentsParamsPanel icon retrieval
229  wxUnusedVar(name);
230  return wxNullIcon;
231 ////@end CMergeAlignmentsParamsPanel icon retrieval
232 }
233 
234 
237 {
238  m_Params = params;
240 }
241 
242 
244 {
245  if(m_InputListDirty) {
248  m_InputListDirty = false;
249  }
250 
256 
257  return wxPanel::TransferDataToWindow();
258 }
259 
260 
262 {
263  if(!wxPanel::TransferDataFromWindow())
264  return false;
265 
267 
268  m_Params->m_MergeAlgo = m_MergeQuerySeqOnly->GetValue() ?
270  m_Params->m_Direction = m_AssumeNegStrand->GetValue() ?
272 
273  if (m_TruncateOverlap->GetValue())
275  else
276  m_Params->m_MergeFlags &= ~CAlnUserOptions::fTruncateOverlaps;
277 
278  if (m_SortInput->GetValue())
279  m_Params->m_MergeFlags &= ~CAlnUserOptions::fSkipSortByScore;
280  else
282 
284 
285  return true;
286 }
287 
289 {
290  m_RegPath = path; // store for later use
291 }
292 
293 
294 static const char* kTableTag = "Table";
295 
297 {
298  if( ! m_RegPath.empty()) {
300  string reg_path = CGuiRegistryUtil::MakeKey(m_RegPath, kTableTag);
301 
302  CRegistryWriteView table_view =
303  gui_reg.GetWriteView(reg_path);
304  m_ObjectListCtrl->SaveTableSettings(table_view);
305  }
306 }
307 
308 
310 {
311  if( ! m_RegPath.empty()) {
313  string reg_path = CGuiRegistryUtil::MakeKey(m_RegPath, kTableTag);
314 
315  CRegistryReadView table_view = gui_reg.GetReadView(reg_path);
316  m_ObjectListCtrl->LoadTableSettings(table_view);
317  }
318 }
319 
321 {
322  if (!m_Params)
323  return;
324  m_Params->Init();
326 }
327 
CAlgoToolManagerParamsPanel.
Options for different alignment manager operations.
@ eMergeAllSeqs
Merge all sequences (greedy algo).
@ eQuerySeqMergeOnly
Only put the query seq on same row (input order is not significant).
@ eBothDirections
No filtering: use both direct and reverse sequences.
@ eReverse
Use only sequences whose strand is opposite to that of the anchor.
@ fSkipSortByScore
In greedy algos, skip sorting input alignments by score thus allowing for user-defined sort order.
@ fTruncateOverlaps
Truncate overlapping ranges.
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
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
Definition: reg_view.cpp:230
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
bool Create(wxWindow *parent, wxWindowID id=ID_CBLASTSEARCHOPTIONSPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
void RestoreDefaults()
override in derived classes
virtual void SetRegistryPath(const string &path)
CAlgoToolManagerParamsPanel.
void SetParams(SMergeAlignmentsParams *params, TConstScopedObjects *objects)
virtual void SaveSettings() const
override in derived classes
virtual void SetRegistryPath(const string &reg_path)
wxBitmap GetBitmapResource(const wxString &name)
CMergeAlignmentsParamsPanel()
CMergeAlignmentsParamsPanel.
wxIcon GetIconResource(const wxString &name)
SMergeAlignmentsParams()
SMergeAlignmentsParams.
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()
static const char * kDirectionTag
USING_SCOPE(objects)
static const char * kMergeAlgoTag
static const char * kFillUnalignedTag
static const char * kMergeFlagsTag
static const char * kTableTag
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
Modified on Tue Jul 16 13:19:12 2024 by modify_doxy.py rev. 669887