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

Go to the SVN repository for this file.

1 /* $Id: cds_translation_panel.cpp 47527 2023-08-01 17:52:51Z 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: Colleen Bollin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
36 #include <objects/seq/Seq_inst.hpp>
37 #include <objects/seq/Seq_data.hpp>
41 #include <objmgr/bioseq_ci.hpp>
42 #include <objmgr/scope.hpp>
43 #include <objmgr/seq_vector.hpp>
44 #include <objmgr/seq_vector_ci.hpp>
45 #include <objmgr/util/sequence.hpp>
50 
54 
56 #include <gui/utils/extension.hpp>
60 
61 #include "generic_props_panel.hpp"
62 
63 ////@begin includes
64 ////@end includes
65 
66 #include <wx/treebook.h>
67 #include <wx/panel.h>
68 #include <wx/sizer.h>
69 #include <wx/choice.h>
70 #include <wx/textctrl.h>
71 #include <wx/stattext.h>
72 #include <wx/hyperlink.h>
73 #include <wx/checkbox.h>
74 #include <wx/msgdlg.h>
75 
76 
78 #include "location_panel.hpp"
79 #include "cds_exception_panel.hpp"
80 
83 
84 
85 static const char* const s_ValidExceptions[] = {
86  "annotated by transcript or proteomic data",
87  "rearrangement required for product",
88  "reasons given in citation",
89  "RNA editing"
90 };
91 
94 
96 {
97  vector<string> exceptions;
98  NStr::Split(text, ",", exceptions, 0);
99  NON_CONST_ITERATE(vector<string>, it, exceptions) {
101  if (sc_LegalExceptions.find((*it).c_str()) != sc_LegalExceptions.end()) {
102  return true;
103  }
104  }
105  return false;
106 }
107 
108 /*!
109  * CCDSTranslationPanel type definition
110  */
111 
112 IMPLEMENT_DYNAMIC_CLASS( CCDSTranslationPanel, wxPanel )
113 
114 
115 /*!
116  * CCDSTranslationPanel event table definition
117  */
118 
119 BEGIN_EVENT_TABLE( CCDSTranslationPanel, wxPanel )
120 
121 ////@begin CCDSTranslationPanel event table entries
122  EVT_HYPERLINK( ID_PREDICT_INTERVAL, CCDSTranslationPanel::OnPredictIntervalHyperlinkClicked )
123 
124  EVT_HYPERLINK( ID_RETRANSLATE_LINK, CCDSTranslationPanel::OnRetranslateLinkHyperlinkClicked )
125 
127 
128  EVT_HYPERLINK( ID_IMPORT_CDS_PROTEIN, CCDSTranslationPanel::OnImportCdsProteinHyperlinkClicked )
129 
132 
134 ////@end CCDSTranslationPanel event table entries
135 
137 
138 
139 /*!
140  * CCDSTranslationPanel constructors
141  */
142 
144 {
145  Init();
146 }
147 
148 CCDSTranslationPanel::CCDSTranslationPanel( wxWindow* parent, CSeq_feat& feat, CScope& scope, wxWindowID id,
149  const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) :
150  m_EditedFeat(new CSeq_feat()), m_Scope(&scope), m_EditedBioseq(0), m_add_stop_codon(false)
151 {
152  Init();
153  m_EditedFeat->Assign (feat);
154  if (feat.IsSetProduct()) {
155  const CSeq_id *id = feat.GetProduct().GetId();
156  if (id) {
157  CBioseq_Handle bsh = m_Scope->GetBioseqHandle(*id);
158  if (bsh && bsh.IsProtein()) {
159  m_EditedBioseq = new CBioseq();
160  m_EditedBioseq->Assign(*(bsh.GetCompleteBioseq()));
161  }
162  }
163  }
164  Create(parent, id, caption, pos, size, style);
165  SetRegistryPath("Dialogs.Edit.CDSTranslationPanel");
166  LoadSettings();
167 }
168 
169 static const char* kUpdateGeneSpan = "UpdateGeneSpan";
170 
171 void CCDSTranslationPanel::SetRegistryPath(const string& reg_path)
172 {
173  m_RegPath = reg_path;
174 }
175 
177 {
178  if (!m_RegPath.empty() && m_UpdateGeneSpan)
179  {
181  CRegistryWriteView view = gui_reg.GetWriteView(m_RegPath);
182  view.Set(kUpdateGeneSpan, m_UpdateGeneSpan->GetValue());
183  }
184 }
185 
186 
188 {
189  if (!m_RegPath.empty() && m_UpdateGeneSpan)
190  {
192  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
193  m_UpdateGeneSpan->SetValue(view.GetBool(kUpdateGeneSpan, true));
194  }
195 }
196 
197 
198 /*!
199  * CCDSTranslationPanel creator
200  */
201 
202 bool CCDSTranslationPanel::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
203 {
204 ////@begin CCDSTranslationPanel creation
205  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
206  wxPanel::Create( parent, id, pos, size, style );
207 
208  CreateControls();
209  bool is_empty = m_ProductCtrl->wxItemContainer::IsEmpty();
210  if (is_empty)
211  m_ProductCtrl->Append(_("ABCDE"));
212  if (GetSizer())
213  {
214  GetSizer()->SetSizeHints(this);
215  }
216  Centre();
217  if (is_empty)
218  m_ProductCtrl->Clear();
219 ////@end CCDSTranslationPanel creation
220  return true;
221 }
222 
223 
224 /*!
225  * CCDSTranslationPanel destructor
226  */
227 
229 {
230 ////@begin CCDSTranslationPanel destruction
231  SaveSettings();
232 ////@end CCDSTranslationPanel destruction
233 }
234 
235 
236 /*!
237  * Member initialisation
238  */
239 
241 {
242 ////@begin CCDSTranslationPanel member initialisation
244  m_Frame = NULL;
248  m_ForceNear = NULL;
254 ////@end CCDSTranslationPanel member initialisation
255 }
256 
257 
258 /*!
259  * Control creation for CCDSTranslationPanel
260  */
261 
263 {
264 ////@begin CCDSTranslationPanel content construction
265  CCDSTranslationPanel* itemPanel1 = this;
266 
267  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
268  itemPanel1->SetSizer(itemBoxSizer2);
269 
270  wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(0, 2, 0, 0);
271  itemBoxSizer2->Add(itemFlexGridSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
272 
273  wxStaticText* itemStaticText4 = new wxStaticText( itemPanel1, wxID_STATIC, _("Genetic Code"), wxDefaultPosition, wxDefaultSize, 0 );
274  itemFlexGridSizer3->Add(itemStaticText4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
275 
276  wxArrayString m_GeneticCodeStrings;
277  m_GeneticCode = new wxChoice( itemPanel1, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, m_GeneticCodeStrings, 0 );
279  m_GeneticCode->SetToolTip(_("Choose the genetic code that should be used to translate the nucleotide sequence. For more information, and for the translation tables themselves, see the NCBI Taxonomy page. If the genetic code is already populated from the taxonomy database, do not change this selection."));
280  itemFlexGridSizer3->Add(m_GeneticCode, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
281 
282  wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("Reading Frame"), wxDefaultPosition, wxDefaultSize, 0 );
283  itemFlexGridSizer3->Add(itemStaticText6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
284 
285  wxArrayString m_FrameStrings;
286  m_FrameStrings.Add(_("One"));
287  m_FrameStrings.Add(_("Two"));
288  m_FrameStrings.Add(_("Three"));
289  m_Frame = new wxChoice( itemPanel1, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, m_FrameStrings, 0 );
291  m_Frame->SetToolTip(_("Choose the reading frame in which to translate the sequence."));
292  itemFlexGridSizer3->Add(m_Frame, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
293 
294  wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("Conflict"), wxDefaultPosition, wxDefaultSize, 0 );
295  itemFlexGridSizer3->Add(itemStaticText8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
296 
297  m_ConflictCtrl = new wxCheckBox( itemPanel1, ID_CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
298  m_ConflictCtrl->SetValue(false);
299  itemFlexGridSizer3->Add(m_ConflictCtrl, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
300 
301  wxStaticText* itemStaticText10 = new wxStaticText( itemPanel1, wxID_STATIC, _("Protein Length"), wxDefaultPosition, wxDefaultSize, 0 );
302  itemFlexGridSizer3->Add(itemStaticText10, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
303 
304  m_ProteinLengthTxt = new wxStaticText( itemPanel1, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
305  itemFlexGridSizer3->Add(m_ProteinLengthTxt, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
306 
307  wxStaticLine* itemStaticLine12 = new wxStaticLine( itemPanel1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
308  itemBoxSizer2->Add(itemStaticLine12, 0, wxGROW|wxALL, 5);
309 
310  wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL);
311  itemBoxSizer2->Add(itemBoxSizer13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
312 
313  wxStaticText* itemStaticText14 = new wxStaticText( itemPanel1, wxID_STATIC, _("Protein Product"), wxDefaultPosition, wxDefaultSize, 0 );
314  itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
315 
316  wxArrayString m_ProductCtrlStrings;
318  m_Scope->GetAllTSEs(tses, CScope::eAllTSEs);
319  ITERATE (CScope::TTSE_Handles, handle, tses) {
320  for (CBioseq_CI bioseq_it(*handle, CSeq_inst::eMol_aa); bioseq_it; ++bioseq_it) {
321  string label;
322  CConstRef<CSeq_id> seqid = sequence::GetId(*bioseq_it, sequence::eGetId_Best).GetSeqId();
323  seqid->GetLabel(&label, CSeq_id::eFasta);
324  m_ProductCtrlStrings.Add(ToWxString(label));
325  m_SeqIds[label] = seqid;
326  }
327  }
328  m_ProductCtrl = new wxOwnerDrawnComboBox( itemPanel1, ID_COMBOBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_ProductCtrlStrings, wxCB_SIMPLE|wxTE_PROCESS_ENTER );
329  itemBoxSizer13->Add(m_ProductCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
330 
331  m_ForceNear = new wxCheckBox( itemPanel1, ID_FORCE_NEAR_BTN, _("Force Near, Create Product"), wxDefaultPosition, wxDefaultSize, 0 );
332  m_ForceNear->SetValue(false);
333  itemBoxSizer13->Add(m_ForceNear, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
334 
335  m_TranslationCtrl = new wxTextCtrl( itemPanel1, ID_TEXTCTRL27, wxEmptyString, wxDefaultPosition, wxSize(400, 100), wxTE_MULTILINE|wxTE_READONLY );
336  m_TranslationCtrl->SetBackgroundColour(wxColour(255, 255, 255));
337  m_TranslationCtrl->Enable(false);
338  itemBoxSizer2->Add(m_TranslationCtrl, 0, wxGROW|wxALL, 5);
339 
340  wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxHORIZONTAL);
341  itemBoxSizer2->Add(itemBoxSizer18, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
342 
343  wxHyperlinkCtrl* itemHyperlinkCtrl19 = new wxHyperlinkCtrl( itemPanel1, ID_PREDICT_INTERVAL, _("Predict Interval"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
344  itemBoxSizer18->Add(itemHyperlinkCtrl19, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
345 
346  m_RetranslateLink = new wxHyperlinkCtrl( itemPanel1, ID_RETRANSLATE_LINK, _("Retranslate"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
347  m_RetranslateLink->SetNormalColour(wxColour(0, 0, 255));
348  m_RetranslateLink->SetVisitedColour(wxColour(0, 0, 255));
349  itemBoxSizer18->Add(m_RetranslateLink, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
350 
351  wxHyperlinkCtrl* itemHyperlinkCtrl21 = new wxHyperlinkCtrl( itemPanel1, ID_HYPERLINKCTRL2, _("Adjust for Stop Codon"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
352  itemHyperlinkCtrl21->SetNormalColour(wxColour(0, 0, 255));
353  itemHyperlinkCtrl21->SetVisitedColour(wxColour(0, 0, 255));
354  itemBoxSizer18->Add(itemHyperlinkCtrl21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
355 
356  wxHyperlinkCtrl* itemHyperlinkCtrl22 = new wxHyperlinkCtrl( itemPanel1, ID_IMPORT_CDS_PROTEIN, _("Import Protein Sequence"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
357  itemBoxSizer18->Add(itemHyperlinkCtrl22, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
358 
359  wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxHORIZONTAL);
360  itemBoxSizer2->Add(itemBoxSizer23, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
361 
362  m_RetranslateOnOkBtn = new wxCheckBox( itemPanel1, ID_RETRANSLATE_ON_OK_BTN, _("Retranslate on OK"), wxDefaultPosition, wxDefaultSize, 0 );
363  m_RetranslateOnOkBtn->SetValue(true);
364  DisableRetranslateOnOk((m_EditedFeat->IsSetExcept_text() && IsValidException(m_EditedFeat->GetExcept_text())), x_IsPseudo());
365  itemBoxSizer23->Add(m_RetranslateOnOkBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
366 
367  m_UpdatemRNASpan = new wxCheckBox( itemPanel1, ID_CHECKBOX3, _("Update mRNA span"), wxDefaultPosition, wxDefaultSize, 0 );
368  m_UpdatemRNASpan->SetValue(false);
369  itemBoxSizer23->Add(m_UpdatemRNASpan, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
370 
371  m_UpdateGeneSpan = new wxCheckBox( itemPanel1, ID_UPDATE_GENE_SPAN, _("Update Gene span"), wxDefaultPosition, wxDefaultSize, 0 );
372  m_UpdateGeneSpan->SetValue(true);
373  itemBoxSizer23->Add(m_UpdateGeneSpan, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
374 
375 ////@end CCDSTranslationPanel content construction
376 
378  const CGenetic_code_table::Tdata& codes = code_table.Get();
379 
380  ITERATE (CGenetic_code_table::Tdata, it, codes) {
381  string str = (*it)->GetName();
382  int id = (*it)->GetId();
384  m_GeneticCode->Append(ToWxString(str), (void*)(uintptr_t)id);
385  }
386 
387 }
388 
389 
390 void CCDSTranslationPanel::DisableRetranslateOnOk(bool exception, bool pseudo)
391 {
392  if (exception)
393  m_RetranslateOnOkBtn->SetValue(false);
394  else
395  m_RetranslateOnOkBtn->SetValue(true);
396  m_RetranslateOnOkBtn->Enable(!(exception || pseudo));
397 }
398 
399 
401 {
402  string::size_type pos = code_name.find(';');
403  code_name = (pos != string::npos) ? code_name.substr(0, pos) + ", etc." : code_name;
404 }
405 
406 
408 {
409  if (!wxPanel::TransferDataToWindow()) {
410  return false;
411  }
412 
413  string label;
414  if (m_EditedFeat->IsSetProduct()) {
415  const CSeq_id *id = m_EditedFeat->GetProduct().GetId();
416  if (id) {
417  // always pick the label to be the one from the CDS product unless it's GI
418  if (id->IsGi()) {
419  CBioseq_Handle prot_bsh = m_Scope->GetBioseqHandle(*id);
420  if (prot_bsh) {
421  CConstRef<CSeq_id> prot_seqid = sequence::GetId(prot_bsh, sequence::eGetId_Best).GetSeqId();
422  prot_seqid->GetLabel(&label, CSeq_id::eFasta);
423  m_Scope->RemoveFromHistory(prot_bsh);
424  }
425  }
426  else {
427  m_EditedFeat->GetProduct().GetId()->GetLabel(&label, CSeq_id::eFasta);
428  }
429 
430  // test for GB-6513
431  CBioseq_Handle bsh = m_Scope->GetBioseqHandle(*id);
432  if (bsh) {
434  string seq_label;
435  seqid->GetLabel(&seq_label, CSeq_id::eFasta);
436 
437  // warn user if this label is different from the CDS product_id (GB-6513)
438  string label_feat;
439  auto feat_seqid_handle = sequence::GetId(*m_EditedFeat->GetProduct().GetId(), *m_Scope, sequence::eGetId_Best);
440  if (feat_seqid_handle)
441  feat_seqid_handle.GetSeqId()->GetLabel(&label_feat, CSeq_id::eFasta);
442  else
443  m_EditedFeat->GetProduct().GetId()->GetLabel(&label_feat, CSeq_id::eFasta);
444  if (!NStr::EqualCase(seq_label, label_feat)) {
445  NcbiWarningBox("Protein seq-id (" + seq_label + ") differs from CDS product-id (" + label_feat + ")");
446  }
447  m_Scope->RemoveFromHistory(bsh);
448  }
449  }
450  }
451 
452  m_ProductCtrl->SetValue (ToWxString(label));
454 
455  if (m_EditedBioseq && m_EditedBioseq->IsAa()) {
456  string prot_seq;
457  CSeqVector prot_vec(*m_EditedBioseq, m_Scope);
459  prot_vec.GetSeqData(0, prot_vec.size(), prot_seq);
460  if (m_add_stop_codon)
461  prot_seq += "*";
462  m_TranslationCtrl->SetValue(ToWxString(prot_seq));
463  m_TranslationCtrl->Enable(true);
465  } else {
466  m_TranslationCtrl->SetValue(wxEmptyString);
467  m_ProteinLengthTxt->SetLabel(wxEmptyString);
468  }
469 
470  CCdregion& cds = m_EditedFeat->SetData().SetCdregion();
471  string codeName = "";
472  int codeId = 1;
473 
474  if (cds.IsSetCode()) {
475  const CCdregion::TCode& code = cds.GetCode();
476  codeId = code.GetId();
477  codeName = code.GetName();
478  }
479 
480  if (NStr::IsBlank(codeName)) {
482  const CGenetic_code_table::Tdata& codes = code_table.Get();
483 
484  ITERATE (CGenetic_code_table::Tdata, it, codes) {
485  string str = (*it)->GetName();
486  int id = (*it)->GetId();
487  if (id == codeId) {
489  codeName = str;
490  break;
491  }
492  }
493  }
494  m_GeneticCode->SetStringSelection(ToWxString (codeName));
495 
496  if (cds.IsSetConflict() && cds.GetConflict()) {
497  m_ConflictCtrl->SetValue (true);
498  }
499 
500  if (cds.IsSetFrame()) {
501  switch (cds.GetFrame()) {
503  m_Frame->SetSelection(1);
504  break;
506  m_Frame->SetSelection(2);
507  break;
508  default:
509  m_Frame->SetSelection(0);
510  break;
511  }
512  } else {
513  m_Frame->SetSelection(0);
514  }
515  return true;
516 }
517 
518 
520 {
521  wxWindow* w = this->GetParent();
522  while (w != NULL) {
523  wxTreebook* parent = dynamic_cast<wxTreebook*>(w);
524  if (parent) {
525  return parent;
526  } else {
527  w = w->GetParent();
528  }
529  }
530  return NULL;
531 }
532 
533 
535 {
536  wxTreebook* parent = x_GetTree();
537  if (!parent) {
539  }
540  CGenericPropsPanel* gen_panel = 0;
541  for (size_t i = 0; i < parent->GetPageCount(); ++i) {
542  gen_panel = dynamic_cast<CGenericPropsPanel*>(parent->GetPage(i));
543  if (gen_panel)
544  break;
545  }
546  if (!gen_panel) {
548  }
549  return gen_panel->IsPseudo();
550 }
551 
552 
554 {
555  if (!wxPanel::TransferDataFromWindow()) {
556  return false;
557  }
558 
559  // change product ID
560  string id_string = ToStdString (m_ProductCtrl->GetValue());
561  if (NStr::IsBlank(id_string)) {
562  m_EditedFeat->ResetProduct();
563  } else {
565  if (id)
566  {
567  m_EditedFeat->SetProduct().SetWhole().Assign(*id);
568  if (m_EditedBioseq) {
569  m_EditedBioseq->SetId().clear();
570  m_EditedBioseq->SetId().push_back(id);
571  }
572  }
573  }
574 
575  int index = m_GeneticCode->GetSelection();
576  long id = 1;
577  if (index != wxNOT_FOUND)
578  id = (long)m_GeneticCode->GetClientData(index);
579 
581  ce->SetId(static_cast<CGenetic_code::C_E::TId>(id));
583  code->Set().push_back(ce);
584 
585  CCdregion& cds = m_EditedFeat->SetData().SetCdregion();
586  cds.SetCode(*code);
587 
588  if (m_ConflictCtrl->GetValue ()) {
589  cds.SetConflict(true);
590  } else {
591  cds.ResetConflict();
592  }
593 
594  switch (m_Frame->GetSelection ()) {
595  case 0:
597  break;
598  case 1:
600  break;
601  case 2:
603  break;
604  default:
605  cds.ResetFrame();
606  break;
607  }
608  return true;
609 }
610 
611 
613 {
614  if (!x_CollectData()) {
615  return false;
616  }
617 
618  return true;
619 }
620 
621 
623 {
624  if (m_EditedFeat->IsSetProduct()) {
625  CRef<CSeq_loc> product(new CSeq_loc());
626  product->Assign(m_EditedFeat->GetProduct());
627  feat.SetProduct(*product);
628  } else {
629  feat.ResetProduct();
630  }
631 
632  const CCdregion& cds = m_EditedFeat->GetData().GetCdregion();
633  CCdregion& edit_cds = feat.SetData().SetCdregion();
634  if (cds.IsSetCode()) {
635  CRef<CGenetic_code> new_code(new CGenetic_code());
636  new_code->Assign(cds.GetCode());
637  edit_cds.SetCode(*new_code);
638  } else {
639  edit_cds.ResetCode();
640  }
641 
642  if (cds.IsSetFrame()) {
643  edit_cds.SetFrame(cds.GetFrame());
644  } else {
645  edit_cds.ResetFrame();
646  }
647 
648  if (cds.IsSetConflict() && cds.GetConflict()) {
649  edit_cds.SetConflict(true);
650  } else {
651  edit_cds.ResetConflict();
652  }
653 
654 
655 }
656 
657 
659 {
661  if (m_EditedBioseq && m_EditedBioseq->IsAa()) {
662  // only copy data and length and ID
663  CRef<CSeq_inst> inst(new CSeq_inst());
664  inst->Assign(m_EditedBioseq->GetInst());
665  bioseq.SetInst(*inst);
666  if (m_EditedBioseq->IsSetId()) {
667  CRef<CSeq_id> new_id(new CSeq_id());
668  new_id->Assign(*(m_EditedBioseq->GetId().front()));
669  bioseq.SetId().push_back(new_id);
670  }
671  } else {
672  bioseq.ResetInst();
673  }
674 }
675 
676 
677 /*!
678  * Should we show tooltips?
679  */
680 
682 {
683  return true;
684 }
685 
686 /*!
687  * Get bitmap resources
688  */
689 
690 wxBitmap CCDSTranslationPanel::GetBitmapResource( const wxString& name )
691 {
692  // Bitmap retrieval
693 ////@begin CCDSTranslationPanel bitmap retrieval
694  wxUnusedVar(name);
695  return wxNullBitmap;
696 ////@end CCDSTranslationPanel bitmap retrieval
697 }
698 
699 /*!
700  * Get icon resources
701  */
702 
703 wxIcon CCDSTranslationPanel::GetIconResource( const wxString& name )
704 {
705  // Icon retrieval
706 ////@begin CCDSTranslationPanel icon retrieval
707  wxUnusedVar(name);
708  return wxNullIcon;
709 ////@end CCDSTranslationPanel icon retrieval
710 }
711 
712 
714 {
715  x_CollectData();
716  // get new location and new frame/code, if it has been edited
717  wxWindow* parent = this->GetParent();
718  wxTreebook* tbook = dynamic_cast<wxTreebook*>(parent);
719  if (tbook) {
720  CLocationPanel* locPanel = 0;
721  CCDSExceptionPanel* exceptionPanel = 0;
722 
723  for (size_t i = 0; i < tbook->GetPageCount(); ++i) {
724  if (!locPanel) {
725  locPanel = dynamic_cast<CLocationPanel*>(tbook->GetPage(i));
726  }
727  if (!exceptionPanel) {
728  exceptionPanel = dynamic_cast<CCDSExceptionPanel*>(tbook->GetPage(i));
729  }
730 
731  if (locPanel && exceptionPanel) {
732  break;
733  }
734  }
735  if (locPanel) {
736  locPanel->TransferDataFromWindow();
737  CRef<CSeq_loc> loc = locPanel->GetSeq_loc();
738  m_EditedFeat->SetLocation(*loc);
739  }
740 
741  if (exceptionPanel) {
742  exceptionPanel->TransferDataFromWindow();
743  exceptionPanel->SetExceptions(m_EditedFeat->SetData().SetCdregion());
744  }
745 
746  }
747  x_Translate();
749 }
750 
752 {
753  m_add_stop_codon = false;
754 
755  if (x_IsPseudo())
756  {
758  m_EditedFeat->ResetProduct();
759  return;
760  }
761 
762  string prot;
763  try
764  {
766  }
767  catch(CSeqMapException&) {}
768  if (!prot.empty())
769  {
770  if (!m_EditedBioseq)
771  {
772  m_EditedBioseq.Reset(new CBioseq());
773  }
774  if (NStr::EndsWith(prot, "*"))
775  {
776  prot = prot.substr(0, prot.length() - 1);
777  m_add_stop_codon = true;
778  }
779  m_EditedBioseq->SetInst().ResetExt();
780  m_EditedBioseq->SetInst().SetRepr(CSeq_inst::eRepr_raw);
781  m_EditedBioseq->SetInst().SetSeq_data().SetNcbieaa().Set(prot);
782  m_EditedBioseq->SetInst().SetLength(TSeqPos(prot.length()));
783  m_EditedBioseq->SetInst().SetMol(CSeq_inst::eMol_aa);
784  }
785  else
786  {
788  }
789 }
790 
792 {
793  return m_ForceNear->GetValue();
794 }
795 
796 
797 void CCDSTranslationPanel::SetProductId(const string& val)
798 {
799  m_ProductCtrl->SetValue(ToWxString(val));
802  if (!id) {
803  m_EditedFeat->ResetProduct();
804  m_EditedBioseq->SetId().clear();
805  } else {
806  m_EditedFeat->SetProduct().SetWhole().Assign(*id);
807  m_EditedBioseq->SetId().clear();
808  m_EditedBioseq->SetId().push_back(id);
809  }
810 }
811 
812 
814 {
815  string id_val = ToStdString(m_ProductCtrl->GetValue());
816  if (m_SeqIds.find(id_val) != m_SeqIds.end())
817  {
818  CRef<CSeq_id> id(new CSeq_id);
819  id->Assign(*m_SeqIds[id_val]);
820  return id;
821  }
822  if (!NStr::IsBlank(id_val)) {
823  CRef<CSeq_id> id;
824  try {
825  id.Reset(new CSeq_id(id_val, CSeq_id::fParse_Default));
826  } catch (const CSeqIdException&) {
827  id.Reset(new CSeq_id);
828  if (NStr::StartsWith(id_val, "gnl|"))
829  {
830  NStr::TrimPrefixInPlace(id_val, "gnl|");
831  string db, tag;
832  NStr::SplitInTwo(id_val, ":", db, tag);
833  id->SetGeneral().SetDb(db);
834  id->SetGeneral().SetTag().SetStr(tag);
835  }
836  else
837  {
838  id->SetLocal().SetStr(id_val);
839  }
840  }
841  return id;
842  }
843  return CRef<CSeq_id>(NULL);
844 }
845 
846 
847 /*!
848  * wxEVT_COMMAND_HYPERLINK event handler for ID_HYPERLINKCTRL1
849  */
850 
852 {
853  if (x_IsPseudo() &&
854  wxYES == wxMessageBox(_("Cannot retranslate with pseudo set, remove pseudo flag?"), wxT("Remove pseudo"), wxYES_NO | wxICON_QUESTION))
855  {
856  wxTreebook* parent = x_GetTree();
857  if (!parent) {
858  return;
859  }
860  CGenericPropsPanel* gen_panel = 0;
861  for (size_t i = 0; i < parent->GetPageCount(); ++i) {
862  gen_panel = dynamic_cast<CGenericPropsPanel*>(parent->GetPage(i));
863  if (gen_panel)
864  break;
865  }
866  if (!gen_panel) {
867  return;
868  }
869  gen_panel->ResetPseudo();
870  }
871  Retranslate();
872 }
873 
874 
875 static CRef<CSeq_loc> TruncateSeqLoc (CRef<CSeq_loc> orig_loc, size_t new_len)
876 {
877  CRef<CSeq_loc> new_loc;
878  if (!orig_loc) {
879  return new_loc;
880  }
881  size_t len = 0;
882  for (CSeq_loc_CI it(*orig_loc); it && len < new_len; ++it) {
883  size_t this_len = it.GetRange().GetLength();
884  CConstRef<CSeq_loc> this_loc = it.GetRangeAsSeq_loc();
885  if (len + this_len <= new_len) {
886  if (new_loc) {
887  new_loc->Add(*this_loc);
888  } else {
889  new_loc.Reset(new CSeq_loc());
890  new_loc->Assign(*this_loc);
891  }
892  len += this_len;
893  } else {
894  CRef<CSeq_loc> partial_loc(new CSeq_loc());
895  size_t len_wanted = new_len - len;
896  TSeqPos start = this_loc->GetStart(eExtreme_Biological);
897  if (len_wanted == 1) {
898  // make a point
899  partial_loc->SetPnt().SetPoint(start);
900  } else {
901  // make an interval
902  if (this_loc->IsSetStrand() && this_loc->GetStrand() == eNa_strand_minus) {
903  partial_loc->SetInt().SetFrom(static_cast<CSeq_interval::TFrom>(start - len_wanted + 1));
904  partial_loc->SetInt().SetTo(start);
905  } else {
906  partial_loc->SetInt().SetFrom(start);
907  partial_loc->SetInt().SetTo(static_cast<CSeq_interval::TTo>(start + len_wanted - 1));
908  }
909  }
910  partial_loc->SetId(*this_loc->GetId());
911  if (this_loc->IsSetStrand()) {
912  partial_loc->SetStrand(this_loc->GetStrand());
913  }
916  if (new_loc) {
917  new_loc->Add(*partial_loc);
918  } else {
919  new_loc.Reset(new CSeq_loc());
920  new_loc->Assign(*partial_loc);
921  }
922  len += len_wanted;
923  }
924  }
925 
926  return new_loc;
927 }
928 
929 
931 {
932  TSeqPos loc_start = loc.GetStart(eExtreme_Positional);
933  TSeqPos loc_stop = loc.GetStop(eExtreme_Positional);
934  bool partial_start = loc.IsPartialStart(eExtreme_Positional);
935  bool partial_stop = loc.IsPartialStop(eExtreme_Positional);
936  ENa_strand strand = loc.GetStrand();
937  CRef<CSeq_loc> new_loc(NULL);
938 
939  if (pos < loc_start) {
940  CRef<CSeq_id> id(new CSeq_id());
941  id->Assign(*(loc.GetId()));
942  CRef<CSeq_loc> add(new CSeq_loc(*id, pos, loc_start - 1, strand));
943  add->SetPartialStart(partial_start, eExtreme_Positional);
945  } else if (pos > loc_stop) {
946  CRef<CSeq_id> id(new CSeq_id());
947  id->Assign(*(loc.GetId()));
948  CRef<CSeq_loc> add(new CSeq_loc(*id, loc_stop + 1, pos, strand));
949  add->SetPartialStop(partial_stop, eExtreme_Positional);
951  }
952  return new_loc;
953 }
954 
955 
957 {
958  CSeq_loc_CI it(loc);
960  while (it) {
961  strand = it.GetStrand();
962  ++it;
963  }
964  return strand;
965 }
966 
968 {
969  CRef<CSeq_loc> new_loc;
970 
971  if (!feat || !feat->IsSetLocation()) {
972  return new_loc;
973  }
974  const CSeq_loc& loc = feat->GetLocation();
975 
976  CBioseq_Handle bsh;
977  try
978  {
979  bsh = scope->GetBioseqHandle(*(loc.GetId()));
980  } catch (const CException &) {}
981  if (!bsh) {
982  return new_loc;
983  }
984 
985  const CGenetic_code* code = NULL;
986  if (feat->IsSetData() && feat->GetData().IsCdregion() && feat->GetData().GetCdregion().IsSetCode()) {
987  code = &(feat->GetData().GetCdregion().GetCode());
988  }
989 
990  TSeqPos stop = loc.GetStop(eExtreme_Biological);
991  // figure out if we have a partial codon at the end
992  TSeqPos orig_len = sequence::GetLength(loc, scope);
993  TSeqPos len = orig_len;
994  if (feat->IsSetData() && feat->GetData().IsCdregion() && feat->GetData().GetCdregion().IsSetFrame()) {
995  CCdregion::EFrame frame = feat->GetData().GetCdregion().GetFrame();
996  if (frame == CCdregion::eFrame_two) {
997  len -= 1;
998  } else if (frame == CCdregion::eFrame_three) {
999  len -= 2;
1000  }
1001  }
1002  TSeqPos mod = len % 3;
1003  CRef<CSeq_loc> vector_loc(new CSeq_loc());
1004  vector_loc->SetInt().SetId().Assign(*(loc.GetId()));
1005 
1007  vector_loc->SetInt().SetFrom(0);
1008  vector_loc->SetInt().SetTo(stop + mod - 1);
1009  vector_loc->SetStrand(eNa_strand_minus);
1010  } else {
1011  vector_loc->SetInt().SetFrom(stop - mod + 1);
1012  vector_loc->SetInt().SetTo(bsh.GetInst_Length() - 1);
1013  }
1014 
1015  CSeqVector seq(*vector_loc, *scope, CBioseq_Handle::eCoding_Iupac);
1016  // reserve our space
1017  const size_t usable_size = seq.size();
1018 
1019  // get appropriate translation table
1020  const CTrans_table & tbl =
1023 
1024  // main loop through bases
1025  CSeqVector::const_iterator start = seq.begin();
1026 
1027  size_t i;
1028  size_t k;
1029  int state = 0;
1030  size_t length = usable_size / 3;
1031 
1032  for (i = 0; i < length; ++i) {
1033  // loop through one codon at a time
1034  for (k = 0; k < 3; ++k, ++start) {
1035  state = tbl.NextCodonState(state, *start);
1036  }
1037 
1038  if (tbl.GetCodonResidue (state) == '*') {
1039  CSeq_loc_CI it(loc);
1040  CSeq_loc_CI it_next = it;
1041  ++it_next;
1042  while (it_next) {
1043  CConstRef<CSeq_loc> this_loc = it.GetRangeAsSeq_loc();
1044  if (new_loc) {
1045  new_loc->Add(*this_loc);
1046  } else {
1047  new_loc.Reset(new CSeq_loc());
1048  new_loc->Assign(*this_loc);
1049  }
1050  it = it_next;
1051  ++it_next;
1052  }
1053  CRef<CSeq_loc> last_interval(new CSeq_loc());
1054  CConstRef<CSeq_loc> this_loc = it.GetRangeAsSeq_loc();
1055  size_t this_start = this_loc->GetStart(eExtreme_Positional);
1056  size_t this_stop = this_loc->GetStop(eExtreme_Positional);
1057  size_t extension = ((i + 1) * 3) - mod;
1058  last_interval->SetInt().SetId().Assign(*(this_loc->GetId()));
1059  if (this_loc->IsSetStrand() && this_loc->GetStrand() == eNa_strand_minus) {
1060  last_interval->SetStrand(eNa_strand_minus);
1061  last_interval->SetInt().SetFrom(static_cast<CSeq_interval::TFrom>(this_start - extension));
1062  last_interval->SetInt().SetTo(static_cast<CSeq_interval::TTo>(this_stop));
1063  } else {
1064  last_interval->SetInt().SetFrom(static_cast<CSeq_interval::TFrom>(this_start));
1065  last_interval->SetInt().SetTo(static_cast<CSeq_interval::TTo>(this_stop + extension));
1066  }
1067 
1068  if (new_loc) {
1069  new_loc->Add(*last_interval);
1070  } else {
1071  new_loc.Reset(new CSeq_loc());
1072  new_loc->Assign(*last_interval);
1073  }
1075  new_loc->SetPartialStop(false, eExtreme_Biological);
1076 
1077  return new_loc;
1078  }
1079  }
1080 
1081  if (usable_size < 3 && !new_loc) {
1082  if (loc.GetStrand() == eNa_strand_minus) {
1083  new_loc = SeqLocExtend(loc, 0, scope);
1084  } else {
1085  new_loc = SeqLocExtend(loc, bsh.GetInst_Length() - 1, scope);
1086  }
1087  if (new_loc) {
1088  new_loc->SetPartialStop(true, eExtreme_Biological);
1089  }
1090  }
1091 
1092  return new_loc;
1093 }
1094 
1095 
1096 /*!
1097  * wxEVT_COMMAND_HYPERLINK event handler for ID_HYPERLINKCTRL2
1098  */
1099 
1101 {
1103 
1104  // get new location and new frame/code, if it has been edited
1105  wxWindow* parent = this->GetParent();
1106  wxTreebook* tbook = dynamic_cast<wxTreebook*>(parent);
1107  if (!tbook) {
1108  return;
1109  }
1110 
1111  CLocationPanel* locPanel = nullptr;
1112  CCDSExceptionPanel* exceptionPanel = nullptr;
1113 
1114  for (size_t i = 0; i < tbook->GetPageCount(); ++i) {
1115  if (!locPanel) {
1116  locPanel = dynamic_cast<CLocationPanel*>(tbook->GetPage(i));
1117  }
1118  if (!exceptionPanel) {
1119  exceptionPanel = dynamic_cast<CCDSExceptionPanel*>(tbook->GetPage(i));
1120  }
1121 
1122  if (locPanel && exceptionPanel) {
1123  break;
1124  }
1125  }
1126  if (!locPanel) {
1127  return;
1128  }
1129 
1130  locPanel->TransferDataFromWindow();
1131  CRef<CSeq_loc> loc = locPanel->GetSeq_loc();
1132  m_EditedFeat->SetLocation(*loc);
1133 
1134  if (exceptionPanel) {
1135  exceptionPanel->TransferDataFromWindow();
1136  exceptionPanel->SetExceptions(m_EditedFeat->SetData().SetCdregion());
1137  }
1138 
1139  string prot_str ;
1141  if (!prot_str.empty()) {
1142  CRef<CSeq_loc> new_loc(NULL);
1143 
1144  size_t pos = NStr::Find(prot_str, "*");
1145  if (pos != string::npos) {
1146  // want to truncate the location and retranslate
1147  size_t len_wanted = 3 * (pos + 1);
1148  if (m_EditedFeat->GetData().GetCdregion().IsSetFrame()) {
1149  CCdregion::EFrame frame = m_EditedFeat->GetData().GetCdregion().GetFrame();
1150  if (frame == CCdregion::eFrame_two) {
1151  len_wanted += 1;
1152  } else if (frame == CCdregion::eFrame_three) {
1153  len_wanted += 2;
1154  }
1155  }
1156  if (len_wanted > 0) {
1157  new_loc = TruncateSeqLoc (loc, len_wanted);
1158  if (new_loc) {
1159  new_loc->SetPartialStop(false, eExtreme_Biological);
1160  }
1161  }
1162  } else {
1163  // want to extend the location and retranslate
1165 
1166  if (!new_loc) {
1167  int choice = wxMessageBox(wxT("No stop codon found - extend to full length of sequence (and make partial)?"), wxT("Error"),
1168  wxYES_NO | wxICON_ERROR, NULL);
1169  if (choice == wxYES) {
1170  if (loc->GetStrand() == eNa_strand_minus) {
1171  new_loc = SeqLocExtend(*loc, 0, m_Scope);
1172  } else {
1173  CBioseq_Handle bsh;
1174  try
1175  {
1176  bsh = m_Scope->GetBioseqHandle(*loc);
1177  } catch(const CException &) {}
1178  new_loc = SeqLocExtend(*loc, bsh.GetInst_Length() - 1, m_Scope);
1179  }
1180  if (!new_loc) {
1181  new_loc.Reset(new CSeq_loc());
1182  new_loc->Assign(*loc);
1183  }
1184  new_loc->SetPartialStop(true, eExtreme_Biological);
1185  }
1186  }
1187  }
1188 
1189  if (new_loc) {
1190  m_EditedFeat->SetLocation(*new_loc);
1191  locPanel->SetSeq_loc(m_EditedFeat->SetLocation());
1192  x_Translate();
1194  }
1195  }
1196 }
1197 
1198 
1199 static void s_ExtendIntervalToEnd (CSeq_interval& ival, size_t len)
1200 {
1201  if (ival.IsSetStrand() && ival.GetStrand() == eNa_strand_minus) {
1202  if (ival.GetFrom() > 3) {
1203  ival.SetFrom(ival.GetFrom() - 3);
1204  } else {
1205  ival.SetFrom(0);
1206  }
1207  } else {
1208  if (ival.GetTo() < len - 4) {
1209  ival.SetTo(ival.GetTo() + 3);
1210  } else {
1211  ival.SetTo(static_cast<CSeq_interval::TTo>(len - 1));
1212  }
1213  }
1214 }
1215 
1216 
1218 {
1219  if (!m_EditedBioseq || !m_EditedBioseq->IsAa()) {
1220  return;
1221  }
1222 
1223  CSeq_entry_Handle protein_h;
1225  {
1226  CRef<CSeq_entry> protein_entry(new CSeq_entry());
1227  protein_entry->SetSeq().Assign(*m_EditedBioseq);
1228  protein_h = seh.GetScope().AddTopLevelSeqEntry(*protein_entry);
1229  }
1230 
1231  CProSplign prosplign(CProSplignScoring(), false, true, false, false);
1232 
1233  CBioseq_Handle bsh;
1234  try
1235  {
1236  bsh = seh.GetScope().GetBioseqHandle(cds->GetLocation());
1237  } catch (const CException &) {return;}
1238 
1239  CRef<CSeq_id> seq_id(new CSeq_id());
1240  seq_id->Assign(*(bsh.GetSeqId()));
1241  CRef<CSeq_loc> match_loc(new CSeq_loc(*seq_id, 0, bsh.GetBioseqLength() - 1));
1242 
1243  CRef<CSeq_align> alignment;
1244  try
1245  {
1246  alignment = prosplign.FindAlignment(seh.GetScope(), *(m_EditedBioseq->GetId().front()), *match_loc,
1248  }
1249  catch(const CException& e) {
1250  LOG_POST(Error << "Could not find alignment: " << e.GetMsg());
1251  alignment.Reset();
1252  }
1253  catch (const exception& e) {
1254  LOG_POST(Error << "Could not find alignment: " << e.what());
1255  alignment.Reset();
1256  }
1257 
1258  if (protein_h)
1259  seh.GetScope().RemoveTopLevelSeqEntry(protein_h);
1260 
1261  CRef<CSeq_loc> cds_loc(new CSeq_loc());
1262  bool found_start_codon = false;
1263  bool found_stop_codon = false;
1264  if (alignment && alignment->IsSetSegs() && alignment->GetSegs().IsSpliced()) {
1265  CRef<CSeq_id> seq_id (new CSeq_id());
1266  seq_id->Assign(*match_loc->GetId());
1267 
1268  ITERATE (CSpliced_seg::TExons, exon_it, alignment->GetSegs().GetSpliced().GetExons()) {
1269 
1270  TSeqPos from = (*exon_it)->GetGenomic_start();
1271  CRangeCollection<TSeqPos> insertions = (*exon_it)->GetRowSeq_insertions(1, alignment->GetSegs().GetSpliced());
1272  for (auto &ins : insertions)
1273  {
1274  CRef<CSeq_loc> exon2(new CSeq_loc(*seq_id, from, ins.GetFrom() - 1));
1275  from = ins.GetTo() + 1;
1276  if ((*exon_it)->IsSetGenomic_strand()) {
1277  exon2->SetStrand((*exon_it)->GetGenomic_strand());
1278  } else if (alignment->GetSegs().GetSpliced().IsSetGenomic_strand()) {
1279  exon2->SetStrand(alignment->GetSegs().GetSpliced().GetGenomic_strand());
1280  }
1281  cds_loc->SetMix().Set().push_back(exon2);
1282  }
1283 
1284  CRef<CSeq_loc> exon(new CSeq_loc(*seq_id, from, (*exon_it)->GetGenomic_end()));
1285  if ((*exon_it)->IsSetGenomic_strand()) {
1286  exon->SetStrand((*exon_it)->GetGenomic_strand());
1287  } else if (alignment->GetSegs().GetSpliced().IsSetGenomic_strand()) {
1288  exon->SetStrand(alignment->GetSegs().GetSpliced().GetGenomic_strand());
1289  }
1290 
1291  cds_loc->SetMix().Set().push_back(exon);
1292  }
1293 
1294 
1296  alignment->GetSegs().GetSpliced().GetModifiers()) {
1297  if ((*mod_it)->IsStart_codon_found()) {
1298  found_start_codon = (*mod_it)->GetStart_codon_found();
1299  }
1300  if ((*mod_it)->IsStop_codon_found()) {
1301  found_stop_codon = (*mod_it)->GetStop_codon_found();
1302  }
1303  }
1304 
1305  }
1306 
1307  if (!cds_loc->IsMix()) {
1308  //no exons, no match
1309  string label;
1310  m_EditedBioseq->GetId().front()->GetLabel(&label, CSeq_id::eFasta);
1311  string error = "Unable to find coding region location for protein sequence " + label + ". Import failed.";
1312  wxMessageBox(ToWxString(error), wxT("Error"),
1313  wxOK | wxICON_ERROR, NULL);
1314  return;
1315  } else {
1316  if (cds_loc->GetMix().Get().size() == 1) {
1317  CRef<CSeq_loc> exon = cds_loc->SetMix().Set().front();
1318  cds_loc->Assign(*exon);
1319  }
1320  }
1321  if (!found_start_codon) {
1322  cds_loc->SetPartialStart(true, eExtreme_Biological);
1323  }
1324  if (found_stop_codon) {
1325  // extend to cover stop codon
1326  size_t len = bsh.GetInst_Length();
1327  if (cds_loc->IsMix()) {
1328  s_ExtendIntervalToEnd(cds_loc->SetMix().Set().back()->SetInt(), len);
1329  } else {
1330  s_ExtendIntervalToEnd(cds_loc->SetInt(), len);
1331  }
1332  } else {
1333  cds_loc->SetPartialStop(true, eExtreme_Biological);
1334  }
1335 
1336 
1337  // set new location and frame
1338  wxWindow* parent = this->GetParent();
1339  wxTreebook* tbook = dynamic_cast<wxTreebook*>(parent);
1340  if (!tbook) {
1341  return;
1342  }
1343 
1344  CLocationPanel* locPanel = 0;
1345  CCDSExceptionPanel* exceptionPanel = 0;
1346 
1347  for (size_t i = 0; i < tbook->GetPageCount(); ++i) {
1348  if (!locPanel) {
1349  locPanel = dynamic_cast<CLocationPanel*>(tbook->GetPage(i));
1350  }
1351  if (!exceptionPanel) {
1352  exceptionPanel = dynamic_cast<CCDSExceptionPanel*>(tbook->GetPage(i));
1353  }
1354 
1355  if (locPanel && exceptionPanel) {
1356  break;
1357  }
1358  }
1359  if (!locPanel) {
1360  return;
1361  }
1362 
1363  m_EditedFeat->SetLocation(*cds_loc);
1364  locPanel->SetSeq_loc(m_EditedFeat->SetLocation());
1365 }
1366 
1368 {
1369  CBioseq_Handle bsh;
1370  CSeq_loc_CI it(loc);
1371  while (it)
1372  {
1373  try
1374  {
1375  bsh = scope.GetBioseqHandle(it.GetSeq_id());
1376  }
1377  catch (const CException&) {}
1378  if (bsh)
1379  break;
1380  ++it;
1381  }
1382  return bsh;
1383 }
1384 
1386 {
1387  CRef<CSeq_entry> protein_entry(new CSeq_entry());
1388  protein_entry->SetSeq().Assign(protein);
1390  int offset = 1;
1391  string id_label;
1392  bool create_general_only = edit::IsGeneralIdProtPresent(seh);
1393  CRef<CSeq_id> product_id = edit::GetNewProtId(bsh, offset, id_label, create_general_only);
1394  protein_entry->SetSeq().ResetId();
1395  protein_entry->SetSeq().SetId().push_back(product_id);
1396 
1397  if (!m_EditedBioseq) {
1398  m_EditedBioseq.Reset(new CBioseq());
1399  }
1400  m_EditedBioseq->Assign(protein_entry->GetSeq());
1401  m_add_stop_codon = false;
1402 
1403  if (cds->IsSetExcept_text() && IsValidException(cds->GetExcept_text())) {
1404  m_RetranslateOnOkBtn->SetValue(false);
1406  return;
1407  }
1408  // x_SetLocationForProtein(cds, seh); // GB-6528
1410 }
1411 
1412 
1413 /*!
1414  * wxEVT_COMMAND_HYPERLINK event handler for ID_IMPORT_CDS_PROTEIN
1415  */
1416 
1418 {
1419  CRef<CFileLoadWizard> fileManager(new CFileLoadWizard());
1420  vector<string> format_ids;
1421  format_ids.push_back("file_loader_fasta");
1422  fileManager->LoadFormats(format_ids);
1423 
1424  vector<CIRef<IOpenObjectsPanelClient> > loadManagers;
1425  loadManagers.push_back(CIRef<IOpenObjectsPanelClient>(fileManager.GetPointer()));
1426 
1427  COpenObjectsDlg dlg(NULL);
1428  dlg.SetSize(710, 480);
1429 
1430  dlg.SetRegistryPath("Dialogs.Edit.OpenTable");
1431 // dlg.SetServiceLocator(workbench);
1432  dlg.SetManagers(loadManagers);
1433 
1434  if (dlg.ShowModal() == wxID_OK) {
1435  CIRef<IObjectLoader> object_loader(dlg.GetObjectLoader());
1436  if (!object_loader) {
1437  wxMessageBox(wxT("Failed to get object loader"), wxT("Error"),
1438  wxOK | wxICON_ERROR);
1439  }
1440  else {
1441  IExecuteUnit* execute_unit = dynamic_cast<IExecuteUnit*>(object_loader.GetPointer());
1442  if (execute_unit) {
1443  if (!execute_unit->PreExecute())
1444  return;
1445 
1446  if (!GUI_AsyncExecUnit(*execute_unit, wxT("Reading file(s)...")))
1447  return; // Canceled
1448 
1449  if (!execute_unit->PostExecute())
1450  return;
1451  }
1452  const CBioseq* seq = NULL;
1453  const IObjectLoader::TObjects& objects = object_loader->GetObjects();
1455  const CObject& ptr = obj_it->GetObject();
1456  seq = dynamic_cast<const CBioseq*>(&ptr);
1457  if (seq) {
1458  break;
1459  } else {
1460  const CSeq_entry* entry = dynamic_cast<const CSeq_entry*>(&ptr);
1461  if (entry && entry->IsSeq()) {
1462  seq = &(entry->GetSeq());
1463  break;
1464  }
1465  }
1466  }
1467  if (seq && seq->IsAa()) {
1469  } else {
1470  wxMessageBox(wxT("Please import a protein sequence file"), wxT("Error"),
1471  wxOK | wxICON_ERROR);
1472  }
1473  }
1474  }
1475 
1476 }
1477 
1478 
1479 /*!
1480  * wxEVT_COMMAND_HYPERLINK event handler for ID_PREDICT_INTERVAL
1481  */
1482 
1484 {
1485  wxBusyCursor wait;
1486 
1489 }
1490 
1491 void CCDSTranslationPanel::OnProductChanged(wxCommandEvent& event)
1492 {
1493  UpdateForceNear();
1494 }
1495 
1497 {
1498  string val = ToStdString(m_ProductCtrl->GetValue());
1500 }
1501 
1503 {
1504  if (x_IsPseudo())
1505  {
1506  m_ForceNear->SetValue(false);
1507  m_ForceNear->Disable();
1508  }
1509  else if (NStr::IsBlank(val))
1510  {
1511  m_ForceNear->SetValue(true);
1512  m_ForceNear->Disable();
1513  }
1514  else if (m_SeqIds.find(val) == m_SeqIds.end())
1515  {
1516  m_ForceNear->SetValue(true);
1517  m_ForceNear->Enable();
1518  }
1519  else
1520  {
1521  m_ForceNear->SetValue(false);
1522  m_ForceNear->Enable();
1523  }
1524 }
1525 
1527 {
1528  if (!x_IsPseudo() && NStr::IsBlank(ToStdString(m_TranslationCtrl->GetValue())) && !m_RetranslateOnOkBtn->GetValue()) {
1529  wxMessageBox(wxT("A coding region usually has to have a protein translation unless it is pseudo"), wxT("Warning"), wxOK | wxICON_ERROR, this);
1530  }
1531 }
1532 
static CRef< CScope > m_Scope
@ eExtreme_Positional
numerical value
Definition: Na_strand.hpp:63
@ eExtreme_Biological
5' and 3'
Definition: Na_strand.hpp:62
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
bool GUI_AsyncExecUnit(IExecuteUnit &exec_unit, const wxString &msg)
Definition: async_call.cpp:53
#define ID_COMBOBOX
CRef< objects::CSeq_id > GetNewProtId(objects::CBioseq_Handle bsh, int &offset, string &id_label, bool general_only)
bool IsGeneralIdProtPresent(objects::CSeq_entry_Handle tse)
USING_SCOPE(objects)
CStaticArraySet< const char *, PNocase_CStr > TLegalExceptions
CRef< CSeq_loc > SeqLocExtend(const CSeq_loc &loc, TSeqPos pos, CScope *scope)
static CRef< CSeq_loc > TruncateSeqLoc(CRef< CSeq_loc > orig_loc, size_t new_len)
static CRef< CSeq_loc > ExtendToStopCodon(CRef< CSeq_feat > feat, CScope *scope)
ENa_strand GetStrandForLastInterval(const CSeq_loc &loc)
CBioseq_Handle GetBioseqHandleForMultihomeLocation(CScope &scope, const CSeq_loc &loc)
static void s_ExtendIntervalToEnd(CSeq_interval &ival, size_t len)
DEFINE_STATIC_ARRAY_MAP(TLegalExceptions, sc_LegalExceptions, s_ValidExceptions)
static const char * kUpdateGeneSpan
static const char *const s_ValidExceptions[]
CBioseq_CI –.
Definition: bioseq_ci.hpp:69
CBioseq_Handle –.
bool IsAa(void) const
Definition: Bioseq.cpp:350
virtual bool TransferDataFromWindow()
void SetExceptions(objects::CCdregion &cds)
void Init()
Initialises member variables.
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)
CCdregion –.
Definition: Cdregion.hpp:66
virtual void SetRegistryPath(const string &path)
Definition: dialog.cpp:59
static const CTrans_table & GetTransTable(int id)
static const CGenetic_code_table & GetCodeTable(void)
CRegistryWriteView GetWriteView(const string &section)
get a read-write view at a particular level.
Definition: registry.cpp:462
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
void SetSeq_loc(CSerialObject &object)
virtual bool TransferDataFromWindow()
CRef< objects::CSeq_loc > GetSeq_loc() const
CObject –.
Definition: ncbiobj.hpp:180
IObjectLoader * GetObjectLoader()
void SetManagers(vector< CIRef< IOpenObjectsPanelClient > > &managers)
Output filtering parameters.
Definition: prosplign.hpp:156
@ ePassThrough
all zeroes - no filtering
Definition: prosplign.hpp:162
spliced protein to genomic alignment
Definition: prosplign.hpp:299
CRef< objects::CSeq_align > FindAlignment(objects::CScope &scope, const objects::CSeq_id &protein, const objects::CSeq_loc &genomic, CProSplignOutputOptions output_options=CProSplignOutputOptions())
Aligns protein to a region on genomic sequence.
Definition: prosplign.hpp:326
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
bool GetBool(const string &key, bool default_val=false) const
Definition: reg_view.cpp:241
void Set(const string &key, int val)
access a named key at this level, with no recursion
Definition: reg_view.cpp:533
CScope –.
Definition: scope.hpp:92
CSeqIdException –.
Definition: Seq_id.hpp:1001
SeqMap related exceptions.
CSeqVector –.
Definition: seq_vector.hpp:65
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
Definition: Seq_loc.hpp:453
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
Definition: tse_handle.cpp:205
char GetCodonResidue(int state) const
static int NextCodonState(int state, unsigned char ch)
virtual bool PreExecute()=0
virtual bool PostExecute()=0
vector< SObject > TObjects
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
#define _(proto)
Definition: ct_nlmzip_i.h:78
#define false
Definition: bool.h:36
static void Init(void)
Definition: cursor6.c:76
static const char * str(char *buf, int n)
Definition: stats.c:84
int offset
Definition: replacements.h:160
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
#define NULL
Definition: ncbistd.hpp:225
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
Definition: ncbiexpt.cpp:342
void NcbiWarningBox(const string &message, const string &title="Warning")
specialized Message Box function for reporting non-critical errors
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
Definition: Seq_id.cpp:318
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
Definition: Seq_id.cpp:2040
@ fParse_Default
By default in ParseIDs and IsValid, allow raw parsable non-numeric accessions and plausible local acc...
Definition: Seq_id.hpp:102
@ eFasta
Tagged ID in NCBI's traditional FASTA style.
Definition: Seq_id.hpp:607
void SetMix(TMix &v)
Definition: Seq_loc.hpp:987
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
Definition: Seq_loc.cpp:3222
ENa_strand GetStrand(void) const
Get the location's strand.
Definition: Seq_loc.cpp:882
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
Definition: Seq_loc.cpp:337
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
Definition: Seq_loc.cpp:3474
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
Definition: Seq_loc.cpp:915
CConstRef< CSeq_loc > GetRangeAsSeq_loc(void) const
Get seq-loc for the current iterator position.
Definition: Seq_loc.cpp:2585
void SetPnt(TPnt &v)
Definition: Seq_loc.hpp:985
void SetInt(TInt &v)
Definition: Seq_loc.hpp:983
void Add(const CSeq_loc &other)
Simple adding of seq-locs.
Definition: Seq_loc.cpp:3875
bool IsSetStrand(EIsSetStrand flag=eIsSetStrand_Any) const
Check if strand is set for any/all part(s) of the seq-loc depending on the flag.
Definition: Seq_loc.cpp:858
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
Definition: Seq_loc.hpp:941
void SetPartialStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (lt/gt - indicating partial interval)
Definition: Seq_loc.cpp:3280
ENa_strand GetStrand(void) const
Definition: Seq_loc.hpp:1056
const CSeq_id & GetSeq_id(void) const
Get seq_id of the current location.
Definition: Seq_loc.hpp:1028
void SetStrand(ENa_strand strand)
Set the strand for all of the location's ranges.
Definition: Seq_loc.cpp:5196
void SetPartialStop(bool val, ESeqLocExtremes ext)
Definition: Seq_loc.cpp:3313
bool IsPartialStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:3251
TSeqPos GetStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:963
@ fMerge_AbuttingOnly
Definition: Seq_loc.hpp:327
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
CRef< CSeq_loc > Seq_loc_Add(const CSeq_loc &loc1, const CSeq_loc &loc2, CSeq_loc::TOpFlags flags, CScope *scope)
Add two seq-locs.
bool IsPseudo(const CSeq_feat &feat, CScope &scope)
Determines whether given feature is pseudo, using gene associated with feature if necessary Checks to...
Definition: sequence.cpp:1428
static void Translate(const string &seq, string &prot, const CGenetic_code *code, bool include_stop=true, bool remove_trailing_X=false, bool *alt_start=NULL, bool is_5prime_complete=true, bool is_3prime_complete=true)
Translate a string using a specified genetic code.
Definition: sequence.cpp:4095
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
Definition: sequence.hpp:101
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
Definition: scope.cpp:522
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
void RemoveTopLevelSeqEntry(const CTSE_Handle &entry)
Revoke TSE previously added using AddTopLevelSeqEntry() or AddBioseq().
Definition: scope.cpp:376
vector< CSeq_entry_Handle > TTSE_Handles
Definition: scope.hpp:645
@ eAllTSEs
Definition: scope.hpp:643
@ eMissing_Null
Definition: scope.hpp:157
const CTSE_Handle & GetTSE_Handle(void) const
Get CTSE_Handle of containing TSE.
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
TSeqPos GetBioseqLength(void) const
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
bool IsProtein(void) const
TInst_Length GetInst_Length(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
Definition: seq_vector.cpp:304
TSeqPos size(void) const
Definition: seq_vector.hpp:291
void SetCoding(TCoding coding)
const_iterator begin(void) const
Definition: seq_vector.hpp:298
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
unsigned int uintptr_t
Definition: ncbitype.h:197
#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 list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
Definition: ncbistr.cpp:3452
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5432
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
Definition: ncbistr.cpp:3192
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
Definition: ncbistr.cpp:2882
static bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another string.
Definition: ncbistr.hpp:5327
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5414
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
Definition: ncbistr.cpp:3545
static void TrimPrefixInPlace(string &str, const CTempString prefix, ECase use_case=eCase)
Trim prefix from a string (in-place)
Definition: ncbistr.cpp:3233
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
static const char label[]
bool IsSetSegs(void) const
Check if a value has been assigned to Segs data member.
Definition: Seq_align_.hpp:909
TGenomic_strand GetGenomic_strand(void) const
Get the Genomic_strand member data.
const TSpliced & GetSpliced(void) const
Get the variant data.
Definition: Seq_align_.cpp:219
list< CRef< CSpliced_seg_modifier > > TModifiers
bool IsSetGenomic_strand(void) const
Check if a value has been assigned to Genomic_strand data member.
list< CRef< CSpliced_exon > > TExons
const TExons & GetExons(void) const
Get the Exons member data.
bool IsSpliced(void) const
Check if variant Spliced is selected.
Definition: Seq_align_.hpp:778
const TModifiers & GetModifiers(void) const
Get the Modifiers member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
Definition: Seq_align_.hpp:921
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
Definition: Seq_feat_.hpp:913
bool IsSetCode(void) const
genetic code used Check if a value has been assigned to Code data member.
Definition: Cdregion_.hpp:700
bool IsCdregion(void) const
Check if variant Cdregion is selected.
void ResetCode(void)
Reset Code data member.
Definition: Cdregion_.cpp:63
void SetProduct(TProduct &value)
Assign a value to Product data member.
Definition: Seq_feat_.cpp:110
void SetCode(TCode &value)
Assign a value to Code data member.
Definition: Cdregion_.cpp:68
list< CRef< CGenetic_code > > Tdata
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
bool IsSetConflict(void) const
conflict Check if a value has been assigned to Conflict data member.
Definition: Cdregion_.hpp:559
TFrame GetFrame(void) const
Get the Frame member data.
Definition: Cdregion_.hpp:534
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
const TExcept_text & GetExcept_text(void) const
Get the Except_text member data.
Definition: Seq_feat_.hpp:1405
bool IsSetExcept_text(void) const
explain if except=TRUE Check if a value has been assigned to Except_text data member.
Definition: Seq_feat_.hpp:1393
const TCode & GetCode(void) const
Get the Code member data.
Definition: Cdregion_.hpp:712
void ResetFrame(void)
Reset Frame data member.
Definition: Cdregion_.hpp:521
void ResetConflict(void)
Reset Conflict data member.
Definition: Cdregion_.hpp:571
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
const TCdregion & GetCdregion(void) const
Get the variant data.
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
const Tdata & Get(void) const
Get the member data.
void ResetProduct(void)
Reset Product data member.
Definition: Seq_feat_.cpp:105
void SetConflict(TConflict value)
Assign a value to Conflict data member.
Definition: Cdregion_.hpp:587
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
Definition: Seq_feat_.hpp:1084
void SetFrame(TFrame value)
Assign a value to Frame data member.
Definition: Cdregion_.hpp:540
TConflict GetConflict(void) const
Get the Conflict member data.
Definition: Cdregion_.hpp:578
bool IsSetFrame(void) const
Check if a value has been assigned to Frame data member.
Definition: Cdregion_.hpp:509
bool IsSetLocation(void) const
feature made from Check if a value has been assigned to Location data member.
Definition: Seq_feat_.hpp:1105
@ eFrame_three
reading frame
Definition: Cdregion_.hpp:98
void SetTo(TTo value)
Assign a value to To data member.
bool IsMix(void) const
Check if variant Mix is selected.
Definition: Seq_loc_.hpp:552
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
TFrom GetFrom(void) const
Get the From member data.
virtual void Reset(void)
Reset the whole object.
Definition: Seq_id_.cpp:56
void SetFrom(TFrom value)
Assign a value to From data member.
const Tdata & Get(void) const
Get the member data.
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
TStrand GetStrand(void) const
Get the Strand member data.
bool IsGi(void) const
Check if variant Gi is selected.
Definition: Seq_id_.hpp:883
TTo GetTo(void) const
Get the To member data.
const TMix & GetMix(void) const
Get the variant data.
Definition: Seq_loc_.cpp:282
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
const TSeq & GetSeq(void) const
Get the variant data.
Definition: Seq_entry_.cpp:102
bool IsSeq(void) const
Check if variant Seq is selected.
Definition: Seq_entry_.hpp:257
TSeq & SetSeq(void)
Select the variant.
Definition: Seq_entry_.cpp:108
TId & SetId(void)
Assign a value to Id data member.
Definition: Bioseq_.hpp:296
void ResetId(void)
Reset Id data member.
Definition: Bioseq_.cpp:54
void SetInst(TInst &value)
Assign a value to Inst data member.
Definition: Bioseq_.cpp:86
void ResetInst(void)
Reset Inst data member.
Definition: Bioseq_.cpp:77
@ eRepr_raw
continuous sequence
Definition: Seq_inst_.hpp:94
@ e_Ncbieaa
extended ASCII 1 letter aa codes
Definition: Seq_data_.hpp:111
END_EVENT_TABLE()
int i
int len
static void text(MDB_val *v)
Definition: mdb_dump.c:62
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
const char * tag
Int mod(Int i, Int j)
Definition: njn_integer.hpp:67
Definition: inftrees.h:24
#define ID_HYPERLINKCTRL2
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Thu Jul 11 17:54:41 2024 by modify_doxy.py rev. 669887