NCBI C++ Toolkit Cross Reference

  C++/src/gui/packages/pkg_sequence_edit/chimera_panel.cpp


/* $Id: chimera_panel.cpp 28329 2013-06-19 11:58:38Z bollin $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors: Colleen Bollin */ #include <ncbi_pch.hpp> ////@begin includes ////@end includes #include <gui/packages/pkg_sequence_edit/chimera_panel.hpp> #include <gui/packages/pkg_sequence_edit/subprep_util.hpp> ////@begin XPM images ////@end XPM images BEGIN_NCBI_SCOPE /*! * CChimeraPanel type definition */ IMPLEMENT_DYNAMIC_CLASS( CChimeraPanel, wxPanel ) /*! * CChimeraPanel event table definition */ BEGIN_EVENT_TABLE( CChimeraPanel, wxPanel ) ////@begin CChimeraPanel event table entries EVT_RADIOBUTTON( ID_YES, CChimeraPanel::OnYesSelected ) EVT_RADIOBUTTON( ID_NO, CChimeraPanel::OnNoSelected ) ////@end CChimeraPanel event table entries END_EVENT_TABLE() /*! * CChimeraPanel constructors */ CChimeraPanel::CChimeraPanel() { Init(); } CChimeraPanel::CChimeraPanel( wxWindow* parent, objects::CSeq_entry_Handle seh, ICommandProccessor* processor, IWorkbench* workbench, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : m_Seh(seh) , m_CmdProcessor(processor), m_Workbench(workbench) { Init(); Create(parent, id, pos, size, style); } /*! * CChimeraPanel creator */ bool CChimeraPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) { ////@begin CChimeraPanel creation wxPanel::Create( parent, id, pos, size, style ); CreateControls(); if (GetSizer()) { GetSizer()->SetSizeHints(this); } Centre(); ////@end CChimeraPanel creation return true; } /*! * CChimeraPanel destructor */ CChimeraPanel::~CChimeraPanel() { ////@begin CChimeraPanel destruction ////@end CChimeraPanel destruction } /*! * Member initialisation */ void CChimeraPanel::Init() { ////@begin CChimeraPanel member initialisation m_Yes = NULL; m_No = NULL; m_ProgVerSizer = NULL; ////@end CChimeraPanel member initialisation m_ProgramVersionField = NULL; } const string kChimeraField = "Chimera Screening"; const string kChimeraLabel = "Program and Version"; /*! * Control creation for CChimeraPanel */ void CChimeraPanel::CreateControls() { ////@begin CChimeraPanel content construction // Generated by DialogBlocks, 10/06/2013 17:52:42 (unregistered) CChimeraPanel* itemPanel1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); itemPanel1->SetSizer(itemBoxSizer2); wxStaticText* itemStaticText3 = new wxStaticText( itemPanel1, wxID_STATIC, _("For bacteria and archaea 16S ribosomal RNA sequences, please verify the sequences in your submission file have been quality checked and anomalous sequences, including chimeras, vector, misassemblies and low quality sequences, have been removed or trimmed where appropriate.\n\nDid you screen your sequences for 16S rRNA artifacts and remove anomalous sequences prior to preparing this submission?"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText3->Wrap(600); itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); m_Yes = new wxRadioButton( itemPanel1, ID_YES, _("Yes (please provide program and version used to screen)"), wxDefaultPosition, wxDefaultSize, 0 ); m_Yes->SetValue(false); itemBoxSizer4->Add(m_Yes, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_No = new wxRadioButton( itemPanel1, ID_NO, _("No"), wxDefaultPosition, wxDefaultSize, 0 ); m_No->SetValue(false); itemBoxSizer4->Add(m_No, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_ProgVerSizer = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(m_ProgVerSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); ////@end CChimeraPanel content construction m_ProgramVersionField = new CSubPrepFieldEditor(this, m_Seh, m_CmdProcessor, m_Workbench); m_ProgVerSizer->Add(m_ProgramVersionField, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0); CSubPrep_panel* parent = x_GetParent(); if (parent) { CSourceRequirements::EWizardSrcType src_type = parent->GetWizardSrcType(); CTableFieldCommandConverter* converter = new CChimeraCommentDescriptorTableCommandConverter(kChimeraLabel, src_type); m_ProgramVersionField->SetConverter(kChimeraLabel, kChimeraLabel, converter); } } void CChimeraPanel::UpdateChimera() { CSubPrep_panel* parent = x_GetParent(); if (!parent) { this->Hide(); return; } CSourceRequirements::EWizardSrcType src_type = parent->GetWizardSrcType(); CTableFieldCommandConverter* converter = new CChimeraCommentDescriptorTableCommandConverter(kChimeraLabel, src_type); CRef<objects::CSeq_table> table = converter->GetValuesTableFromSeqEntry(m_Seh); if (!table || !table->IsSetNum_rows() || table->GetNum_rows() == 0) { this->Hide(); delete converter; return; } else { this->Show(); } string answer = CSubPrep_panel::GetWizardFieldFromSeqEntry(m_Seh, kChimeraField); if (NStr::EqualNocase(answer, "Yes")) { x_ShowYes(converter); converter = NULL; } else if (NStr::EqualNocase(answer, "No")) { x_ShowNo(); } else { //m_ProgVerSizer->Show(false); m_ProgramVersionField->Enable(false); } if (converter) { delete converter; } // update Fit(); Layout(); Refresh(); } void CChimeraPanel::x_ShowYes(CTableFieldCommandConverter* converter) { m_ProgramVersionField->Enable(true); m_Yes->SetValue(true); m_No->SetValue(false); m_ProgramVersionField->SetConverter(kChimeraLabel, kChimeraLabel, converter); } void CChimeraPanel::x_ShowNo() { //m_ProgVerSizer->Show(false); m_ProgramVersionField->Enable(false); m_Yes->SetValue(false); m_No->SetValue(true); Layout(); Refresh(); } /*! * Should we show tooltips? */ bool CChimeraPanel::ShowToolTips() { return true; } /*! * Get bitmap resources */ wxBitmap CChimeraPanel::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin CChimeraPanel bitmap retrieval wxUnusedVar(name); return wxNullBitmap; ////@end CChimeraPanel bitmap retrieval } /*! * Get icon resources */ wxIcon CChimeraPanel::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin CChimeraPanel icon retrieval wxUnusedVar(name); return wxNullIcon; ////@end CChimeraPanel icon retrieval } CSubPrep_panel* CChimeraPanel::x_GetParent() { wxWindow* w = this->GetParent(); while (w != NULL) { CSubPrep_panel* parent = dynamic_cast<CSubPrep_panel*>(w); if (parent) { return parent; } else { w = w->GetParent(); } } return NULL; } /*! * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_NO */ void CChimeraPanel::OnNoSelected( wxCommandEvent& event ) { CRef<CCmdComposite> cmd = CSubPrep_panel::SetWizardFieldInSeqEntry(m_Seh, kChimeraField, "No"); m_CmdProcessor->Execute(cmd); } /*! * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_YES */ void CChimeraPanel::OnYesSelected( wxCommandEvent& event ) { CRef<CCmdComposite> cmd = CSubPrep_panel::SetWizardFieldInSeqEntry(m_Seh, kChimeraField, "Yes"); m_CmdProcessor->Execute(cmd); } END_NCBI_SCOPE

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.