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

Go to the SVN repository for this file.

1  /* $Id: edit_sequence.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: Igor Filippov
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 ////@begin includes
33 ////@end includes
34 #include <sstream>
35 
36 #include <objmgr/scope.hpp>
38 #include <objmgr/seq_vector.hpp>
39 
40 #include <objmgr/util/sequence.hpp>
41 #include <objmgr/util/feature.hpp>
43 #include <gui/objutils/utils.hpp>
56 #include <objects/seq/Pubdesc.hpp>
62 // For compilers that support precompilation, includes "wx/wx.h".
63 #include "wx/wxprec.h"
64 
65 #ifdef __BORLANDC__
66 #pragma hdrstop
67 #endif
68 
69 #ifndef WX_PRECOMP
70 #include "wx/wx.h"
71 #endif
72 
73 #include <wx/button.h>
74 #include <wx/statbox.h>
75 #include <wx/stattext.h>
76 #include <wx/textdlg.h>
77 #include <wx/msgdlg.h>
78 #include <wx/display.h>
79 #include <wx/hyperlink.h>
80 
83 
84 ////@begin XPM images
85 ////@end XPM images
86 
87 
88 
90 
91 
92 
93 IMPLEMENT_DYNAMIC_CLASS( CEditSequence, wxFrame )
94 
95 
96 /*!
97  * CEditSequence event table definition
98  */
99 
100 
101 BEGIN_EVENT_TABLE( CEditSequence, wxFrame )
102 
109 
112 
115 
118 
121 
124 
127 
130 
133 
136 
139 
142 
145 
148 
150 
157 
159 
226 
228 
230 
232 
233 
234 static
235 WX_DEFINE_MENU(kAnnotateMenu)
236  WX_SUBMENU_EXT("gene/mRNA/CDS")
246  WX_SUBMENU_EXT("Structural RNAs")
254  WX_SUBMENU_EXT("Regulatory")
262  WX_SUBMENU_EXT("Protein Features")
268  WX_SUBMENU_EXT("Other Features")
284 
285  WX_SUBMENU_INT("Genes and Named Regions")
303  WX_SUBMENU_INT("Coding Regions and Transcripts")
312  WX_SUBMENU_INT("Structural RNAs")
319  WX_SUBMENU_INT("Bibliographic and Comments")
323  WX_SUBMENU_INT("Sites and Bonds")
332  WX_SUBMENU_INT("Remaining Features")
352 WX_END_MENU()
353 
354 
355 /*!
356  * CEditSequence constructors
357  */
358 
360 {
361  Init();
362 }
363 
364 
365 const char* kExclusiveEditDescr = "The Sequence editor requires exclusive access to a project";
366 
367 CEditSequence::CEditSequence( wxWindow* parent, const CSeq_loc *loc, CScope &scope, ICommandProccessor* processor, int start,
368  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
369  : m_loc(loc), m_scope(&scope), m_start(start), m_readonly_timer(this, READONLY_TIMER_ID)
370 {
371  m_UndoManager = dynamic_cast<IUndoManager*>(processor);
372  Init();
373  Create(parent, id, caption, pos, size, style);
374  if (m_is_nucleotide)
375  {
376  SetRegistryPath("Dialogs.Edit.EditNucleotideSequence");
377  }
378  LoadSettings();
379  if (m_Panel)
380  m_Panel->InitPanel();
382 }
383 
384 
385 bool CEditSequence::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
386 {
387 ////@begin CEditSequence creation
388 // SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
389  wxFrame::Create( parent, id, caption, pos, size, style );
390 
391  CreateControls();
392  if (GetSizer())
393  {
394  GetSizer()->SetSizeHints(this);
395  }
396 
397  Centre(wxBOTH|wxCENTRE_ON_SCREEN);
398 ////@end CEditSequence creation
399  return true;
400 }
401 
402 
403 /*!
404  * CEditSequence destructor
405  */
406 
408 {
409 ////@begin CEditSequence destruction
410 ////@end CEditSequence destruction
411 
412  if (m_UndoManager && m_seh && m_NumCmds > 0)
414  SaveSettings();
415 }
416 
417 static const char* kFrameWidth = "Frame Width";
418 static const char* kFrameHeight = "Frame Height";
419 static const char* kFramePosX = "Frame Position X";
420 static const char* kFramePosY = "Frame Position Y";
421 
422 void CEditSequence::SetRegistryPath(const string& reg_path)
423 {
424  m_RegPath = reg_path;
425 }
426 
428 {
429  if (m_RegPath.empty())
430  return;
431 
433  CRegistryWriteView view = gui_reg.GetWriteView(m_RegPath);
434 
435  view.Set(kFrameWidth,GetScreenRect().GetWidth());
436  view.Set(kFrameHeight,GetScreenRect().GetHeight());
437  view.Set(kFramePosX,GetScreenPosition().x);
438  view.Set(kFramePosY,GetScreenPosition().y);
439 }
440 
441 
443 {
444  if (m_RegPath.empty())
445  return;
446 
448  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
449 
450  int width = view.GetInt(kFrameWidth, -1);
451  int height = view.GetInt(kFrameHeight, -1);
452  if (width >= 0 && height >= 0)
453  SetSize(wxSize(width,height));
454 
455  int pos_x = view.GetInt(kFramePosX, -1);
456  int pos_y = view.GetInt(kFramePosY, -1);
457 
458  if (pos_x >= 0 && pos_y >= 0)
459  {
460  int max_x = 0;
461  for (auto i = 0; i < wxDisplay::GetCount(); i++) // also see gui/widgets/wx/wx_utils.cpp:CorrectWindowRect() for alternative window position validation
462  {
463  wxDisplay display(i);
464  max_x += display.GetGeometry().GetWidth();
465  }
466  if (pos_x + width > max_x) pos_x = wxGetDisplaySize().GetWidth()-width-5;
467  if (pos_y + height > wxGetDisplaySize().GetHeight()) pos_y = wxGetDisplaySize().GetHeight()-height-5;
468 
469  SetPosition(wxPoint(pos_x,pos_y));
470  }
471 }
472 
473 /*!
474  * Member initialisation
475  */
476 
478 {
479  m_modified = false;
480  m_Panel = NULL;
481  m_Pos = NULL;
483  m_RangeFrom = NULL;
484  m_RangeTo = NULL;
485  m_NumCmds = 0;
488 }
489 
490 
491 /*!
492  * Control creation for CEditSequence
493  */
494 
496 {
497  wxMenuBar *menubar = new wxMenuBar();
498  wxMenu *menu = new wxMenu();
499  menubar->Append(menu, wxT("&Show"));
500 
501  wxMenu *translate_menu = new wxMenu();
502 
503  m_translate_item = new wxMenuItem(menu, ID_SHOW_TRANSLATE_EDSEQ_MENU, _("+1\tAlt+1"), _("Show translation at offset 0"), wxITEM_CHECK);
504  translate_menu->Append(m_translate_item);
505 
506  m_translate_item1 = new wxMenuItem(menu, ID_SHOW_TRANSLATE1_EDSEQ_MENU, _("+2\tAlt+2"), _("Show translation at offset 1"), wxITEM_CHECK);
507  translate_menu->Append(m_translate_item1);
508 
509  m_translate_item2 = new wxMenuItem(menu, ID_SHOW_TRANSLATE2_EDSEQ_MENU, _("+3\tAlt+3"), _("Show translation at offset 2"), wxITEM_CHECK);
510  translate_menu->Append(m_translate_item2);
511 
512  m_translate_item_all = new wxMenuItem(menu, ID_SHOW_TRANSLATE_ALL_EDSEQ_MENU, _("All +\tAlt++"), _("Show translation at all + offsets"), wxITEM_CHECK);
513  translate_menu->Append(m_translate_item_all);
514 
515  m_revtranslate_item = new wxMenuItem(menu, ID_SHOW_REVTRANSLATE_EDSEQ_MENU, _("-1\tCtrl+1"), _("Show translation at offset 0"), wxITEM_CHECK);
516  translate_menu->Append(m_revtranslate_item);
517 
518  m_revtranslate_item1 = new wxMenuItem(menu, ID_SHOW_REVTRANSLATE1_EDSEQ_MENU, _("-2\tCtrl+2"), _("Show translation at offset -1"), wxITEM_CHECK);
519  translate_menu->Append(m_revtranslate_item1);
520 
521  m_revtranslate_item2 = new wxMenuItem(menu, ID_SHOW_REVTRANSLATE2_EDSEQ_MENU, _("-3\tCtrl+3"), _("Show translation at offset -2"), wxITEM_CHECK);
522  translate_menu->Append(m_revtranslate_item2);
523 
524  m_revtranslate_item_all = new wxMenuItem(menu, ID_SHOW_REVTRANSLATE_ALL_EDSEQ_MENU, _("All -\tCtrl+-"), _("Show translation at all - offsets"), wxITEM_CHECK);
525  translate_menu->Append(m_revtranslate_item_all);
526 
527  m_translate_item_everything = new wxMenuItem(menu, ID_SHOW_TRANSLATE_EVERYTHING_EDSEQ_MENU, _("All \tAlt+a"), _("Show translation at all offsets"), wxITEM_CHECK);
528  translate_menu->Append(m_translate_item_everything);
529 
530  m_translate_item_none = new wxMenuItem(menu, ID_SHOW_TRANSLATE_NONE_EDSEQ_MENU, _("None \tAlt+n"), _("Show no translation"), wxITEM_CHECK);
531  translate_menu->Append(m_translate_item_none);
532 
533  menu->AppendSubMenu(translate_menu,_("Reading frames"));
534 
535  wxMenuItem *revcomp_item = new wxMenuItem(menu, ID_SHOW_REVCOMP_EDSEQ_MENU, _("Complement\tAlt+c"), _("Show complement"), wxITEM_CHECK);
536  menu->Append(revcomp_item);
537 
538  wxMenuItem *features_item = new wxMenuItem(menu, ID_SHOW_FEATURES_EDSEQ_MENU, _("Features\tAlt+f"), _("Show features"), wxITEM_CHECK);
539  menu->Append(features_item);
540 
541  wxMenuItem * onthefly_item = new wxMenuItem(menu, ID_SHOW_ONTHEFLY_EDSEQ_MENU, _("On-the-fly\tAlt+t"), _("Show on-the-fly translation"), wxITEM_CHECK);
542  menu->Append(onthefly_item);
543 
544  wxMenuItem * mismatch_item = new wxMenuItem(menu, ID_SHOW_MISMATCH_EDSEQ_MENU, _("Mismatch\tAlt+m"), _("Show mismatch"), wxITEM_CHECK);
545  menu->Append(mismatch_item);
546 
547 
548  wxMenu *menu2 = new wxMenu();
549  menubar->Append(menu2, wxT("&Edit"));
550 
551  wxMenuItem *cut_item = new wxMenuItem(menu2, ID_EDIT_CUT_EDSEQ_MENU, _("Cut\tCtrl+X"), _("Cut to clipboard"), wxITEM_NORMAL);
552  menu2->Append(cut_item);
553 
554  wxMenuItem *copy_item = new wxMenuItem(menu2, ID_EDIT_COPY_EDSEQ_MENU, _("Copy\tCtrl+C"), _("Copy to clipboard"), wxITEM_NORMAL);
555  menu2->Append(copy_item);
556 
557  wxMenuItem *paste_item = new wxMenuItem(menu2, ID_EDIT_PASTE_EDSEQ_MENU, _("Paste\tCtrl+V"), _("Paste from clipboard"), wxITEM_NORMAL);
558  menu2->Append(paste_item);
559 
560  wxMenuItem *find_item = new wxMenuItem(menu2, ID_EDIT_FIND_EDSEQ_MENU, _("Find\tCtrl+F"), _("Find pattern"), wxITEM_NORMAL);
561  menu2->Append(find_item);
562 
563  wxMenu* menu3 = CUICommandRegistry::GetInstance().CreateMenu(kAnnotateMenu);
564  if (RunningInsideNCBI())
565  menubar->Append(menu3, wxT("Annotate"));
566  else
567  menubar->Append(menu3, wxT("Features"));
568 
569  SetMenuBar(menubar);
570 
571  wxPanel *Dialog1 = new wxPanel(this, wxID_ANY);
572 
573  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
574  Dialog1->SetSizer(itemBoxSizer2);
575 
576  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
577  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
578 
579  wxButton* itemButton6 = new wxButton( Dialog1, ID_GOTO_EDSEQ_BUTTON, wxT("Go to:"), wxDefaultPosition, wxDefaultSize, 0 );
580  itemBoxSizer3->Add(itemButton6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
581 
582  m_GoTo_TextCtrl = new wxTextCtrl( Dialog1, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
583  itemBoxSizer3->Add(m_GoTo_TextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
584 
585  wxStaticText* itemStaticText8 = new wxStaticText( Dialog1, wxID_STATIC, wxT("Position:"), wxDefaultPosition, wxDefaultSize, 0 );
586  itemBoxSizer3->Add(itemStaticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
587 
588  m_Pos = new wxStaticText( Dialog1, wxID_STATIC, wxT(""), wxDefaultPosition, wxSize(Dialog1->ConvertDialogToPixels(wxSize(40, -1)).x, -1), wxNO_BORDER );
589  itemBoxSizer3->Add(m_Pos, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
590 
591 
592  wxButton* itemButton7 = new wxButton( Dialog1, ID_RANGE_EDSEQ_BUTTON, wxT("Select:"), wxDefaultPosition, wxDefaultSize, 0 );
593  itemBoxSizer3->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
594 
595  m_RangeFrom = new wxTextCtrl( Dialog1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
596  itemBoxSizer3->Add(m_RangeFrom, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
597  m_RangeFrom->SetValidator( wxTextValidator( wxFILTER_NUMERIC ) );
598 
599  wxStaticText* rangeDash = new wxStaticText( Dialog1, wxID_STATIC, wxT("-"), wxDefaultPosition, wxDefaultSize, 0 );
600  itemBoxSizer3->Add(rangeDash, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
601 
602  m_RangeTo = new wxTextCtrl( Dialog1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
603  itemBoxSizer3->Add(m_RangeTo, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
604  m_RangeTo->SetValidator( wxTextValidator( wxFILTER_NUMERIC ) );
605 
606  GetSequence();
607  string title = GetSeqTitle();
608  SetTitle(wxString(title));
609  string seq;
610  vector<int> seq_len;
611  vector<bool> read_only;
612  SSeqMapSelector selector;
613  selector.SetFlags(CSeqMap::fDefaultFlags);
614  CBioseq_Handle bsh(m_seh.GetSeq());
616  CSeqMap_CI seqmap_ci(bsh, selector);
617  while (seqmap_ci)
618  {
619  TSeqPos len = seqmap_ci.GetLength();
620  seq_len.push_back(len);
621  if (seqmap_ci.IsValid() && seqmap_ci.GetType() == CSeqMap::eSeqData)
622  read_only.push_back(false);
623  else
624  read_only.push_back(true);
625  ++seqmap_ci;
626  }
627  objects::CSeqVector vec(bsh,CBioseq_Handle::eCoding_Iupac);
628  vec.GetSeqData(0,bsh.GetBioseqLength(),seq);
629  if (seq.empty())
630  NCBI_THROW( CException, eUnknown, "No bioseq selected" );
631  if (seq_len.empty())
632  {
633  seq_len.push_back(static_cast<int>(seq.size()));
634  read_only.push_back(true);
635  }
636 
637  string allowed_char_set = "ATUCGRYSWKMBDHVN";
638  if (!m_is_nucleotide)
639  allowed_char_set = "ABCDEFGHIJKLMNOPQRSTUVWXYZ*";
640 
641  wxBoxSizer *BoxSizer = new wxBoxSizer(wxHORIZONTAL);
642  itemBoxSizer2->Add(BoxSizer, 1, wxGROW|wxALL, 5);
644  BoxSizer->Add(m_Panel, 1, wxGROW|wxALL, 5);
645  features_item->Check();
646  m_Panel->EnableFeatures(true);
647  if (m_is_nucleotide)
648  {
649  mismatch_item->Check();
650  m_Panel->EnableMismatch(true);
651  }
652  m_Panel->SetFocus();
653 
654  m_commit_warning = new wxStaticText( Dialog1, wxID_STATIC, wxT("You need to commit the changes to the sequence before annotating or retranslating"), wxDefaultPosition, wxDefaultSize, 0 );
655  m_commit_warning->SetForegroundColour(*wxRED);
656  itemBoxSizer2->Add(m_commit_warning, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5);
657  m_commit_warning->Hide();
658 
659  m_readonly_warning = new wxStaticText( Dialog1, wxID_STATIC, wxT("You need to convert to raw sequence before editing within the gap"), wxDefaultPosition, wxDefaultSize, 0 );
660  m_readonly_warning->SetForegroundColour(*wxRED);
661  itemBoxSizer2->Add(m_readonly_warning, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5);
662  m_readonly_warning->Hide();
663 
664  wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
665  itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
666 
667  m_CommitButton = new wxButton( Dialog1, ID_ACCEPT_EDSEQ_BUTTON, _("Commit"), wxDefaultPosition, wxDefaultSize, 0 );
668  itemBoxSizer12->Add(m_CommitButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
669  m_CommitButton->Disable();
670 
671  m_RetranslateButton = new wxButton( Dialog1, ID_RETRANSLATE_EDSEQ_BUTTON, _("Retranslate"), wxDefaultPosition, wxDefaultSize, 0 );
672  itemBoxSizer12->Add(m_RetranslateButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
673 
674  wxButton* itemButton13 = new wxButton( Dialog1, ID_CLOSE_EDSEQ_BUTTON, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
675  itemBoxSizer12->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
676 
677  wxButton* itemButton14 = new wxButton( Dialog1, ID_CANCEL_EDSEQ_BUTTON, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
678  itemBoxSizer12->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
679 
680  wxHyperlinkCtrl* itemHyperlinkCtrl = new wxHyperlinkCtrl( Dialog1, wxID_HELP, _("Help"), wxT("https://www.ncbi.nlm.nih.gov/tools/gbench/manual9/#edit-sequence"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
681  itemHyperlinkCtrl->SetForegroundColour(wxColour(192, 192, 192));
682  itemBoxSizer12->Add(itemHyperlinkCtrl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
683 }
684 
686 {
687  string accession;
688  string local;
689  string label;
690  for (CBioseq_Handle::TId::const_iterator it = m_seh.GetSeq().GetId().begin(); it != m_seh.GetSeq().GetId().end(); ++it)
691  {
692  const CSeq_id &id = *(it->GetSeqId());
693  if (id.IsGenbank() && id.GetGenbank().IsSetAccession())
694  accession = id.GetGenbank().GetAccession();
695  if (id.IsLocal() && id.GetLocal().IsStr())
696  local = id.GetLocal().GetStr();
697  }
698  if (!accession.empty())
699  return accession;
700  if (!local.empty())
701  return local;
702 
704  return label;
705 }
706 
708 {
709  m_CommitButton->Enable(enable);
710  m_RetranslateButton->Enable(!enable);
711  m_commit_warning->Show(enable);
712 }
713 
715 {
716  m_readonly_warning->Show();
717  if (!m_readonly_timer.IsRunning())
718  m_readonly_timer.StartOnce(2000);
719 }
720 
721 void CEditSequence::OnReadOnlyTimer(wxTimerEvent& event)
722 {
723  m_readonly_warning->Hide();
724 }
725 
727 {
729  CRef<CScope> scope_copy(new CScope(*object_manager));
730 
731  if (m_loc && m_loc->IsWhole())
732  {
734  if (!m_seh.IsSeq())
735  {
736  NCBI_THROW( CException, eUnknown, "No bioseq selected" );
737  }
740  copy->Assign(*m_seh.GetCompleteSeq_entry());
741  m_edited_seh = scope_copy->AddTopLevelSeqEntry(*copy);
742  }
743  else
744  {
745  NCBI_THROW( CException, eUnknown, "No bioseq selected" );
746  }
747 }
748 
749 /*!
750  * Should we show tooltips?
751  */
752 
754 {
755  return true;
756 }
757 
758 /*!
759  * Get bitmap resources
760  */
761 
762 wxBitmap CEditSequence::GetBitmapResource( const wxString& name )
763 {
764  // Bitmap retrieval
765  wxUnusedVar(name);
766  return wxNullBitmap;
767 }
768 
769 /*!
770  * Get icon resources
771  */
772 
773 wxIcon CEditSequence::GetIconResource( const wxString& name )
774 {
775  // Icon retrieval
776  wxUnusedVar(name);
777  return wxNullIcon;
778 }
779 
780 void CEditSequence::OnAccept( wxCommandEvent& event )
781 {
782  if (!m_seh)
783  return;
784  CRef<CCmdComposite> composite(new CCmdComposite("Adjust Features Locations"));
785  string seq = m_Panel->GetSeq();
786  vector<int> &seq_len = m_Panel->GetSeqLen();
787  vector<bool> &read_only = m_Panel->GetReadOnly();
788  SSeqMapSelector selector;
789  selector.SetFlags(CSeqMap::fDefaultFlags);
791  CSeqMap_I seqmap_i(besh, selector);
792  int start = 0;
793  int i = 0;
794  bool modified = false;
795  while (seqmap_i)
796  {
797  bool removed = false;
798  if (!read_only[i])
799  {
800  string seq_in;
801  if (m_is_nucleotide)
802  seqmap_i.GetSequence(seq_in, CSeqUtil::e_Iupacna);
803  else
804  seqmap_i.GetSequence(seq_in, CSeqUtil::e_Iupacaa);
805  string seq_out = seq.substr(start,seq_len[i]);
806  if (seq_in != seq_out)
807  {
808  if (!seq_out.empty())
809  {
810  if (m_is_nucleotide)
812  else
814  }
815  else
816  {
817  seqmap_i = seqmap_i.Remove();
818  removed = true;
819  }
820  modified = true;
821  }
822  }
823  if (!removed)
824  {
825  ++seqmap_i;
826  }
827  start += seq_len[i];
828  ++i;
829  }
830  vector<int>::iterator seq_len_i = seq_len.begin();
831  vector<bool>::iterator read_only_i = read_only.begin();
832  while (seq_len_i != seq_len.end() && read_only_i != read_only.end())
833  {
834  if (*seq_len_i == 0)
835  {
836  seq_len_i = seq_len.erase(seq_len_i);
837  read_only_i = read_only.erase(read_only_i);
838  continue;
839  }
840  ++seq_len_i;
841  ++read_only_i;
842  }
843  if (modified)
844  {
846  if (cmd)
847  composite->AddCommand(*cmd);
848  }
849  AdjustFeatureLocations(composite);
850  x_ExecuteCommand(composite);
851  m_Panel->SetClean(true);
852  m_Panel->SetFocus();
853 }
854 
855 void CEditSequence::OnClose( wxCommandEvent& event )
856 {
857  if (!m_Panel->GetClean())
858  {
859  int answer = wxMessageBox (ToWxString("Uncommitted changes, proceed with closing?"), ToWxString("Warning"), wxYES_NO | wxICON_QUESTION);
860  if (answer == wxYES)
861  Close();
862  }
863  else
864  Close();
865 }
866 
867 void CEditSequence::OnCancel( wxCommandEvent& event )
868 {
869  if (m_UndoManager && m_seh) {
870  bool exclusive = (m_NumCmds > 0);
871  while (m_UndoManager->CanUndo() && m_NumCmds > 0) {
872  m_UndoManager->Undo(this);
873  --m_NumCmds;
874  }
875 
876  m_NumCmds = 0;
877  if (exclusive)
879  }
880 
881  Close();
882 }
883 
885 {
886  m_Pos->SetLabel(ToWxString(NStr::IntToString(pos)));
887 }
888 
889 void CEditSequence::ReportRange(int pos1, int pos2)
890 {
891  if (pos1 > 0 && pos2 > 0)
892  {
893  m_RangeFrom->SetValue(ToWxString(NStr::IntToString(pos1)));
894  m_RangeTo->SetValue(ToWxString(NStr::IntToString(pos2)));
895  }
896  else
897  {
898  m_RangeFrom->SetValue(wxEmptyString);
899  m_RangeTo->SetValue(wxEmptyString);
900  }
901 }
902 
903 
904 void CEditSequence::OnGoTo( wxCommandEvent& event )
905 {
906  wxString val = m_GoTo_TextCtrl->GetValue();
907  long pos;
908  if(val.ToLong(&pos))
909  {
910  m_Panel->SetPos(static_cast<int>(pos));
911  m_Panel->SetFocus();
912  }
913  else if (!val.IsEmpty())
914  {
915  m_Panel->Search(val.ToStdString());
916  m_Panel->SetFocus();
917  }
918 }
919 
920 void CEditSequence::OnRange( wxCommandEvent& event )
921 {
922  wxString val1 = m_RangeFrom->GetValue();
923  wxString val2 = m_RangeTo->GetValue();
924  long pos1, pos2;
925  int seq_len = m_Panel->GetLength();
926  if(val1.ToLong(&pos1) && val2.ToLong(&pos2) && pos1 > 0 && pos2 > 0 && pos2 > pos1 && pos1 <= seq_len && pos2 <= seq_len)
927  {
928  m_Panel->SetRange(static_cast<int>(pos1), static_cast<int>(pos2));
929  }
930  m_Panel->SetFocus();
931 }
932 
933 void CEditSequence::OnFind( wxCommandEvent& event )
934 {
936  dlg->Show(true);
937 }
938 
939 void CEditSequence::OnTranslate( wxCommandEvent& event )
940 {
941  if (event.IsChecked())
942  {
943  m_Panel->EnableTranslation(true);
944  m_translate_item_none->Check(false);
945  m_Panel->UpdateData();
946  }
947  else
948  {
949  m_translate_item_all->Check(false);
950  m_translate_item_everything->Check(false);
951  m_Panel->EnableTranslation(false);
952  }
953  m_Panel->Refresh();
954  m_Panel->SetFocus();
955 }
956 
957 void CEditSequence::OnTranslate1( wxCommandEvent& event )
958 {
959  if (event.IsChecked())
960  {
962  m_translate_item_none->Check(false);
963  m_Panel->UpdateData();
964  }
965  else
966  {
967  m_translate_item_all->Check(false);
968  m_translate_item_everything->Check(false);
969  m_Panel->EnableTranslation1(false);
970  }
971  m_Panel->Refresh();
972  m_Panel->SetFocus();
973 }
974 
975 void CEditSequence::OnTranslate2( wxCommandEvent& event )
976 {
977  if (event.IsChecked())
978  {
980  m_translate_item_none->Check(false);
981  m_Panel->UpdateData();
982  }
983  else
984  {
985  m_translate_item_all->Check(false);
986  m_translate_item_everything->Check(false);
987  m_Panel->EnableTranslation2(false);
988  }
989  m_Panel->Refresh();
990  m_Panel->SetFocus();
991 }
992 
993 void CEditSequence::OnTranslateAll( wxCommandEvent& event )
994 {
995  if (event.IsChecked())
996  {
997  m_translate_item->Check(true);
998  m_translate_item1->Check(true);
999  m_translate_item2->Check(true);
1000  m_translate_item_none->Check(false);
1001  m_Panel->EnableTranslation(true);
1002  m_Panel->EnableTranslation1(true);
1003  m_Panel->EnableTranslation2(true);
1004  m_Panel->UpdateData();
1005  }
1006  else
1007  {
1008  m_translate_item->Check(false);
1009  m_translate_item1->Check(false);
1010  m_translate_item2->Check(false);
1011  m_translate_item_everything->Check(false);
1012  m_Panel->EnableTranslation(false);
1013  m_Panel->EnableTranslation1(false);
1014  m_Panel->EnableTranslation2(false);
1015  }
1016  m_Panel->Refresh();
1017  m_Panel->SetFocus();
1018 }
1019 
1020 void CEditSequence::OnRevTranslate( wxCommandEvent& event )
1021 {
1022  if (event.IsChecked())
1023  {
1025  m_translate_item_none->Check(false);
1026  m_Panel->UpdateData();
1027  }
1028  else
1029  {
1030  m_revtranslate_item_all->Check(false);
1031  m_translate_item_everything->Check(false);
1032  m_Panel->EnableRevTranslation(false);
1033  }
1034  m_Panel->Refresh();
1035  m_Panel->SetFocus();
1036 }
1037 
1038 void CEditSequence::OnRevTranslate1( wxCommandEvent& event )
1039 {
1040  if (event.IsChecked())
1041  {
1043  m_translate_item_none->Check(false);
1044  m_Panel->UpdateData();
1045  }
1046  else
1047  {
1048  m_revtranslate_item_all->Check(false);
1049  m_translate_item_everything->Check(false);
1051  }
1052  m_Panel->Refresh();
1053  m_Panel->SetFocus();
1054 }
1055 
1056 void CEditSequence::OnRevTranslate2( wxCommandEvent& event )
1057 {
1058  if (event.IsChecked())
1059  {
1061  m_translate_item_none->Check(false);
1062  m_Panel->UpdateData();
1063  }
1064  else
1065  {
1066  m_revtranslate_item_all->Check(false);
1067  m_translate_item_everything->Check(false);
1069  }
1070  m_Panel->Refresh();
1071  m_Panel->SetFocus();
1072 }
1073 
1074 void CEditSequence::OnRevTranslateAll( wxCommandEvent& event )
1075 {
1076  if (event.IsChecked())
1077  {
1078  m_revtranslate_item->Check(true);
1079  m_revtranslate_item1->Check(true);
1080  m_revtranslate_item2->Check(true);
1081  m_translate_item_none->Check(false);
1085  m_Panel->UpdateData();
1086  }
1087  else
1088  {
1089  m_revtranslate_item->Check(false);
1090  m_revtranslate_item1->Check(false);
1091  m_revtranslate_item2->Check(false);
1092  m_translate_item_everything->Check(false);
1093  m_Panel->EnableRevTranslation(false);
1096  }
1097  m_Panel->Refresh();
1098  m_Panel->SetFocus();
1099 }
1100 
1101 void CEditSequence::OnTranslateEverything( wxCommandEvent& event )
1102 {
1103  if (event.IsChecked())
1104  {
1105  m_translate_item->Check(true);
1106  m_translate_item1->Check(true);
1107  m_translate_item2->Check(true);
1108  m_Panel->EnableTranslation(true);
1109  m_Panel->EnableTranslation1(true);
1110  m_Panel->EnableTranslation2(true);
1111 
1112  m_revtranslate_item->Check(true);
1113  m_revtranslate_item1->Check(true);
1114  m_revtranslate_item2->Check(true);
1118 
1119  m_translate_item_none->Check(false);
1120  m_translate_item_all->Check(true);
1121  m_revtranslate_item_all->Check(true);
1122  m_Panel->UpdateData();
1123  }
1124  else
1125  {
1126  m_translate_item->Check(false);
1127  m_translate_item1->Check(false);
1128  m_translate_item2->Check(false);
1129  m_Panel->EnableTranslation(false);
1130  m_Panel->EnableTranslation1(false);
1131  m_Panel->EnableTranslation2(false);
1132 
1133  m_revtranslate_item->Check(false);
1134  m_revtranslate_item1->Check(false);
1135  m_revtranslate_item2->Check(false);
1136  m_Panel->EnableRevTranslation(false);
1139 
1140  m_translate_item_all->Check(false);
1141  m_revtranslate_item_all->Check(false);
1142  }
1143  m_Panel->Refresh();
1144  m_Panel->SetFocus();
1145 }
1146 
1147 
1148 void CEditSequence::OnTranslateNone( wxCommandEvent& event )
1149 {
1150  if (event.IsChecked())
1151  {
1152 
1153  m_translate_item->Check(false);
1154  m_translate_item1->Check(false);
1155  m_translate_item2->Check(false);
1156  m_Panel->EnableTranslation(false);
1157  m_Panel->EnableTranslation1(false);
1158  m_Panel->EnableTranslation2(false);
1159 
1160  m_revtranslate_item->Check(false);
1161  m_revtranslate_item1->Check(false);
1162  m_revtranslate_item2->Check(false);
1163  m_Panel->EnableRevTranslation(false);
1166 
1167  m_translate_item_all->Check(false);
1168  m_revtranslate_item_all->Check(false);
1169  m_translate_item_everything->Check(false);
1170  }
1171  m_Panel->Refresh();
1172  m_Panel->SetFocus();
1173 }
1174 
1175 
1176 void CEditSequence::OnOnTheFly( wxCommandEvent& event )
1177 {
1178  if (event.IsChecked())
1179  {
1180  m_Panel->EnableOnTheFly(true);
1181  m_Panel->UpdateData();
1182  }
1183  else
1184  {
1185  m_Panel->EnableOnTheFly(false);
1186  }
1187  m_Panel->Refresh();
1188  m_Panel->SetFocus();
1189 }
1190 
1191 void CEditSequence::OnComplement( wxCommandEvent& event )
1192 {
1193  if (event.IsChecked())
1194  {
1195  m_Panel->EnableComplement(true);
1196  m_Panel->UpdateData();
1197  }
1198  else
1199  {
1200  m_Panel->EnableComplement(false);
1201  }
1202  m_Panel->Refresh();
1203  m_Panel->SetFocus();
1204 }
1205 
1206 void CEditSequence::GetFeatures(const CSeq_loc &loc, CScope &scope)
1207 {
1208  m_FeatRanges.clear();
1209  m_FeatTypes.clear();
1210  m_FeatStrand.clear();
1211  m_RealProt.clear();
1212  m_FeatFrames.clear();
1213  m_GeneticCode.clear();
1214  m_Feat5Partial.clear();
1215  m_ProtFeatRanges.clear();
1216 
1217  TSeqPos seq_start = loc.GetStart(objects::eExtreme_Positional);
1218  SAnnotSelector sel;
1219  CFeat_CI feat_it(scope, loc, sel);
1220  const CSeq_id* seq_id = loc.GetId();
1221 
1222  while (feat_it)
1223  {
1224  if (feat_it->GetOriginalFeature().IsSetData())
1225  {
1226  vector<pair<TSeqPos,TSeqPos> > vec;
1227  const CSeq_loc& feat_loc = feat_it->GetLocation();
1228  for(CSeq_loc_CI loc_it(feat_loc, CSeq_loc_CI::eEmpty_Skip, CSeq_loc_CI::eOrder_Positional); loc_it; ++loc_it)
1229  {
1230  if (seq_id && !sequence::IsSameBioseq(*seq_id, loc_it.GetSeq_id(), &scope)) {
1231  continue;
1232  }
1233  CSeq_loc_CI::TRange feat_range = loc_it.GetRange();
1234  TSeqPos feat_start = feat_range.GetFrom() - seq_start;
1235  TSeqPos feat_stop = feat_range.GetTo() - seq_start;
1236  vec.push_back(pair<TSeqPos, TSeqPos>(feat_start, feat_stop));
1237  }
1239  if (feat_loc.GetStrand() == eNa_strand_minus)
1241  if (!vec.empty())
1242  {
1244  string label;
1245  string prot_seq;
1246  if (subtype == CSeqFeatData::eSubtype_cdregion && feat_it->IsSetProduct())
1247  {
1248  CBioseq_Handle prot_bsh = feat_it->GetScope().GetBioseqHandle(feat_it->GetProduct());
1249  if (prot_bsh && prot_bsh.IsProtein())
1250  {
1251  prot_bsh.GetSeqVector(CBioseq_Handle::eCoding_Iupac, strand).GetSeqData(0,prot_bsh.GetBioseqLength(),prot_seq);
1252  CFeat_CI prot_feat_it(prot_bsh, SAnnotSelector().IncludeFeatType(CSeqFeatData::e_Prot));
1253  if (prot_feat_it)
1254  prot_feat_it->GetData().GetProt().GetLabel(&label);
1255  GetProteinFeatures(prot_bsh, static_cast<int>(m_FeatRanges.size()), seq_id, feat_it->GetOriginalFeature(), seq_start);
1256  }
1257  }
1258  if (strand == objects::CBioseq_Handle::eStrand_Minus && !prot_seq.empty())
1259  {
1260  reverse(prot_seq.begin(), prot_seq.end());
1261  }
1262  if (label.empty())
1263  {
1265  }
1266  m_FeatTypes.push_back(pair<string,CSeqFeatData::ESubtype>(label,subtype));
1267  m_FeatRanges.push_back(vec);
1268  m_FeatStrand.push_back(strand);
1269  m_Feat5Partial.push_back(feat_loc.IsPartialStart(objects::eExtreme_Positional));
1270  m_RealProt.push_back(prot_seq);
1271  int frame = 0;
1273  {
1274  switch(feat_it->GetOriginalFeature().GetData().GetCdregion().GetFrame())
1275  {
1276  case CCdregion::eFrame_two: frame = 1; break;
1277  case CCdregion::eFrame_three: frame = 2; break;
1278  default: break;
1279  }
1280  }
1281  m_FeatFrames.push_back(frame);
1282 
1284  if (feat_it->GetOriginalFeature().GetData().IsCdregion() && feat_it->GetOriginalFeature().GetData().GetCdregion().IsSetCode())
1285  {
1286  code.Reset(new CGenetic_code);
1287  code->Assign(feat_it->GetOriginalFeature().GetData().GetCdregion().GetCode());
1288  }
1289  m_GeneticCode.push_back(code);
1290 
1291  }
1292  }
1293  ++feat_it;
1294  }
1295 }
1296 
1297 void CEditSequence::GetProteinFeatures(CBioseq_Handle prot_bsh, int i, const CSeq_id* seq_id, const CSeq_feat &old_cds, TSeqPos seq_start)
1298 {
1299  CScope &scope = prot_bsh.GetScope();
1300  CSeq_loc_Mapper map_to_nuc(old_cds, CSeq_loc_Mapper::eProductToLocation, &scope);
1301  map_to_nuc.SetMergeAbutting();
1302 
1303  for (CFeat_CI feat_ci(prot_bsh); feat_ci; ++feat_ci)
1304  {
1305  CSeq_feat_Handle fh = feat_ci->GetSeq_feat_Handle();
1307  continue;
1308 
1309  const CSeq_loc &loc = feat_ci->GetLocation();
1310  CRef<CSeq_loc> nuc_loc = map_to_nuc.Map(loc);
1311  vector<pair<TSeqPos,TSeqPos> > vec;
1312  for(CSeq_loc_CI loc_it(*nuc_loc, CSeq_loc_CI::eEmpty_Skip, CSeq_loc_CI::eOrder_Positional); loc_it; ++loc_it)
1313  {
1314  if (seq_id && !sequence::IsSameBioseq(*seq_id, loc_it.GetSeq_id(), &scope)) {
1315  continue;
1316  }
1317  CSeq_loc_CI::TRange feat_range = loc_it.GetRange();
1318  TSeqPos feat_start = feat_range.GetFrom() - seq_start;
1319  TSeqPos feat_stop = feat_range.GetTo() - seq_start;
1320  vec.push_back(pair<TSeqPos, TSeqPos>(feat_start, feat_stop));
1321  }
1322  m_ProtFeatRanges[i].push_back(vec);
1323  }
1324 }
1325 
1326 
1328 {
1330  TSeqPos seq_start = loc->GetStart(objects::eExtreme_Positional);
1331  SAnnotSelector sel;
1332  CScope &scope = m_seh.GetScope();
1333  CFeat_CI feat_it(scope, *loc, sel);
1334  const CSeq_id* seq_id = loc->GetId();
1335  unsigned int i = 0;
1336  while (feat_it)
1337  {
1338  if (feat_it->GetOriginalFeature().IsSetData())
1339  {
1340  CRef<CSeq_feat> new_feat(new CSeq_feat);
1341  new_feat->Assign(feat_it->GetOriginalFeature());
1342  const CSeq_loc& feat_loc = feat_it->GetLocation();
1343  CRef<CSeq_loc> new_loc(new CSeq_loc);
1344  new_loc->Assign(feat_loc);
1345  unsigned int j = 0;
1346  CSeq_loc_I loc_it(*new_loc); // , CSeq_loc_CI::eEmpty_Skip, CSeq_loc_CI::eOrder_Positional
1347  while(loc_it)
1348  {
1349  if (loc_it.IsEmpty())
1350  {
1351  ++loc_it;
1352  continue;
1353  }
1354  if (seq_id && !sequence::IsSameBioseq(*seq_id, loc_it.GetSeq_id(), &scope))
1355  {
1356  ++loc_it;
1357  continue;
1358  }
1359 
1360  CSeq_loc_CI::TRange feat_range = loc_it.GetRange();
1361  TSeqPos feat_start = feat_range.GetFrom() - seq_start;
1362  TSeqPos feat_stop = feat_range.GetTo() - seq_start;
1363  TSeqPos new_start = m_Panel->GetFeatureStart(i,j);
1364  TSeqPos new_stop = m_Panel->GetFeatureStop(i,j);
1365  if (new_stop == numeric_limits<int>::max() || new_start == numeric_limits<int>::max())
1366  {
1367  loc_it.Delete();
1368  ++j;
1369  continue;
1370  }
1371  if (feat_start != new_start)
1372  {
1373  loc_it.SetFrom(new_start);
1374  }
1375  if (feat_stop != new_stop)
1376  {
1377  loc_it.SetTo(new_stop);
1378  }
1379  ++loc_it;
1380  ++j;
1381  }
1382  CRef<CSeq_loc> loc = loc_it.MakeSeq_loc();
1383  bool modified = loc_it.HasChanges();
1384  bool removed = loc->IsNull() || loc_it.GetSize() == 0;
1385 
1386  if (modified)
1387  {
1388  if (removed)
1389  {
1390  CRef<CCmdDelSeq_feat> cmd_del(new CCmdDelSeq_feat(feat_it->GetSeq_feat_Handle()));
1391  if (cmd_del)
1392  {
1393  composite->AddCommand(*cmd_del);
1394  }
1395  }
1396  else
1397  {
1398  new_feat->SetLocation(*loc);
1399  if (new_feat->GetData().GetSubtype() == CSeqFeatData::eSubtype_cdregion)
1400  new_feat->SetData().SetCdregion().SetFrame(CSeqTranslator::FindBestFrame(*new_feat, m_edited_seh.GetScope()));
1401  if (m_ProtFeatRanges.find(i) != m_ProtFeatRanges.end())
1402  {
1403  AdjustProtFeatureLocations(composite, feat_it->GetOriginalFeature(), *new_feat, i, seq_id, seq_start);
1404  }
1406  if (cmd)
1407  {
1408  composite->AddCommand(*cmd);
1409  }
1410  }
1411  }
1412  }
1413  ++feat_it;
1414  i++;
1415  }
1416 }
1417 
1418 void CEditSequence::AdjustProtFeatureLocations(CRef<CCmdComposite> composite, const CSeq_feat &old_cds, const CSeq_feat &cds, int i, const CSeq_id* seq_id, TSeqPos seq_start)
1419 {
1420  CScope &scope = m_seh.GetScope();
1421  CBioseq_Handle prot_bsh = scope.GetBioseqHandle(cds.GetProduct());
1422  CSeq_loc_Mapper map_to_nuc(old_cds, CSeq_loc_Mapper::eProductToLocation, &scope);
1423  map_to_nuc.SetMergeAbutting();
1424  CSeq_loc_Mapper map_to_prot(cds, CSeq_loc_Mapper::eLocationToProduct, &scope);
1425  map_to_prot.SetMergeAbutting();
1426  unsigned int k = 0;
1427  for (CFeat_CI feat_ci(prot_bsh); feat_ci; ++feat_ci)
1428  {
1429  CSeq_feat_Handle fh = feat_ci->GetSeq_feat_Handle();
1431  continue;
1432 
1433  CRef<CSeq_loc> nuc_loc = map_to_nuc.Map(feat_ci->GetLocation());
1434  unsigned int j = 0;
1435  CSeq_loc_I loc_it(*nuc_loc); // , CSeq_loc_CI::eEmpty_Skip, CSeq_loc_CI::eOrder_Positional
1436  while(loc_it)
1437  {
1438  if (loc_it.IsEmpty())
1439  {
1440  ++loc_it;
1441  continue;
1442  }
1443  if (seq_id && !sequence::IsSameBioseq(*seq_id, loc_it.GetSeq_id(), &scope))
1444  {
1445  ++loc_it;
1446  continue;
1447  }
1448 
1449  CSeq_loc_CI::TRange feat_range = loc_it.GetRange();
1450  TSeqPos feat_start = feat_range.GetFrom() - seq_start;
1451  TSeqPos feat_stop = feat_range.GetTo() - seq_start;
1452  TSeqPos new_start = m_Panel->GetProtFeatureStart(i,k,j);
1453  TSeqPos new_stop = m_Panel->GetProtFeatureStop(i,k,j);
1454  if (new_stop == numeric_limits<int>::max() || new_start == numeric_limits<int>::max())
1455  {
1456  loc_it.Delete();
1457  ++j;
1458  continue;
1459  }
1460  if (feat_start != new_start)
1461  {
1462  loc_it.SetFrom(new_start);
1463  }
1464  if (feat_stop != new_stop)
1465  {
1466  loc_it.SetTo(new_stop);
1467  }
1468  ++loc_it;
1469  ++j;
1470  }
1471 
1472  CRef<CSeq_loc> loc = loc_it.MakeSeq_loc();
1473  bool modified = loc_it.HasChanges();
1474  bool removed = loc->IsNull() || loc_it.GetSize() == 0;
1475 
1476 
1477  if (modified)
1478  {
1479  if (removed)
1480  {
1481  CRef<CCmdDelSeq_feat> cmd_del(new CCmdDelSeq_feat(feat_ci->GetSeq_feat_Handle()));
1482  if (cmd_del)
1483  {
1484  composite->AddCommand(*cmd_del);
1485  }
1486  }
1487  else
1488  {
1489  CRef<CSeq_loc> prot_loc = map_to_prot.Map(*loc);
1490  CRef<CSeq_feat> new_feat(new CSeq_feat);
1491  new_feat->Assign(feat_ci->GetOriginalFeature());
1492  new_feat->SetLocation(*prot_loc);
1493  CRef< CCmdChangeSeq_feat > cmd(new CCmdChangeSeq_feat(feat_ci->GetSeq_feat_Handle(),*new_feat));
1494  if (cmd)
1495  {
1496  composite->AddCommand(*cmd);
1497  }
1498  }
1499  }
1500  k++;
1501  }
1502 }
1503 
1505 {
1507  m_NumCmds++;
1508  m_UndoManager->Execute(command, this);
1509  return true;
1510  }
1511  return false;
1512 }
1513 
1514 
1515 void CEditSequence::OnFeatures( wxCommandEvent& event )
1516 {
1517  if (event.IsChecked())
1518  {
1519  m_Panel->EnableFeatures(true);
1520  }
1521  else
1522  {
1523  m_Panel->EnableFeatures(false);
1524  }
1525  m_Panel->Refresh();
1526  m_Panel->SetFocus();
1527 }
1528 
1529 void CEditSequence::OnMismatch( wxCommandEvent& event )
1530 {
1531  if (event.IsChecked())
1532  {
1533  m_Panel->EnableMismatch(true);
1534  }
1535  else
1536  {
1537  m_Panel->EnableMismatch(false);
1538  }
1539  m_Panel->Refresh();
1540  m_Panel->SetFocus();
1541 }
1542 
1543 void CEditSequence::OnCopy( wxCommandEvent& event )
1544 {
1545  m_Panel->OnCopy(event);
1546  m_Panel->SetFocus();
1547 }
1548 
1549 void CEditSequence::OnCut( wxCommandEvent& event )
1550 {
1551  m_Panel->OnCut(event);
1552  m_Panel->SetFocus();
1553 }
1554 
1555 void CEditSequence::OnPaste( wxCommandEvent& event )
1556 {
1557  m_Panel->OnPaste(event);
1558  m_Panel->SetFocus();
1559 }
1560 
1561 void CEditSequence::IsClipboard(wxUpdateUIEvent &event)
1562 {
1563  event.Enable(m_Panel->IsClipboard() && m_seh);
1564 }
1565 
1566 void CEditSequence::IsSelection(wxUpdateUIEvent &event)
1567 {
1568  event.Enable(m_Panel->IsSelection() && m_seh);
1569 }
1570 
1571 void CEditSequence::IsNucleotide(wxUpdateUIEvent &event)
1572 {
1573  event.Enable(m_is_nucleotide && m_seh);
1574 }
1575 
1576 void CEditSequence::IsSelectionAndClean(wxUpdateUIEvent &event)
1577 {
1579  bool allow = true;
1583  allow = false;
1584  event.Enable(m_Panel->IsSelection() && m_Panel->GetClean() && allow && m_seh);
1585 }
1586 
1587 
1588 void CEditSequence::CreateFeature ( wxCommandEvent& event)
1589 {
1590  if (!m_seh)
1591  return;
1592  CSeq_entry_Handle seh = m_seh;
1593  pair<int,int> sel = m_Panel->GetSelection();
1594 
1595  if (sel.first >=0 && sel.second >= 0 && sel.second >= sel.first)
1596  {
1597  CRef<CSeq_loc> interval(new CSeq_loc);
1598  interval->SetInt().SetFrom(sel.first);
1599  interval->SetInt().SetTo(sel.second);
1600  CRef<CSeq_id> id(new CSeq_id);
1601  CRef<CSeq_loc> loc = seh.GetSeq().GetRangeSeq_loc(0,0);//seh.GetSeq().GetInst_Length()-1);
1602  id->Assign(*loc->GetId());
1603  interval->SetInt().SetId(*id);
1606  feat->SetLocation().Assign(*interval);
1607 
1608  CIRef<IEditObject> editor(new CEditObjectSeq_feat(*feat, seh, seh.GetScope(), true));
1609  CEditObjViewDlgModal edit_dlg(NULL, true);
1610  wxWindow* editorWindow = editor->CreateWindow(&edit_dlg);
1611  edit_dlg.SetEditorWindow(editorWindow);
1612  edit_dlg.SetEditor(editor);
1613  if (edit_dlg.ShowModal() == wxID_OK)
1614  {
1615  CIRef<IEditCommand> cmd(editor->GetEditCommand());
1616  if (cmd && x_ExecuteCommand(cmd)) {
1617  GetFeatures(*loc, seh.GetScope());
1619  m_Panel->Refresh();
1620  m_Panel->SetFocus();
1621  }
1622  } else
1623  m_Panel->SetFocus();
1624  }
1625 }
1626 
1627 void CEditSequence::CreateRegulatory ( wxCommandEvent& evt)
1628 {
1629  if (!m_seh)
1630  return;
1631  CSeq_entry_Handle seh = m_seh;
1632  pair<int,int> sel = m_Panel->GetSelection();
1633 
1634  if (sel.first >=0 && sel.second >= 0 && sel.second >= sel.first)
1635  {
1636  CRef<CSeq_loc> interval(new CSeq_loc);
1637  interval->SetInt().SetFrom(sel.first);
1638  interval->SetInt().SetTo(sel.second);
1639  CRef<CSeq_id> id(new CSeq_id);
1640  CRef<CSeq_loc> loc = seh.GetSeq().GetRangeSeq_loc(0,0);//seh.GetSeq().GetInst_Length()-1);
1641  id->Assign(*loc->GetId());
1642  interval->SetInt().SetId(*id);
1645  feat->SetLocation().Assign(*interval);
1646 
1647  string regulatory_class;
1648  switch(evt.GetId())
1649  {
1650  case eCmdCreateRegulatory_promoter : regulatory_class = "promoter"; break;
1651  case eCmdCreateRegulatory_enhancer : regulatory_class = "enhancer"; break;
1652  case eCmdCreateRegulatory_ribosome_binding_site : regulatory_class = "ribosome_binding_site"; break;
1653  case eCmdCreateRegulatory_riboswitch : regulatory_class = "riboswitch"; break;
1654  case eCmdCreateRegulatory_terminator : regulatory_class = "terminator"; break;
1655  default : break;
1656  }
1657  if (!regulatory_class.empty())
1658  {
1659  CRef<CGb_qual> q(new CGb_qual());
1660  q->SetQual("regulatory_class");
1661  q->SetVal(regulatory_class);
1662  feat->SetQual().push_back(q);
1663  }
1664 
1665 
1666  CIRef<IEditObject> editor(new CEditObjectSeq_feat(*feat, seh, seh.GetScope(), true));
1667  CEditObjViewDlgModal edit_dlg(NULL, true);
1668  wxWindow* editorWindow = editor->CreateWindow(&edit_dlg);
1669  edit_dlg.SetEditorWindow(editorWindow);
1670  edit_dlg.SetEditor(editor);
1671  if (edit_dlg.ShowModal() == wxID_OK)
1672  {
1673  CIRef<IEditCommand> cmd(editor->GetEditCommand());
1674  if (cmd && x_ExecuteCommand(cmd)) {
1675  GetFeatures(*loc, seh.GetScope());
1677  m_Panel->Refresh();
1678  m_Panel->SetFocus();
1679  }
1680  } else
1681  m_Panel->SetFocus();
1682  }
1683 }
1684 
1685 void CEditSequence::OnRetranslate ( wxCommandEvent& event)
1686 {
1687  CScope &scope = m_seh.GetScope();
1689  CRef<CCmdComposite> cmd(new CCmdComposite("Retranslate CDS"));
1691  int offset = 1;
1692  bool create_general_only = false;
1693  CScope::TTSE_Handles vec_tse;
1694  scope.GetAllTSEs(vec_tse, CScope::eAllTSEs);
1695  if (!vec_tse.empty())
1696  create_general_only = objects::edit::IsGeneralIdProtPresent(vec_tse.front());
1697  for (CFeat_CI feat_it(scope, *loc, sel); feat_it; ++feat_it)
1698  {
1699  cmd->AddCommand(*GetRetranslateCDSCommand(scope, feat_it->GetOriginalFeature(), offset, create_general_only));
1700  }
1701  if (cmd && x_ExecuteCommand(cmd))
1702  {
1703  GetFeatures(*loc, scope);
1705  m_Panel->Refresh();
1706  m_Panel->SetFocus();
1707  }
1708 }
1709 
1710 
1711 /*
1712  * CFindEditSequence type definition
1713  */
1714 
1715 IMPLEMENT_DYNAMIC_CLASS( CFindEditSequence, wxDialog )
1716 
1717 
1718 /*
1719  * CFindEditSequence event table definition
1720  */
1721 
1722 BEGIN_EVENT_TABLE( CFindEditSequence, wxDialog )
1723 
1724 ////@begin CFindEditSequence event table entries
1728 EVT_CLOSE(CFindEditSequence::OnClose)
1729 
1735 
1736 ////@end CFindEditSequence event table entries
1737 
1739 
1740 
1741 /*
1742  * CFindEditSequence constructors
1743  */
1744 
1746 {
1747  Init();
1748 }
1749 
1750 CFindEditSequence::CFindEditSequence( wxWindow* parent, CPaintSequence *panel, bool is_nucleotide, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
1751  : m_Panel(panel), m_is_nucleotide(is_nucleotide)
1752 {
1753  Init();
1754  Create(parent, id, caption, pos, size, style);
1755 }
1756 
1757 
1758 /*
1759  * CFindEditSequence creator
1760  */
1761 
1762 bool CFindEditSequence::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
1763 {
1764 ////@begin CFindEditSequence creation
1765  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1766  wxDialog::Create( parent, id, caption, pos, size, style );
1767 
1768  CreateControls();
1769  if (GetSizer())
1770  {
1771  GetSizer()->SetSizeHints(this);
1772  }
1773  Centre();
1774 ////@end CFindEditSequence creation
1775  return true;
1776 }
1777 
1778 
1779 /*
1780  * CFindEditSequence destructor
1781  */
1782 
1784 {
1785 ////@begin CFindEditSequence destruction
1786 ////@end CFindEditSequence destruction
1787 }
1788 
1789 
1790 /*
1791  * Member initialisation
1792  */
1793 
1795 {
1796 ////@begin CFindEditSequence member initialisation
1797  m_Pattern = NULL;
1798  m_ItemOfText = NULL;
1799  m_Nuc = NULL;
1800  m_RevComp = NULL;
1801  m_TransFrame = NULL;
1802  m_FrameChoice = NULL;
1803  m_Prev = NULL;
1804  m_Next = NULL;
1805 ////@end CFindEditSequence member initialisation
1806  m_Num = 0;
1807  m_Total = 0;
1808 }
1809 
1810 
1811 /*
1812  * Control creation for CFindEditSequence
1813  */
1814 
1816 {
1817 ////@begin CFindEditSequence content construction
1818  // Generated by DialogBlocks, 30/01/2015 13:52:15 (unregistered)
1819 
1820  CFindEditSequence* itemDialog1 = this;
1821 
1822  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
1823  itemDialog1->SetSizer(itemBoxSizer2);
1824 
1825  wxStaticText* itemStaticText3 = new wxStaticText( itemDialog1, wxID_STATIC, _("Find pattern"), wxDefaultPosition, wxDefaultSize, 0 );
1826  itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
1827 
1828  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
1829  itemBoxSizer2->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5);
1830 
1831  m_Pattern = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_FIND_EDIT_SEQ, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
1832  itemBoxSizer4->Add(m_Pattern, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1833 
1834  m_ItemOfText = new wxStaticText( itemDialog1, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
1835  itemBoxSizer2->Add(m_ItemOfText, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
1836 
1837  wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Search in"));
1838  wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL);
1839  itemBoxSizer2->Add(itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
1840 
1841  wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
1842  itemStaticBoxSizer7->Add(itemBoxSizer8, 0, wxALIGN_LEFT|wxALL, 5);
1843 
1844  m_Nuc = new wxRadioButton( itemStaticBoxSizer7->GetStaticBox(), ID_NUC_FIND_EDIT_SEQ, _("Nucleotide sequence"), wxDefaultPosition, wxDefaultSize, 0 );
1845  m_Nuc->SetValue(true);
1846  itemBoxSizer8->Add(m_Nuc, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1847 
1848  m_RevComp = new wxCheckBox( itemStaticBoxSizer7->GetStaticBox(), ID_REVCOMP_FIND_EDIT_SEQ, _("reverse complement"), wxDefaultPosition, wxDefaultSize, 0 );
1849  m_RevComp->SetValue(false);
1850  itemBoxSizer8->Add(m_RevComp, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1851 
1852  wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxHORIZONTAL);
1853  itemStaticBoxSizer7->Add(itemBoxSizer11, 0, wxALIGN_LEFT|wxALL, 5);
1854 
1855  m_TransFrame = new wxRadioButton( itemStaticBoxSizer7->GetStaticBox(), ID_TRANSFRAME_FIND_EDIT_SEQ, _("Translated frame"), wxDefaultPosition, wxDefaultSize, 0 );
1856  m_TransFrame->SetValue(false);
1857  itemBoxSizer11->Add(m_TransFrame, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1858 
1859  wxArrayString m_FrameChoiceStrings;
1860  m_FrameChoiceStrings.Add(_("Any"));
1861  m_FrameChoiceStrings.Add(_("+1"));
1862  m_FrameChoiceStrings.Add(_("+2"));
1863  m_FrameChoiceStrings.Add(_("+3"));
1864  m_FrameChoiceStrings.Add(_("-1"));
1865  m_FrameChoiceStrings.Add(_("-2"));
1866  m_FrameChoiceStrings.Add(_("-3"));
1867  m_FrameChoice = new wxChoice( itemStaticBoxSizer7->GetStaticBox(), ID_FRAMECHOICE_FIND_EDIT_SEQ, wxDefaultPosition, wxDefaultSize, m_FrameChoiceStrings, 0 );
1868  m_FrameChoice->SetStringSelection(_("Any"));
1869  m_FrameChoice->Disable();
1870  itemBoxSizer11->Add(m_FrameChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1871 
1872  wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxHORIZONTAL);
1873  itemBoxSizer2->Add(itemBoxSizer14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
1874 
1875  m_Prev = new wxButton( itemDialog1, ID_PREV_FIND_EDIT_SEQ, _("Previous"), wxDefaultPosition, wxDefaultSize, 0 );
1876  itemBoxSizer14->Add(m_Prev, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1877  m_Prev->Disable();
1878 
1879  m_Next = new wxButton( itemDialog1, ID_NEXT_FIND_EDIT_SEQ, _("Next"), wxDefaultPosition, wxDefaultSize, 0 );
1880  itemBoxSizer14->Add(m_Next, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1881  m_Next->Disable();
1882 
1883  wxButton* itemButton17 = new wxButton( itemDialog1, ID_DISMISS_FIND_EDIT_SEQ, _("Dismiss"), wxDefaultPosition, wxDefaultSize, 0 );
1884  itemBoxSizer14->Add(itemButton17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1885 
1886 ////@end CFindEditSequence content construction
1887  if (!m_is_nucleotide)
1888  {
1889  itemStaticBoxSizer7Static->Hide();
1890  }
1891 }
1892 
1893 
1894 /*
1895  * Should we show tooltips?
1896  */
1897 
1899 {
1900  return true;
1901 }
1902 
1903 /*
1904  * Get bitmap resources
1905  */
1906 
1907 wxBitmap CFindEditSequence::GetBitmapResource( const wxString& name )
1908 {
1909  // Bitmap retrieval
1910 ////@begin CFindEditSequence bitmap retrieval
1911  wxUnusedVar(name);
1912  return wxNullBitmap;
1913 ////@end CFindEditSequence bitmap retrieval
1914 }
1915 
1916 /*
1917  * Get icon resources
1918  */
1919 
1920 wxIcon CFindEditSequence::GetIconResource( const wxString& name )
1921 {
1922  // Icon retrieval
1923 ////@begin CFindEditSequence icon retrieval
1924  wxUnusedVar(name);
1925  return wxNullIcon;
1926 ////@end CFindEditSequence icon retrieval
1927 }
1928 
1929 
1930 
1931 void CFindEditSequence::OnPrev( wxCommandEvent& event )
1932 {
1933  m_Num--;
1934  m_CurrentPos--;
1935  wxString label;
1936  label << m_Num << " of " << m_Total;
1937  m_ItemOfText->SetLabel(label);
1939  if (m_Num <= 1)
1940  m_Prev->Disable();
1941  if (m_Num < m_Total)
1942  m_Next->Enable();
1943 }
1944 
1945 void CFindEditSequence::OnNext( wxCommandEvent& event )
1946 {
1947  if (m_Pos.empty())
1948  {
1949  string choice;
1950  int sel = m_FrameChoice->GetSelection();
1951  if (sel != wxNOT_FOUND)
1952  choice = m_FrameChoice->GetString(sel).ToStdString();
1953  m_Pos.clear();
1954  m_Num = 0;
1955  if (!m_Nuc->GetValue() && choice == "Any")
1956  {
1957  FindMatchPositions("+1");
1958  FindMatchPositions("+2");
1959  FindMatchPositions("+3");
1960  FindMatchPositions("-1");
1961  FindMatchPositions("-2");
1962  FindMatchPositions("-3");
1963  }
1964  else
1965  {
1966  FindMatchPositions(choice);
1967  }
1968  m_Total = static_cast<int>(m_Pos.size());
1969  m_CurrentPos = m_Pos.begin();
1970  SetHighlights();
1971 
1972  }
1973  else
1974  {
1975  m_CurrentPos++;
1976  }
1977  if (!m_Pos.empty())
1978  {
1979  m_Num++;
1980  wxString label;
1981  label << m_Num << " of " << m_Total;
1982  m_ItemOfText->SetLabel(label);
1984  if (m_Num >= m_Total)
1985  m_Next->Disable();
1986  if (m_Num > 1)
1987  m_Prev->Enable();
1988  }
1989  else
1990  {
1991  m_ItemOfText->SetLabel(_("No matches found"));
1992  m_Next->Disable();
1993  }
1994 
1995 }
1996 
1997 void CFindEditSequence::OnDismiss( wxCommandEvent& event )
1998 {
1999  Close();
2000 }
2001 
2002 void CFindEditSequence::OnClose(wxCloseEvent& event)
2003 {
2004  m_Pos.clear();
2005  SetHighlights();
2006  m_Panel->Refresh();
2007  event.Skip();
2008 }
2009 
2011 {
2012  string str = m_Pattern->GetValue().ToStdString();
2013  string res;
2014  for (size_t i=0; i<str.length(); i++)
2015  {
2016  char a = str[i];
2017  if (isdigit(a) || isspace(a))
2018  continue;
2019  res += a;
2020  }
2021  return res;
2022 }
2023 
2024 void CFindEditSequence::OnChange( wxCommandEvent& event )
2025 {
2026  m_Num = 0;
2027  m_Total = 0;
2028  m_Pos.clear();
2029  m_ItemOfText->SetLabel(wxEmptyString);
2030  m_Prev->Disable();
2031  if (m_Nuc->GetValue())
2032  {
2033  m_RevComp->Enable();
2034  m_FrameChoice->Disable();
2035  }
2036  else
2037  {
2038  m_RevComp->Disable();
2039  m_FrameChoice->Enable();
2040  }
2041 
2042  if (!GetPattern().empty())
2043  {
2044  m_Next->Enable();
2045  }
2046  else
2047  {
2048  m_Next->Disable();
2049  }
2050 }
2051 
2052 
2053 void CFindEditSequence::FindMatchPositions(const string &choice)
2054 {
2055  size_t pos = 0;
2056  string *str = m_Panel->GetFindString(m_Nuc->GetValue(), m_RevComp->GetValue(), choice);
2057  string value = GetPattern();
2058  if ( (m_Nuc->GetValue() && m_RevComp->GetValue()) )//|| (!m_Nuc->GetValue() && (choice == "-1" || choice == "-2" || choice == "-3"))
2059  {
2060  reverse(value.begin(),value.end());
2061  }
2062  if (str && !value.empty())
2063  {
2064  while (pos != NPOS && pos <str->size())
2065  {
2066  pos = NStr::FindNoCase(*str,value,pos);
2067  if (pos != NPOS)
2068  {
2069  auto pos_actual = pos;
2070  if (!m_Nuc->GetValue())
2071  {
2072  if (choice == "-1" || choice == "-2" || choice == "-3")
2073  pos_actual = str->size() - pos_actual - 1 - (value.size() - 1);
2074  int length = m_Panel->GetLength();
2075  pos_actual *= 3;
2076  size_t offset = 0;
2077  if (choice == "+2")
2078  offset = 1;
2079  if (choice == "+3")
2080  offset = 2;
2081  if (choice == "-1")
2082  offset = length - str->size()*3;
2083  if (choice == "-2")
2084  offset = length - str->size()*3 - 1;
2085  if (choice == "-3")
2086  offset = length - str->size()*3 - 2;
2087  if (offset < 0)
2088  offset = 0;
2089  pos_actual += offset;
2090 
2091  }
2092  m_Pos.insert(static_cast<int>(pos_actual));
2093  pos++;
2094  }
2095  }
2096  }
2097 }
2098 
2100 {
2101  size_t length = GetPattern().size();
2102  if (!m_Nuc->GetValue())
2103  {
2104  length *= 3;
2105  }
2106  set<int> highlights;
2107  for (set<int>::iterator it = m_Pos.begin(); it != m_Pos.end(); ++it)
2108  {
2109  for (size_t j = 0; j < length; j++)
2110  highlights.insert(static_cast<int>((*it)+j));
2111  }
2112  m_Panel->SetHighlights().swap(highlights);
2113 }
2114 
User-defined methods of the data storage class.
#define static
@ eExtreme_Positional
numerical value
Definition: Na_strand.hpp:63
User-defined methods of the data storage class.
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
EVT_UPDATE_UI(eCmdAlnShowMethodsDlg, CAlnMultiWidget::OnUpdateShowMethodDlg) EVT_UPDATE_UI(eCmdMethodProperties
@ eCmdCreateSigPeptide
@ eCmdCreateRegion
@ eCmdCreateMiscRecomb
@ eCmdCreateRepeatRegion
@ eCmdCreateRegulatory_ribosome_binding_site
@ eCmdCreatetRNA
@ eCmdCreateAssemblyGap
@ eCmdCreateBond
@ eCmdCreatepreRNA
@ eCmdCreateRegulatory
@ eCmdCreateCRegion
@ eCmdCreateProt
@ eCmdCreateVSegment
@ eCmdCreateMiscFeature
@ eCmdCreateModifiedBase
@ eCmdCreateMobileElement
@ eCmdCreateNRegion
@ eCmdCreateTelomere
@ eCmdCreateMiscStructure
@ eCmdCreaterRNA
@ eCmdCreatetmRNA
@ eCmdCreatePrimerBind
@ eCmdCreateBiosourceFeat
@ eCmdCreateExon
@ eCmdCreateMatPeptide
@ eCmdCreateCentromere
@ eCmdCreateiDNA
@ eCmdCreatePrimTranscript
@ eCmdCreateJSegment
@ eCmdCreateMiscBinding
@ eCmdCreatemiscRNA
@ eCmdCreateRegulatory_promoter
@ eCmdCreateOriT
@ eCmdCreateDSegment
@ eCmdCreateVRegion
@ eCmdCreateRegulatory_riboswitch
@ eCmdCreateSTS
@ eCmdCreateCodingRegion_ext
@ eCmdCreatePolyASite
@ eCmdCreateSRegion
@ eCmdCreateCommentDescriptor
@ eCmdCreate5UTR
@ eCmdCreatePubFeatureLabeled
@ eCmdCreateMRNA
@ eCmdCreateGene
@ eCmdCreateCodingRegion
@ eCmdCreateSite
@ eCmdCreateUnsure
@ eCmdCreateRegulatory_enhancer
@ eCmdCreateVariation
@ eCmdCreatePreRNA
@ eCmdCreateTransitPeptide
@ eCmdCreateIntron
@ eCmdCreateDLoop
@ eCmdCreateSecondaryStructure
@ eCmdCreateProprotein
@ eCmdCreatencRNA
@ eCmdCreateProteinBind
@ eCmdCreate3UTR
@ eCmdCreateRepOrigin
@ eCmdCreateLTR
@ eCmdCreateStemLoop
@ eCmdCreateRNA
@ eCmdCreateOperon
@ eCmdCreateRegulatory_terminator
@ eCmdCreateMiscDifference
bool IsGeneralIdProtPresent(objects::CSeq_entry_Handle tse)
static CRef< objects::CSeq_feat > MakeDefaultFeature(objects::CSeqFeatData::ESubtype subtype)
static objects::CSeqFeatData::ESubtype GetFeatTypeFromCmdID(int cmd_id)
CBioseq_EditHandle –.
CBioseq_Handle –.
@ eContent
Definition: Bioseq.hpp:103
void GetLabel(string *label, ELabelType type, bool worst=false) const
Definition: Bioseq.cpp:202
void AddCommand(IEditCommand &command)
void SetEditorWindow(wxWindow *editorWindow)
void SetEditor(CIRef< IEditObject > editor)
wxMenuItem * m_translate_item2
void IsSelectionAndClean(wxUpdateUIEvent &event)
void OnTranslate(wxCommandEvent &event)
void OnRevTranslate2(wxCommandEvent &event)
wxMenuItem * m_translate_item_none
void OnTranslateAll(wxCommandEvent &event)
static bool ShowToolTips()
Should we show tooltips?
void OnTranslate1(wxCommandEvent &event)
wxTextCtrl * m_RangeTo
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void OnMismatch(wxCommandEvent &event)
CPaintSequence * m_Panel
void ReportRange(int pos1, int pos2)
wxStaticText * m_readonly_warning
wxMenuItem * m_translate_item_everything
wxMenuItem * m_translate_item1
void IsNucleotide(wxUpdateUIEvent &event)
void CreateControls()
Creates the controls and sizers.
wxTextCtrl * m_GoTo_TextCtrl
void OnRevTranslateAll(wxCommandEvent &event)
void OnPaste(wxCommandEvent &event)
void OnTranslate2(wxCommandEvent &event)
void OnTranslateEverything(wxCommandEvent &event)
void IsClipboard(wxUpdateUIEvent &event)
wxMenuItem * m_translate_item_all
vector< vector< pair< TSeqPos, TSeqPos > > > m_FeatRanges
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
wxStaticText * m_Pos
vector< pair< string, CSeqFeatData::ESubtype > > m_FeatTypes
void OnReadOnlyTimer(wxTimerEvent &event)
CSeq_entry_Handle m_seh
virtual ~CEditSequence()
Destructor.
wxMenuItem * m_revtranslate_item2
virtual void SaveSettings() const
CEditSequence()
Constructors.
void OnTranslateNone(wxCommandEvent &event)
virtual void SetRegistryPath(const string &reg_path)
void OnFeatures(wxCommandEvent &event)
vector< CBioseq_Handle::EVectorStrand > m_FeatStrand
void AdjustProtFeatureLocations(CRef< CCmdComposite > composite, const CSeq_feat &old_cds, const CSeq_feat &cds, int i, const CSeq_id *seq_id, TSeqPos seq_start)
void CreateRegulatory(wxCommandEvent &event)
void Init()
Initialises member variables.
wxMenuItem * m_translate_item
vector< bool > m_Feat5Partial
void GetProteinFeatures(CBioseq_Handle prot_bsh, int i, const CSeq_id *seq_id, const CSeq_feat &old_cds, TSeqPos seq_start)
void GetFeatures(const CSeq_loc &loc, CScope &scope)
wxMenuItem * m_revtranslate_item
void OnGoTo(wxCommandEvent &event)
const CSeq_loc * m_loc
CSeq_entry_Handle m_edited_seh
void CreateFeature(wxCommandEvent &event)
vector< int > m_FeatFrames
wxButton * m_CommitButton
void ReportPos(int pos)
void OnRevTranslate1(wxCommandEvent &event)
wxButton * m_RetranslateButton
void OnRevTranslate(wxCommandEvent &event)
void OnRetranslate(wxCommandEvent &event)
virtual void LoadSettings()
vector< CRef< CGenetic_code > > m_GeneticCode
bool x_ExecuteCommand(IEditCommand *command)
IUndoManager * m_UndoManager
void OnCopy(wxCommandEvent &event)
void OnComplement(wxCommandEvent &event)
wxTimer m_readonly_timer
unsigned int m_NumCmds
string GetSeqTitle()
vector< string > m_RealProt
void ShowReadOnlyWarning()
wxTextCtrl * m_RangeFrom
unordered_map< int, vector< vector< pair< TSeqPos, TSeqPos > > > > m_ProtFeatRanges
void OnFind(wxCommandEvent &event)
void AdjustFeatureLocations(CRef< CCmdComposite > composite)
void OnCut(wxCommandEvent &event)
void EnableCommit(bool enable)
wxMenuItem * m_revtranslate_item_all
wxStaticText * m_commit_warning
void OnRange(wxCommandEvent &event)
void OnOnTheFly(wxCommandEvent &event)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Edit Sequence"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(704, 504), long style=wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void IsSelection(wxUpdateUIEvent &event)
void OnClose(wxCommandEvent &event)
void OnAccept(wxCommandEvent &event)
void OnCancel(wxCommandEvent &event)
wxMenuItem * m_revtranslate_item1
CFeat_CI –.
Definition: feat_ci.hpp:64
void OnChange(wxCommandEvent &event)
wxCheckBox * m_RevComp
void CreateControls()
Creates the controls and sizers.
CPaintSequence * m_Panel
static bool ShowToolTips()
Should we show tooltips?
set< int >::iterator m_CurrentPos
wxChoice * m_FrameChoice
wxRadioButton * m_Nuc
void OnPrev(wxCommandEvent &event)
void FindMatchPositions(const string &choice)
void OnDismiss(wxCommandEvent &event)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxTextCtrl * m_Pattern
CFindEditSequence()
Constructors.
wxRadioButton * m_TransFrame
void OnClose(wxCloseEvent &event)
~CFindEditSequence()
Destructor.
void Init()
Initialises member variables.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void OnNext(wxCommandEvent &event)
bool Create(wxWindow *parent, wxWindowID id=29000, const wxString &caption=_("find"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
wxStaticText * m_ItemOfText
@Gb_qual.hpp User-defined methods of the data storage class.
Definition: Gb_qual.hpp:61
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
set< int > & SetHighlights()
void EnableRevTranslation1(bool enable)
void EnableOnTheFly(bool enable)
void OnCut(wxCommandEvent &event)
vector< int > & GetSeqLen()
void SetPos(int pos)
string * GetFindString(bool is_nuc, bool is_revcomp, const string &choice)
pair< int, int > GetSelection()
TSeqPos GetProtFeatureStart(int i, int k, int j)
void EnableMismatch(bool enable)
vector< bool > & GetReadOnly()
void EnableComplement(bool enable)
void UpdateFeatures(const vector< vector< pair< TSeqPos, TSeqPos > > > &feat_ranges, const vector< pair< string, objects::CSeqFeatData::ESubtype > > &feat_types, const vector< objects::CBioseq_Handle::EVectorStrand > &feat_strand, const vector< int > &feat_frames, const vector< CRef< objects::CGenetic_code > > &genetic_code, const vector< bool > &feat_partial5, const vector< string > &real_prot, const unordered_map< int, vector< vector< pair< TSeqPos, TSeqPos > > > > &prot_feat_ranges)
void OnPaste(wxCommandEvent &event)
void EnableTranslation1(bool enable)
void SetRange(int pos1, int pos2)
void OnCopy(wxCommandEvent &event)
void EnableRevTranslation(bool enable)
void EnableTranslation2(bool enable)
void EnableTranslation(bool enable)
void Search(const string &val)
void EnableRevTranslation2(bool enable)
void SetClean(bool clean)
TSeqPos GetFeatureStop(int i, int j)
TSeqPos GetProtFeatureStop(int i, int k, int j)
void EnableFeatures(bool enable)
TSeqPos GetFeatureStart(int i, int j)
void GetLabel(string *label) const
Definition: Prot_ref.cpp:62
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
Definition: reg_view.cpp:230
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
static EFeatureLocationAllowed AllowedFeatureLocation(ESubtype subtype)
@ eFeatureLocationAllowed_NucOnly
@ eFeatureLocationAllowed_ProtOnly
ESubtype GetSubtype(void) const
Iterator over CSeqMap.
Definition: seq_map_ci.hpp:252
Non-const iterator over CSeqMap (allows to edit the sequence).
Definition: seq_map_ci.hpp:407
@ e_Iupacna
Definition: sequtil.hpp:47
@ e_Iupacaa
Definition: sequtil.hpp:55
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
CSeq_feat_Handle –.
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:593
CSeq_loc_Mapper –.
static CUICommandRegistry & GetInstance()
the main instance associated with the application
Definition: ui_command.cpp:176
wxMenu * CreateMenu(const SwxMenuItemRec *items)
create a menu from a static definition (see WX_*_MENU macros)
Definition: ui_command.cpp:349
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
Interface (functor) for object editing.
virtual bool RequestExclusiveEdit(wxWindow *window, const string &descr)=0
virtual bool CanUndo()=0
virtual bool ReleaseExclusiveEdit(wxWindow *window)=0
virtual void Undo(wxWindow *window=0)=0
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
const_iterator begin() const
Definition: set.hpp:135
void clear()
Definition: set.hpp:153
size_type size() const
Definition: set.hpp:132
bool empty() const
Definition: set.hpp:133
const_iterator end() const
Definition: set.hpp:136
void swap(this_type &m)
Definition: set.hpp:102
#define _(proto)
Definition: ct_nlmzip_i.h:78
static const char * kFramePosX
static const char * kFrameHeight
const char * kExclusiveEditDescr
static const char * kFramePosY
static const char * kFrameWidth
#define ID_ACCEPT_EDSEQ_BUTTON
#define ID_TRANSFRAME_FIND_EDIT_SEQ
#define READONLY_TIMER_ID
#define ID_SHOW_ONTHEFLY_EDSEQ_MENU
#define ID_EDIT_CUT_EDSEQ_MENU
#define ID_EDIT_PASTE_EDSEQ_MENU
#define ID_SHOW_TRANSLATE_NONE_EDSEQ_MENU
#define ID_DISMISS_FIND_EDIT_SEQ
#define ID_SHOW_TRANSLATE_EVERYTHING_EDSEQ_MENU
#define ID_TEXTCTRL_FIND_EDIT_SEQ
#define ID_CLOSE_EDSEQ_BUTTON
#define ID_SHOW_TRANSLATE2_EDSEQ_MENU
#define ID_SHOW_REVTRANSLATE_EDSEQ_MENU
#define ID_SHOW_REVTRANSLATE2_EDSEQ_MENU
#define ID_SHOW_REVCOMP_EDSEQ_MENU
#define ID_SHOW_REVTRANSLATE1_EDSEQ_MENU
#define ID_GOTO_EDSEQ_BUTTON
#define ID_NUC_FIND_EDIT_SEQ
#define ID_SHOW_FEATURES_EDSEQ_MENU
#define ID_SHOW_MISMATCH_EDSEQ_MENU
#define ID_RANGE_EDSEQ_BUTTON
#define ID_RETRANSLATE_EDSEQ_BUTTON
#define ID_PREV_FIND_EDIT_SEQ
#define ID_SHOW_REVTRANSLATE_ALL_EDSEQ_MENU
#define ID_EDIT_COPY_EDSEQ_MENU
#define ID_NEXT_FIND_EDIT_SEQ
#define ID_REVCOMP_FIND_EDIT_SEQ
#define ID_EDIT_FIND_EDSEQ_MENU
#define ID_SHOW_TRANSLATE1_EDSEQ_MENU
#define ID_CANCEL_EDSEQ_BUTTON
#define ID_SHOW_TRANSLATE_EDSEQ_MENU
#define ID_FRAMECHOICE_FIND_EDIT_SEQ
#define ID_SHOW_TRANSLATE_ALL_EDSEQ_MENU
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
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 NULL
Definition: ncbistd.hpp:225
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
string GetLabel(const CSeq_id &id)
CRef< CSeq_loc > MakeSeq_loc(EMakeType make_type=eMake_CompactType) const
return constructed CSeq_loc with all changes
Definition: Seq_loc.cpp:2946
void SetFrom(TSeqPos from)
Set the range from position.
Definition: Seq_loc.cpp:2818
void SetTo(TSeqPos to)
Set the range to position.
Definition: Seq_loc.cpp:2829
void Delete(void)
Delete current element, and make iterator to point to the next element.
Definition: Seq_loc.cpp:2724
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
Definition: Seq_loc.cpp:337
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
Definition: Seq_loc.cpp:915
bool HasChanges(void) const
return true of any part was changed since initialization
Definition: Seq_loc.cpp:2706
void SetInt(TInt &v)
Definition: Seq_loc.hpp:983
bool IsEmpty(void) const
True if the current location is empty.
Definition: Seq_loc.hpp:1084
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
size_t GetSize(void) const
Get number of ranges.
Definition: Seq_loc.cpp:2636
TRange GetRange(void) const
Get the range.
Definition: Seq_loc.hpp:1042
const CSeq_id & GetSeq_id(void) const
Get seq_id of the current location.
Definition: Seq_loc.hpp:1028
@ eOrder_Positional
Definition: Seq_loc.hpp:461
@ fFGL_Content
Include its content if there is any.
Definition: feature.hpp:73
bool IsSameBioseq(const CSeq_id &id1, const CSeq_id &id2, CScope *scope, CScope::EGetBioseqFlag get_flag=CScope::eGetBioseq_All)
Determines if two CSeq_ids represent the same CBioseq.
static CCdregion::EFrame FindBestFrame(const CSeq_feat &cds, CScope &scope)
Find "best" frame for a coding region.
Definition: sequence.cpp:4376
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
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 GetAllTSEs(TTSE_Handles &tses, enum ETSEKind kind=eManualTSEs)
Definition: scope.cpp:295
CSeq_loc_Mapper_Base & SetMergeAbutting(void)
Merge only abutting intervals, keep overlapping.
vector< CSeq_entry_Handle > TTSE_Handles
Definition: scope.hpp:645
@ eAllTSEs
Definition: scope.hpp:643
@ eProductToLocation
Map from the feature's product to location.
@ eLocationToProduct
Map from the feature's location to product.
bool IsNucleotide(void) const
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
const CSeqFeatData & GetData(void) const
TSeqPos GetBioseqLength(void) const
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
bool IsSetProduct(void) const
virtual const CSeq_loc & GetLocation(void) const
TSeq GetSeq(void) const
bool IsProtein(void) const
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
CScope & GetScope(void) const
Get scope this handle belongs to.
CScope & GetScope(void) const
Get scope this handle belongs to.
CScope & GetScope(void) const
Get scope this handle belongs to.
CSeqFeatData::ESubtype GetFeatSubtype(void) const
CRef< CSeq_loc > GetRangeSeq_loc(TSeqPos start, TSeqPos stop, ENa_strand strand=eNa_strand_unknown) const
Return CSeq_loc referencing the given range and strand on the bioseq If start == 0,...
bool IsPlainFeat(void) const
Check if this is plain feature.
const TId & GetId(void) const
CSeqVector GetSeqVector(EVectorCoding coding, ENa_strand strand=eNa_strand_plus) const
Get sequence: Iupacna or Iupacaa if use_iupac_coding is true.
bool IsSeq(void) const
@ eStrand_Plus
Plus strand.
@ eStrand_Minus
Minus strand.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
CSeqMap_I & Remove(void)
Remove current segment.
Definition: seq_map_ci.cpp:893
void GetSequence(string &buffer, CSeqUtil::ECoding buffer_coding) const
Get current sequence as a string with the selected encoding.
Definition: seq_map_ci.cpp:901
const CSeq_loc & GetLocation(void) const
SSeqMapSelector & SetFlags(TFlags flags)
Select segment type(s)
Definition: seq_map_ci.hpp:179
void SetSequence(const string &buffer, CSeqUtil::ECoding buffer_coding, CSeq_data::E_Choice seq_data_coding)
Set sequence data.
Definition: seq_map_ci.cpp:937
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
const CSeq_feat_Handle & GetSeq_feat_Handle(void) const
Get original feature handle.
Definition: mapped_feat.hpp:71
bool IsValid(void) const
Definition: seq_map_ci.cpp:724
const CSeq_loc & GetProduct(void) const
CSeqMap::ESegmentType GetType(void) const
Definition: seq_map_ci.hpp:651
TSeqPos GetLength(void) const
return length of current segment
Definition: seq_map_ci.hpp:672
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
@ fDefaultFlags
Definition: seq_map.hpp:140
@ eSeqData
real sequence data
Definition: seq_map.hpp:98
#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 SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
Definition: ncbistr.cpp:2993
#define NPOS
Definition: ncbistr.hpp:133
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
static const char label[]
TTo GetTo(void) const
Get the To member data.
Definition: Range_.hpp:269
TFrom GetFrom(void) const
Get the From member data.
Definition: Range_.hpp:222
void SetQual(const TQual &value)
Assign a value to Qual data member.
Definition: Gb_qual_.hpp:221
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
void SetLocation(TLocation &value)
Assign a value to Location data member.
Definition: Seq_feat_.cpp:131
bool IsCdregion(void) const
Check if variant Cdregion is selected.
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 TCode & GetCode(void) const
Get the Code member data.
Definition: Cdregion_.hpp:712
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
void SetVal(const TVal &value)
Assign a value to Val data member.
Definition: Gb_qual_.hpp:268
const TProt & GetProt(void) const
Get the variant data.
TQual & SetQual(void)
Assign a value to Qual data member.
Definition: Seq_feat_.hpp:1153
bool IsSetFrame(void) const
Check if a value has been assigned to Frame data member.
Definition: Cdregion_.hpp:509
@ eFrame_three
reading frame
Definition: Cdregion_.hpp:98
bool IsNull(void) const
Check if variant Null is selected.
Definition: Seq_loc_.hpp:504
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
const TSeq & GetSeq(void) const
Get the variant data.
Definition: Seq_entry_.cpp:102
const TInst & GetInst(void) const
Get the Inst member data.
Definition: Bioseq_.hpp:336
@ e_Iupacna
IUPAC 1 letter nuc acid code.
Definition: Seq_data_.hpp:104
@ e_Iupacaa
IUPAC 1 letter amino acid code.
Definition: Seq_data_.hpp:105
END_EVENT_TABLE()
int i
int len
CMinPanelContainer::OnRestoreWindow EVT_UPDATE_UI_RANGE(eCmdCloseDockPanel, eCmdWindowRestore, CMinPanelContainer::OnUpdateWindowCommand) CMinPanelContainer
#define wxT(x)
Definition: muParser.cpp:41
void ReportUsage(const wxString &dialog_name)
Report opening & accepting events in the editing package.
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
unsigned int a
Definition: ncbi_localip.c:102
int isspace(Uchar c)
Definition: ncbictype.hpp:69
int isdigit(Uchar c)
Definition: ncbictype.hpp:64
const char * command
T max(T x_, T y_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:613
The Object manager core.
static static static wxID_ANY
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
SAnnotSelector –.
Selector used in CSeqMap methods returning iterators.
Definition: seq_map_ci.hpp:113
Definition: inftrees.h:24
#define WX_MENU_ITEM_EXT(cmd)
Definition: ui_command.hpp:324
#define WX_DEFINE_MENU(name)
New macros for defining menus for use with CUICommandRegistry.
Definition: ui_command.hpp:266
#define WX_SUBMENU_EXT(label)
Definition: ui_command.hpp:321
#define WX_END_MENU()
Definition: ui_command.hpp:294
#define WX_SUBMENU_INT(label)
Definition: ui_command.hpp:299
#define WX_MENU_ITEM_INT(cmd)
Definition: ui_command.hpp:302
#define WX_END_SUBMENU()
Definition: ui_command.hpp:291
static void SetTitle(CRef< CSeq_entry > entry, string title)
CRef< CCmdComposite > GetRetranslateCDSCommand(objects::CScope &scope, const objects::CSeq_feat &cds, bool create_general_only)
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
bool RunningInsideNCBI()
Definition: wx_utils.cpp:1335
wxRect GetScreenRect(const wxWindow &win)
Definition: wx_utils.cpp:783
#define local
Definition: zutil.h:33
Modified on Wed Apr 17 13:08:57 2024 by modify_doxy.py rev. 669887