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

Go to the SVN repository for this file.

1 /* $Id: bulk_rna_add_panel.cpp 47479 2023-05-02 13:24:02Z ucko $
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 
29 
30 #include <ncbi_pch.hpp>
37 #include <objmgr/bioseq_ci.hpp>
38 
39 ////@begin includes
40 ////@end includes
41 
47 #include <wx/stattext.h>
48 #include <wx/statbox.h>
49 #include <wx/button.h>
50 
51 ////@begin XPM images
52 ////@end XPM images
53 
55 
57 
58 /*!
59  * CBulkRNAAddPanel type definition
60  */
61 
62 IMPLEMENT_DYNAMIC_CLASS( CBulkRNAAddPanel, CBulkCmdPanel )
63 
64 
65 /*!
66  * CBulkRNAAddPanel event table definition
67  */
68 
69 BEGIN_EVENT_TABLE( CBulkRNAAddPanel, CBulkCmdPanel )
70 
71 ////@begin CBulkRNAAddPanel event table entries
73 
75 
77 
78 ////@end CBulkRNAAddPanel event table entries
79 
81 
82 
83 /*!
84  * CBulkRNAAddPanel constructors
85  */
86 
88 {
89  Init();
90 }
91 
92 CBulkRNAAddPanel::CBulkRNAAddPanel( wxWindow* parent, CSeq_entry_Handle seh, bool add_location_panel, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
93 : m_TopSeqEntry(seh), m_tRNAname(NULL), m_RNAname(NULL), CBulkCmdPanel(add_location_panel)
94 {
95  Init();
96  Create(parent, id, pos, size, style);
97 }
98 
99 
100 /*!
101  * CBulkRNAAddPanel creator
102  */
103 
104 bool CBulkRNAAddPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
105 {
106 ////@begin CBulkRNAAddPanel creation
107  CBulkCmdPanel::Create( parent, id, pos, size, style );
108 
109  CreateControls();
110  if (GetSizer())
111  {
112  GetSizer()->SetSizeHints(this);
113  }
114  Centre();
115 ////@end CBulkRNAAddPanel creation
116  return true;
117 }
118 
119 
120 /*!
121  * CBulkRNAAddPanel destructor
122  */
123 
125 {
126 ////@begin CBulkRNAAddPanel destruction
127 ////@end CBulkRNAAddPanel destruction
128 }
129 
130 
131 /*!
132  * Member initialisation
133  */
134 
136 {
137 ////@begin CBulkRNAAddPanel member initialisation
138  m_RNAType = NULL;
139  m_ncRNAClass = NULL;
140  m_FieldSizer = NULL;
142  m_Comment = NULL;
144  m_Location = NULL;
145 ////@end CBulkRNAAddPanel member initialisation
146  m_Locus = NULL;
147  m_GeneDesc = NULL;
148  m_tRNAname = NULL;
149  m_RNAname = NULL;
150  m_rRNAname = NULL;
151 }
152 
153 
154 /*!
155  * Control creation for CBulkRNAAddPanel
156  */
157 
159 {
160 ////@begin CBulkRNAAddPanel content construction
161  CBulkRNAAddPanel* itemCBulkCmdPanel1 = this;
162 
163  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
164  itemCBulkCmdPanel1->SetSizer(itemBoxSizer2);
165 
166  itemBoxSizer2->Add(0, 500, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
167 
168  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
169  itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
170 
171  wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemCBulkCmdPanel1, wxID_ANY, _("RNA Type"));
172  wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL);
173  itemBoxSizer4->Add(itemStaticBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
174 
175  wxArrayString m_RNATypeStrings;
176  m_RNATypeStrings.Add(_("preRNA"));
177  m_RNATypeStrings.Add(_("mRNA"));
178  m_RNATypeStrings.Add(_("tRNA"));
179  m_RNATypeStrings.Add(_("rRNA"));
180  m_RNATypeStrings.Add(_("ncRNA"));
181  m_RNATypeStrings.Add(_("tmRNA"));
182  m_RNATypeStrings.Add(_("miscRNA"));
183  m_RNAType = new wxChoice( itemStaticBoxSizer5->GetStaticBox(), ID_CHOICE1, wxDefaultPosition, wxDefaultSize, m_RNATypeStrings, 0 );
184  m_RNAType->SetStringSelection(_("rRNA"));
185  itemStaticBoxSizer5->Add(m_RNAType, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
186 
187  wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
188  itemStaticBoxSizer5->Add(itemBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
189 
190  wxStaticText* itemStaticText8 = new wxStaticText( itemStaticBoxSizer5->GetStaticBox(), wxID_STATIC, _("ncRNA class"), wxDefaultPosition, wxDefaultSize, 0 );
191  itemBoxSizer7->Add(itemStaticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
192 
193  wxArrayString m_ncRNAClassStrings;
194  m_ncRNAClass = new wxComboBox( itemStaticBoxSizer5->GetStaticBox(), ID_COMBOBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_ncRNAClassStrings, wxCB_DROPDOWN );
195  m_ncRNAClass->Enable(false);
196  itemBoxSizer7->Add(m_ncRNAClass, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
197 
198  m_FieldSizer = new wxFlexGridSizer(0, 2, 0, 0);
199  itemBoxSizer4->Add(m_FieldSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
200 
201  wxStaticText* itemStaticText11 = new wxStaticText( itemCBulkCmdPanel1, wxID_STATIC, _("RNA Name"), wxDefaultPosition, wxDefaultSize, 0 );
202  m_FieldSizer->Add(itemStaticText11, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
203 
204  m_RNANameSizer = new wxBoxSizer(wxHORIZONTAL);
205  m_FieldSizer->Add(m_RNANameSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0);
206 
207  wxStaticText* itemStaticText13 = new wxStaticText( itemCBulkCmdPanel1, wxID_STATIC, _("Comment"), wxDefaultPosition, wxDefaultSize, 0 );
208  m_FieldSizer->Add(itemStaticText13, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
209 
210  m_Comment = new wxTextCtrl( itemCBulkCmdPanel1, ID_TEXTCTRL10, wxEmptyString, wxDefaultPosition, wxSize(300, 70), wxTE_MULTILINE );
211  m_FieldSizer->Add(m_Comment, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
212 
213  m_ButtonsSizer = new wxBoxSizer(wxHORIZONTAL);
214  itemBoxSizer4->Add(m_ButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
215 
216  wxButton* itemButton16 = new wxButton( itemCBulkCmdPanel1, ID_BUTTON11, _("Add '18S-ITS-5.8S-ITS-28S' to comment"), wxDefaultPosition, wxDefaultSize, 0 );
217  m_ButtonsSizer->Add(itemButton16, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
218 
219  wxButton* itemButton17 = new wxButton( itemCBulkCmdPanel1, ID_BUTTON12, _("Add '16S-IGS-23S' to comment"), wxDefaultPosition, wxDefaultSize, 0 );
220  m_ButtonsSizer->Add(itemButton17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
221 
223  {
224  m_Location = new CBulkLocationPanel( itemCBulkCmdPanel1, ID_WINDOW1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER );
225  itemBoxSizer4->Add(m_Location, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
226  }
227 
228 ////@end CBulkRNAAddPanel content construction
229  vector<string> class_vals = CRNA_gen::GetncRNAClassList();
230  ITERATE(vector<string>, it, class_vals) {
231  m_ncRNAClass->AppendString(ToWxString(*it));
232  }
233 
234  // because we start with rRNA as the default:
235  x_AddrRNAName();
236  m_ButtonsSizer->ShowItems(false);
237 }
238 
239 
240 /*!
241  * Should we show tooltips?
242  */
243 
245 {
246  return true;
247 }
248 
249 /*!
250  * Get bitmap resources
251  */
252 
253 wxBitmap CBulkRNAAddPanel::GetBitmapResource( const wxString& name )
254 {
255  // Bitmap retrieval
256 ////@begin CBulkRNAAddPanel bitmap retrieval
257  wxUnusedVar(name);
258  return wxNullBitmap;
259 ////@end CBulkRNAAddPanel bitmap retrieval
260 }
261 
262 /*!
263  * Get icon resources
264  */
265 
266 wxIcon CBulkRNAAddPanel::GetIconResource( const wxString& name )
267 {
268  // Icon retrieval
269 ////@begin CBulkRNAAddPanel icon retrieval
270  wxUnusedVar(name);
271  return wxNullIcon;
272 ////@end CBulkRNAAddPanel icon retrieval
273 }
274 
275 
277 {
278  // hide feature details
279  if (m_RNANameSizer->GetItemCount() > 0) {
280  int pos = 0;
281  m_RNANameSizer->GetItem(pos)->DeleteWindows();
282  m_RNANameSizer->Remove(pos);
283  m_RNAname = NULL;
284  m_tRNAname = NULL;
285  m_rRNAname = NULL;
286  }
287 }
288 
289 
291 {
292  if (m_Locus == NULL && m_GeneDesc == NULL) {
293  wxStaticText* itemStaticText11 = new wxStaticText( this, wxID_STATIC, _("Gene Symbol"), wxDefaultPosition, wxDefaultSize, 0 );
294  m_FieldSizer->Add(itemStaticText11, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
295 
296  m_Locus = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1), 0 );
297  m_FieldSizer->Add(m_Locus, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
298 
299  wxStaticText* itemStaticText13 = new wxStaticText( this, wxID_STATIC, _("Gene Description"), wxDefaultPosition, wxDefaultSize, 0 );
300  m_FieldSizer->Add(itemStaticText13, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
301 
302  m_GeneDesc = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1), 0 );
303  m_FieldSizer->Add(m_GeneDesc, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
304  return true;
305  } else {
306  return false;
307  }
308 
309 }
310 
311 
313 {
314  bool need_layout = false;
315  auto num_items = m_FieldSizer->GetItemCount();
316  while (num_items > 4) {
317  auto pos = num_items - 1;
318  m_FieldSizer->GetItem(pos)->DeleteWindows();
319  m_FieldSizer->Remove(static_cast<int>(pos));
320  need_layout = true;
321  num_items = m_FieldSizer->GetItemCount();
322  }
323  m_Locus = NULL;
324  m_GeneDesc = NULL;
325  return need_layout;
326 }
327 
328 
330 {
331  bool need_layout = false;
332  if (m_rRNAname == NULL) {
334  wxArrayString m_NameStrings;
335  m_NameStrings.Add(_("16S ribosomal RNA"));
336  m_NameStrings.Add(_("18S ribosomal RNA"));
337  m_NameStrings.Add(_("23S ribosomal RNA"));
338  m_NameStrings.Add(_("26S ribosomal RNA"));
339  m_NameStrings.Add(_("28S ribosomal RNA"));
340  m_NameStrings.Add(_("5.8S ribosomal RNA"));
341  m_NameStrings.Add(_("large subunit ribosomal RNA"));
342  m_NameStrings.Add(_("small subunit ribosomal RNA"));
343  m_rRNAname = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_NameStrings, wxCB_DROPDOWN );
344  m_RNANameSizer->Add(m_rRNAname, 0, wxALL, 5);
345  need_layout = true;
346  }
347  return need_layout;
348 }
349 
350 
351 /*!
352  * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE1
353  */
354 
355 void CBulkRNAAddPanel::OnSelectRNAType( wxCommandEvent& event )
356 {
357  string rna_type = ToStdString(m_RNAType->GetStringSelection());
358  bool need_layout = false;
359  if (NStr::Equal(rna_type, "ncRNA")) {
360  m_ncRNAClass->Enable(true);
361  } else {
362  m_ncRNAClass->Enable(false);
363  }
364  bool buttons_shown = m_ButtonsSizer->IsShown((size_t)0);
365  if (NStr::Equal(rna_type, "miscRNA")) {
366  if (!buttons_shown) {
367  m_ButtonsSizer->ShowItems(true);
368  need_layout = true;
369  }
370  } else {
371  if (buttons_shown) {
372  m_ButtonsSizer->ShowItems(false);
373  need_layout = true;
374  }
375  }
376  // create RNA Name control
377  if (NStr::Equal(rna_type, "tRNA")) {
378  if (m_tRNAname == NULL) {
380  wxArrayString m_tRNAStrings;
381  m_tRNAStrings.Add(_("A Alanine"));
382  m_tRNAStrings.Add(_("B Asp or Asn"));
383  m_tRNAStrings.Add(_("C Cysteine"));
384  m_tRNAStrings.Add(_("D Aspartic Acid"));
385  m_tRNAStrings.Add(_("E Glutamic Acid"));
386  m_tRNAStrings.Add(_("F Phenylalanine"));
387  m_tRNAStrings.Add(_("G Glycine"));
388  m_tRNAStrings.Add(_("H Histidine"));
389  m_tRNAStrings.Add(_("I Isoleucine"));
390  m_tRNAStrings.Add(_("J Leu or Ile"));
391  m_tRNAStrings.Add(_("K Lysine"));
392  m_tRNAStrings.Add(_("L Leucine"));
393  m_tRNAStrings.Add(_("M Methionine"));
394  m_tRNAStrings.Add(_("N Asparagine"));
395  m_tRNAStrings.Add(_("O Pyrrolysine"));
396  m_tRNAStrings.Add(_("P Proline"));
397  m_tRNAStrings.Add(_("Q Glutamine"));
398  m_tRNAStrings.Add(_("R Arginine"));
399  m_tRNAStrings.Add(_("S Serine"));
400  m_tRNAStrings.Add(_("T Threonine"));
401  m_tRNAStrings.Add(_("U Selenocysteine"));
402  m_tRNAStrings.Add(_("V Valine"));
403  m_tRNAStrings.Add(_("W Tryptophan"));
404  m_tRNAStrings.Add(_("X Undetermined or atypical"));
405  m_tRNAStrings.Add(_("Y Tyrosine"));
406  m_tRNAStrings.Add(_("Z Glu or Gln"));
407  m_tRNAname = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_tRNAStrings, 0 );
408  m_RNANameSizer->Add(m_tRNAname, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
409  need_layout = true;
410  }
411  need_layout |= x_AddGeneFields();
412  } else if (NStr::Equal(rna_type, "rRNA")) {
413  need_layout |= x_RemoveGeneFields();
414  need_layout |= x_AddrRNAName();
415 
416  } else {
417  if (NStr::Equal(rna_type, "ncRNA") || NStr::Equal(rna_type, "mRNA")) {
418  need_layout |= x_AddGeneFields();
419  } else {
420  need_layout |= x_RemoveGeneFields();
421  }
422 
423  if (m_RNAname == NULL) {
425  m_RNAname = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1), 0 );
426  m_RNANameSizer->Add(m_RNAname, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
427  need_layout = true;
428  }
429  }
430  if (need_layout) {
431  Fit();
432  Layout();
433  }
434 }
435 
436 
437 /*!
438  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON11
439  */
440 
441 void CBulkRNAAddPanel::OnAdd18SToComment( wxCommandEvent& event )
442 {
443  string comment = ToStdString(m_Comment->GetValue());
444  if (!NStr::IsBlank(comment)) {
445  comment += "; ";
446  }
447  comment += "contains small subunit ribosomal RNA, internal transcribed spacer 1, 5.8S ribosomal RNA, internal transcribed spacer 2, and large subunit ribosomal RNA";
448  m_Comment->SetValue(ToWxString(comment));
449 }
450 
451 
452 /*!
453  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON12
454  */
455 
456 void CBulkRNAAddPanel::OnAdd16StoComment( wxCommandEvent& event )
457 {
458  string comment = ToStdString(m_Comment->GetValue());
459  if (!NStr::IsBlank(comment)) {
460  comment += "; ";
461  }
462  comment += "contains 16S ribosomal RNA, 16S-23S ribosomal RNA intergenic spacer, and 23S ribosomal RNA";
463  m_Comment->SetValue(ToWxString(comment));
464 }
465 
466 
467 static void s_SettRNAProduct(string aa, CRef<CRNA_ref> rna)
468 {
469  rna->SetExt().SetTRNA();
470  if (NStr::IsBlank(aa)) {
471  return;
472  }
473  aa = NStr::ToUpper(aa);
474  char a = aa.c_str()[0];
475  rna->SetExt().SetTRNA().SetAa().SetNcbieaa(a);
476 }
477 
478 
480 {
482  switch (m_RNAType->GetSelection()) {
483  case 0:
484  rna_type = CRNA_ref::eType_premsg;
485  break;
486  case 1:
487  rna_type = CRNA_ref::eType_mRNA;
488  break;
489  case 2:
490  rna_type = CRNA_ref::eType_tRNA;
491  break;
492  case 3:
493  rna_type = CRNA_ref::eType_rRNA;
494  break;
495  case 4:
496  rna_type = CRNA_ref::eType_ncRNA;
497  break;
498  case 5:
499  rna_type = CRNA_ref::eType_tmRNA;
500  break;
501  case 6:
502  rna_type = CRNA_ref::eType_miscRNA;
503  break;
504  case 7:
505  rna_type = CRNA_ref::eType_other;
506  break;
507  }
508  return rna_type;
509 }
510 
511 
513 {
514  string rna_name = "";
515  if (m_RNAname != NULL) {
516  rna_name = ToStdString(m_RNAname->GetValue());
517  } else if (m_rRNAname != NULL) {
518  rna_name = ToStdString(m_rRNAname->GetValue());
519  }
520  rna_name = GetAdjustedRnaName(rna_name);
521  return rna_name;
522 }
523 
524 
526 {
527  CRNA_ref::TType rna_type = x_GetRnaType();
528  string rna_name = x_GetRnaName();
529 
530  if (NStr::IsBlank(rna_name) && rna_type == CRNA_ref::eType_rRNA) {
532  return empty;
533  }
534 
535  CRef<CCmdComposite> cmd (new CCmdComposite("Bulk Add RNA"));
536  objects::CBioseq_CI b_iter(m_TopSeqEntry, objects::CSeq_inst::eMol_na);
537  for ( ; b_iter ; ++b_iter ) {
538  AddOneCommand(*b_iter,cmd);
539 
540  }
541 
542  return cmd;
543 }
544 
546 {
547  CRNA_ref::TType rna_type = x_GetRnaType();
548  string rna_name = x_GetRnaName();
549  string comment = ToStdString(m_Comment->GetValue());
550  string ncrna_class = ToStdString (m_ncRNAClass->GetStringSelection());
551  string gene_symbol = "";
552  if (m_Locus) {
553  gene_symbol = ToStdString(m_Locus->GetValue());
554  }
555  string gene_desc = "";
556  if (m_GeneDesc) {
557  gene_desc = ToStdString(m_GeneDesc->GetValue());
558  }
559  CRef<CRNA_ref> rna_ref(new CRNA_ref());
560  rna_ref->SetType(rna_type);
561  // set product
562  switch (rna_type) {
566  rna_ref->SetExt().SetGen();
567  if (!NStr::IsBlank(rna_name)) {
568  rna_ref->SetExt().SetGen().SetProduct(rna_name);
569  }
570  if (rna_type == CRNA_ref::eType_ncRNA && !NStr::IsBlank(ncrna_class)) {
571  rna_ref->SetExt().SetGen().SetClass(ncrna_class);
572  }
573  break;
575  if (m_tRNAname != NULL) {
576  s_SettRNAProduct(ToStdString(m_tRNAname->GetStringSelection()), rna_ref);
577  }
578  break;
579  default:
580  if (!NStr::IsBlank(rna_name)) {
581  rna_ref->SetExt().SetName(rna_name);
582  }
583  break;
584  }
585 
586  objects::CSeq_entry_Handle seh = bsh.GetSeq_entry_Handle();
587  CRef<objects::CSeq_feat> rna(new objects::CSeq_feat());
588  rna->SetData().SetRna().Assign(*rna_ref);
589  if (!ShouldAddToExisting() && AlreadyHasFeature(bsh, rna->GetData().GetSubtype())) {
590  return;
591  }
592 
593  if (!NStr::IsBlank(comment)) {
594  rna->SetComment(comment);
595  }
597  rna->SetLocation().Assign(*loc);
598  if (rna->GetLocation().IsPartialStart(objects::eExtreme_Biological)
599  || rna->GetLocation().IsPartialStop(objects::eExtreme_Biological)) {
600  rna->SetPartial(true);
601  }
602  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *rna)));
603 
604  if (!NStr::IsBlank(gene_symbol) || !NStr::IsBlank(gene_desc)) {
605  // create gene feature
606  CRef<objects::CSeq_feat> new_gene(new objects::CSeq_feat());
607  new_gene->SetData().SetGene().SetLocus(gene_symbol);
608  new_gene->SetData().SetGene().SetDesc(gene_desc);
609  new_gene->SetLocation().Assign(*loc);
610  if (new_gene->GetLocation().IsPartialStart(objects::eExtreme_Biological)
611  || new_gene->GetLocation().IsPartialStop(objects::eExtreme_Biological)) {
612  new_gene->SetPartial(true);
613  }
614  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_gene)));
615  }
616 }
617 
619 {
620  CRNA_ref::TType rna_type = x_GetRnaType();
621  string rna_name = x_GetRnaName();
622  if (NStr::IsBlank(rna_name) && rna_type == CRNA_ref::eType_rRNA) {
623  return "Must specify rRNA product name!";
624  } else {
625  return "Unknown error";
626  }
627 }
628 
@ eExtreme_Biological
5' and 3'
Definition: Na_strand.hpp:62
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
#define ID_WINDOW1
USING_SCOPE(ncbi::objects)
static void s_SettRNAProduct(string aa, CRef< CRNA_ref > rna)
#define ID_BUTTON12
#define ID_BUTTON11
#define ID_TEXTCTRL10
#define ID_COMBOBOX
#define ID_CHOICE1
CBioseq_Handle –.
CBulkLocationPanel * m_Location
virtual bool ShouldAddToExisting()
virtual CRef< objects::CSeq_loc > GetLocForBioseq(const objects::CBioseq &bioseq)
wxBoxSizer * m_ButtonsSizer
virtual string GetErrorMessage()
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void OnAdd16StoComment(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON12
wxBoxSizer * m_RNANameSizer
wxFlexGridSizer * m_FieldSizer
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
objects::CRNA_ref::TType x_GetRnaType()
void CreateControls()
Creates the controls and sizers.
objects::CSeq_entry_Handle m_TopSeqEntry
bool Create(wxWindow *parent, wxWindowID id=10062, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
~CBulkRNAAddPanel()
Destructor.
void Init()
Initialises member variables.
virtual void AddOneCommand(const objects::CBioseq_Handle &bsh, CRef< CCmdComposite > cmd)
CBulkRNAAddPanel()
Constructors.
void OnSelectRNAType(wxCommandEvent &event)
wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE1
void OnAdd18SToComment(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON11
virtual CRef< CCmdComposite > GetCommand()
static bool ShowToolTips()
Should we show tooltips?
static vector< string > GetncRNAClassList()
Definition: RNA_gen.cpp:86
@RNA_ref.hpp User-defined methods of the data storage class.
Definition: RNA_ref.hpp:54
CSeq_entry_Handle –.
#define _(proto)
Definition: ct_nlmzip_i.h:78
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
static void Init(void)
Definition: cursor6.c:76
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NULL
Definition: ncbistd.hpp:225
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
#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 bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
Definition: ncbistr.hpp:5384
static string & ToUpper(string &str)
Convert string to upper case – string& version.
Definition: ncbistr.cpp:424
EType
type of RNA feature
Definition: RNA_ref_.hpp:95
void SetExt(TExt &value)
Assign a value to Ext data member.
Definition: RNA_ref_.cpp:211
void SetType(TType value)
Assign a value to Type data member.
Definition: RNA_ref_.hpp:538
@ eType_ncRNA
non-coding RNA; subsumes snRNA, scRNA, snoRNA
Definition: RNA_ref_.hpp:104
string GetAdjustedRnaName(const string &orig_rna_name)
Definition: utilities.cpp:70
END_EVENT_TABLE()
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
unsigned int a
Definition: ncbi_localip.c:102
static static static wxID_ANY
bool AlreadyHasFeature(objects::CBioseq_Handle bh, string key, string comment)
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Tue May 28 05:51:30 2024 by modify_doxy.py rev. 669887