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

Go to the SVN repository for this file.

1 /* $Id: ngalign_blast_panel.cpp 39079 2017-07-24 20:52:58Z 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: Roman Katargin
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
34 ////@begin includes
35 ////@end includes
36 
37 #include "ngalign_blast_panel.hpp"
43 
45 
46 #include <wx/sizer.h>
47 #include <wx/stattext.h>
48 #include <wx/statbox.h>
49 #include <wx/checkbox.h>
50 #include <wx/choice.h>
51 #include <wx/button.h>
52 #include <wx/dialog.h>
53 #include <wx/msgdlg.h>
54 #include <wx/app.h>
55 
56 #include "wx/bitmap.h"
57 #include "wx/icon.h"
58 
61 
62 IMPLEMENT_DYNAMIC_CLASS( CNGAlignBLASTPanel, CAlgoToolManagerParamsPanel )
63 
65 
66 ////@begin CNGAlignBLASTPanel event table entries
68 
69 ////@end CNGAlignBLASTPanel event table entries
70 
72 
74 : m_data()
75 , m_AutoDelete(this)
76 {
77  Init();
78 }
79 
81 : m_AutoDelete(this)
82 {
83  Init();
84  Create(parent);
85 }
86 
87 bool CNGAlignBLASTPanel::Create( wxWindow* parent, wxWindowID id )
88 {
89  SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY|wxWS_EX_BLOCK_EVENTS);
90  CAlgoToolManagerParamsPanel::Create( parent, id, wxDefaultPosition, wxSize(0, 0), SYMBOL_CNGALIGNBLASTPANEL_STYLE );
91 
92  Hide();
93 
95  if (GetSizer())
96  {
97  GetSizer()->SetSizeHints(this);
98  }
99  Centre();
100 
101  return true;
102 }
103 
105 {
106 ////@begin CNGAlignBLASTPanel destruction
107 ////@end CNGAlignBLASTPanel destruction
108 }
109 
111 {
112 ////@begin CNGAlignBLASTPanel member initialisation
114  m_WMStatic = NULL;
115  m_WMTaxIds = NULL;
116  m_WMDownload = NULL;
117 ////@end CNGAlignBLASTPanel member initialisation
118 }
119 
121 {
122 ////@begin CNGAlignBLASTPanel content construction
123  CNGAlignBLASTPanel* itemCAlgoToolManagerParamsPanel1 = this;
124 
125  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
126  itemCAlgoToolManagerParamsPanel1->SetSizer(itemBoxSizer2);
127 
128  wxStaticText* itemStaticText3 = new wxStaticText( itemCAlgoToolManagerParamsPanel1, wxID_STATIC, _("Selected options:"), wxDefaultPosition, wxDefaultSize, 0 );
129  itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_LEFT|wxALL, 5);
130 
131  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
132  itemBoxSizer2->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5);
133 
134  wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemCAlgoToolManagerParamsPanel1, wxID_ANY, _("General Parameters"));
135  wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL);
136  itemBoxSizer4->Add(itemStaticBoxSizer5, 0, wxGROW|wxALL, 5);
137 
138  wxFlexGridSizer* itemFlexGridSizer6 = new wxFlexGridSizer(0, 2, 0, 0);
139  itemStaticBoxSizer5->Add(itemFlexGridSizer6, 1, wxGROW|wxALL, 5);
140 
141  wxStaticText* itemStaticText7 = new wxStaticText( itemStaticBoxSizer5->GetStaticBox(), wxID_STATIC, _("Word size:"), wxDefaultPosition, wxDefaultSize, 0 );
142  itemFlexGridSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
143 
144  wxTextCtrl* itemTextCtrl8 = new wxTextCtrl( itemStaticBoxSizer5->GetStaticBox(), ID_WORDSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
145  itemFlexGridSizer6->Add(itemTextCtrl8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
146 
147  wxStaticText* itemStaticText9 = new wxStaticText( itemStaticBoxSizer5->GetStaticBox(), wxID_STATIC, _("e-value"), wxDefaultPosition, wxDefaultSize, 0 );
148  itemFlexGridSizer6->Add(itemStaticText9, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
149 
150  wxTextCtrl* itemTextCtrl10 = new wxTextCtrl( itemStaticBoxSizer5->GetStaticBox(), ID_E_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
151  itemFlexGridSizer6->Add(itemTextCtrl10, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5);
152 
153  itemFlexGridSizer6->AddGrowableCol(1);
154 
155  wxCheckBox* itemCheckBox11 = new wxCheckBox( itemStaticBoxSizer5->GetStaticBox(), ID_CHECKBOX13, _("Use BLAST best hit algorithm"), wxDefaultPosition, wxDefaultSize, 0 );
156  itemCheckBox11->SetValue(false);
157  itemStaticBoxSizer5->Add(itemCheckBox11, 0, wxALIGN_LEFT|wxALL, 5);
158 
159  wxStaticBox* itemStaticBoxSizer12Static = new wxStaticBox(itemCAlgoToolManagerParamsPanel1, wxID_ANY, _("Filtering Parameters"));
160  wxStaticBoxSizer* itemStaticBoxSizer12 = new wxStaticBoxSizer(itemStaticBoxSizer12Static, wxVERTICAL);
161  itemBoxSizer4->Add(itemStaticBoxSizer12, 1, wxGROW|wxALL, 5);
162 
163  wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL);
164  itemStaticBoxSizer12->Add(itemBoxSizer13, 0, wxGROW|wxALL, 5);
165 
166  wxStaticText* itemStaticText14 = new wxStaticText( itemStaticBoxSizer12->GetStaticBox(), wxID_STATIC, _("Tune search for:"), wxDefaultPosition, wxDefaultSize, 0 );
167  itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
168 
169  wxArrayString itemChoice15Strings;
170  itemChoice15Strings.Add(_("Phase 1 HTG Sequences"));
171  itemChoice15Strings.Add(_("Finished clones"));
172  itemChoice15Strings.Add(_("Curated genomic sequences(NGs)"));
173  wxChoice* itemChoice15 = new wxChoice( itemStaticBoxSizer12->GetStaticBox(), ID_CHOICE5, wxDefaultPosition, wxDefaultSize, itemChoice15Strings, 0 );
174  itemBoxSizer13->Add(itemChoice15, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
175 
176  wxStaticBox* itemStaticBoxSizer16Static = new wxStaticBox(itemCAlgoToolManagerParamsPanel1, wxID_ANY, _("Windowmasker filtering"));
177  m_WMStaticBoxSizer = new wxStaticBoxSizer(itemStaticBoxSizer16Static, wxHORIZONTAL);
178  itemBoxSizer2->Add(m_WMStaticBoxSizer, 0, wxGROW|wxALL, 5);
179 
180  m_WMStatic = new wxStaticText( m_WMStaticBoxSizer->GetStaticBox(), wxID_STATIC, _("Windowmasker tax IDs:"), wxDefaultPosition, wxDefaultSize, 0 );
181  m_WMStaticBoxSizer->Add(m_WMStatic, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
182 
183  wxArrayString m_WMTaxIdsStrings;
184  m_WMTaxIds = new wxChoice( m_WMStaticBoxSizer->GetStaticBox(), ID_CHOICE6, wxDefaultPosition, wxDefaultSize, m_WMTaxIdsStrings, 0 );
185  m_WMStaticBoxSizer->Add(m_WMTaxIds, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
186 
187  m_WMStaticBoxSizer->Add(7, 8, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
188 
189  m_WMDownload = new wxButton( m_WMStaticBoxSizer->GetStaticBox(), ID_BUTTON1, _("Configure..."), wxDefaultPosition, wxDefaultSize, 0 );
190  m_WMStaticBoxSizer->Add(m_WMDownload, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
191 
192  wxStaticBox* itemStaticBoxSizer21Static = new wxStaticBox(itemCAlgoToolManagerParamsPanel1, wxID_ANY, _("Advanced Parameters (standard MegaBLAST parameters are honored)"));
193  wxStaticBoxSizer* itemStaticBoxSizer21 = new wxStaticBoxSizer(itemStaticBoxSizer21Static, wxHORIZONTAL);
194  itemBoxSizer2->Add(itemStaticBoxSizer21, 0, wxGROW|wxALL, 5);
195 
196  wxTextCtrl* itemTextCtrl22 = new wxTextCtrl( itemStaticBoxSizer21->GetStaticBox(), ID_ADV_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
197  itemStaticBoxSizer21->Add(itemTextCtrl22, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
198 
199  wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL);
200  itemBoxSizer2->Add(itemBoxSizer23, 0, wxGROW|wxALL, 5);
201 
202  wxStaticText* itemStaticText24 = new wxStaticText( itemCAlgoToolManagerParamsPanel1, wxID_STATIC, _("Job Title:"), wxDefaultPosition, wxDefaultSize, 0 );
203  itemBoxSizer23->Add(itemStaticText24, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
204 
205  wxTextCtrl* itemTextCtrl25 = new wxTextCtrl( itemCAlgoToolManagerParamsPanel1, ID_TITLE_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
206  itemBoxSizer23->Add(itemTextCtrl25, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
207 
208  // Set validators
209  itemTextCtrl8->SetValidator( CNumberValidator(& GetData().m_WordSize, 0, 200) );
210  itemTextCtrl10->SetValidator( CFloatTextValidator(& GetData().m_eValue) );
211  itemCheckBox11->SetValidator( wxGenericValidator(& GetData().m_BestHit) );
212  itemChoice15->SetValidator( wxGenericValidator(& GetData().m_FilterMode) );
213  itemTextCtrl22->SetValidator( wxGenericValidator(& GetData().m_AdvParams) );
214  itemTextCtrl25->SetValidator( wxGenericValidator(& GetData().m_JobTitle) );
215 ////@end CNGAlignBLASTPanel content construction
216 
217  wxStaticText* loadingText = new wxStaticText(m_WMStaticBoxSizer->GetStaticBox(), ID_LOADING_TEXT, wxT("Windomasker tax ID: none. Loading..."), wxDefaultPosition, wxDefaultSize, 0);
218  wxFont bold(wxNORMAL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(), wxNORMAL_FONT->GetStyle(), wxFONTWEIGHT_BOLD, wxNORMAL_FONT->GetUnderlined(), wxNORMAL_FONT->GetFaceName());
219  loadingText->SetFont(bold);
220  loadingText->SetForegroundColour(*wxBLACK);
221  m_WMStaticBoxSizer->Add(loadingText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
222  m_WMStaticBoxSizer->Hide(loadingText);
223 
224  m_WMStaticBoxSizer->Add(1, m_WMDownload->GetSize().GetHeight(), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
225 
226  CIndProgressBar* progress = new CIndProgressBar(m_WMStaticBoxSizer->GetStaticBox(), ID_LOADING_PROGRESS, wxDefaultPosition, 100);
227  m_WMStaticBoxSizer->Add(progress, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5);
228  m_WMStaticBoxSizer->Hide(progress);
229 }
230 
232 {
233  x_InitTaxons();
234  return CAlgoToolManagerParamsPanel::TransferDataToWindow();
235 }
236 
238 {
239  if (CTaxIdHelper::GetInstance().FillControl(this, *m_WMTaxIds, true, GetData().GetWMTaxId()))
240  x_ShowWM(true);
241  else
242  x_ShowWM(false);
243 }
244 
246 {
247  if (!local) return;
248  CTaxIdHelper::GetInstance().FillControl(this, *m_WMTaxIds, true, GetData().GetWMTaxId());
249  x_ShowWM(true);
250 }
251 
253 {
254  m_WMStaticBoxSizer->Show(FindWindow(ID_LOADING_TEXT), !show);
255  m_WMStaticBoxSizer->Show(FindWindow(ID_LOADING_PROGRESS), !show);
256 
257  m_WMStaticBoxSizer->Show(m_WMStatic, show);
258  m_WMStaticBoxSizer->Show(m_WMTaxIds, show);
259  m_WMStaticBoxSizer->Show(m_WMDownload, show);
260  GetSizer()->Layout();
261 }
262 
264 {
265  int taxId = 0, index = m_WMTaxIds->GetSelection();
266  if (wxNOT_FOUND != index)
267  taxId = (int)(size_t)m_WMTaxIds->GetClientData(index);
268  GetData().SetWMTaxId(taxId);
269 
270  if (taxId != 0) {
272  string wmDir(storage.GetPath().ToUTF8());
273  GetData().SetWMDir(wmDir);
274  }
275 
276  return CAlgoToolManagerParamsPanel::TransferDataFromWindow();
277 }
278 
280 {
281  return true;
282 }
283 wxBitmap CNGAlignBLASTPanel::GetBitmapResource( const wxString& name )
284 {
285  // Bitmap retrieval
286 ////@begin CNGAlignBLASTPanel bitmap retrieval
287  wxUnusedVar(name);
288  return wxNullBitmap;
289 ////@end CNGAlignBLASTPanel bitmap retrieval
290 }
291 wxIcon CNGAlignBLASTPanel::GetIconResource( const wxString& name )
292 {
293  // Icon retrieval
294 ////@begin CNGAlignBLASTPanel icon retrieval
295  wxUnusedVar(name);
296  return wxNullIcon;
297 ////@end CNGAlignBLASTPanel icon retrieval
298 }
299 
301 {
302  if (!m_RegPath.empty()) {
303  //CGuiRegistry& gui_reg = CGuiRegistry::GetInstance();
304  }
305 }
306 
308 {
309  if (!m_RegPath.empty()) {
310  //CGuiRegistry& gui_reg = CGuiRegistry::GetInstance();
311  }
312 }
313 
314 void CNGAlignBLASTPanel::OnWMDownload(wxCommandEvent& event)
315 {
317  x_InitTaxons();
318 }
319 
321 {
322  GetData().Init();
324 }
325 
CAlgoToolManagerParamsPanel.
string m_RegPath
registry path to the settings
void RestoreDefaults()
override in derived classes
virtual void TaxonsLoaded(bool local)
wxBitmap GetBitmapResource(const wxString &name)
wxIcon GetIconResource(const wxString &name)
virtual void SaveSettings() const
override in derived classes
bool Create(wxWindow *parent, wxWindowID id=ID_CNGALIGNBLASTPANEL)
wxStaticBoxSizer * m_WMStaticBoxSizer
CNGAlignParams & GetData()
virtual bool TransferDataFromWindow()
void OnWMDownload(wxCommandEvent &event)
virtual bool TransferDataToWindow()
bool FillControl(ICallback *callback, wxControlWithItems &ctrl, bool local, int selectTaxId)
static CTaxIdHelper & GetInstance()
wxString GetPath() const
static CWinMaskerFileStorage & GetInstance()
access the application-wide singleton
#define _(proto)
Definition: ct_nlmzip_i.h:78
#define ID_BUTTON1
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
void SetWMDir(string value)
void SetWMTaxId(int value)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
END_EVENT_TABLE()
#define wxT(x)
Definition: muParser.cpp:41
USING_SCOPE(ncbi::objects)
#define SYMBOL_CNGALIGNBLASTPANEL_STYLE
static static static wxID_ANY
#define local
Definition: zutil.h:33
Modified on Fri Sep 20 14:57:44 2024 by modify_doxy.py rev. 669887