NCBI C++ ToolKit
cds_translation_panel.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: cds_translation_panel.hpp 42778 2019-04-11 16:12:41Z filippov $
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: Colleen Bollin
27  */
28 #ifndef _CDSTRANSLATION_PANEL_H_
29 #define _CDSTRANSLATION_PANEL_H_
30 
31 #include <corelib/ncbistd.hpp>
33 #include <objects/seq/Bioseq.hpp>
34 
35 /*!
36  * Includes
37  */
38 
39 ////@begin includes
40 #include "wx/statline.h"
41 #include "wx/hyperlink.h"
42 ////@end includes
43 
44 #include "wx/combobox.h"
45 #include <wx/odcombo.h>
46 #include "wx/checkbox.h"
47 #include <wx/toplevel.h>
48 #include <wx/stattext.h>
49 
50 /*!
51  * Forward declarations
52  */
53 
54 ////@begin forward declarations
55 class wxHyperlinkCtrl;
56 ////@end forward declarations
57 
59 
60 BEGIN_SCOPE(objects) // namespace ncbi::objects::
61 class CScope;
63 
64 /*!
65  * Control identifiers
66  */
67 
68 ////@begin control identifiers
69 #define SYMBOL_CCDSTRANSLATIONPANEL_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL
70 #define SYMBOL_CCDSTRANSLATIONPANEL_TITLE _("CDS TranslationPanel")
71 #define SYMBOL_CCDSTRANSLATIONPANEL_IDNAME ID_CCDSTRANSLATIONPANEL
72 #define SYMBOL_CCDSTRANSLATIONPANEL_SIZE wxSize(400, 300)
73 #define SYMBOL_CCDSTRANSLATIONPANEL_POSITION wxDefaultPosition
74 ////@end control identifiers
75 
76 
77 /*!
78  * CCDSTranslationPanel class declaration
79  */
80 
81 class CCDSTranslationPanel: public wxPanel, public IRegSettings
82 {
83  DECLARE_DYNAMIC_CLASS( CCDSTranslationPanel )
84  DECLARE_EVENT_TABLE()
85 
86 public:
87  /// Constructors
89  CCDSTranslationPanel( wxWindow* parent, objects::CSeq_feat& feat, objects::CScope& scope,
90  wxWindowID id = SYMBOL_CCDSTRANSLATIONPANEL_IDNAME,
91  const wxString& caption = SYMBOL_CCDSTRANSLATIONPANEL_TITLE,
92  const wxPoint& pos = SYMBOL_CCDSTRANSLATIONPANEL_POSITION,
93  const wxSize& size = SYMBOL_CCDSTRANSLATIONPANEL_SIZE,
94  long style = SYMBOL_CCDSTRANSLATIONPANEL_STYLE );
95 
96  /// Creation
97  bool Create( wxWindow* parent,
98  wxWindowID id = SYMBOL_CCDSTRANSLATIONPANEL_IDNAME,
99  const wxString& caption = SYMBOL_CCDSTRANSLATIONPANEL_TITLE,
100  const wxPoint& pos = SYMBOL_CCDSTRANSLATIONPANEL_POSITION,
101  const wxSize& size = SYMBOL_CCDSTRANSLATIONPANEL_SIZE,
102  long style = SYMBOL_CCDSTRANSLATIONPANEL_STYLE );
103 
104  /// Destructor
106 
107  /// Initialises member variables
108  void Init();
109 
110  /// Creates the controls and sizers
111  void CreateControls();
112 
113  virtual bool TransferDataToWindow();
114  virtual bool TransferDataFromWindow();
115 
116  void SetProduct(objects::CSeq_feat& feat);
117  void SetProtein(objects::CBioseq& bioseq);
118 
119 ////@begin CCDSTranslationPanel event handler declarations
120 
121  /// wxEVT_COMMAND_HYPERLINK event handler for ID_PREDICT_INTERVAL
122  void OnPredictIntervalHyperlinkClicked( wxHyperlinkEvent& event );
123 
124  /// wxEVT_COMMAND_HYPERLINK event handler for ID_RETRANSLATE_LINK
125  void OnRetranslateLinkHyperlinkClicked( wxHyperlinkEvent& event );
126 
127  /// wxEVT_COMMAND_HYPERLINK event handler for ID_HYPERLINKCTRL2
128  void AdjustForStopCodonHyperlinkClicked( wxHyperlinkEvent& event );
129 
130  /// wxEVT_COMMAND_HYPERLINK event handler for ID_IMPORT_CDS_PROTEIN
131  void OnImportCdsProteinHyperlinkClicked( wxHyperlinkEvent& event );
132 
133  void OnProductChanged(wxCommandEvent& event);
134 
135  void OnRetranslateOnOkChanged(wxCommandEvent& event);
136 ////@end CCDSTranslationPanel event handler declarations
137 
138 ////@begin CCDSTranslationPanel member function declarations
139 
140  /// Retrieves bitmap resources
141  wxBitmap GetBitmapResource( const wxString& name );
142 
143  /// Retrieves icon resources
144  wxIcon GetIconResource( const wxString& name );
145 ////@end CCDSTranslationPanel member function declarations
146 
147  /// Should we show tooltips?
148  static bool ShowToolTips();
149 
150 ////@begin CCDSTranslationPanel member variables
151  wxChoice* m_GeneticCode;
152  wxChoice* m_Frame;
153  wxCheckBox* m_ConflictCtrl;
154  wxStaticText* m_ProteinLengthTxt;
155  wxOwnerDrawnComboBox* m_ProductCtrl;
156  wxCheckBox* m_ForceNear;
157  wxTextCtrl* m_TranslationCtrl;
158  wxHyperlinkCtrl* m_RetranslateLink;
159  wxCheckBox* m_RetranslateOnOkBtn;
160  wxCheckBox* m_UpdatemRNASpan;
161  wxCheckBox* m_UpdateGeneSpan;
162  /// Control identifiers
163  enum {
178  };
179 ////@end CCDSTranslationPanel member variables
181  objects::CScope *m_Scope;
183 
184  bool ShouldUpdatemRNALocation() { return m_UpdatemRNASpan->GetValue(); }
185  bool ShouldUpdateGeneLocation() { return m_UpdateGeneSpan->GetValue(); }
186  bool ShouldRetranslate() { return (m_RetranslateOnOkBtn->GetValue()); }
187  void Retranslate();
189  void SetProductId(const string& val);
191 
192  /// @name IRegSettings interface implementation
193  /// @{
194  virtual void SetRegistryPath(const string& reg_path);
195  virtual void LoadSettings();
196  virtual void SaveSettings() const;
197  /// @}
198 
199  void DisableRetranslateOnOk(bool exception, bool pseudo);
200  void UpdateForceNear();
201  static bool IsValidException(const string& text);
202 
203 private:
204  wxTreebook* x_GetTree();
205  bool x_IsPseudo();
206  void x_SetLocationForProtein(CRef<objects::CSeq_feat> cds, objects::CSeq_entry_Handle seh);
207  void x_SetProtein(const objects::CBioseq& protein, CRef<objects::CSeq_feat> cds, objects::CSeq_entry_Handle seh);
208  bool x_CollectData();
209  void x_NormalizeGeneticCodeName(string& code_name);
210  void x_Translate(void);
211  void x_UpdateForceNear(const string &val);
213  string m_RegPath;
215 };
216 
218 
219 #endif
220  // _CDSTRANSLATION_PANEL_H_
#define SYMBOL_CCDSTRANSLATIONPANEL_POSITION
#define SYMBOL_CCDSTRANSLATIONPANEL_IDNAME
#define SYMBOL_CCDSTRANSLATIONPANEL_SIZE
#define SYMBOL_CCDSTRANSLATIONPANEL_TITLE
#define SYMBOL_CCDSTRANSLATIONPANEL_STYLE
void Init()
Initialises member variables.
CCDSTranslationPanel(wxWindow *parent, objects::CSeq_feat &feat, objects::CScope &scope, wxWindowID id=ID_CCDSTRANSLATIONPANEL, const wxString &caption=_("CDS TranslationPanel"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
bool Create(wxWindow *parent, wxWindowID id=ID_CCDSTRANSLATIONPANEL, const wxString &caption=_("CDS TranslationPanel"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
virtual bool TransferDataFromWindow()
static bool IsValidException(const string &text)
void OnProductChanged(wxCommandEvent &event)
void AdjustForStopCodonHyperlinkClicked(wxHyperlinkEvent &event)
wxEVT_COMMAND_HYPERLINK event handler for ID_HYPERLINKCTRL2
void SetProduct(objects::CSeq_feat &feat)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
virtual void SaveSettings() const
void CreateControls()
Creates the controls and sizers.
void OnRetranslateOnOkChanged(wxCommandEvent &event)
virtual void SetRegistryPath(const string &reg_path)
map< string, CConstRef< objects::CSeq_id > > m_SeqIds
wxOwnerDrawnComboBox * m_ProductCtrl
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void x_UpdateForceNear(const string &val)
void OnPredictIntervalHyperlinkClicked(wxHyperlinkEvent &event)
wxEVT_COMMAND_HYPERLINK event handler for ID_PREDICT_INTERVAL
void SetProtein(objects::CBioseq &bioseq)
void OnRetranslateLinkHyperlinkClicked(wxHyperlinkEvent &event)
wxEVT_COMMAND_HYPERLINK event handler for ID_RETRANSLATE_LINK
void x_NormalizeGeneticCodeName(string &code_name)
wxHyperlinkCtrl * m_RetranslateLink
void x_SetProtein(const objects::CBioseq &protein, CRef< objects::CSeq_feat > cds, objects::CSeq_entry_Handle seh)
CRef< objects::CSeq_feat > m_EditedFeat
void SetProductId(const string &val)
void OnImportCdsProteinHyperlinkClicked(wxHyperlinkEvent &event)
wxEVT_COMMAND_HYPERLINK event handler for ID_IMPORT_CDS_PROTEIN
static bool ShowToolTips()
Should we show tooltips?
void DisableRetranslateOnOk(bool exception, bool pseudo)
CRef< objects::CSeq_id > GetProductId()
CRef< objects::CBioseq > m_EditedBioseq
void x_SetLocationForProtein(CRef< objects::CSeq_feat > cds, objects::CSeq_entry_Handle seh)
CScope –.
Definition: scope.hpp:92
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
Definition: map.hpp:338
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
static void text(MDB_val *v)
Definition: mdb_dump.c:62
const struct ncbi::grid::netcache::search::fields::SIZE size
Modified on Thu Jul 11 17:56:27 2024 by modify_doxy.py rev. 669887