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

Go to the SVN repository for this file.

1 /* $Id: macro_loc_constraint_panel.cpp 46865 2021-11-15 20:54:03Z asztalos $
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: Igor Filippov
27  *
28  * File Description:
29  *
30  */
31 #include <ncbi_pch.hpp>
36 
37 #include <wx/sizer.h>
38 #include <wx/stattext.h>
39 #include <wx/textctrl.h>
40 #include <wx/choice.h>
41 #include <wx/valtext.h>
42 #include <wx/icon.h>
43 
46 USING_SCOPE(macro);
47 
48 /*
49  * CMacroLocationConstraintPanel type definition
50  */
51 
53 
54 
55 /*
56  * CMacroLocationConstraintPanel event table definition
57  */
58 
59 BEGIN_EVENT_TABLE( CMacroLocationConstraintPanel, wxPanel )
60 
61 ////@begin CMacroLocationConstraintPanel event table entries
63 
64 ////@end CMacroLocationConstraintPanel event table entries
65 
67 
68 
69 /*
70  * CMacroLocationConstraintPanel constructors
71  */
72 
74 {
75  Init();
76 }
77 
78 CMacroLocationConstraintPanel::CMacroLocationConstraintPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
79 {
80  Init();
81  Create( parent, id, pos, size, style );
82 }
83 
84 
85 /*
86  * CMacroLocationConstraintPanel creator
87  */
88 
89 bool CMacroLocationConstraintPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
90 {
91 ////@begin CMacroLocationConstraintPanel creation
92  wxPanel::Create( parent, id, pos, size, style );
93 
95  Centre();
96 ////@end CMacroLocationConstraintPanel creation
97  return true;
98 }
99 
100 
101 /*
102  * CMacroLocationConstraintPanel destructor
103  */
104 
106 {
107 ////@begin CMacroLocationConstraintPanel destruction
108 ////@end CMacroLocationConstraintPanel destruction
109 }
110 
111 
112 /*
113  * Member initialisation
114  */
115 
117 {
118 ////@begin CMacroLocationConstraintPanel member initialisation
119  m_Strand = NULL;
120  m_NucOrProt = NULL;
121  m_5Partial = NULL;
122  m_3Partial = NULL;
123  m_LocType = NULL;
124  m_5DistType = NULL;
125  m_5Dist = NULL;
126  m_3DistType = NULL;
127  m_3Dist = NULL;
128 ////@end CMacroLocationConstraintPanel member initialisation
129 }
130 
131 
132 /*
133  * Control creation for CMacroLocationConstraintPanel
134  */
135 
137 {
138 ////@begin CMacroLocationConstraintPanel content construction
139  CMacroLocationConstraintPanel* itemPanel2 = this;
140 
141  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxVERTICAL);
142  itemPanel2->SetSizer(itemBoxSizer1);
143 
144  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
145  itemBoxSizer1->Add(itemBoxSizer2, 0, wxALIGN_CENTER_HORIZONTAL, 0);
146 
147  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
148  itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW, 0);
149 
150  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
151  itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5);
152 
153  wxStaticText* itemStaticText5 = new wxStaticText( itemPanel2, wxID_STATIC, _("on"), wxDefaultPosition, wxDefaultSize, 0 );
154  itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
155 
156  wxArrayString m_StrandStrings;
157  m_StrandStrings.Add(_("Any strand"));
158  m_StrandStrings.Add(_("Plus strand"));
159  m_StrandStrings.Add(_("Minus strand"));
160  m_Strand = new wxChoice( itemPanel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_StrandStrings, 0 );
161  m_Strand->SetStringSelection(_("Any strand"));
162  itemBoxSizer4->Add(m_Strand, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
163 
164  wxStaticText* itemStaticText7 = new wxStaticText( itemPanel2, wxID_STATIC, _("on"), wxDefaultPosition, wxDefaultSize, 0 );
165  itemBoxSizer4->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
166 
167  wxArrayString m_NucOrProtStrings;
168  m_NucOrProtStrings.Add(_("nucleotide and protein sequences"));
169  m_NucOrProtStrings.Add(_("nucleotide sequences only"));
170  m_NucOrProtStrings.Add(_("protein sequences only"));
171  m_NucOrProt = new wxChoice( itemPanel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_NucOrProtStrings, 0 );
172  m_NucOrProt->SetStringSelection(_("nucleotide and protein sequences"));
173  itemBoxSizer4->Add(m_NucOrProt, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
174 
175  wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
176  itemBoxSizer3->Add(itemBoxSizer9, 0, wxGROW|wxALL, 5);
177 
178  wxStaticText* itemStaticText10 = new wxStaticText( itemPanel2, wxID_STATIC, _("5' end"), wxDefaultPosition, wxDefaultSize, 0 );
179  itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
180 
181  wxArrayString m_5PartialStrings;
182  m_5PartialStrings.Add(_("Partial or Complete"));
183  m_5PartialStrings.Add(_("Partial"));
184  m_5PartialStrings.Add(_("Complete"));
185  m_5Partial = new wxChoice( itemPanel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_5PartialStrings, 0 );
186  m_5Partial->SetStringSelection(_("Partial or Complete"));
187  itemBoxSizer9->Add(m_5Partial, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
188 
189  wxStaticText* itemStaticText12 = new wxStaticText( itemPanel2, wxID_STATIC, _("3' end"), wxDefaultPosition, wxDefaultSize, 0 );
190  itemBoxSizer9->Add(itemStaticText12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
191 
192  wxArrayString m_3PartialStrings;
193  m_3PartialStrings.Add(_("Partial or Complete"));
194  m_3PartialStrings.Add(_("Partial"));
195  m_3PartialStrings.Add(_("Complete"));
196  m_3Partial = new wxChoice( itemPanel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_3PartialStrings, 0 );
197  m_3Partial->SetStringSelection(_("Partial or Complete"));
198  itemBoxSizer9->Add(m_3Partial, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
199 
200  wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxHORIZONTAL);
201  itemBoxSizer3->Add(itemBoxSizer14, 0, wxGROW|wxALL, 5);
202 
203  wxStaticText* itemStaticText15 = new wxStaticText( itemPanel2, wxID_STATIC, _("location type"), wxDefaultPosition, wxDefaultSize, 0 );
204  itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
205 
206  wxArrayString m_LocTypeStrings;
207  m_LocTypeStrings.Add(_("Any"));
208  m_LocTypeStrings.Add(_("Single interval"));
209  m_LocTypeStrings.Add(_("Joined"));
210  m_LocTypeStrings.Add(_("Ordered"));
211  m_LocType = new wxChoice( itemPanel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_LocTypeStrings, 0 );
212  m_LocType->SetStringSelection(_("Any"));
213  itemBoxSizer14->Add(m_LocType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
214 
215  wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxHORIZONTAL);
216  itemBoxSizer3->Add(itemBoxSizer17, 0, wxGROW|wxALL, 5);
217 
218  wxStaticText* itemStaticText18 = new wxStaticText( itemPanel2, wxID_STATIC, _("where end of sequence is"), wxDefaultPosition, wxDefaultSize, 0 );
219  itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
220 
221  wxArrayString m_5DistTypeStrings;
222  m_5DistTypeStrings.Add(_("Any distance"));
223  m_5DistTypeStrings.Add(_("Exactly"));
224  m_5DistTypeStrings.Add(_("No more than"));
225  m_5DistTypeStrings.Add(_("No less than"));
226  m_5DistType = new wxChoice( itemPanel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_5DistTypeStrings, 0 );
227  m_5DistType->SetStringSelection(_("Any distance"));
228  itemBoxSizer17->Add(m_5DistType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
229 
230  m_5Dist = new wxTextCtrl( itemPanel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
231  itemBoxSizer17->Add(m_5Dist, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
232  m_5Dist->SetValidator( wxTextValidator( wxFILTER_NUMERIC ) );
233  m_5Dist->Disable();
234 
235  wxStaticText* itemStaticText21 = new wxStaticText( itemPanel2, wxID_STATIC, _("from 5' end of the feature"), wxDefaultPosition, wxDefaultSize, 0 );
236  itemBoxSizer17->Add(itemStaticText21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
237 
238  wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL);
239  itemBoxSizer3->Add(itemBoxSizer22, 0, wxGROW|wxALL, 5);
240 
241  wxStaticText* itemStaticText23 = new wxStaticText( itemPanel2, wxID_STATIC, _("where end of sequence is"), wxDefaultPosition, wxDefaultSize, 0 );
242  itemBoxSizer22->Add(itemStaticText23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
243 
244  wxArrayString m_3DistTypeStrings;
245  m_3DistTypeStrings.Add(_("Any distance"));
246  m_3DistTypeStrings.Add(_("Exactly"));
247  m_3DistTypeStrings.Add(_("No more than"));
248  m_3DistTypeStrings.Add(_("No less than"));
249  m_3DistType = new wxChoice( itemPanel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_3DistTypeStrings, 0 );
250  m_3DistType->SetStringSelection(_("Any distance"));
251  itemBoxSizer22->Add(m_3DistType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
252 
253  m_3Dist = new wxTextCtrl( itemPanel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
254  itemBoxSizer22->Add(m_3Dist, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
255  m_3Dist->SetValidator( wxTextValidator( wxFILTER_NUMERIC ) );
256  m_3Dist->Disable();
257 
258  wxStaticText* itemStaticText26 = new wxStaticText( itemPanel2, wxID_STATIC, _("from 3' end of the feature"), wxDefaultPosition, wxDefaultSize, 0 );
259  itemBoxSizer22->Add(itemStaticText26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
260 
261 ////@end CMacroLocationConstraintPanel content construction
262 }
263 
264 
265 /*
266  * Should we show tooltips?
267  */
268 
270 {
271  return true;
272 }
273 
274 /*
275  * Get bitmap resources
276  */
277 
278 wxBitmap CMacroLocationConstraintPanel::GetBitmapResource( const wxString& name )
279 {
280  // Bitmap retrieval
281 ////@begin CMacroLocationConstraintPanel bitmap retrieval
282  wxUnusedVar(name);
283  return wxNullBitmap;
284 ////@end CMacroLocationConstraintPanel bitmap retrieval
285 }
286 
287 /*
288  * Get icon resources
289  */
290 
292 {
293  // Icon retrieval
294 ////@begin CMacroLocationConstraintPanel icon retrieval
295  wxUnusedVar(name);
296  return wxNullIcon;
297 ////@end CMacroLocationConstraintPanel icon retrieval
298 }
299 
300 
301 /*
302  * wxEVT_COMMAND_CHOICE_SELECTED event handler for wxID_ANY
303  */
304 
305 void CMacroLocationConstraintPanel::OnAnySelected( wxCommandEvent& event )
306 {
307  if (m_5DistType->GetSelection() > 0) {
308  m_5Dist->Enable();
309  }
310  else {
311  m_5Dist->SetValue(wxEmptyString);
312  m_5Dist->Disable();
313  }
314 
315  if (m_3DistType->GetSelection() > 0) {
316  m_3Dist->Enable();
317  }
318  else {
319  m_3Dist->SetValue(wxEmptyString);
320  m_3Dist->Disable();
321  }
322  event.Skip();
323 }
324 
325 // TODO - reevaluate this function, in the presence of CFuncWithArgs
326 pair<string,string> CMacroLocationConstraintPanel::GetMatcher(const pair<string, string> &target, size_t num)
327 {
328  return make_pair(GetDescription(), GetLocationConstraint());
329 }
330 
331 void CMacroLocationConstraintPanel::SetMatcher(const vector<CFuncWithArgs>& func_info)
332 {
333  for (const auto& fn_it : func_info) {
334  if (NStr::EqualNocase(fn_it.m_FName, CMacroFunction_LocationStrand::GetFuncName())) {
335  auto strand_it = fn_it.m_FArgs.find(NMacroArgs::kConstr_Strand);
336  if (strand_it != fn_it.m_FArgs.end()) {
337  const int sel = (strand_it->second == "plus") ? 1 : (strand_it->second == "minus") ? 2 : 0;
338  m_Strand->SetSelection(sel);
339  }
340  }
342  m_NucOrProt->SetSelection(1);
343  }
345  m_NucOrProt->SetSelection(2);
346  }
348  const int sel = (fn_it.m_Negate) ? 2 : 1;
349  m_5Partial->SetSelection(sel);
350  }
352  const int sel = (fn_it.m_Negate) ? 2 : 1;
353  m_3Partial->SetSelection(sel);
354  }
355  else if (NStr::EqualNocase(fn_it.m_FName, CMacroFunction_LocationType::GetFuncName())) {
356  auto type_it = fn_it.m_FArgs.find(NMacroArgs::kConstr_LocType);
357  int sel = 0;
358  if (type_it->second == "single-interval") {
359  sel = 1;
360  }
361  else if (type_it->second == "joined") {
362  sel = 2;
363  }
364  else if (type_it->second == "ordered") {
365  sel = 3;
366  }
367  m_LocType->SetSelection(sel);
368  }
370  auto dist_it = fn_it.m_FArgs.find(NMacroArgs::kConstr_Distance);
371  m_5Dist->ChangeValue(dist_it->second);
372  m_5Dist->Enable();
373  int sel = 0;
374  if (fn_it.m_ParentFnc == "=") {
375  sel = 1;
376  }
377  else if (fn_it.m_ParentFnc == "<=") {
378  sel = 2;
379  }
380  else if (fn_it.m_ParentFnc == ">=") {
381  sel = 3;
382  }
383  m_5DistType->SetSelection(sel);
384  }
386  auto dist_it = fn_it.m_FArgs.find(NMacroArgs::kConstr_Distance);
387  m_3Dist->ChangeValue(dist_it->second);
388  m_3Dist->Enable();
389  int sel = 0;
390  if (fn_it.m_ParentFnc == "=") {
391  sel = 1;
392  }
393  else if (fn_it.m_ParentFnc == "<=") {
394  sel = 2;
395  }
396  else if (fn_it.m_ParentFnc == ">=") {
397  sel = 3;
398  }
399  m_3DistType->SetSelection(sel);
400  }
401  }
402 }
403 
404 
405 vector<CFuncWithArgs> CMacroLocationConstraintPanel::GetFuncWithArgs(const pair<string, string>& target, size_t num) const
406 {
407  vector<CFuncWithArgs> functions;
408  {
409  CFuncWithArgs fn;
410  int sel = m_Strand->GetSelection();
411  if (sel > 0) {
412  fn.m_FName = CMacroFunction_LocationStrand::GetFuncName();
413  string strand;
414  if (sel == 1) strand = "plus";
415  else if (sel == 2) strand = "minus";
416  fn.m_FArgs.emplace(NMacroArgs::kConstr_Strand, strand);
417  functions.push_back(fn);
418  }
419  }
420  {
421  CFuncWithArgs fn;
422  int sel = m_NucOrProt->GetSelection();
423  if (sel == 1) {
425  functions.push_back(fn);
426  }
427  else if (sel == 2) {
429  functions.push_back(fn);
430  }
431  }
432  {
433  CFuncWithArgs fn;
434  int sel = m_5Partial->GetSelection();
435  if (sel > 0) {
437  if (sel == 2) {
438  fn.m_Negate = true;
439  }
440  functions.push_back(fn);
441  }
442  }
443  {
444  CFuncWithArgs fn;
445  int sel = m_3Partial->GetSelection();
446  if (sel > 0) {
448  if (sel == 2) {
449  fn.m_Negate = true;
450  }
451  functions.push_back(fn);
452  }
453  }
454  {
455  CFuncWithArgs fn;
456  int sel = m_LocType->GetSelection();
457  if (sel > 0) {
459  string loc_type;
460  if (sel == 1) loc_type = "single-interval";
461  else if (sel == 2) loc_type = "joined";
462  else if (sel == 3) loc_type = "ordered";
463  fn.m_FArgs.emplace(NMacroArgs::kConstr_LocType, loc_type);
464  functions.push_back(fn);
465  }
466  }
467  {
468  CFuncWithArgs fn;
469  int sel = m_5DistType->GetSelection();
470  string dist = m_5Dist->GetValue().ToStdString();
471  if (sel > 0 && !dist.empty()) {
473  fn.m_FArgs.emplace(NMacroArgs::kConstr_Distance, dist);
474  if (sel == 1)
475  fn.m_ParentFnc = "=";
476  else if (sel == 2)
477  fn.m_ParentFnc = "<=";
478  else if (sel == 3)
479  fn.m_ParentFnc = ">=";
480  functions.push_back(fn);
481  }
482  }
483  {
484  CFuncWithArgs fn;
485  int sel = m_3DistType->GetSelection();
486  string dist = m_3Dist->GetValue().ToStdString();
487  if (sel > 0 && !dist.empty()) {
489  fn.m_FArgs.emplace(NMacroArgs::kConstr_Distance, dist);
490  if (sel == 1)
491  fn.m_ParentFnc = "=";
492  else if (sel == 2)
493  fn.m_ParentFnc = "<=";
494  else if (sel == 3)
495  fn.m_ParentFnc = ">=";
496  functions.push_back(fn);
497  }
498  }
499  return functions;
500 }
501 
503 {
504  vector<string> c;
505  switch (m_Strand->GetSelection())
506  {
507  case 1 : c.push_back(CMacroFunction_LocationStrand::GetFuncName() + "() = \"plus\""); break;
508  case 2 : c.push_back(CMacroFunction_LocationStrand::GetFuncName() + "() = \"minus\""); break;
509  default : break;
510  }
511  switch (m_NucOrProt->GetSelection())
512  {
513  case 1 : c.push_back(string(CMacroFunction_LocationSeqType::sm_SeqNa) + "()"); break;
514  case 2 : c.push_back(string(CMacroFunction_LocationSeqType::sm_SeqAa) + "()"); break;
515  default : break;
516  }
517  switch (m_5Partial->GetSelection())
518  {
519  case 1 : c.push_back(string(CMacroFunction_LocPartialTest::sm_PartialStart) + "()"); break;
520  case 2 : c.push_back("NOT " + string(CMacroFunction_LocPartialTest::sm_PartialStart) + "()"); break;
521  default : break;
522  }
523  switch (m_3Partial->GetSelection())
524  {
525  case 1 : c.push_back(string(CMacroFunction_LocPartialTest::sm_PartialStop) + "()"); break;
526  case 2 : c.push_back("NOT " + string(CMacroFunction_LocPartialTest::sm_PartialStop) + "()"); break;
527  default : break;
528  }
529  switch (m_LocType->GetSelection())
530  {
531  case 1 : c.push_back(CMacroFunction_LocationType::GetFuncName() + "(\"single-interval\")"); break;
532  case 2 : c.push_back(CMacroFunction_LocationType::GetFuncName() + "(\"joined\")"); break;
533  case 3 : c.push_back(CMacroFunction_LocationType::GetFuncName() + "(\"ordered\")"); break;
534  default : break;
535  }
536 
537 
538  if ( m_5DistType->GetSelection() > 0 && !m_5Dist->GetValue().IsEmpty() )
539  {
540  string d = m_5Dist->GetValue().ToStdString();
542  switch (m_5DistType->GetSelection())
543  {
544  case 1: c.push_back(func + "= " + d); break;
545  case 2: c.push_back(func + "<= " + d); break;
546  case 3: c.push_back(func + ">= " + d); break;
547  default : break;
548  }
549  }
550 
551  if ( m_3DistType->GetSelection() > 0 && !m_3Dist->GetValue().IsEmpty() )
552  {
553  string d = m_3Dist->GetValue().ToStdString();
555  switch (m_3DistType->GetSelection())
556  {
557  case 1: c.push_back(func + "= " + d); break;
558  case 2: c.push_back(func + "<= " + d); break;
559  case 3: c.push_back(func + ">= " + d); break;
560  default : break;
561  }
562  }
563  // Note that there are multiple constraints returned from the panel
564  return NStr::Join(c, " AND ");
565 }
566 
567 
569 {
570  string label = "only objects on ";
571  switch (m_Strand->GetSelection())
572  {
573  case 1 : label += "plus strands of "; break;
574  case 2 : label += "minus strands of "; break;
575  default : break;
576  }
577  switch (m_NucOrProt->GetSelection())
578  {
579  case 1 : label += "nucleotide "; break;
580  case 2 : label += "protein "; break;
581  default : break;
582  }
583  label += "sequences ";
584  string label2;
585  switch (m_5Partial->GetSelection())
586  {
587  case 1 : label2 += "5' partial "; break;
588  case 2 : label2 += "5' complete "; break;
589  default : break;
590  }
591  switch (m_3Partial->GetSelection())
592  {
593  case 1 : label2 += "3' partial "; break;
594  case 2 : label2 += "3' complete "; break;
595  default : break;
596  }
597  switch (m_LocType->GetSelection())
598  {
599  case 1 : label2 += "with single interval "; break;
600  case 2 : label2 += "with joined intervals "; break;
601  case 3 : label2 += "with ordered intervals "; break;
602  default : break;
603  }
604  if ( m_5DistType->GetSelection() > 0 && !m_5Dist->GetValue().IsEmpty() )
605  {
606  label2 += "with 5' end ";
607  switch (m_5DistType->GetSelection())
608  {
609  case 1: label2 += "exactly "; break;
610  case 2: label2 += "no more than "; break;
611  case 3: label2 += "no less than "; break;
612  }
613  label2 += m_5Dist->GetValue().ToStdString();
614  label2 += " from end of sequence ";
615  }
616  if ( m_3DistType->GetSelection() > 0 && !m_3Dist->GetValue().IsEmpty() )
617  {
618  label2 += "with 3' end ";
619  switch (m_3DistType->GetSelection())
620  {
621  case 1: label2 += "exactly "; break;
622  case 2: label2 += "no more than "; break;
623  case 3: label2 += "no less than "; break;
624  }
625  label2 += m_3Dist->GetValue().ToStdString();
626  label2 += " from end of sequence ";
627  }
628  if (!label2.empty())
629  label += "that are " + label2;
630  return label;
631 }
632 
633 
Class to store one function as it appears in the macro and its arguments (as GUI fieldnames)
TInterpretedArgs m_FArgs
string m_FName
Function name as it appears in the macro.
virtual pair< string, string > GetMatcher(const pair< string, string > &target, size_t num)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
virtual void SetMatcher(const vector< CFuncWithArgs > &func_info)
void Init()
Initialises member variables.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void OnAnySelected(wxCommandEvent &event)
wxEVT_COMMAND_CHOICE_SELECTED event handler for wxID_ANY
virtual vector< CFuncWithArgs > GetFuncWithArgs(const pair< string, string > &target, size_t num) const
void CreateControls()
Creates the controls and sizers.
static bool ShowToolTips()
Should we show tooltips?
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
#define _(proto)
Definition: ct_nlmzip_i.h:78
IMPLEMENT_CLASS(CFloatingFrame, CFloatingFrameBaseClass) const static long kFloatFrameStyle
CFloatingFrame.
static void Init(void)
Definition: cursor6.c:76
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
static const char * sm_SeqNa
class CMacroFunction_LocationSeqType IS_SEQ_AA(["location"]) - returns true if the sequence identifie...
static const char * sm_PartialStart
class CMacroFunction_LocPartialTest - tests whether the location is 5'/3' partial ISPARTIALSTART() - ...
static const char * sm_FromStart
class CMacroFunction_LocationDistConstraint DISTFROMSTART() [>][=][<] distance DISTFROMSTOP()
static CTempString GetFuncName()
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
Definition: ncbistr.hpp:2697
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5353
static const char label[]
END_EVENT_TABLE()
USING_SCOPE(objects)
const string kConstr_Strand
const string kConstr_LocType
const string kConstr_Distance
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
Modified on Mon May 20 05:02:05 2024 by modify_doxy.py rev. 669887