NCBI C++ Toolkit Cross Reference

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


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
/* $Id: autodef_feat_clause_panel.cpp 33740 2015-09-11 18:04:23Z 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 */ // Generated by DialogBlocks (unregistered), 21/06/2013 14:35:39 #include <ncbi_pch.hpp> ////@begin includes ////@end includes #include <objects/seqfeat/BioSource.hpp> #include <gui/widgets/object_list/object_list_widget.hpp> #include <gui/widgets/seq/feature_check_dialog.hpp> #include <gui/packages/pkg_sequence_edit/autodef_feat_clause_panel.hpp> #include <objtools/edit/autodef.hpp> #include <wx/sizer.h> ////@begin XPM images ////@end XPM images BEGIN_NCBI_SCOPE /*! * CAutodefFeatClausePanel type definition */ IMPLEMENT_DYNAMIC_CLASS( CAutodefFeatClausePanel, wxPanel ) /*! * CAutodefFeatClausePanel event table definition */ BEGIN_EVENT_TABLE( CAutodefFeatClausePanel, wxPanel ) ////@begin CAutodefFeatClausePanel event table entries ////@end CAutodefFeatClausePanel event table entries END_EVENT_TABLE() /*! * CAutodefFeatClausePanel constructors */ CAutodefFeatClausePanel::CAutodefFeatClausePanel() { Init(); } CAutodefFeatClausePanel::CAutodefFeatClausePanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) { Init(); Create(parent, id, pos, size, style); } /*! * CAutodefFeatClausePanel creator */ bool CAutodefFeatClausePanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) { ////@begin CAutodefFeatClausePanel creation wxPanel::Create( parent, id, pos, size, style ); CreateControls(); if (GetSizer()) { GetSizer()->SetSizeHints(this); } Centre(); ////@end CAutodefFeatClausePanel creation return true; } /*! * CAutodefFeatClausePanel destructor */ CAutodefFeatClausePanel::~CAutodefFeatClausePanel() { ////@begin CAutodefFeatClausePanel destruction ////@end CAutodefFeatClausePanel destruction } /*! * Member initialisation */ void CAutodefFeatClausePanel::Init() { ////@begin CAutodefFeatClausePanel member initialisation m_FeatureListChoice = NULL; m_ProductClauseChoice = NULL; m_AppendAltSplice = NULL; m_UseNcRNAComment = NULL; m_OptFeatPanel = NULL; m_SuppressedFeatureTypeList = NULL; m_SuppressTransposon = NULL; m_SupressGeneCluster = NULL; m_SuppressLocusTags = NULL; m_SuppressAltSplice = NULL; ////@end CAutodefFeatClausePanel member initialisation m_SuppressedFeatures.clear(); } /*! * Control creation for CAutodefFeatClausePanel */ void CAutodefFeatClausePanel::CreateControls() { ////@begin CAutodefFeatClausePanel content construction CAutodefFeatClausePanel* itemPanel1 = this; wxStaticBox* itemStaticBoxSizer2Static = new wxStaticBox(itemPanel1, wxID_ANY, _("Feature Clauses")); wxStaticBoxSizer* itemStaticBoxSizer2 = new wxStaticBoxSizer(itemStaticBoxSizer2Static, wxVERTICAL); itemPanel1->SetSizer(itemStaticBoxSizer2); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); itemStaticBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer4->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxStaticText* itemStaticText6 = new wxStaticText( itemStaticBoxSizer2->GetStaticBox(), wxID_STATIC, _("Features or Complete"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxArrayString m_FeatureListChoiceStrings; m_FeatureListChoiceStrings.Add(_("List Features")); m_FeatureListChoiceStrings.Add(_("Complete Sequence")); m_FeatureListChoiceStrings.Add(_("Partial Sequence")); m_FeatureListChoiceStrings.Add(_("Complete Genome")); m_FeatureListChoiceStrings.Add(_("Partial Genome")); m_FeatureListChoiceStrings.Add(_("Sequence")); m_FeatureListChoice = new wxChoice( itemStaticBoxSizer2->GetStaticBox(), ID_AD_LISTCHOICE, wxDefaultPosition, wxDefaultSize, m_FeatureListChoiceStrings, 0 ); m_FeatureListChoice->SetStringSelection(_("List Features")); itemBoxSizer5->Add(m_FeatureListChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxArrayString m_ProductClauseChoiceStrings; m_ProductClauseChoiceStrings.Add(_("No mitochondrial or chloroplast suffix")); m_ProductClauseChoiceStrings.Add(_("Nuclear gene(s) for mitochondrial product(s)")); m_ProductClauseChoiceStrings.Add(_("Nuclear gene(s) for chloroplast product(s)")); m_ProductClauseChoiceStrings.Add(_("Nuclear gene(s) for kinetoplast product(s)")); m_ProductClauseChoiceStrings.Add(_("Nuclear gene(s) for plastid product(s);")); m_ProductClauseChoiceStrings.Add(_("Nuclear gene(s) for chromoplast product(s)")); m_ProductClauseChoiceStrings.Add(_("Nuclear gene(s) for cyanelle product(s) Nuclear gene(s) for apicoplast product(s)")); m_ProductClauseChoiceStrings.Add(_("Nuclear gene(s) for leucoplast product(s)")); m_ProductClauseChoiceStrings.Add(_("Nuclear gene(s) for proplastid product(s)")); m_ProductClauseChoiceStrings.Add(_("Nuclear genes based on CDS products")); m_ProductClauseChoice = new wxChoice( itemStaticBoxSizer2->GetStaticBox(), ID_AD_PRODUCT_CLAUSE, wxDefaultPosition, wxDefaultSize, m_ProductClauseChoiceStrings, 0 ); m_ProductClauseChoice->SetStringSelection(_("Nuclear genes based on CDS products")); itemBoxSizer4->Add(m_ProductClauseChoice, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); m_AppendAltSplice = new wxCheckBox( itemStaticBoxSizer2->GetStaticBox(), ID_AD_ALTSPLICE_ADD, _("Append \"alternatively spliced\" to definition line"), wxDefaultPosition, wxDefaultSize, 0 ); m_AppendAltSplice->SetValue(false); itemBoxSizer4->Add(m_AppendAltSplice, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); m_UseNcRNAComment = new wxCheckBox( itemStaticBoxSizer2->GetStaticBox(), ID_AD_NCRNA_NOTE, _("Use ncRNA note if no class or product"), wxDefaultPosition, wxDefaultSize, 0 ); m_UseNcRNAComment->SetValue(false); itemBoxSizer4->Add(m_UseNcRNAComment, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); m_OptFeatPanel = new CAutodefOptFeatPanel( itemStaticBoxSizer2->GetStaticBox(), ID_AD_WINDOW9, wxDefaultPosition, wxSize(100, 100), 0 ); itemBoxSizer3->Add(m_OptFeatPanel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxStaticBox* itemStaticBoxSizer12Static = new wxStaticBox(itemStaticBoxSizer2->GetStaticBox(), wxID_ANY, _("Suppress Features")); wxStaticBoxSizer* itemStaticBoxSizer12 = new wxStaticBoxSizer(itemStaticBoxSizer12Static, wxHORIZONTAL); itemStaticBoxSizer2->Add(itemStaticBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); m_SuppressedFeatureTypeList = new wxTextCtrl( itemStaticBoxSizer12->GetStaticBox(), ID_SUPPRESSFEATURETYPELIST, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); itemStaticBoxSizer12->Add(m_SuppressedFeatureTypeList, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL); itemStaticBoxSizer12->Add(itemBoxSizer14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_SuppressTransposon = new wxCheckBox( itemStaticBoxSizer12->GetStaticBox(), ID_AD_MOBILE_ELEMENT, _("Mobile element subfeatures"), wxDefaultPosition, wxDefaultSize, 0 ); m_SuppressTransposon->SetValue(false); itemBoxSizer14->Add(m_SuppressTransposon, 0, wxALIGN_LEFT|wxALL, 5); m_SupressGeneCluster = new wxCheckBox( itemStaticBoxSizer12->GetStaticBox(), ID_AD_GENE_CLUSTER, _("Gene cluster/locus subfeatures (both strands)"), wxDefaultPosition, wxDefaultSize, 0 ); m_SupressGeneCluster->SetValue(false); itemBoxSizer14->Add(m_SupressGeneCluster, 0, wxALIGN_LEFT|wxALL, 5); m_SuppressLocusTags = new wxCheckBox( itemStaticBoxSizer12->GetStaticBox(), ID_AD_LOCUS_TAG, _("Locus tags"), wxDefaultPosition, wxDefaultSize, 0 ); m_SuppressLocusTags->SetValue(false); itemBoxSizer14->Add(m_SuppressLocusTags, 0, wxALIGN_LEFT|wxALL, 5); m_SuppressAltSplice = new wxCheckBox( itemStaticBoxSizer12->GetStaticBox(), ID_AD_ALT_SPLICE_PHRASE, _("Alternative splice phrase"), wxDefaultPosition, wxDefaultSize, 0 ); m_SuppressAltSplice->SetValue(false); itemBoxSizer14->Add(m_SuppressAltSplice, 0, wxALIGN_LEFT|wxALL, 5); // Connect events and objects m_SuppressedFeatureTypeList->Connect(ID_SUPPRESSFEATURETYPELIST, wxEVT_LEFT_DOWN, wxMouseEventHandler(CAutodefFeatClausePanel::OnLeftDown), NULL, this); ////@end CAutodefFeatClausePanel content construction } /*! * Should we show tooltips? */ bool CAutodefFeatClausePanel::ShowToolTips() { return true; } /*! * Get bitmap resources */ wxBitmap CAutodefFeatClausePanel::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin CAutodefFeatClausePanel bitmap retrieval wxUnusedVar(name); return wxNullBitmap; ////@end CAutodefFeatClausePanel bitmap retrieval } /*! * Get icon resources */ wxIcon CAutodefFeatClausePanel::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin CAutodefFeatClausePanel icon retrieval wxUnusedVar(name); return wxNullIcon; ////@end CAutodefFeatClausePanel icon retrieval } void CAutodefFeatClausePanel::Clear() { m_SuppressAltSplice->SetValue (false); m_UseNcRNAComment->SetValue (false); m_SuppressTransposon->SetValue (false); m_SupressGeneCluster->SetValue (false); m_SuppressLocusTags->SetValue (false); m_ProductClauseChoice->SetSelection (9); m_AppendAltSplice->SetValue (false); m_FeatureListChoice->SetSelection (0); m_OptFeatPanel->Clear(); m_SuppressedFeatures.clear(); x_UpdateSuppressedFeatureTypeList(); } void CAutodefFeatClausePanel::x_UpdateSuppressedFeatureTypeList() { string label = ""; if (m_SuppressedFeatures.empty()) { label = "No individual feature types are suppressed"; } else { size_t pos = 0; size_t num_items = m_SuppressedFeatures.size(); ITERATE(set<objects::CFeatListItem>, it, m_SuppressedFeatures) { if (!NStr::IsBlank(label)) { if (num_items > 2) { label += ","; } label += " "; if (pos == num_items - 1) { label += "and "; } } label += it->GetDescription(); pos++; } label += " feature types are suppressed"; } m_SuppressedFeatureTypeList->SetValue(ToWxString(label)); } void CAutodefFeatClausePanel::SetParams(SAutodefParams* params) { if (!params) { Clear(); return; } m_SuppressAltSplice->SetValue (params->m_SuppressFeatureAltSplice); m_UseNcRNAComment->SetValue (params->m_UseNcRNAComment); m_SuppressTransposon->SetValue (params->m_SuppressMobileElementSubfeatures); m_SupressGeneCluster->SetValue (params->m_GeneClusterOppStrand); m_SuppressLocusTags->SetValue (params->m_SuppressLocusTags); if (params->m_SpecifyNuclearProduct) { m_ProductClauseChoice->SetSelection (9); } else { switch (params->m_ProductFlag) { case objects::CBioSource::eGenome_mitochondrion: m_ProductClauseChoice->SetSelection (1); break; case objects::CBioSource::eGenome_chloroplast: m_ProductClauseChoice->SetSelection (2); break; case objects::CBioSource::eGenome_kinetoplast: m_ProductClauseChoice->SetSelection (3); break; case objects::CBioSource::eGenome_plastid: m_ProductClauseChoice->SetSelection (4); break; case objects::CBioSource::eGenome_chromoplast: m_ProductClauseChoice->SetSelection (5); break; case objects::CBioSource::eGenome_cyanelle: m_ProductClauseChoice->SetSelection (6); break; case objects::CBioSource::eGenome_apicoplast: m_ProductClauseChoice->SetSelection (7); break; case objects::CBioSource::eGenome_leucoplast: m_ProductClauseChoice->SetSelection (8); break; case objects::CBioSource::eGenome_proplastid: m_ProductClauseChoice->SetSelection (9); break; default: m_ProductClauseChoice->SetSelection (0); break; } } m_AppendAltSplice->SetValue (params->m_AltSpliceFlag); m_FeatureListChoice->SetSelection (params->m_FeatureListType); // suppressed features m_SuppressedFeatures = params->m_SuppressedFeatures; x_UpdateSuppressedFeatureTypeList(); m_OptFeatPanel->SetParams(params); } void CAutodefFeatClausePanel::PopulateParams(SAutodefParams& params) { params.m_SuppressFeatureAltSplice = m_SuppressAltSplice->GetValue(); params.m_SuppressMobileElementSubfeatures = m_SuppressTransposon->GetValue (); params.m_GeneClusterOppStrand = m_SupressGeneCluster->GetValue (); params.m_SuppressLocusTags = m_SuppressLocusTags->GetValue (); if (m_ProductClauseChoice->GetSelection() == 9) { params.m_SpecifyNuclearProduct = true; } else { params.m_SpecifyNuclearProduct = false; switch (m_ProductClauseChoice->GetSelection()) { case 1: params.m_ProductFlag = objects::CBioSource::eGenome_mitochondrion; break; case 2: params.m_ProductFlag = objects::CBioSource::eGenome_chloroplast; break; case 3: params.m_ProductFlag = objects::CBioSource::eGenome_kinetoplast; break; case 4: params.m_ProductFlag = objects::CBioSource::eGenome_plastid; break; case 5: params.m_ProductFlag = objects::CBioSource::eGenome_chromoplast; break; case 6: params.m_ProductFlag = objects::CBioSource::eGenome_cyanelle; break; case 7: params.m_ProductFlag = objects::CBioSource::eGenome_apicoplast; break; case 8: params.m_ProductFlag = objects::CBioSource::eGenome_leucoplast; break; case 9: params.m_ProductFlag = objects::CBioSource::eGenome_proplastid; break; default: params.m_ProductFlag = objects::CBioSource::eGenome_unknown; break; } } params.m_AltSpliceFlag = m_AppendAltSplice->GetValue (); params.m_UseNcRNAComment = m_UseNcRNAComment->GetValue(); int val = m_FeatureListChoice->GetSelection (); switch (val) { case 0: params.m_FeatureListType = objects::CAutoDefOptions::eListAllFeatures; break; case 1: params.m_FeatureListType = objects::CAutoDefOptions::eCompleteSequence; break; case 2: params.m_FeatureListType = objects::CAutoDefOptions::ePartialSequence; break; case 3: params.m_FeatureListType = objects::CAutoDefOptions::eCompleteGenome; break; case 4: params.m_FeatureListType = objects::CAutoDefOptions::ePartialGenome; break; case 5: params.m_FeatureListType = objects::CAutoDefOptions::eSequence; break; default: params.m_FeatureListType = objects::CAutoDefOptions::eListAllFeatures; break; } params.m_SuppressedFeatures = m_SuppressedFeatures; m_OptFeatPanel->PopulateParams(params); } /*! * wxEVT_LEFT_DOWN event handler for ID_SUPPRESSFEATURETYPELIST */ void CAutodefFeatClausePanel::OnLeftDown( wxMouseEvent& event ) { CFeatureCheckDialog dlg(this); dlg.SetSelected (m_SuppressedFeatures); if (dlg.ShowModal() == wxID_OK) { m_SuppressedFeatures.clear(); dlg.GetSelected(m_SuppressedFeatures); x_UpdateSuppressedFeatureTypeList(); } } 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.