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

Go to the SVN repository for this file.

1 /* $Id: view_graphic.cpp 47029 2022-05-16 18:09:35Z 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: Vlad Lebedev, Liangshou Wu
27  *
28  * File Description:
29  * User-modifiable portion of main graphical sequence viewer class
30  */
31 
32 
33 #include <ncbi_pch.hpp>
34 
36 
41 
44 
47 
52 
53 #include <gui/objutils/utils.hpp>
54 #include <gui/objutils/label.hpp>
58 
61 
63 
64 #include <objmgr/util/sequence.hpp>
65 
66 #include <serial/iterator.hpp>
67 #include <wx/msgdlg.h>
68 
71 
76 
77 ///////////////////////////////////////////////////////////////////////////////
78 /// CViewGraphic
79 
81  "Graphical Sequence View", // type name
82  "graphical_view", // icon alias TODO
83  "Graphical View",
84  "The Graphical View provides an overview of annotations "
85  "on sequence, with extensive drill-down capabilities.",
86  "GRAPHICAL_VIEW", // help ID
87  "Sequence", // category
88  false, // singleton
89  "Seq-loc",
91 );
92 
94  : m_GraphicPanel(NULL)
95 {
96 }
97 
98 
100 {
101 }
102 
103 
104 const wxMenu* CViewGraphic::GetMenu()
105 {
106  return NULL;// TODO
107 }
108 
109 void CViewGraphic::CreateViewWindow(wxWindow* parent)
110 {
112 
113  m_GraphicPanel = new CGraphicPanel(parent);
114 
116  AddListener(widget, ePool_Child);
117  widget->AddListener(this, ePool_Parent);
118 }
119 
120 
122 {
123  //m_DataSource->DeleteAllJobs(); // Cancel all jobs before listener is deleted
124 
125  if (m_GraphicPanel) {
126  m_GraphicPanel->Destroy();
128  }
129 }
130 
131 //TODO this function is too long
132 bool CViewGraphic::InitView(TConstScopedObjects& objects, const objects::CUser_object* params)
133 {
134  CScope* scope = NULL;
135  const CObject* object = NULL;
136 
137  wxBusyCursor wait;
138 
140 
141  if(objects.size() == 1) {
142  object = objects[0].object.GetPointer();
143  scope = objects[0].scope.GetPointer();
144 
145  const CSeq_loc* loc = dynamic_cast<const CSeq_loc*> (object);
146  const CSeq_id* sid = dynamic_cast<const CSeq_id*> (object);
147  const CBioseq* seq = dynamic_cast<const CBioseq*> (object);
148  const CSeq_entry* seq_entry = dynamic_cast<const CSeq_entry*> (object);
149  if (seq_entry && seq_entry->IsSeq())
150  seq = &seq_entry->GetSeq();
151 
152  if (loc) {
153  sid = &sequence::GetId(*loc, scope);
154  } else if (seq) {
155  sid = seq->GetFirstId();
156  }
157 
158  if (sid) {
159  static const wxString strInitializing = wxT("Initializing...");
160  m_SeqId.Reset(sid);
161 
162  SConstScopedObject s_obj(m_SeqId, scope);
163  CBioseq_Handle handle;
164  try {
165  handle = GUI_AsyncExec(
166  [&s_obj](ICanceled&)
167  {
168  const CSeq_id* id = dynamic_cast<const CSeq_id*>(s_obj.object.GetPointer());
169  CScope* scope = s_obj.scope.GetPointer();
170 
171  CBioseq_Handle handle;
172  if (id && scope) {
173  handle = scope->GetBioseqHandle(*id);
174  // resolving the seq-id in other form to avoid
175  // potential future network connection
176  CSeq_id_Handle idh = handle.GetSeq_id_Handle();
177  idh = sequence::GetId(*idh.GetSeqId(), *scope, sequence::eGetId_Best);
178  }
179  return handle;
180  },
181  strInitializing);
182  } catch (CException& e) {
183  string str("Failed to retrieve sequence: ");
184  str += e.GetMsg();
185  wxMessageBox(ToWxString(str));
186  return false;
187  }
188 
189  if ( !handle ) {
190  string str;
191  m_SeqId->GetLabel(&str);
192  ReportIDError(str, m_SeqId->IsLocal(), "Graphical Sequence View");
193  return false;
194  }
195 
198 
199  _ASSERT(srv);
200 
201  CRef<CGBWorkspace> ws = srv->GetGBWorkspace();
202  if (!ws) return false;
203 
204  CGBDocument* doc = dynamic_cast<CGBDocument*>(ws->GetProjectFromScope(*scope));
205  _ASSERT(doc);
206 
207  // type info for retrieving view settings
208  string view_type = GetTypeDescriptor().GetHelpId();
209  string view_ins_id;
210  m_SeqId->GetLabel(&view_ins_id, CSeq_id::eFasta);
211  string settings = doc->GetViewSettings(view_type, view_ins_id);
212  LOG_POST(Info << "Retrieve view settings: " << settings);
213  if (nullptr != params) {
214  string param_settings = x_GetViewSettingsFromParams(params);
215  if (!param_settings.empty()) {
216  LOG_POST(Info << "View settings through params: " << param_settings);
217  // Override settings
218  settings = param_settings;
219  }
220  }
221 
222  typedef vector<string> TToken;
223  TToken setting_set;
224  NStr::Split(settings, "&", setting_set);
225  map<string, string> setting_map;
226  ITERATE (TToken, iter, setting_set) {
227  string curr_setting = NStr::TruncateSpaces(*iter);
228  TToken tokens;
229  NStr::Split(curr_setting, "=", tokens);
230  if (tokens.size() == 2) {
231  setting_map.insert(map<string, string>::value_type(tokens[0],
232  tokens[1]));
233  }
234  }
235 
237  CFeaturePanel* fp = widget->GetFeaturePanel();
238  if (fp) {
239  fp->SetDefaultAssembly(doc->GetDefaultAssembly());
240  fp->SetServiceLocator(m_Workbench);
241  }
242 
243  try {
244  widget->UpdateConfig();
245  LOG_POST(Info <<
246  "CViewGraphical::InitView() - finish with loading configuration!");
247  } catch (CException&) {
248  wxMessageBox(wxT("Something is wrong with configuration!"),
249  wxT("Failed to load configuration for Graphical view"),
250  wxOK | wxICON_EXCLAMATION);
251  return false;
252  }
253 
254  try {
255  SConstScopedObject obj(m_SeqId, scope);
256 
257  // initialize the data source using async call to
258  // avoid completely blocking application without
259  // users' attention.
260 
262  [widget, &obj](ICanceled&) { widget->InitDataSource(obj); },
263  strInitializing);
264 
265  // set input object to initialize the view
266  widget->SetInputObject(obj);
267 
268  x_SetNonAsnInput(doc->GetData());
269 
270  auto &cmdProcessor = doc->GetUndoManager();
271  widget->InitBioseqEditor(cmdProcessor);
272  widget->SetWorkDir(doc->GetWorkDir());
273  string id_desc;
274  CLabel::GetLabel(*m_SeqId, &id_desc, CLabel::eContent, scope);
275  LOG_POST(Info <<
276  "CViewGraphical::InitView() - load sequence: " << id_desc);
277  } catch (CException&) {
279  return false;
280  }
281 
282 
283  if (setting_map.count("m") != 0) {
284  widget->SetMarkers(setting_map["m"]);
285  }
286  if (setting_map.count("mk") != 0) {
287  widget->SetMarkers(setting_map["mk"]);
288  }
289 
290  x_AttachToProject(*doc);
291 
293 
294  // TODO move this block into a separate function
295  // set our visible range
296  if (loc && !loc->IsWhole()) {
297  TSeqRange range = loc->GetTotalRange();
298  widget->ZoomOnRange(range, 0);
299  } else if (setting_map.count("v") != 0) {
300  TToken tokens;
301  NStr::Split(setting_map["v"], "-:", tokens);
302  if ( !tokens.empty() ) {
303  try {
304  TSeqPos from = NStr::StringToNumeric<TSeqPos>(NStr::TruncateSpaces(tokens[0]));
305  TSeqPos to = from;
306  if (tokens.size() > 1) {
307  to = NStr::StringToNumeric<TSeqPos>(NStr::TruncateSpaces(tokens[1]));
308  if (to < from) {
309  to = from;
310  }
311  }
312  widget->ZoomOnRange(TSeqRange(from, to), 0);
313  } catch (CException&) {
314  }
315  }
316  }
317 
318 
319  //LOG_POST("CViewGraphic::InitView() finished init" << int(1000 * sw.Elapsed()) << " ms");
320 
322 
323  return true;
324  }
325 
326  // cannot represent the data
328  return false;
329  } else {
330  return false;
331  }
332 }
333 
334 
336 {
339  widget->OnDataChanging();
340  }
341  else if (evt.GetSubtype() == CProjectViewEvent::eData ||
344  widget->OnDataChanged();
345 
347  _ASSERT(service);
348 
349  CRef<CGBWorkspace> ws = service->GetGBWorkspace();
350  if (ws) {
351  CGBProjectHandle* project = ws->GetProjectFromId(evt.GetProjectId());
352  if (project) {
353  CGBDocument& doc = dynamic_cast<CGBDocument&>(*project);
354  x_SetNonAsnInput(doc.GetData());
355  }
356 
357  }
358 
359  widget->Refresh();
360  }
361 }
362 
363 
365 {
367  return m_GraphicPanel;
368 }
369 
370 
372 {
373  return GetClientLabel();
374 }
375 
376 
378 {
379  return s_ViewGraphicTypeDescr;
380 }
381 
382 
384 {
385  if (m_GraphicPanel && x_HasProject()) {
386  CScope* scope = x_GetScope();
387 
388  /// object selection
389  TConstObjects sel_objs;
390 
392  widget->GetObjectSelection(sel_objs);
393 
394  set<CSeq_id_Handle> seqIds;
396 
397  ITERATE (TConstObjects, it, sel_objs) {
398  objs.push_back(SConstScopedObject(*it, scope));
399 
400  const CSeq_align* align = dynamic_cast<const CSeq_align*>(it->GetPointerOrNull());
401  if (align) {
403  CObjectConverter::FindRelations(*scope, *align, CSeq_id::GetTypeInfo()->GetName(), relations);
405  if ((*itr)->GetName() == "Seq-align -> Seq-id") {
406  CRelation::TObjects related;
407  (*itr)->GetRelated(*scope, *align, related, CRelation::fConvert_NoExpensive);
408  ITERATE(CRelation::TObjects, itLoc, related) {
409  const CSeq_id* seq_id = dynamic_cast<const CSeq_id*>(&itLoc->GetObject());
410  if (seq_id) {
411  CSeq_id_Handle handle = CSeq_id_Handle::GetHandle(*seq_id);
412  if (seqIds.find(handle) == seqIds.end()) {
413  objs.push_back(SConstScopedObject(seq_id, scope));
414  seqIds.insert(handle);
415  }
416  }
417  }
418  }
419  }
420  }
421  }
422 
423  /// range selection
424  const CSeqGraphicWidget::TRangeColl& coll = widget->GetRangeSelection();
425  if (coll.size()) {
427  if (loc) {
428  objs.push_back(SConstScopedObject(loc, scope));
429  }
430  }
431  }
432 }
433 
434 
436 {
437  if (m_GraphicPanel && x_HasProject()) {
439  // add range selection
440  const CSeqGraphicWidget::TRangeColl& cl_sel
441  = widget->GetRangeSelection();
442  evt.AddRangeSelection(*m_SeqId, cl_sel);
443 
444  // add object selection
445  TConstObjects sel_objs;
446  widget->GetObjectSelection(sel_objs);
447  evt.AddObjectSelection(sel_objs);
448  }
449 }
450 
451 
452 // handles incoming selection broadcast (overriding CView virtual function)
454 {
455  CScope* scope = x_GetScope();
457 
458  if (evt.HasRangeSelection()) { // set range selection
460  evt.GetRangeSelection(*m_SeqId, *scope, coll);
461  // set selection
462  if (coll.size()) {
463  widget->ResetRangeSelection();
464  widget->SetRangeSelection(coll);
465  }
466  }
467 
468  if (&evt.GetScope() != scope)
469  return;
470 
471  TConstObjects sel_objs;
472  evt.GetAllObjects(sel_objs);
473 
474  //CScope::TIds ids = scope.GetIds(*m_SeqId);
475  widget->ResetObjectSelection();
476  ITERATE (TConstObjects, it_obj, sel_objs) {
477  if (typeid(CSeq_id) == typeid(*it_obj)) {
478  widget->SelectObject(*it_obj, false);
479  } else if (const CSerialObject* nc_obj =
480  dynamic_cast<const CSerialObject*>(it_obj->GetPointer()) ) {
481  CTypeConstIterator<CSeq_id> id_iter(*nc_obj);
482  for ( ; id_iter; ++id_iter) {
483  if(evt.MatchIdWithId(*m_SeqId, *scope, *id_iter, evt.GetScope())) {
484  widget->SelectObject(*it_obj, true); // scope matched
485  break;
486  }
487  }
488  // set selection with verified set to false
489  widget->SelectObject(*it_obj, false);
490  } else if (const CIdLoc* id_loc =
491  dynamic_cast<const CIdLoc*>(it_obj->GetPointer()) ) {
492  widget->SelectObject(id_loc->m_Id, false);
493  } else if(dynamic_cast<const CVcfVariant*>(it_obj->GetPointer()) != NULL) {
494  widget->SelectObject(*it_obj, false);
495  } else { // log message
496  LOG_POST(Warning << "The selected objects are not understood!");
497  }
498  }
499 }
500 
501 // override function to suppress Navigation toolbar
503 {
505 }
506 
508 {
509  return m_SeqId.GetPointer();
510 }
511 
513 {
514  m_SeqId.Reset(dynamic_cast<const CSeq_id*>(obj.object.GetPointer()));
516  widget->InitDataSource(obj);
517  widget->SetInputObject(obj);
520 }
521 
523  IVisibleRangeClient* /*source*/)
524 {
527  x_UpdateVisRangeLayout(siblings);
528 
530 
531  try {
532  if( vrange.Match( *m_SeqId ) ) {
533  TSeqRange this_range = widget->GetVisibleSeqRange();
534  CBioseq_Handle bsh = x_GetScope()->GetBioseqHandle(*m_SeqId);
535  if (vrange.Clamp(bsh, this_range)) {
536  widget->ZoomOnRange(this_range, CSeqGraphicWidget::fSaveRange);
537  }
538  }
539  } catch( std::exception& e ){
540  LOG_POST(Error
541  << "CViewGraphic::OnVisibleRangeChanged(): exception caught "
542  << e.what() );
543  }
544 }
545 
547 {
548  CSeqGlyph::TObjects tmp_objs;
549  ITERATE( IViewManagerService::TViews, iter, views ){
550  const IView* iview = *iter;
551  const CProjectView* view_p = dynamic_cast<const CProjectView*> (iview);
552  try {
553  if (view_p && view_p->GetId() != GetId()) { // not self
555  string label;
556  list<TSeqRange> vis_ranges;
557  view_p->GetReflectionInfo(*m_SeqId, vis_ranges, color, label);
558  if ( !vis_ranges.empty() ) {
559  CRef<CSeqGlyph> vref(new CVisRangeGlyph(view_p,
560  vis_ranges, color, label));
561  tmp_objs.push_back(vref);
562  }
563  }
564  } catch( std::exception& e ){
565  LOG_POST(Error
566  << "CViewGraphic::x_UpdateVisRangeLayout(): exception caught "
567  << e.what() );
568  }
569  }
570 
572 }
573 
574 
576 {
578  CRef<CSeq_loc> loc(new CSeq_loc());
579  loc->SetInt().SetFrom(range.GetFrom());
580 
581  loc->SetInt().SetTo (range.GetTo());
582  loc->SetId(*m_SeqId);
583  vrange.AddLocation(*loc);
584 }
585 
586 
588 {
591  x_UpdateVisRangeLayout(siblings);
592 }
593 
594 
596 {
597  _ASSERT(evt);
599 }
600 
601 
603 {
604  COpenGraphicViewEvent* openEvent = static_cast<COpenGraphicViewEvent*>(evt);
606  CIRef<IProjectView> view = srv->AddProjectView("Graphical Sequence View", openEvent->GetObject(), openEvent->GetParams());
607 }
608 
609 
611 {
614  x_UpdateVisRangeLayout( siblings );
615 }
616 
618 {
621  const CProjectView* view_u = dynamic_cast<CProjectView*>(&view);
623  const IView* iview = *iter;
624  const CProjectView* view_p = dynamic_cast<const CProjectView*> (iview);
625  if (view_u && view_p && view_p->GetId() == view_u->GetId()) {
626  siblings.erase(iter);
627  break;
628  }
629  }
630 
631  x_UpdateVisRangeLayout(siblings);
632 }
633 
634 
636 {
637  if(workbench) {
638  // connect
640  workbench->GetServiceByType<CDataMiningService>();
641  if (dm_srv) {
642  dm_srv->AttachContext(*this);
643  }
644  }
645  else {
646  // disconnect
649  if (dm_srv) {
650  dm_srv->DetachContext(*this);
651  }
652  }
653  CProjectView::SetWorkbench(workbench);
654 
655 }
656 
657 
659 {
660  const CSeqGraphicWidget::TRangeColl& coll =
662 
663  CRef<CSeq_loc> loc(new CSeq_loc());
664 
665  // if we have range selection use it for search
666  if (coll.size()) {
667  loc = CSeqUtils::CreateSeq_loc(*m_SeqId, coll);
668  }
669  else {
670  CRef<CSeq_id> id(new CSeq_id());
671  id->Assign(*m_SeqId);
672  loc->SetWhole(*id);
673  }
674 
675  return loc;
676 }
677 
678 
680 {
681  return m_Scope;
682 }
683 
685 {
687  CFeaturePanel* fp = widget->GetFeaturePanel();
688  if (fp) {
689  return fp->GetAnnotNames();
690  }
691  return {};
692 }
693 
694 
695 ///////////////////////////////////////////////////////////////////////////////
696 /// CViewGraphicFactory
698 {
699  static string sid("view_graphic_factory");
700  return sid;
701 }
702 
703 
705 {
706  static string slabel("View Graphic Factory");
707  return slabel;
708 }
709 
710 
712 {
713  string alias = GetViewTypeDescriptor().GetIconAlias();
714  provider.RegisterFileAlias(ToWxString(alias), wxT("graphical_view.png"));
715 }
716 
717 
719  wxFileArtProvider& provider)
720 {
721  CSeqGraphicWidget::RegisterCommands(cmd_reg, provider);
722 }
723 
724 
727 {
728  return s_ViewGraphicTypeDescr;
729 }
730 
731 
733 {
734  return new CViewGraphic();
735 }
736 
737 
739 {
740  return NULL;
741 }
742 
743 bool CViewGraphicFactory::IsCompatibleWith( const CObject& object, objects::CScope& )
744 {
745  const type_info& type = typeid(object);
746 
747  if (typeid(CSeq_entry) == type) {
748  const CSeq_entry& seq_entry = dynamic_cast<const CSeq_entry&>(object);
749  return seq_entry.IsSeq();
750  }
751 
752  return
753  typeid(CSeq_loc) == type
754  || typeid(CSeq_id) == type
755  || typeid(CBioseq) == type
756  ;
757 }
758 
759 
761 {
762  bool found_good = false;
763  bool found_bad = false;
764  for( size_t i = 0; i < objects.size(); i++ ){
765  if( IsCompatibleWith( *objects[i].object, *objects[i].scope ) ){
766  found_good = true;
767  } else {
768  found_bad = true;
769  }
770  }
771 
772  if( found_good ){
773  return fCanShowSeparated | (found_bad ? fCanShowSome : fCanShowAll);
774  }
775  return 0; // can show nothing
776 }
777 
778 
780 {
781  if( objects.size() < 2 ){
782  return true;
783  }
784  // verify that all the objects has the same seq-id
786  TRanges ranges;
788  const CSeq_loc* loc = dynamic_cast<const CSeq_loc*> (iter->object.GetPointer());
789  if (loc) {
790  CScope* scope = const_cast<CScope*>(iter->scope.GetPointer());
791  CSeq_id_Handle idh = sequence::GetIdHandle(*loc, scope);
792  TSeqRange range = loc->GetTotalRange();
793  ranges[idh] += range;
794  }
795  }
796  if (ranges.size() == 1) {
797  CRef<objects::CScope> scope = objects[0].scope;
798  CRef<CSeq_loc> loc(new CSeq_loc);
799  TRanges::iterator iter = ranges.begin();
800  loc->SetInt().SetFrom(iter->second.GetFrom());
801  loc->SetInt().SetTo (iter->second.GetTo());
802  loc->SetId(*iter->first.GetSeqId());
803 
804  //! Should be better incapsulation of m_OutputObjects
805  objects.clear();
806  objects.push_back(
807  SConstScopedObject(loc, scope)
808  );
809  return true;
810  } else {
811  return false;
812  }
813 }
814 
815 
816 void CViewGraphic::SaveSettingsAtProject(objects::CGBProjectHandle& project) const
817 {
819 
820  if (!widget || !widget->IsDirty())
821  return;
822 
823  string settings = "v=";
824  settings += NStr::NumericToString(widget->GetVisibleSeqRange().GetFrom());
825  settings += "-";
826  settings += NStr::NumericToString(widget->GetVisibleSeqRange().GetTo());
827  string markers = widget->GetMarkers();
828  if (!markers.empty()) {
829  settings += "&m=" + markers;
830  }
831 
832  string view_type = GetTypeDescriptor().GetHelpId();
833  string view_ins_id;
834  m_SeqId->GetLabel(&view_ins_id, CSeq_id::eFasta);
835 
836  project.SaveViewSettings(view_type, view_ins_id, settings);
837  project.SetDirty(true);
838  LOG_POST(Info << "Save view settings: " << settings);
839 
840  widget->SetDirty(false);
841 }
842 
843 
844 string CViewGraphic::x_GetViewSettingsFromParams(const objects::CUser_object* params)
845 {
846  _ASSERT(nullptr != params);
847  const CObject_id& type = params->GetType();
848  if (type.IsStr() && type.GetStr() == "GraphicalViewParams") {
849  ITERATE(CUser_object::TData, it, params->GetData()) {
850  const CObject_id& field_id = (*it)->GetLabel();
851  if (!field_id.IsStr())
852  continue;
853 
854  const string& label = field_id.GetStr();
855  const CUser_field::TData& data = (*it)->GetData();
856 
857  if ((label == "Settings") && data.IsStr())
858  return data.GetStr();
859  }
860  }
861  return string();
862 }
863 
864 
865 void CViewGraphic::x_SetNonAsnInput(const objects::CProjectFolder &prj_folder)
866 {
867  if (!prj_folder.IsSetItems())
868  return;
869 
870  vector< CIRef<INonAsnTrackDataFactory> > data_factories;
872 
873  if (data_factories.empty())
874  return;
875 
876 // LOG_POST(Info << "CViewGraphic::x_SetNonAsnInput() " << GetDMContextName() << " for: " << m_SeqId->AsFastaString() << ", m_NonAsnTrackData: " <<
877 // m_NonAsnTrackData.GetPointer());
878 
879  for (const auto& prj_item : prj_folder.GetItems()) {
880  if (!prj_item->GetItem().IsOther())
881  continue;
882 
883  for (auto &factory : data_factories) {
884 // LOG_POST(Info << "\tChecking item: " << prj_item->GetLabel());
885  CIRef<INonAsnTrackData> track_data(factory->CreateTrackData(*m_SeqId, *prj_item));
886  if (track_data.IsNull()) {
887  continue;
888  }
889  m_NonAsnTrackData.Reset(track_data);
891  }
892  }
893 
894  for (const auto& prj_folder : prj_folder.GetFolders()) {
895  x_SetNonAsnInput(*prj_folder);
896  }
897 // LOG_POST(Info << "m_NonAsnTrackData reset to: " << m_NonAsnTrackData.GetPointer());
898 }
899 
900 
vector< TRangeWithFuzz > TRanges
Definition: Seq_loc.cpp:4277
User-defined methods of the data storage class.
std::invoke_result< _Fty, ICanceled & >::type GUI_AsyncExec(_Fty &&_Fnarg, const wxString &msg=wxT("Accessing network..."))
Definition: async_call.hpp:130
CBioseq_Handle –.
const CSeq_id * GetFirstId() const
Definition: Bioseq.cpp:271
CDataMiningService.
CEvent - generic event implementation TODO TODO - Attachments.
Definition: event.hpp:86
CGBDocument.
Definition: document.hpp:113
string GetDefaultAssembly() const
Definition: document.cpp:142
wxString GetWorkDir() const
Definition: document.cpp:1364
CUndoManager & GetUndoManager()
Definition: document.hpp:158
CSeqGraphicWidget * GetWidget()
void CreateToolbar()
vector< TRelation > TRelationVector
static void FindRelations(objects::CScope &scope, const CObject &obj, const string &to_type_in, TRelationVector &relations)
CObject –.
Definition: ncbiobj.hpp:180
SConstScopedObject & GetObject()
Definition: view_event.hpp:96
const objects::CUser_object * GetParams() const
Definition: view_event.hpp:97
CProjectService - a service providing API for operations with Workspaces and Projects.
virtual void x_ReportInvalidInputData(TConstScopedObjects &objects)
use this function to report incompatible data in InitView()
virtual void OnProjectChanged()
virtual void x_UpdateContentLabel()
CRef< objects::CScope > m_Scope
virtual string GetClientLabel(IWMClient::ELabel ltype=IWMClient::eDefault) const
returns the client label (name) to be displayed in UI
virtual objects::CScope * x_GetScope() const
virtual void x_AttachToProject(CGBDocument &doc)
TId GetId() const
retrieve a unique ID for this view
virtual void RefreshViewWindow()
virtual bool x_HasProject() const
CProjectViewEvent.
Definition: document.hpp:62
objects::CGBProjectHandle::TId GetProjectId()
Definition: document.hpp:97
EEventSubtype GetSubtype() const
Definition: document.hpp:96
CProjectViewTypeDescriptor - holds description of a project view type.
CProjectView.
virtual void SetWorkbench(IWorkbench *workbench)
IView implementation.
void GetReflectionInfo(const objects::CSeq_id &id, list< TSeqRange > &visible_ranges, CRgbaColor &color, string &label) const
Retrieve all information relevant to showing view reflection - that is, displaying the location of si...
size_type size() const
Definition: range_coll.hpp:98
CRef –.
Definition: ncbiobj.hpp:618
vector< SObject > TObjects
Definition: relation.hpp:130
@ fConvert_NoExpensive
do not perform any expensive tests (such as fetching from the network)
Definition: relation.hpp:60
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
CScope –.
Definition: scope.hpp:92
CSelectionEvent CSelectionEvent is used for broadcasting selection between views.
Definition: obj_event.hpp:68
static bool MatchIdWithId(const objects::CSeq_id &id1, objects::CScope &scope1, const objects::CSeq_id &id2, objects::CScope &scope2)
Definition: obj_event.cpp:526
bool HasRangeSelection() const
Range Selection - represents a collection of selected segments.
Definition: obj_event.cpp:92
void GetAllObjects(TConstObjects &objs) const
Definition: obj_event.cpp:314
void AddRangeSelection(const objects::CSeq_id &id, const TRangeColl &segs)
objects::CScope & GetScope()
Definition: obj_event.hpp:95
const objects::CHandleRangeMap & GetRangeSelection() const
Definition: obj_event.cpp:98
bool AddObjectSelection(const CObject &obj)
Definition: obj_event.cpp:177
list< CRef< CSeqGlyph > > TObjects
Definition: seq_glyph.hpp:85
const TRangeColl & GetRangeSelection(void) const
retrieve set of intervals selected on the sequence
TSeqRange GetVisibleSeqRange() const
void InitBioseqEditor(ICommandProccessor &cmdProcessor)
void SetDirty(bool flag)
void SetRangeSelection(const TRangeColl &ranges)
CFeaturePanel * GetFeaturePanel()
void SetExternalGlyphs(const CSeqGlyph::TObjects &objs)
void SelectObject(const CObject *obj, bool verified)
set/clear selections
string GetMarkers() const
Get markers as a string.
void InitDataSource(SConstScopedObject &obj)
void SetWorkDir(const wxString &workDir)
void GetObjectSelection(TConstObjects &objs) const
retrieve selected objects from this widget
void UpdateConfig()
The config object has changed. Do what is necessary.
void ZoomOnRange(TSeqRange range, TZoomFlag flag)
void SetNonAsnInput(const INonAsnTrackData &data)
void SetMarkers(const string &markers)
bool IsDirty() const
check if there is any visible range or marker change
void SetInputObject(SConstScopedObject &obj)
access the data source
static void RegisterCommands(CUICommandRegistry &cmd_reg, wxFileArtProvider &provider)
Definition: Seq_entry.hpp:56
Base class for all serializable objects.
Definition: serialbase.hpp:150
Template class for iteration on objects of class C (non-medifiable version)
Definition: iterator.hpp:767
CUICommandRegistry is a centralized registry where all application commands should be registered.
Definition: ui_command.hpp:146
@ eOpenGraphicalViewEvent
Definition: view_event.hpp:66
@ eWidgetDataChanged
notification from child to parent that the underlying data has changed
Definition: view_event.hpp:61
CViewGraphic.
CViewTypeDescriptor - holds description of a view type.
Definition: view.hpp:98
bool Clamp(const objects::CBioseq_Handle &handle, TSeqRange &range) const
Alter the supplied range according to the rules provided in the policy and the supplied new location.
bool Match(const objects::CSeq_id &id) const
See if we can match the supplied range.
void AddLocation(const objects::CSeq_loc &loc)
Interface for testing cancellation request in a long lasting operation.
Definition: icanceled.hpp:51
virtual const CViewTypeDescriptor & GetViewTypeDescriptor() const
returns a Descriptor for the View Type supported by the Factory
IView - represents a standard visual part of Workbench UI.
Definition: view.hpp:73
IVisibleRangeClient - represents an object that wants notifications about visible range changes.
CFingerprint identifies an instance of IWMClient and is used for labeling layout positions.
Definition: wm_client.hpp:58
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
Definition: set.hpp:45
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
const_iterator find(const key_type &key) const
Definition: set.hpp:137
const_iterator end() const
Definition: set.hpp:136
virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)
static const char fp[]
Definition: des.c:87
static const struct name_t names[]
#define false
Definition: bool.h:36
static int type
Definition: getdata.c:31
static const char * str(char *buf, int n)
Definition: stats.c:84
char data[12]
Definition: iconv.c:80
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
string
Definition: cgiapp.hpp:687
virtual const CObject * x_GetOrigObject() const
virtual void GetCompatibleToolBars(vector< string > &names)
returns the names of toolbars compatible with this class (toolbars that are relevant and useful in th...
virtual void x_OnSetSelection(CSelectionEvent &evt)
override in derived classes in order to handle selection broadcast
#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
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1191
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
Definition: service.hpp:91
vector< CIRef< IView > > TViews
virtual void GetViews(TViews &views)=0
get all registered views
virtual IViewManagerService * GetViewManagerService()=0
static CRef< objects::CSeq_loc > CreateSeq_loc(const objects::CSeq_id &id, const CRangeCollection< TSeqPos > &ranges)
Definition: utils.cpp:555
#define EXT_POINT__NONASN_TRACK_DATA_FACTORY
virtual string GetExtensionIdentifier() const
CViewGraphicFactory.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual void CreateViewWindow(wxWindow *parent)
create Window corresponding to the view
CConstRef< objects::CSeq_id > m_SeqId
virtual void GetVisibleRanges(CVisibleRange &vrange) const
populate a visible range event for broadcasting
virtual void RegisterCommands(CUICommandRegistry &cmd_reg, wxFileArtProvider &provider)
called by the framework to give Factory a chance to register commands used by view
void OnWidgetDataChanged(CEvent *evt)
virtual IView * CreateInstanceByFingerprint(const TFingerprint &fingerprint) const
if fingerprint is recognized - creates and returns a new instance
virtual void SetWorkbench(IWorkbench *workbench)
IView implementation.
virtual const CViewTypeDescriptor & GetTypeDescriptor() const
return an object providing meta information about thei view type
virtual const wxMenu * GetMenu()
returns a menu (must be deleted by the caller) menu injections should follow a separator named "Contr...
virtual CRef< objects::CScope > GetSearchScope()
virtual CRef< objects::CSeq_loc > GetSearchLoc()
virtual void DestroyViewWindow()
destroy Window corresponding to the view
string x_GetViewSettingsFromParams(const objects::CUser_object *params)
void x_SetNonAsnInput(const objects::CProjectFolder &prj_folder)
void x_UpdateVisRangeLayout(const IViewManagerService::TViews &views)
virtual string GetDMContextName()
returns Name of the context to be used in UI
void OnOpenGraphicalView(CEvent *evt)
virtual void RegisterIconAliases(wxFileArtProvider &provider)
called by the framework to give Factory a chance to register images used by view
virtual bool IsCompatibleWith(const CObject &object, objects::CScope &scope)
CGraphicPanel * m_GraphicPanel
virtual bool InitView(TConstScopedObjects &objects, const objects::CUser_object *params)
initialize view with data, inside this function the view must call CProjectService::AttachView to con...
virtual set< string > GetAnnotNames() const
virtual const CProjectViewTypeDescriptor & GetProjectViewTypeDescriptor() const
returns a Descriptor for the View Type supported by the Factory
virtual void OnViewReleased(IView &)
virtual void OnWidgetRangeChanged()
virtual IView * CreateInstance() const
creates a view instance
virtual void OnViewAttached(IView &)
void SaveSettingsAtProject(objects::CGBProjectHandle &project) const
virtual void SetOrigObject(SConstScopedObject &obj)
virtual void OnVisibleRangeChanged(const CVisibleRange &vrange, IVisibleRangeClient *source)
void GetSelection(CSelectionEvent &evt) const
get selection for broadcasting
CIRef< INonAsnTrackData > m_NonAsnTrackData
virtual int TestInputObjects(TConstScopedObjects &objects)
tests input objects (probably using object conversion, or not) and returns a combination of ETestResu...
virtual wxWindow * GetWindow()
returns a pointer to the wxWindow representing the client
virtual bool x_MergeObjects(TConstScopedObjects &objects)
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
Definition: label.cpp:140
CRef< objects::CScope > scope
Definition: objects.hpp:53
void GetExtensionAsInterface(const string &ext_point_id, vector< CIRef< I > > &interfaces)
GetExtensionAsInterface() is a helper function that extracts all extensions implementing the specifie...
vector< CConstRef< CObject > > TConstObjects
Definition: objects.hpp:64
virtual const string & GetIconAlias() const
Definition: ui_object.cpp:130
virtual const string & GetHelpId() const
Definition: ui_object.cpp:148
#define ON_EVENT(type, id, handler)
#define END_EVENT_MAP()
Ends definition of Command Map.
CConstRef< CObject > object
Definition: objects.hpp:52
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
virtual void AddListener(CEventHandler *listener, int pool_name=ePool_Default)
Add a listener.
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
@ eContent
Definition: label.hpp:62
CConstRef< CSeq_id > GetSeqId(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
@ eFasta
Tagged ID in NCBI's traditional FASTA style.
Definition: Seq_id.hpp:607
void SetWhole(TWhole &v)
Definition: Seq_loc.hpp:982
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
Definition: Seq_loc.cpp:3474
TRange GetTotalRange(void) const
Definition: Seq_loc.hpp:913
void SetInt(TInt &v)
Definition: Seq_loc.hpp:983
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,...
CSeq_id_Handle GetIdHandle(const CSeq_loc &loc, CScope *scope)
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
Definition: sequence.hpp:101
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
const CSeq_id_Handle & GetSeq_id_Handle(void) const
Get handle of id used to obtain this bioseq handle.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1684
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:1439
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
Definition: ncbiobj.hpp:735
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
Definition: range.hpp:419
#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:3461
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 string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string.
Definition: ncbistr.cpp:3186
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
bool IsStr(void) const
Check if variant Str is selected.
Definition: Object_id_.hpp:291
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
vector< CRef< CUser_field > > TData
bool IsWhole(void) const
Check if variant Whole is selected.
Definition: Seq_loc_.hpp:522
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
n background color
int i
#define wxT(x)
Definition: muParser.cpp:41
range(_Ty, _Ty) -> range< _Ty >
@ eSimilarObjectsAccepted
Definition: type.c:6
#define _ASSERT
TToken
Definition: tokens.hpp:38
USING_SCOPE(objects)
CProjectViewTypeDescriptor s_ViewGraphicTypeDescr("Graphical Sequence View", "graphical_view", "Graphical View", "The Graphical View provides an overview of annotations " "on sequence, with extensive drill-down capabilities.", "GRAPHICAL_VIEW", "Sequence", false, "Seq-loc", eSimilarObjectsAccepted)
CViewGraphic.
void ReportIDError(const string &id_label, bool is_local, const string &title="Error message")
Definition: wx_utils.cpp:99
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
Modified on Wed Apr 24 14:16:18 2024 by modify_doxy.py rev. 669887