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

Go to the SVN repository for this file.

1 /* $Id: gene_model_track.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: Liangshou Wu
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
46 
47 #include <gui/utils/rgba_color.hpp>
48 #include <gui/objutils/utils.hpp>
49 #include <gui/objutils/label.hpp>
51 
52 #include <objmgr/util/feature.hpp>
53 #include <objmgr/util/sequence.hpp>
55 
57 #include <objects/seq/Seqdesc.hpp>
61 
63 
64 #include <wx/string.h>
65 #include <wx/menu.h>
66 
69 
70 
71 ///////////////////////////////////////////////////////////////////////////////
72 /// CGeneModelTrack
73 ///////////////////////////////////////////////////////////////////////////////
74 
75 // content menu item base id
76 static const size_t kContentBaseID = 10000;
77 // potential maximal menu item id range
78 // assumming there will be less than 100 menu items
79 static const int kMaxID = 100;
80 // GeneID's DB name
81 static const string kGeneIdDb("GeneID");
82 
83 
84 class CGeneContentEvtHandler : public wxEvtHandler
85 {
86 public:
88  : m_Track( track )
89  {}
90 
91  void OnContextMenu( wxContextMenuEvent& anEvent );
92 
93 private:
94  /// @name event handlers.
95  /// @{
96  /// on toggle a conent menu item.
97  void x_OnToggleContent(wxCommandEvent& event)
98  {
99  int track_order = event.GetId() - kContentBaseID;
100  m_Track->OnToggleContent(track_order);
101  }
102 
103  /// @}
104 
105 private:
107 
108  DECLARE_EVENT_TABLE()
109 };
110 
111 
112 BEGIN_EVENT_TABLE(CGeneContentEvtHandler, wxEvtHandler)
115 
116 
120 static const string kTrackName = "Gene models";
121 static const string kBaseKey = "GBPlugins.SeqGraphicGeneModel";
122 
123 CTrackTypeInfo CGeneModelTrack::m_TypeInfo("gene_model_track",
124  "A track for showing four main \
125 features: gene, RNAs, coding regions and Exons. A Gene model is a group of \
126 linked gene, RNAs, coding regions and Exons. A gene model may contain one \
127 or more pairs of linked RNA and coding region.");
128 
129 
131  : CDataTrack(r_cntx)
132  , m_ContentHandler(new CGeneContentEvtHandler(this))
133  , m_DS(ds)
134  , m_Compact(new CCompactLayout)
135  , m_AnnotNameUpdated(false)
136 {
137  m_DS->SetJobListener(this);
138 
139  // initialize annotation selector for land mark features
140  m_LandMarkFeatSel = CSeqUtils::GetAnnotSelector();
141  m_LandMarkFeatSel.IncludeFeatType(CSeqFeatData::e_Gene);
142 
143  // initialize annotation selector for main features
144  m_MainSel = CSeqUtils::GetAnnotSelector();
145 
146  // initialize annotation selector for CDS product features
147  m_cdsFeatSel = CSeqUtils::GetAnnotSelector();
149  CSeqFeatData::ESubtype subtype =
150  static_cast<CSeqFeatData::ESubtype>(iter->GetSubtype());
151  if (subtype == CSeqFeatData::eSubtype_any ||
153  subtype == CSeqFeatData::eSubtype_source ||
156  subtype == CSeqFeatData::eSubtype_gene ||
157  subtype == CSeqFeatData::eSubtype_prot) {
158  continue;
159  }
160  m_cdsFeatSel.IncludeFeatSubtype(subtype);
161  }
162 
163  x_RegisterIcon(SIconInfo(eIcon_Content, "Content", true, "track_content"));
164  x_RegisterIcon(
165  SIconInfo(eIcon_Layout, "Layout style", true, "track_layout"));
166 }
167 
168 
170 {
171  if ( !m_DS->AllJobsFinished() ) {
172  m_DS->DeleteAllJobs();
173  }
174 }
175 
176 
178 {
179  return m_TypeInfo;
180 }
181 
182 
184 {
185  string title = GetTitle();
186  if (title.empty()) {
188  title = "NCBI genes";
189  } else {
190  title = m_AnnotName;
191  }
192  }
193 
194  return title;
195 }
196 
197 
198 void CGeneModelTrack::SetAnnot(const string& annot)
199 {
200  m_AnnotName = annot;
201  m_RealAnnot = annot;
202  m_LandMarkFeatSel.ResetAnnotsNames();
203  m_MainSel.ResetAnnotsNames();
206  m_LandMarkFeatSel.AddUnnamedAnnots();
207  m_MainSel.AddUnnamedAnnots();
208  } else {
209  m_MainSel.AddNamedAnnots(m_AnnotName);
210  m_MainSel.ExcludeUnnamedAnnots();
211  m_LandMarkFeatSel.AddNamedAnnots(m_AnnotName);
212  m_LandMarkFeatSel.ExcludeUnnamedAnnots();
213  if (NStr::StartsWith(m_AnnotName, "NA0")) {
214  if (m_AnnotName.find(".") == string::npos) {
215  m_AnnotName += ".1";
216  }
217  m_MainSel.IncludeNamedAnnotAccession(m_AnnotName);
218  m_LandMarkFeatSel.IncludeNamedAnnotAccession(m_AnnotName);
220  }
221  }
222 }
223 
225 {
226  for (auto s : m_subtypes)
227  subtypes.insert(s);
228 }
229 
230 // This method is responsible for selection feature types to be included
231 // into gene model track. If you modify it, make corresponding changes in
232 // negative selection counterpart at src/gui/objutils/na_utils.cpp
233 // CDataTrackUtils::IsGeneModelFeature
235 {
236  m_MainSel.SetFeatType(CSeqFeatData::e_Gene);
237  m_subtypes.clear();
239 
240  if (m_Conf->m_ShowRNAs) {
241  m_MainSel.IncludeFeatType(CSeqFeatData::e_Rna);
242  // RNA subfeature for Imp feature
243  m_MainSel.IncludeFeatSubtype(CSeqFeatData::eSubtype_misc_RNA);
246  }
247 
248  if (m_Conf->m_ShowCDSs) {
249  m_MainSel.IncludeFeatType(CSeqFeatData::e_Cdregion);
251  }
252 
253  if (m_Conf->m_ShowExons) {
254  m_MainSel.IncludeFeatSubtype(CSeqFeatData::eSubtype_exon);
256  }
257 
258  if (m_Conf->m_ShowVDJCs) {
259  m_MainSel.IncludeFeatSubtype(CSeqFeatData::eSubtype_C_region);
260  m_MainSel.IncludeFeatSubtype(CSeqFeatData::eSubtype_V_segment);
261  m_MainSel.IncludeFeatSubtype(CSeqFeatData::eSubtype_D_segment);
262  m_MainSel.IncludeFeatSubtype(CSeqFeatData::eSubtype_J_segment);
263 // Temporary moved back out of gene model track, see SV-2107
264 // m_MainSel.IncludeFeatSubtype(CSeqFeatData::eSubtype_enhancer);
269  }
270 }
271 
272 
274 {
275  // the menu item order:
276  // 0 - "Hide gene feature bar"
277  // 1 - "Show RNAs"
278  // 2 - "Show CDSs"
279  // 3 - "Show Exons"
280  // 4 - "Show VDJ segments"
281  // 5 - "Show CDS product features"
282  // 6 - "Show Histogram if can't show all genes"
283  // 7 - "Show Nt Ruler"
284  // 8 - "Show Aa Ruler"
285  // 9 - Hide transcripts without associated CDS
286  // 10 - Hide Model RefSeqs
287  // 11 - Show only CCDS variants
288  // 12 - Show only Select/MANE variants
289 
290  switch (id) {
291  case 0:
293  break;
294  case 1:
296  break;
297  case 2:
299  break;
300  case 3:
302  break;
303  case 4:
305  break;
306  case 5:
308  break;
309  case 6:
311  break;
312  case 7:
314  break;
315  case 8:
317  break;
318  case 9:
320  break;
321  case 10:
323  break;
324  case 11:
326  break;
327  case 12:
329  break;
330  default:
331  break;
332  }
333 
335  x_UpdateData();
336 }
337 
338 
340 {
342  TSeqPos(m_Context->ScreenToSeq(3.0))));
343 
344  m_DS->DeleteAllJobs();
346  TSeqRange vis_range = x_GetVisRange();
347  if (vis_range.Empty()) {
348  vis_range = m_Context->GetVisSeqRange();
349  }
352  vis_range, m_Context->GetScale(),
353  m_Conf);
354 }
355 
357 {
359  CScope& scope(Handle.GetScope());
361 
362  CFeat_CI feature_iter(Handle, range, m_MainSel);
363 // cerr << "got features size before microintron activation: " << feature_iter.GetSize() << endl;
364  // activate microintrons
365  // blocked for a while
366  // this is because of SV-4756 and until SV-4757 is resolved
368 // cerr << "got features size after microintron activation: " << feature_iter.GetSize() << endl;
369  CRef<CSeq_annot> pAnnot(new CSeq_annot);
370  CSeq_annot::TData::TFtable& ftable(pAnnot->SetData().SetFtable());
371 
372  for ( ; feature_iter; ++feature_iter) {
373  CRef<CSeq_feat> pFeat(new CSeq_feat);
374  const CMappedFeat& feat = *feature_iter;
375 // cerr << "Got feature" << endl <<
376 // MSerial_AsnText << feat.GetMappedFeature() << endl;
377  pFeat->Assign(feat.GetMappedFeature());
378  ftable.push_back(pFeat);
379  }
380  seq_entry.SetAnnot().push_back(pAnnot);
381 }
382 
384 {
385  m_DS->ClearJobID(notify.GetJobID());
386  CRef<CObject> res_obj = notify.GetResult();
387  CJobResultBase* result = dynamic_cast<CJobResultBase*>(&*res_obj);
388  if (!result) {
389  LOG_POST(Error << "CGeneModelTrack::x_OnJobCompleted() notification for job \
390  does not contain results.");
391  return;
392  }
393 
394  EJobType type = (EJobType)result->m_Token;
395  switch (type) {
396  case eJob_LandMarkGenes:
397  x_AddLandMarkFeaturesLayout(dynamic_cast<CSGJobResult&>(*res_obj));
398  break;
399  case eJob_MainFeats:
400  x_AddMainFeaturesLayout(dynamic_cast<CSGJobResult&>(*res_obj));
401  break;
402  case eJob_FeatProducts:
403  x_AddFeatProductLayout(dynamic_cast<CBatchJobResult&>(*res_obj));
404  break;
405  default:
406  break;
407  } // switch
408 
409 
410 }
411 
412 
413 void CGeneModelTrack::x_LoadSettings(const string& preset_style,
414  const TKeyValuePairs& settings)
415 {
416  if ( !m_Conf ) {
418  }
419 
420  if (preset_style.empty()) {
421  SetProfile("Default");
422  } else {
423  SetProfile(preset_style);
424  }
425 
427  m_Conf->UpdateSettings(settings);
428 
430 
433 }
434 
435 
436 void CGeneModelTrack::x_SaveSettings(const string& preset_style)
437 {
438  SetProfile(m_Conf->SaveSettingsAsString(preset_style));
439 }
440 
441 
443 {
444  switch (id) {
445  case eIcon_Content:
447  break;
448  case eIcon_Layout:
450  break;
451  default:
452  // use default handlers
454  }
455 }
456 
457 
459 {
460  wxMenu menu;
461  int curr_id = 0;
462  wxMenuItem* item;
463  item = menu.AppendCheckItem(kContentBaseID + curr_id++,
464  wxT("Hide gene feature bar"));
465  if ( !m_Conf->m_ShowGenes ) {
466  item->Check();
467  }
468 
469  item = menu.AppendCheckItem(kContentBaseID + curr_id++, wxT("Show RNAs"));
470  if (m_Conf->m_ShowRNAs) {
471  item->Check();
472  }
473 
474  item = menu.AppendCheckItem(kContentBaseID + curr_id++, wxT("Show CDSs"));
475  if (m_Conf->m_ShowCDSs) {
476  item->Check();
477  }
478 
479  item = menu.AppendCheckItem(kContentBaseID + curr_id++, wxT("Show Exons"));
480  if (m_Conf->m_ShowExons) {
481  item->Check();
482  }
483 
484  item = menu.AppendCheckItem(kContentBaseID + curr_id++, wxT("Show VDJ segments"));
485  if (m_Conf->m_ShowVDJCs) {
486  item->Check();
487  }
488 
489  item = menu.AppendCheckItem(
490  kContentBaseID + curr_id++, wxT("Show CDS product features"));
492  item->Check();
493  }
494 
495  item = menu.AppendCheckItem(
496  kContentBaseID + curr_id++, wxT("Show Histogram if can't show all genes"));
497  if (m_Conf->m_ShowHistogram) {
498  item->Check();
499  }
500 
501  curr_id++;
502  /*
503  item = menu.AppendCheckItem(
504  kContentBaseID + curr_id++, wxT("Show product ruler"));
505  if (m_Conf->m_ShowNtRuler) {
506  item->Check();
507  }
508  */
509 
510  curr_id++;
511 /*
512  item = menu.AppendCheckItem(
513  kContentBaseID + curr_id++, wxT("Show protein ruler"));
514  if (m_Conf->m_ShowAaRuler) {
515  item->Check();
516  }
517  */
518 
519  /*
520  item = menu.AppendCheckItem(
521  kContentBaseID + curr_id++, wxT("Hide non-coding variants"));
522  item->Check(m_Conf->m_HideNonCoding);
523 
524  item = menu.AppendCheckItem(
525  kContentBaseID + curr_id++, wxT("Hide model variants"));
526  item->Check(m_Conf->m_HideModels);
527 
528  item = menu.AppendCheckItem(
529  kContentBaseID + curr_id++, wxT("Show only CCDS variants"));
530  item->Check(m_Conf->m_CCDSOnly);
531 
532  item = menu.AppendCheckItem(
533  kContentBaseID + curr_id++, wxT("Show only Select or MANE transcripts"));
534  item->Check(m_Conf->m_SelectOnly);
535  */
537  m_LTHost->LTH_PopupMenu(&menu);
539 }
540 
541 
543 {
545  TStyleMap styles;
546  styles[CGeneModelConfig::eMerge_No] = wxT("Don't merge (Default)");
547  styles[CGeneModelConfig::eMerge_Pairs] = wxT("Merge matched RNA + proteins pair");
548  styles[CGeneModelConfig::eMerge_All] = wxT("Merge all RNAs and proteins");
549  styles[CGeneModelConfig::eMerge_OneLine] = wxT("Merge everything as one line");
550 
551 
552  wxMenu menu;
553  UseDefaultMarginWidth(menu);
554 
555  int id_base = 10000;
556  ITERATE (TStyleMap, iter, styles) {
557  wxMenuItem* item = menu.AppendRadioItem(id_base + iter->first,
558  iter->second);
559  item->Check(m_Conf->m_MergeStyle == iter->first);
560  }
561 
562  m_LTHost->LTH_PopupMenu(&menu);
563  wxMenuItemList& item_list = menu.GetMenuItems();
564  ITERATE (wxMenuItemList, iter, item_list) {
566  (CGeneModelConfig::EMergeStyle)((*iter)->GetId() - id_base);
567  if ((*iter)->IsChecked() && style != m_Conf->m_MergeStyle) {
568  m_Conf->m_MergeStyle = style;
569  x_UpdateData();
570  }
571  }
572 }
573 
574 
575 //static const size_t kLabelsColWidth = 100; // width of a column small
576 
578 {
580  {
581  CFeatGlyph* f1 = dynamic_cast<CFeatGlyph*>(o1.GetPointer());
582  CFeatGlyph* f2 = dynamic_cast<CFeatGlyph*>(o2.GetPointer());
583 
584  string label1;
585  objects::feature::GetLabel(f1->GetFeature(), &label1,
587 
588  string label2;
589  objects::feature::GetLabel(f2->GetFeature(), &label2,
591 
592  return label1 < label2;
593  }
594 };
595 
596 
598 {
599  //TIME_ME("x_AddLandMarkFeaturesLayout()");
600  SetGroup().Clear();
601 
602  CSeqGlyph::TObjects objs = result.m_ObjectList;
603  size_t count = objs.size();
604 
605  if (count == 0) {
606  // an empty track should be navigable as there might be out of range objects
607  m_Attrs |= fNavigable;
608  x_UpdateLayout();
609  return;
610  }
611 
612  if ( !m_AnnotNameUpdated ) {
613  CFeatGlyph* feat_glyph =
614  dynamic_cast<CFeatGlyph*>(objs.front().GetPointer());
615  m_AnnotName =
616  CSeqUtils::GetAnnotName(feat_glyph->GetMappedFeature().GetAnnot());
617  m_AnnotNameUpdated = true;
618  }
619 
621  CConstRef<CFeatureParams> gene_conf =
623 
624  CLayoutGroup::TObjectList the_genes;
626  CFeatGlyph* feat_glyph = dynamic_cast<CFeatGlyph*>(iter->GetPointer());
627  if (!feat_glyph)
628  continue;
629  feat_glyph->SetConfig(gene_conf);
630  if ((!GetHighlights().empty() || !GetHighlightsByKey().empty()) && x_NeedHighlight(*feat_glyph)) {
631  feat_glyph->SetHighlighted(true);
632  if (m_HighlightsColor.get())
633  feat_glyph->SetHighlightsColor(*m_HighlightsColor.get());
634  } else if ( !feat_glyph->IsHighlighted() ) {
635  feat_glyph->SetHideLabel(true);
636  }
637  the_genes.push_back(*iter);
638  }
639 
641  if (g_config->GetShowComments()) {
642  attr |= fShowTitle;
643  }
644 
645  CGlyphContainer* container = this;
646  string gene_track_label;
647  if ( g_config->GetShowSimpleComments() ) {
648  string count_str = NStr::SizetToString(count);
649  if (count >= (size_t)m_Conf->m_LandmarkFeatLimit) {
650  gene_track_label += count_str + " landmark genes shown";
651  } else {
652  gene_track_label += "all " + count_str + " genes shown";
653  }
654  }
655 
656  // Add histogram if avaliable
657  if (result.m_ExtraObj.NotEmpty()) {
659  SetMsg(", Overview mode");
660 
661  CGlyphContainer* hist_track = new CGlyphContainer(m_Context);
662  CRef<CSeqGlyph> track_holder(dynamic_cast<CSeqGlyph*>(hist_track));
663  Add(track_holder);
664  hist_track->SetConfig(m_gConfig);
665  hist_track->SetIndent(m_IndentLevel + 1);
666 
667  CHistogramGlyph* hist =
668  dynamic_cast<CHistogramGlyph*>(result.m_ExtraObj.GetPointer());
669  hist->SetDialogHost(dynamic_cast<IGlyphDialogHost*>(m_LTHost));
670  hist->SetConfig(*x_GetGlobalConfig());
671  hist_track->SetTitle("Genes Distribution Histogram");
672  hist_track->SetTrackAttr(attr);
673  hist_track->Add(result.m_ExtraObj);
674 
675  container = new CGlyphContainer(m_Context);
676  CRef<CSeqGlyph> glyph(dynamic_cast<CSeqGlyph*>(container));
677  Add(glyph);
678  container->SetConfig(m_gConfig);
679  container->SetLayoutPolicy(m_Layered);
680  container->SetIndent(m_IndentLevel + 1);
681  container->SetTitle(gene_track_label);
682  container->SetTrackAttr(attr);
683  } else {
685  SetMsg(", Overview mode, " + gene_track_label);
686  }
687  m_Attrs |= fNavigable;
688  container->SetObjects(the_genes);
689 
690  // Compress Landmark Genes layout if there are more than
691  // kMaxGenesOverviewRows rows in the layout
693 
694  if (m_Conf->m_ShowLabel && !result.m_CommentObjs.empty() ) {
695  CRef<CCommentConfig> cmt_config(new CCommentConfig);
696  cmt_config->m_LineColor.Set(0.5f, 0.5f, 0.5f);
697  cmt_config->m_Centered = false;
698  cmt_config->m_LabelColor.Set(0.1f, 0.1f, 0.1f);
699  SetLabelGlyphs(result.m_CommentObjs, cmt_config);
700  }
701 
702  // add labels
703  /*
704  if (m_Conf->m_ShowLMGeneLabel) {
705  // sort feature labels alphabetically
706  sort(the_genes.begin(), the_genes.end(), SFeatureByName());
707 
708  // a number of columns that will fit
709  int cols_count = m_Context->GetViewPortWidth() / kLabelsColWidth;
710  cols_count = max(1, cols_count); // always at least 1 column
711 
712  // create all row first
713  CLayout layout_labels;
714  for (size_t i = 0; i < the_genes.size() / cols_count + 1; i++) {
715  layout_labels.AddRow(); // add empty row to layout
716  }
717 
718  // assign columns and repack
719  size_t cur_row = 0;
720  size_t cur_col = 0;
721  NON_CONST_ITERATE (CLayoutGroup::TObjectList, iter, the_genes) {
722  CSeqGlyph* tmp = *iter;
723  CFeatGlyph* feat = dynamic_cast<CFeatGlyph*>(tmp);
724  CRef<CLayoutFeatLabel> lbl
725  (new CLayoutFeatLabel(feat->GetMappedFeature()));
726 
727  TVPUnit start = cur_col * kLabelsColWidth + 1;
728  TSeqPos from = m_VisRange.GetFrom() + TSeqPos ( m_SeqScale * start);
729  TSeqPos to = m_VisRange.GetFrom() + TSeqPos ( m_SeqScale * (start + kLabelsColWidth) );
730 
731  // set the column index
732  lbl->SetColumn(m_OrigScale < 0 ? cols_count - cur_col - 1 : cur_col);
733 
734  // set a range in model coordinates
735  lbl->SetRange(from, to);
736 
737  CLayout::TLayoutRow& the_row = layout_labels.SetRow(cur_row);
738  CRef<CSeqGlyph> obj(lbl);
739  the_row.push_back(obj);
740  cur_row++;
741 
742  if (cur_row >= layout_labels.GetLayout().size()) {
743  cur_row = 0;
744  cur_col++;
745  }
746  }
747  }
748  */
749  x_UpdateLayout();
750 }
751 
752 
754 {
755  //TIME_ME("x_AddMainFeaturesLayout()");
756  if (m_Conf->m_HighlightMode != 0) {
757  ResetLabelGlyph();
758  }
759 
760  m_FilterDescr = result.m_FilterDescr;
761 
762  SetGroup().Clear();
763  SetMsg("");
765  if (result.m_ObjectList.empty()) {
766  // an empty track should be navigable as there might be out of range objects
767  m_Attrs |= fNavigable;
768  x_UpdateLayout();
769  return;
770  }
771 
772  // make sure we remove the constraint on maximal number of row set
773  // in overview mode.
775 
776  SetObjects(result.m_ObjectList);
777 
778  // Turning off label for mRNA and CDS if they are not the first ones,
779  // not side labeling, and not forced to show all.
780  // a) First
781  // b) Longest (always first, actually)
782  // c) Most exons (turns our this is also first one)
783  // LinkFeatures works that way
784 
785  // set rendering context and corresponding configs if any
786 
787  // prepare feature configs
788  TFeatConfigMap feat_confs;
789  feat_confs[CSeqFeatData::eSubtype_gene] =
791  feat_confs[CSeqFeatData::eSubtype_mRNA] =
793  feat_confs[CSeqFeatData::eSubtype_cdregion] =
795  feat_confs[CSeqFeatData::eSubtype_exon] =
799 
800  size_t size = GetChildren().size();
801  bool compact_mode = size > kCompactThreshold && GetHighlights().empty() && GetHighlightsByKey().empty();
802  if (compact_mode) {
803  // for large number of features, we use
804  // - less expensive layout style
805  // - faster layout in terms of rendering
807  }
808 
809  TFeatBatchJobRequests requests;
810  x_InitFeature_Recursive(SetChildren(), feat_confs, NULL, requests, compact_mode);
811 
813  " gene model" + (size > 1 ? "s shown" : " shown"));
814  if ( !requests.empty() ) {
816  m_Context->GetScale(), eJob_FeatProducts, requests);
817  }
818 
819  x_UpdateLayout();
820 }
821 
822 
824 {
825  //TIME_ME("x_AddCDSProduct_FeatsLayout()");
826 
827  SetMsg("");
828  const CSeqGlyph::TObjects& objs = result.m_ObjectList;
829  size_t obj_num = objs.size();
830  if (obj_num == 0 || !result.m_Owner) {
831  m_Attrs |= fNavigable;
832  return;
833  }
834 
835  CSeqGlyph* p_feat = result.m_Owner;
836  CLayoutGroup* parent_group =
837  dynamic_cast<CLayoutGroup*>(p_feat->SetParent());
838  _ASSERT(parent_group);
839 
840  // need a group to hold it
841  CRef<CLayoutGroup> group(new CLayoutGroup());
842  group->SetLayoutPolicy(m_Layered);
843  parent_group->InsertAft(p_feat, group);
844  group->Set(objs);
845 
847  CFeatGlyph* feat = dynamic_cast<CFeatGlyph*>(iter->GetPointer());
849  feat->GetFeature().GetData().GetSubtype()));
850  }
851  if (m_DS->IsBackgroundJob()) {
852  // udpate children's layout
853  group->Update(true);
854  // update parent's layout
855  group->UpdateLayout();
856  }
857 
858 }
859 
860 
862 {
863  //TIME_ME("x_AddFeatProductLayout()");
864 
865  SetMsg("");
866  if (results.m_Results.empty()) {
867  m_Attrs |= fNavigable;
868  return;
869  }
870 
872  CSGJobResult& result = **iter;
873  if ((result.m_ObjectList.empty() && !result.m_ExtraObj) ||
874  !result.m_Owner) {
875  continue;
876  }
877 
878  CSeqGlyph* p_feat = result.m_Owner;
879  CLayoutGroup* parent_group =
880  dynamic_cast<CLayoutGroup*>(p_feat->SetParent());
881  _ASSERT(parent_group);
882 
883  if ( !result.m_ObjectList.empty() ) {
885  for (auto& obj : result.m_ObjectList) {
886  CFeatGlyph* feat = dynamic_cast<CFeatGlyph*>(obj.GetPointer());
887  _ASSERT(feat);
888  if (!feat) // only CFeatGlyph are expected
889  continue;
890  groups[feat->GetFeature().GetData().GetSubtype()].push_back(obj);
891  }
892  auto last_group = p_feat;
893  for (auto& gr : groups) {
894  CRef<CLayoutGroup> group(new CLayoutGroup());
895  parent_group->InsertAft(last_group, group);
896  last_group = group;
897  group->Set(gr.second);
899  CFeatGlyph* feat = dynamic_cast<CFeatGlyph*>(c_iter->GetPointer());
900  feat->SetConfig(m_gConfig->GetFeatParams(feat->GetFeature().GetData().GetSubtype()));
901  feat->SetProjectedFeat(true);
902  if (m_Conf->m_ShowLabel == false)
903  feat->SetHideLabel(true);
904  }
905  group->SetLayoutPolicy(m_Layered);
906  }
907  } else {
908  CHistogramGlyph* hist =
909  dynamic_cast<CHistogramGlyph*>(result.m_ExtraObj.GetPointer());
910  hist->SetDialogHost(dynamic_cast<IGlyphDialogHost*>(m_LTHost));
911  hist->SetConfig(*m_gConfig);
912  parent_group->InsertAft(p_feat, hist);
913  }
914 
915  if (m_DS->IsBackgroundJob()) {
916  // udpate children's layout
917  parent_group->Update(true);
918  }
919  }
920 
921  if (m_DS->IsBackgroundJob()) {
922  // update parent's layout
923  x_UpdateLayout();
924  }
925 }
926 
927 
928 bool CGeneModelTrack::x_NeedHighlight(const CFeatGlyph &feat_glyph) const
929 {
930  string label;
931  feat_glyph.GetLabel(label, CLabel::eContent);
933 
934  if (GetHighlights().count(label) > 0)
935  return true;
936 
937  do
938  {
939  if (GetHighlightsByKey().empty())
940  break;
941 
942  const CSeq_feat &feat = feat_glyph.GetFeature();
944  break;
945 
946  const CGlyphContainer::TKeyHighlights &dbxrefHighlights = GetHighlightsByKey();
947  string geneIdKey(kGeneIdDb);
948  NStr::ToLower(geneIdKey);
949  const CGlyphContainer::TKeyHighlights::const_iterator it_geneid = dbxrefHighlights.find(geneIdKey);
950  if (dbxrefHighlights.end() == it_geneid)
951  break;
952 
954  if (id_tag.Empty() || !id_tag->IsSetTag())
955  break;
956 
957  CNcbiOstrstream ss_tag;
958  id_tag->GetTag().AsString(ss_tag);
959  if (it_geneid->second.find((string)CNcbiOstrstreamToString(ss_tag)) != it_geneid->second.end())
960  return true;
961  }
962  while (false);
963 
964  return false;
965 }
966 
968  TFeatConfigMap& feat_confs,
969  const CFeatGlyph* parent_gene,
970  TFeatBatchJobRequests& requests,
971  bool compact_mode)
972 {
973  bool need_highlight = false;
974  CLayoutGroup::TObjectList::iterator iter = objs.begin();
975  while (iter != objs.end()) {
976  /// it is possible that the objs size will be increased within the
977  /// iteration when the job is executed in the foreground thread. In
978  /// order to keep the iterator point to the right element, we need
979  /// to know exactly how many new elements are added between two
980  /// iterations.
981  size_t obj_cnt = objs.size();
982 
983  CSeqGlyph* glyph = iter->GetPointer();
985  if (CGeneGroup* group = dynamic_cast<CGeneGroup*>(glyph)) {
986  group->SetConfig(m_Conf->m_GeneBoxConfig);
987  group->SetLayoutPolicy(m_Simple);
989  group->HideGeneAndLabel();
990  } else if ( !compact_mode ) {
991  // follow the setting to hide gene feature bar
992  // only not in compact mode
994  group->HideGeneAndLabel();
995  else
996  group->SetShowGene(m_Conf->m_ShowGenes);
997  }
998  if (!group->GetChildren().empty()) {
999  const CSeqGlyph* first_glyph = group->SetChildren().front();
1000  const CFeatGlyph* feat = dynamic_cast<const CFeatGlyph*>(first_glyph);
1001  _ASSERT(feat);
1002  if (x_InitFeature_Recursive(group->SetChildren(),
1003  feat_confs, feat, requests, compact_mode)) {
1004  need_highlight = true;
1005  group->SetHighlighted(true);
1006  if (m_HighlightsColor.get())
1007  group->SetHighlightsColor(*m_HighlightsColor.get());
1008  }
1009  }
1010 
1011  } else if (CLinkedFeatsGroup* group = dynamic_cast<CLinkedFeatsGroup*>(glyph)) {
1012  group->SetParentFeat(parent_gene);
1013  group->SetLayoutPolicy(m_Simple);
1014  group->SetConfig(m_gConfig->GetFeatParams("RnaCds"));
1015  group->SetGroup().SetRenderingContext(m_Context);
1016  group->SetShowLabel(m_Conf->m_ShowLabel);
1017  if (x_InitFeature_Recursive(group->SetChildren(),
1018  feat_confs, NULL, requests, compact_mode)) {
1019  need_highlight = true;
1020  }
1021  if (need_highlight) {
1022  group->SetHighlighted(true);
1023  if (m_HighlightsColor.get())
1024  group->SetHighlightsColor(*m_HighlightsColor.get());
1025  }
1026  } else if (CLayoutGroup* group = dynamic_cast<CLayoutGroup*>(glyph)) {
1027  // can be a group containing mRNA and CDS or only exons.
1028  CRef<CSeqGlyph> child0 = group->GetChild(0);
1029  const CFeatGlyph* feat =
1030  dynamic_cast<const CFeatGlyph*>(child0.GetPointer());
1031  _ASSERT(feat);
1032  if (feat->GetFeature().GetData().GetSubtype() ==
1035  // exons from mRNA very likely abut upon each other, use
1036  // layered layout
1037  group->SetLayoutPolicy(m_Layered);
1038  } else {
1039  // Otherwise, we apply inline layout for to form compact layout
1040  group->SetLayoutPolicy(m_Inline);
1041  }
1042  } else {
1043  // otherwise, we apply simple layout policy
1044  group->SetLayoutPolicy(m_Simple);
1045  }
1046  if (x_InitFeature_Recursive(group->SetChildren(),
1047  feat_confs, NULL, requests, compact_mode)) {
1048  need_highlight = true;
1049  group->SetHighlighted(true);
1050  if (m_HighlightsColor.get())
1051  group->SetHighlightsColor(*m_HighlightsColor.get());
1052  }
1053 
1054  } else if (CFeatGlyph* feat = dynamic_cast<CFeatGlyph*>(glyph)){
1055  m_Attrs |= fNavigable;
1056  if (compact_mode || m_Conf->m_ShowLabel == false) {
1057  feat->SetHideLabel(true);
1058  }
1059  if ( !m_AnnotNameUpdated) {
1060  m_AnnotName =
1061  CSeqUtils::GetAnnotName(feat->GetMappedFeature().GetAnnot());
1062  m_AnnotNameUpdated = true;
1063  }
1064  if ((!GetHighlights().empty() || !GetHighlightsByKey().empty()) && x_NeedHighlight(*feat)) {
1065  feat->SetHighlighted(true);
1066  if (m_HighlightsColor.get())
1067  feat->SetHighlightsColor(*m_HighlightsColor.get());
1068  need_highlight = true;
1069  }
1070  CSeqFeatData::ESubtype subtype =
1071  feat->GetFeature().GetData().GetSubtype();
1072  bool show_product = feat->GetFeature().IsSetProduct() &&
1074 
1075  switch (subtype) {
1077  feat->SetConfig(feat_confs[CSeqFeatData::eSubtype_exon]);
1078  break;
1080  {{
1081  feat->SetConfig(feat_confs[CSeqFeatData::eSubtype_cdregion]);
1084  CCdsGlyph* cds_glyph = dynamic_cast<CCdsGlyph*>(feat);
1085  cds_glyph->SetCdsConfig(m_Conf->m_CdsConfig);
1086  if (show_product) {
1088  requests.push_back(SFeatBatchJobRequest(feat, m_cdsFeatSel));
1089  }
1090  }
1091  }}
1092  break;
1094  feat->SetConfig(feat_confs[CSeqFeatData::eSubtype_gene]);
1095  break;
1097  default:
1100  break;
1101  }
1102 
1103  }
1104 
1105  for (size_t i = obj_cnt; i <= objs.size(); ++i) {
1106  ++iter;
1107  }
1108  } // while loop
1109 
1110  return need_highlight;
1111 }
1112 
1113 
1115 {
1116  if (m_Conf) {
1118  }
1119 }
1120 
1121 /*
1122 static
1123 bool s_IsTrackFiltered(const CGeneModelConfig& conf)
1124 {
1125  return conf.m_HideNonCoding || conf.m_HideModels || conf.m_CCDSOnly || conf.m_SelectOnly;
1126 }
1127 */
1128 
1130 {
1132  if (!m_FilterDescr.empty()) {
1133  CHTMLActiveArea area;
1135  area.m_Bounds.SetTop(area.m_Bounds.Top() + x_GetTBHeight());
1136  // left = 1 right = 0, makes it right-aligned
1137  area.m_Bounds.SetLeft(1);
1138  area.m_Bounds.SetRight(0);
1144  area.m_ID = m_FilterDescr;
1145  area.m_ParentId = GetId();
1146  area.m_PositiveStrand = true;
1147  area.m_SeqRange.SetFrom(0);
1148  area.m_SeqRange.SetTo(0);
1149  p_areas->push_back(area);
1150  }
1151 }
1152 
1153 
1155 {
1157  // make room for "Filtered" message
1158  if (!m_FilterDescr.empty()) {
1159  IRender& gl = GetGl();
1160  if (gl.IsPrinterFriendly() == false) {
1161  m_Group.SetTop(m_Group.GetTop() + 16);
1162  SetHeight(GetHeight() + 16);
1163  }
1164  }
1165 }
1166 
1168 {
1169  // do not show 'no track data' message if track is filtered
1170  if (GetChildren().empty() && m_FilterDescr.empty())
1172  else
1173  x_SetStatus(m_Msg, 100);
1174 }
1175 
1176 
1177 ///////////////////////////////////////////////////////////////////////////////
1178 /// CGeneModelFactory
1179 ///////////////////////////////////////////////////////////////////////////////
1182  ISGDataSourceContext* ds_context,
1183  CRenderingContext* r_cntx,
1184  const SExtraParams& params,
1185  const TAnnotMetaDataList& src_annots) const
1186 {
1187  TSeqRange range = params.m_Range;
1188  if (range.Empty()) {
1189  range = r_cntx->GetVisSeqRange();
1190  }
1191 
1192  const CFeatList& feats(*CSeqFeatData::GetFeatList());
1193  CIRef<ISGDataSource> pre_ds = ds_context->GetDS(
1194  typeid(CSGFeatureDSType).name(), object);
1195  CSGFeatureDS* seq_ds = dynamic_cast<CSGFeatureDS*>(pre_ds.GetPointer());
1196  seq_ds->SetDepth(params.m_Level);
1197  seq_ds->SetAdaptive(params.m_Adaptive);
1198 
1199  // check if there is data available
1200  // gene
1202 
1203  TAnnotNameTitleMap gene_annots;
1204 
1205  if ((params.m_SkipGenuineCheck || !params.m_DataTypeCheck)
1206  && !params.m_Annots.empty())
1207  {
1208  ITERATE (SExtraParams::TAnnots, iter, params.m_Annots) {
1209  gene_annots.insert(TAnnotNameTitleMap::value_type(*iter, ""));
1210  }
1211  } else {
1213  seq_ds->GetAnnotNames(sel, range, gene_annots);
1214  // collect NA tracks
1215  if ( !src_annots.empty() ) {
1216  ILayoutTrackFactory::GetMatchedAnnots(src_annots, params.m_Annots, "ftable",
1217  feats.GetStoragekey(CSeqFeatData::eSubtype_gene), gene_annots);
1218  }
1219  }
1220 
1221  // do something differently if there is any filters set
1222  if ( !params.m_Filter.empty() ) {
1223  return x_CreateTracksWithFilters(object, ds_context,
1224  r_cntx, params, gene_annots);
1225  }
1226 
1227  TTrackMap tracks;
1228  if (!params.m_SkipGenuineCheck) {
1229 
1230  const string unnamed_a = CSeqUtils::GetUnnamedAnnot();
1231  bool need_unnamed_track = false;
1232  bool has_unnamed_track = gene_annots.count(unnamed_a) > 0;
1233 
1234  // rna, there might be more annots for RNA than gene
1235  list<int> rna_subtypes;
1236  ITERATE (CFeatList, iter, feats) {
1237  if (iter->GetType() == CSeqFeatData::e_Rna &&
1238  iter->GetSubtype() != CSeqFeatData::eSubtype_any) {
1239  rna_subtypes.push_back(iter->GetSubtype());
1240  }
1241  }
1242 
1243  TAnnotNameTitleMap rna_annots;
1245  seq_ds->GetAnnotNames(sel, range, rna_annots);
1246  // collect NA tracks
1247  if ( !src_annots.empty() ) {
1248  ITERATE (list<int>, st_iter, rna_subtypes) {
1249  ILayoutTrackFactory::GetMatchedAnnots(src_annots, params.m_Annots, "ftable",
1250  feats.GetStoragekey(*st_iter), rna_annots);
1251  }
1252  }
1253 
1254  if ( !has_unnamed_track && rna_annots.count(unnamed_a) > 0 ) {
1255  TAnnotNameTitleMap::iterator rna_i = rna_annots.find(unnamed_a);
1256  rna_annots.erase(rna_i);
1257  need_unnamed_track = true;
1258  }
1259 
1260  // see if we need to create RNA feature tracks
1261  TAnnotNameTitleMap::iterator gene_i = gene_annots.begin();
1262  while ( !rna_annots.empty() && gene_i != gene_annots.end()) {
1263  TAnnotNameTitleMap::iterator rna_i = rna_annots.find(gene_i->first);
1264  if (rna_i != rna_annots.end()) {
1265  rna_annots.erase(rna_i);
1266  }
1267  ++gene_i;
1268  }
1269 
1270 
1271  // cds, there might be more annots for cds than gene
1272  TAnnotNameTitleMap cds_annots;
1274  seq_ds->GetAnnotNames(sel, range, cds_annots);
1275  // collect NA tracks
1276  if ( !src_annots.empty() ) {
1277  ILayoutTrackFactory::GetMatchedAnnots(src_annots, params.m_Annots, "ftable",
1278  feats.GetStoragekey(CSeqFeatData::eSubtype_cdregion), rna_annots);
1279  }
1280 
1281  if ( !has_unnamed_track && cds_annots.count(unnamed_a) > 0 ) {
1282  TAnnotNameTitleMap::iterator rna_i = cds_annots.find(unnamed_a);
1283  cds_annots.erase(rna_i);
1284  need_unnamed_track = true;
1285  }
1286 
1287  // see if we need to create exon feature track
1288  gene_i = gene_annots.begin();
1289  while ( !cds_annots.empty() && gene_i != gene_annots.end()) {
1290  TAnnotNameTitleMap::iterator cds_i = cds_annots.find(gene_i->first);
1291  if (cds_i != cds_annots.end()) {
1292  cds_annots.erase(cds_i);
1293  }
1294  ++gene_i;
1295  }
1296 
1297 
1298  // exon, there might be more annots for exon than gene
1300  TAnnotNameTitleMap exon_annots;
1301  seq_ds->GetAnnotNames(sel, range, exon_annots);
1302  // collect NA tracks
1303  if ( !src_annots.empty() ) {
1304  ILayoutTrackFactory::GetMatchedAnnots(src_annots, params.m_Annots, "ftable",
1305  feats.GetStoragekey(CSeqFeatData::eSubtype_exon), exon_annots);
1306  }
1307 
1308  // see if we need to create exon feature track
1309  gene_i = gene_annots.begin();
1310  while ( !exon_annots.empty() && gene_i != gene_annots.end()) {
1311  TAnnotNameTitleMap::iterator exon_i = exon_annots.find(gene_i->first);
1312  if (exon_i != exon_annots.end()) {
1313  exon_annots.erase(exon_i);
1314  }
1315  ++gene_i;
1316  }
1317 
1318  // check to see if any two of rna, cds and exon share the same
1319  // annotatation name. If yes, we need to create a Gene track
1320  // to group them together.
1321  set<string> unique_annots;
1322  TAnnotNameTitleMap rna_cds_exon_annots;
1323  ITERATE (TAnnotNameTitleMap, iter, rna_annots) {
1324  unique_annots.insert(iter->first);
1325  }
1326  ITERATE (TAnnotNameTitleMap, iter, cds_annots) {
1327  if ( !unique_annots.insert(iter->first).second ) {
1328  rna_cds_exon_annots.insert(*iter);
1329  }
1330  }
1331  ITERATE (TAnnotNameTitleMap, iter, exon_annots) {
1332  if ( !unique_annots.insert(iter->first).second ) {
1333  rna_cds_exon_annots.insert(*iter);
1334  }
1335  }
1336 
1337  // remove any annotaiton shared by any two of rna, cds,
1338  // and exons from the corresponding list
1339  ITERATE (TAnnotNameTitleMap, iter, rna_cds_exon_annots) {
1340  rna_annots.erase(iter->first);
1341  cds_annots.erase(iter->first);
1342  exon_annots.erase(iter->first);
1343  gene_annots.insert(*iter);
1344  }
1345 
1346  // create rna feature tracks
1347  if ( !rna_annots.empty() ) {
1348  ITERATE (TAnnotNameTitleMap, iter, rna_annots) {
1349  SExtraParams feat_params(params);
1350  feat_params.m_Annots.clear();
1351  feat_params.m_Annots.push_back(iter->first);
1352  ITERATE (list<int>, st_iter, rna_subtypes) {
1353  feat_params.m_Subkey = feats.GetStoragekey(*st_iter);
1354  CFeatureTrackFactory feature_factory;
1355  TTrackMap rna_tracks = feature_factory.CreateTracks(
1356  object, ds_context, r_cntx, feat_params, src_annots);
1357  if ( !rna_tracks.empty()) {
1358  tracks[iter->first] = rna_tracks.begin()->second;
1359  }
1360  }
1361  }
1362  }
1363 
1364  // create cdregion feature tracks
1365  ITERATE (TAnnotNameTitleMap, iter, cds_annots) {
1366  CFeatureTrackFactory feature_factory;
1367  SExtraParams feat_params(params);
1368  feat_params.m_Annots.clear();
1369  feat_params.m_Annots.push_back(iter->first);
1371  TTrackMap cds_tracks = feature_factory.CreateTracks(
1372  object, ds_context, r_cntx, feat_params, src_annots);
1373  if (!cds_tracks.empty()) {
1374  tracks[iter->first] = cds_tracks.begin()->second;
1375  }
1376  }
1377 
1378  // create exon feature tracks
1379  ITERATE (TAnnotNameTitleMap, iter, exon_annots) {
1380  CFeatureTrackFactory feature_factory;
1381  SExtraParams feat_params(params);
1382  feat_params.m_Annots.clear();
1383  feat_params.m_Annots.push_back(iter->first);
1384  feat_params.m_Subkey = feats.GetStoragekey(CSeqFeatData::eSubtype_exon);
1385  TTrackMap exon_tracks = feature_factory.CreateTracks(
1386  object, ds_context, r_cntx, feat_params, src_annots);
1387  if (!exon_tracks.empty()) {
1388  tracks[iter->first] = exon_tracks.begin()->second;
1389  }
1390  }
1391 
1392  if (need_unnamed_track) {
1393  gene_annots.insert(TAnnotNameTitleMap::value_type(unnamed_a, ""));
1394  }
1395  }
1396 
1397  // create gene model tracks
1398  ITERATE (TAnnotNameTitleMap, iter, gene_annots) {
1399  CIRef<ISGDataSource> ds = ds_context->GetDS(
1400  typeid(CSGFeatureDSType).name(), object);
1401  seq_ds = dynamic_cast<CSGFeatureDS*>(ds.GetPointer());
1402  seq_ds->SetDepth(params.m_Level);
1403  seq_ds->SetAdaptive(params.m_Adaptive);
1404  //seq_ds->SetSortBy(params.m_SortBy);
1405  CRef<CGeneModelTrack> gene_model(new CGeneModelTrack(seq_ds, r_cntx));
1406  gene_model->SetAnnot(iter->first);
1407  if ( !iter->second.empty() ) {
1408  gene_model->SetTitle(iter->second);
1409  }
1410  tracks[iter->first] = gene_model.GetPointer();
1411  }
1412 
1413  return tracks;
1414 }
1415 
1417  const TAnnotMetaDataList& src_annots,
1418  const ILayoutTrackFactory::SExtraParams& params,
1419  TAnnotNameTitleMap& out_annots) const
1420 {
1421  const CFeatList& feats(*CSeqFeatData::GetFeatList());
1422  ILayoutTrackFactory::GetMatchedAnnots(src_annots, params.m_Annots, "ftable",
1423  feats.GetStoragekey(CSeqFeatData::eSubtype_gene), out_annots);
1424  if (!params.m_Filter.empty()) return;
1425 
1426  // rna, there might be more annots for RNA than gene
1427  list<int> rna_subtypes;
1428  ITERATE(CFeatList, iter, feats) {
1429  if (iter->GetType() == CSeqFeatData::e_Rna &&
1430  iter->GetSubtype() != CSeqFeatData::eSubtype_any) {
1431  rna_subtypes.push_back(iter->GetSubtype());
1432  }
1433  }
1434 
1435  ITERATE(list<int>, st_iter, rna_subtypes) {
1436  ILayoutTrackFactory::GetMatchedAnnots(src_annots, params.m_Annots, "ftable",
1437  feats.GetStoragekey(*st_iter), out_annots);
1438  }
1439 
1440  ILayoutTrackFactory::GetMatchedAnnots(src_annots, params.m_Annots, "ftable",
1441  feats.GetStoragekey(CSeqFeatData::eSubtype_cdregion), out_annots);
1442 
1443  ILayoutTrackFactory::GetMatchedAnnots(src_annots, params.m_Annots, "ftable",
1444  feats.GetStoragekey(CSeqFeatData::eSubtype_exon), out_annots);
1445 }
1446 
1447 
1448 
1450 {
1452 }
1453 
1454 
1456 {
1458 }
1459 
1460 
1462 CGeneModelFactory::GetSettings(const string& profile,
1463  const TKeyValuePairs& settings,
1464  const CTempTrackProxy* /*track_proxy*/) const
1465 {
1466  CRef<CTrackConfigSet> config_set(new CTrackConfigSet);
1467  // create a track configure
1469  config_set->Set().push_back(config);
1470  config->SetHelp() = GetThisTypeInfo().GetDescr();
1471  config->SetLegend_text("anchor_1");
1472 
1473  CGeneModelConfig gm_settings;
1474  gm_settings.LoadSettingsPartial(kBaseKey, profile);
1475  gm_settings.UpdateSettings(settings);
1476 
1478  if (gm_settings.m_ShowGenes) {
1479  if (gm_settings.m_ShowRNAs) {
1480  if (gm_settings.m_MergeStyle == CGeneModelConfig::eMerge_No) {
1482  }
1483  } else {
1485  }
1486  } else {
1487  if (gm_settings.m_MergeStyle == CGeneModelConfig::eMerge_Pairs) {
1489  } else if (gm_settings.m_MergeStyle == CGeneModelConfig::eMerge_No) {
1491  } else if (gm_settings.m_MergeStyle == CGeneModelConfig::eMerge_OneLine) {
1493  }
1494  }
1495 
1497  "Options", "Rendering options", CGeneModelConfig::OptionValueToStr(option),
1498  "Rendering options on how gene features are rendered.");
1499 
1500  choice->SetValues().push_back(
1503  "Gene bar only",
1504  "Only the 'green' gene bar is shown",
1505  "Each bar represents the extent of the gene as it was last annotated, without showing exons."));
1506  choice->SetValues().push_back(
1509  "Merge all transcripts and CDSs, no gene bar",
1510  "Merge all transcripts and CDSs into a single line, no gene bar shown.",
1511  "Vertical lines represent exon placements. Arrows indicate orientation of the gene, 5' to 3'. Coding regions (CDS) are blue"));
1512  choice->SetValues().push_back(
1515  "Merge transcript and CDS pairs, no gene bar",
1516  "Merge the display of the transcript and its coding region as appropritate. Coding reginos are represented by different color. No gene bar is shown.",
1517  "Each transcript variant is rendered on a separate line. Verticqal lines represent exon features. Arrows indicate orientation of the gene, 5' to 3'."));
1518  choice->SetValues().push_back(
1521  "Show all transcripts and CDSs, no gene bar",
1522  "Show all transcripts and CDSs separately but with no gene bar.",
1523  "Blue lines represent transcripts while red lines represent CDSs. Vertical lines represent exon features. Arrows indicate orientation of the gene, 5' to 3'."));
1524  choice->SetValues().push_back(
1527  "Show all",
1528  "Show all transcripts and CDSs separately with gene bar.",
1529  "Blue lines represent transcripts while red lines represent CDSs. Vertical lines represent exon features. Arrows indicate orientation of the gene, 5' to 3'."));
1530  choice->SetValues().push_back(
1533  "Show on single line with exon structure, no gene bar",
1534  "No gene bar, but merge exon/CDS features and only show on a single line.",
1535  "The vertical lines represent exon features. Arrows indicate orientation of the gene, 5' to 3'."));
1536  config->SetChoice_list().push_back(choice);
1537 
1538  auto options_condition = Ref(new CConditional);
1539  options_condition->SetName("Options");
1540  options_condition->SetValue().push_back(CGeneModelConfig::OptionValueToStr(CGeneModelConfig::eOption_GeneOnly));
1541  options_condition->SetValue().push_back(CGeneModelConfig::OptionValueToStr(CGeneModelConfig::eOption_SingleLine));
1542  options_condition->SetValue().push_back(CGeneModelConfig::OptionValueToStr(CGeneModelConfig::eOption_MergeAll));
1543  options_condition->SetAction(CConditional::eAction_disable);
1544 
1545  {
1546  auto cb = CTrackConfigUtils::CreateCheckBox("HideNonCoding", "Hide non-coding",
1547  "Hide non-coding transcript variants", "", gm_settings.m_HideNonCoding, true);
1548  cb->SetConditions().push_back(options_condition);
1549  config->SetCheck_boxes().emplace_back(cb.Release());
1550  }
1551 
1552  {
1553  auto cb = CTrackConfigUtils::CreateCheckBox("HideModels", "Hide model transcripts",
1554  "Hide model transcript variants", "",gm_settings.m_HideModels, true);
1555  cb->SetConditions().push_back(options_condition);
1556  config->SetCheck_boxes().push_back(cb);
1557  }
1558 
1559  {
1560  auto cb = CTrackConfigUtils::CreateCheckBox("CCDSOnly", "Show only CCDS variants",
1561  "Show only CCDS variants", "", gm_settings.m_CCDSOnly, true);
1562  cb->SetConditions().push_back(options_condition);
1563  config->SetCheck_boxes().push_back(cb);
1564  }
1565 
1566  {
1567  auto cb = CTrackConfigUtils::CreateCheckBox("SelectOnly",
1568  "Show only RefSeq or MANE Select&nbsp;<a href='https://www.ncbi.nlm.nih.gov/refseq/refseq_select/' target='_blank'>What\'s this?</a>",
1569  "Show only the Select or MANE Select variants", "", gm_settings.m_SelectOnly, true);
1570  cb->SetConditions().push_back(options_condition);
1571  config->SetCheck_boxes().push_back(cb);
1572  }
1573 
1574  {
1575  auto cb = CTrackConfigUtils::CreateCheckBox("CDSProductFeats", "Show annotated protein features",
1576  "Show product features projected from protein sequence", "", gm_settings.m_ShowCDSProductFeats);
1577  auto options_condition = Ref(new CConditional);
1578  options_condition->SetName("Options");
1579  options_condition->SetValue().push_back(CGeneModelConfig::OptionValueToStr(CGeneModelConfig::eOption_GeneOnly));
1580  options_condition->SetValue().push_back(CGeneModelConfig::OptionValueToStr(CGeneModelConfig::eOption_SingleLine));
1581  options_condition->SetValue().push_back(CGeneModelConfig::OptionValueToStr(CGeneModelConfig::eOption_MergeAll));
1582  options_condition->SetValue().push_back(CGeneModelConfig::OptionValueToStr(CGeneModelConfig::eOption_MergePairs));
1583  options_condition->SetAction(CConditional::eAction_disable);
1584  cb->SetConditions().push_back(options_condition);
1585  config->SetCheck_boxes().push_back(cb);
1586  }
1587 
1588 
1589  /*
1590  config->SetCheck_boxes().push_back(
1591  CTrackConfigUtils::CreateCheckBox(
1592  "NtRuler", "Show Product Ruler",
1593  "Show Product Ruler", "",
1594  gm_settings.m_ShowNtRuler));
1595  config->SetCheck_boxes().push_back(
1596  CTrackConfigUtils::CreateCheckBox(
1597  "AaRuler", "Show Protein Ruler",
1598  "Show Protein Ruler", "",
1599  gm_settings.m_ShowAaRuler));
1600  */
1601 
1602  config->SetHidden_settings().push_back(
1604  "NtRuler", NStr::BoolToString(gm_settings.m_ShowNtRuler)));
1605  config->SetHidden_settings().push_back(
1607  "AaRuler", NStr::BoolToString(gm_settings.m_ShowAaRuler)));
1608  config->SetHidden_settings().push_back(
1610  "HighlightMode", NStr::IntToString(gm_settings.m_HighlightMode)));
1611  config->SetHidden_settings().push_back(
1613  "ShowLabel", NStr::BoolToString(gm_settings.m_ShowLabel)));
1614 
1615  return config_set;
1616 }
1617 
1618 
1621  ISGDataSourceContext* ds_context, CRenderingContext* r_cntx,
1622  const SExtraParams& params, const TAnnotNameTitleMap& annots) const
1623 {
1624  TTrackMap tracks;
1625 
1626  TSeqRange range = params.m_Range;
1627  if (range.Empty()) {
1628  range = r_cntx->GetVisSeqRange();
1629  }
1630 
1631  CIRef<ISGDataSource> pre_ds = ds_context->GetDS(
1632  typeid(CSGFeatureDSType).name(), object);
1633  CSGFeatureDS* seq_ds = dynamic_cast<CSGFeatureDS*>(pre_ds.GetPointer());
1634  seq_ds->SetDepth(params.m_Level);
1635  seq_ds->SetAdaptive(params.m_Adaptive);
1636  seq_ds->SetFilter(params.m_Filter);
1637  seq_ds->SetSortBy(params.m_SortBy);
1638  // create gene model tracks with specified filters
1639  ITERATE (TAnnotNameTitleMap, iter, annots) {
1640  vector<string> filters;
1641  if (params.m_SkipGenuineCheck) {
1642  filters.push_back(params.m_Filter);
1643  } else {
1644  filters = seq_ds->GetFilters(iter->first, range);
1645  }
1646  ITERATE (vector<string>, f_iter, filters) {
1647  CIRef<ISGDataSource> ds = ds_context->GetDS(
1648  typeid(CSGFeatureDSType).name(), object);
1649  CSGFeatureDS* feat_ds = dynamic_cast<CSGFeatureDS*>(ds.GetPointer());
1650  feat_ds->SetDepth(params.m_Level);
1651  feat_ds->SetAdaptive(params.m_Adaptive);
1652  CRef<CGeneModelTrack> gene_model(new CGeneModelTrack(feat_ds, r_cntx));
1653  gene_model->SetAnnot(iter->first);
1654  if ( !iter->second.empty() ) {
1655  gene_model->SetTitle(iter->second);
1656  }
1657  gene_model->SetFilter(*f_iter);
1658  tracks[MergeAnnotAndFilter(iter->first, *f_iter)] = gene_model.GetPointer();
1659  }
1660  }
1661 
1662  return tracks;
1663 
1664 }
1665 
1666 
User-defined methods of the data storage class.
#define static
CAppJobNotification Notification send by CAppJobEventTranslator.
CBatchJobResult – the data structure holding the seqgraphic job results for a batch job processing.
vector< CRef< CSGJobResult > > TResults
CBioseq_Handle –.
void SetCdsConfig(CCdsConfig *config)
CCdsGlyph inline methods.
Definition: cds_glyph.hpp:102
CCommentConfig – help config class for holding a set of settings for a comment glyph.
CRgbaColor m_LineColor
CRgbaColor m_LabelColor
bool m_Centered
label is centered against the target.
CCompactLayout is amed to generate more compact 2D layout policy than layered layout for glyphs with ...
void SetMinDist(TSeqPos dist)
CConditional –.
Definition: Conditional.hpp:66
CDataTrack - a abstract base class for layout tracks which need to deal with background data retrieva...
Definition: data_track.hpp:55
const TSeqRange & x_GetVisRange() const
Definition: data_track.hpp:121
virtual void x_OnAllJobsFinished()
Definition: data_track.cpp:185
void x_UpdateLayout()
Definition: data_track.hpp:127
virtual void SetHideLabel(bool b)
Force to hide label.
void SetProjectedFeat(bool f)
void SetConfig(CConstRef< CFeatureParams > conf)
const objects::CMappedFeat & GetMappedFeature(void) const
Access a new, fully remapped feature.
const objects::CSeq_feat & GetFeature(void) const
Access the original feature.
void GetLabel(string &label, CLabel::ELabelType type) const
retrieve feature label for a given type
CConfigurableItems - a static list of items that can be configured.
string GetStoragekey(int type, int subtype) const
Get the key used to store this type of feature.
CFeat_CI –.
Definition: feat_ci.hpp:64
static void CreateMicroIntrons(objects::CScope &scope, objects::CBioseq_Handle bsh, const string &annot_name="", TSeqRange *range=NULL, bool ignore_errors=false)
@ ePos_NoLabel
no label
CFeatureTrackFactory.
virtual TTrackMap CreateTracks(SConstScopedObject &object, ISGDataSourceContext *ds_context, CRenderingContext *r_cntx, const SExtraParams &params=SExtraParams(), const TAnnotMetaDataList &src_annots=TAnnotMetaDataList()) const
create a layout track based on the input objects and extra parameters.
void OnContextMenu(wxContextMenuEvent &anEvent)
CGeneModelTrack * m_Track
void x_OnToggleContent(wxCommandEvent &event)
CGeneContentEvtHandler(CGeneModelTrack *track)
CGeneGroup is a subclass of CLayoutGroup contains gene, RNA, cds, and Exon features.
bool m_CCDSOnly
Show only CCDS variants.
bool m_ShowCDSProductFeats
CDS associated protein features.
bool m_ShowNtRuler
Show nucleotide ruler.
EMergeStyle m_MergeStyle
the way on how to merge CDSs and RNAs.
static const string & OptionValueToStr(CGeneModelConfig::ERenderingOption option)
bool m_ShowAaRuler
Show protein ruler.
bool m_SelectOnly
Show only Select/MANE variants.
void SaveSettings(CConstRef< CSeqGraphicConfig > g_conf, const string &reg_path, const string &profile) const
void UpdateSettings(const CSGConfigUtils::TKeyValuePairs &settings)
bool m_HideNonCoding
Hide transcripts without associated CDS.
void LoadSettingsPartial(const string &reg_path, const string &profile)
void LoadSettings(CConstRef< CSeqGraphicConfig > g_conf, const string &reg_path, const string &profile)
bool m_ShowVDJCs
show VDJ_segments and C_region
CRef< CBoundaryParams > m_GeneBoxConfig
bool m_ShowHistogram
show gene distribution histogram.
ERenderingOption
rendering options on how to render features overall.
@ eOption_SingleLine
merge all RNAs and CDSs into one line
@ eOption_MergeAll
merge all RNAs and CDSs, show exons, no gene bar
@ eOption_ShowAll
show all features individually
@ eOption_MergePairs
merge each RNA and CDS pair, show exons, no gene bar
@ eOption_ShowAllButGenes
show all RNAs, CDSs and exons, no gene bar
@ eOption_GeneOnly
show gene bar only
string SaveSettingsAsString(const string &preset_style) const
CRef< CCdsConfig > m_CdsConfig
EMergeStyle
style on how to merge RNAs and CDSs.
@ eMerge_OneLine
merge into one line
@ eMerge_Pairs
merge each transcript and CDS pair
@ eMerge_All
merge all transcripts and CDSs
@ eMerge_No
show all feature individually
bool m_HideModels
Hide Model RefSeqs.
bool m_ShowLabel
Show labels.
virtual const CTrackTypeInfo & GetThisTypeInfo() const override
TTrackMap x_CreateTracksWithFilters(SConstScopedObject &object, ISGDataSourceContext *ds_context, CRenderingContext *r_cntx, const SExtraParams &params, const TAnnotNameTitleMap &annots) const
virtual CRef< objects::CTrackConfigSet > GetSettings(const string &profile, const TKeyValuePairs &settings, const CTempTrackProxy *track_proxy) const override
virtual string GetExtensionLabel() const override
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual TTrackMap CreateTracks(SConstScopedObject &object, ISGDataSourceContext *ds_context, CRenderingContext *r_cntx, const SExtraParams &params=SExtraParams(), const TAnnotMetaDataList &src_annots=TAnnotMetaDataList()) const override
CGeneModelFactory.
virtual string GetExtensionIdentifier() const override
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual void GetMatchedAnnots(const TAnnotMetaDataList &src_annots, const ILayoutTrackFactory::SExtraParams &params, TAnnotNameTitleMap &out_annots) const override
CGeneModelTrack –.
objects::SAnnotSelector m_cdsFeatSel
virtual void x_OnAllJobsFinished() override
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const override
Get html active areas.
wxEvtHandler * m_ContentHandler
wx-related event handler.
bool x_NeedHighlight(const CFeatGlyph &feat_glyph) const
void x_AddFeatProductLayout(CBatchJobResult &results)
objects::SAnnotSelector m_LandMarkFeatSel
CRef< CGeneModelConfig > m_Conf
void GenerateAsn1(objects::CSeq_entry &seq_entry, TSeqRange range) override
void x_AddCDSProduct_FeatsLayout(CSGJobResult &result)
static CTrackTypeInfo m_TypeInfo
virtual string GetFullTitle() const override
get a more meaningful title.
virtual void x_SaveSettings(const string &preset_style) override
save part of settings to a profile string.
virtual void x_UpdateBoundingBox() override
Update the bounding box assuming children's sizes are fixed if any.
void OnToggleContent(int id)
CRef< CSGFeatureDS > m_DS
objects::SAnnotSelector m_MainSel
virtual void x_OnJobCompleted(CAppJobNotification &notify) override
virtual const CTrackTypeInfo & GetTypeInfo() const override
void x_SaveConfiguration() const
save all track settings to the configuration file.
set< objects::CSeqFeatData::ESubtype > m_subtypes
Text inidcating that some transcripts were filtered out.
virtual ~CGeneModelTrack()
virtual void x_UpdateData() override
update track content.
virtual void GetFeatSubtypes(set< objects::CSeqFeatData::ESubtype > &subtypes) const override
virtual void x_OnIconClicked(TIconID id) override
Mouse left-click event handler on an icon.
CRef< CCompactLayout > m_Compact
virtual void x_LoadSettings(const string &preset_style, const TKeyValuePairs &settings) override
load the track settings.
void x_AddLandMarkFeaturesLayout(CSGJobResult &result)
bool m_AnnotNameUpdated
flag for indicating if we have used a more meaningful annotation name.
void x_AddMainFeaturesLayout(const CSGJobResult &result)
void SetAnnot(const string &annot)
bool x_InitFeature_Recursive(CLayoutGroup::TObjectList &objs, TFeatConfigMap &feat_confs, const CFeatGlyph *parent_gene, TFeatBatchJobRequests &requests, bool compact_mode)
File Description:
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
void Add(CSeqGlyph *obj)
Append a layout object to the end.
const TKeyHighlights & GetHighlightsByKey() const
void SetLabelGlyphs(const CSeqGlyph::TObjects &objs, CRef< CCommentConfig > config)
void SetObjects(const CLayoutGroup::TObjectList &objs)
const THighlights & GetHighlights() const
CGlyphContainer(CRenderingContext *r_cntx)
CLayoutGroup & SetGroup()
CRef< CInlineLayout > m_Inline
const CLayoutGroup::TObjectList & GetChildren() const
CLayoutGroup::TObjectList & SetChildren()
CRef< CLayeredLayout > m_Layered
CRef< CSimpleLayout > m_Simple
void SetLayoutPolicy(ILayoutPolicy *policy)
Set policy on how to deploy the layout of its children.
@ fNoHighlight
no highlighting on mouse over
@ fDrawBackground
highlight background for this area
@ fComment
render a label/comment on client side
@ fNoSelection
the object can't be selected
@ fTooltipEmbedded
tooltip embedded
string m_ID
area identifier
int m_Flags
area flags, will need to replace m_Type
string m_ParentId
parent entity idendifier, such as track_id
bool m_PositiveStrand
the default is true
void SetDialogHost(IGlyphDialogHost *host)
void SetConfig(const CSeqGraphicConfig &config)
CJobResultBase – the basic job result class holding a token.
CLayoutGroup is a container of CSeqGlyphs (layout objects).
void SetLayoutPolicy(ILayoutPolicy *policy)
Set policy on how to deploy the layout of its children.
TObjectList & SetChildren()
virtual void Update(bool layout_only)
Update content and layout including the bounding box.
void Set(const TObjectList &objs)
void UpdateLayout()
update group's bounding box only, and its parent layout.
void InsertAft(const CSeqGlyph *at_obj, CSeqGlyph *obj)
Insert a layout object after the given layout object.
ILayoutPolicy::TObjectList TObjectList
void SetTrackAttr(TTrackAttrFlags flags)
int m_IndentLevel
track hierachy indentation level.
void SetTitle(const string &label, const string &default_title=NcbiEmptyString)
@ eIcon_Content
icon id for setting content
@ eIcon_Layout
icon id for setting layout style
void SetIndent(int indent)
ILayoutTrackHost * m_LTHost
Top level host owning the tracks.
string m_Msg
special message need to show on title bar
string GetTitle() const
get the track title.
TTrackAttrFlags m_Attrs
various track attributes
const string & GetId() const
void SetConfig(CRef< CSeqGraphicConfig > conf)
virtual void x_OnIconClicked(TIconID id)
Mouse left-click event handler on an icon.
@ fNavigable
Track has navigation controls.
@ fShowAlways
always be rendered even for an empty track.
@ fFullTrack
track occupying the full horizontal screen.
const string & GetProfile() const
void x_SetStatus(const string &msg, int progress)
unsigned TTrackAttrFlags
TModelUnit x_GetTBHeight() const
Get title bar height including margin.
void SetMsg(const string &msg)
CConstRef< CSeqGraphicConfig > x_GetGlobalConfig() const
Method for getting global configuration from rendering context.
void SetProfile(const string &preset_style)
CLayoutTrack inline method implmentation.
CRef< CSeqGraphicConfig > m_gConfig
global configuration.
int TIconID
use int as TIconID instead of EIconID.
CLinkedFeatsGroup is a container class contains related features.
CMappedFeat –.
Definition: mapped_feat.hpp:59
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Definition: ncbistre.hpp:802
ostream & AsString(ostream &s) const
Definition: Object_id.cpp:202
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
const TSeqRange & GetVisSeqRange() const
const TModelUnit & GetScale() const
TModelUnit ScreenToSeq(const TModelUnit &size) const
convert from screen pixels to sequence positions
bool IsOverviewMode() const
static bool IsBackgroundJob()
CSGFeatureDSType.
Definition: feature_ds.hpp:156
CSGFeatureDS.
Definition: feature_ds.hpp:49
void LoadGeneModelFeatures(objects::SAnnotSelector &lm_feat_sel, objects::SAnnotSelector &m_feat_sel, TJobToken lm_token, TJobToken main_token, bool landmark_feat, const TSeqRange &range, TModelUnit window, const CRef< CGeneModelConfig > &conf)
load features for gene model.
Definition: feature_ds.cpp:482
void GetAnnotNames(objects::SAnnotSelector &sel, const TSeqRange &range, TAnnotNameTitleMap &names) const
Definition: feature_ds.cpp:513
void SetSortBy(const string &sortby)
Definition: feature_ds.hpp:184
void SetFilter(const string &filter)
CSGFeatureDS inline method.
Definition: feature_ds.hpp:176
virtual void LoadFeatures(objects::SAnnotSelector &sel, const TSeqRange &range, TModelUnit window, TJobToken token=-1, int max_feat=-1, ELinkedFeatDisplay LinkedFeatDisplay=ELinkedFeatDisplay::eLFD_Default, const string &extra_filter="")
vector< string > GetFilters(const string &annot_name, const TSeqRange &range) const
Definition: feature_ds.cpp:531
objects::CScope & GetScope(void) const
Get the scope from the handle.
virtual bool AllJobsFinished() const
objects::CBioseq_Handle & GetBioseqHandle(void)
Get the underlying bioseq handle.
virtual void ClearJobID(TJobID job_id)
void SetDepth(int depth)
Set the annotation selector resolving depth.
virtual void DeleteAllJobs()
Remove waiting jobs from queue or cancel the unfinished jobs.
void SetAdaptive(bool flag)
CSGJobResult – the data structure holding the seqgraphic job results.
static bool IsmRNA(const objects::CBioseq_Handle &handle, objects::CScope &scope)
CScope –.
Definition: scope.hpp:92
ESubtype GetSubtype(void) const
static const CFeatList * GetFeatList()
class CSeqGlyph defines an interface that wraps a rectilinear abstract object.
Definition: seq_glyph.hpp:82
void SetHighlightsColor(const CRgbaColor &hl_color)
Definition: seq_glyph.hpp:640
void x_InitHTMLActiveArea(CHTMLActiveArea &area) const
initialize the basic information for a given active area.
Definition: seq_glyph.cpp:380
CRenderingContext * m_Context
the rendering context
Definition: seq_glyph.hpp:346
virtual void SetHeight(TModelUnit h)
Definition: seq_glyph.hpp:650
void SetParent(CSeqGlyph *p)
Definition: seq_glyph.hpp:670
virtual TModelUnit GetTop() const
Definition: seq_glyph.hpp:599
virtual TModelUnit GetHeight() const
Definition: seq_glyph.hpp:587
unique_ptr< CRgbaColor > m_HighlightsColor
Highlight color.
Definition: seq_glyph.hpp:347
virtual void SetTop(TModelUnit b)
Definition: seq_glyph.hpp:658
vector< CHTMLActiveArea > TAreaVector
Definition: seq_glyph.hpp:84
void SetHighlighted(bool flag)
Definition: seq_glyph.hpp:634
list< CRef< CSeqGlyph > > TObjects
Definition: seq_glyph.hpp:85
void SetRenderingContext(CRenderingContext *context)
Set the rendering context.
Definition: seq_glyph.hpp:684
bool IsHighlighted() const
Definition: seq_glyph.hpp:577
bool GetShowSimpleComments() const
CConstRef< CFeatureParams > GetFeatParams(TFeatSubtype subtype) const
Get feature settings using a feature subtype.
int GetObjectSpace() const
bool GetShowComments() const
Definition: Seq_entry.hpp:56
TAnnot & SetAnnot(void)
Definition: Seq_entry.cpp:195
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CConstRef< CDbtag > GetNamedDbxref(const CTempString &db) const
Return a specified DB xref.
Definition: Seq_feat.cpp:415
class CStaticArrayMap<> provides access to a static array in much the same way as CStaticArraySet<>,...
Definition: static_map.hpp:175
File Description:
CTrackConfigSet –.
static CRef< objects::CChoice > CreateChoice(const string &name, const string &disp_name, const string &curr_val, const string &help, bool optional=false)
Definition: layout_conf.hpp:79
static CRef< objects::CHiddenSetting > CreateHiddenSetting(const string &name, const string &value)
static CRef< objects::CCheckBox > CreateCheckBox(const string &name, const string &disp_n, const string &help_text, const string &legend_txt, bool value, bool optional=false)
Definition: layout_conf.hpp:96
static CRef< objects::CChoiceItem > CreateChoiceItem(const string &name, const string &disp_name, const string &help, const string &legend_txt, bool optional=false)
Definition: layout_conf.hpp:61
CTrackConfig –.
Definition: TrackConfig.hpp:66
CTrackTypeInfo - holds description of a layout track type.
const string & GetDescr() const
const string & GetId() const
IGlyphDialogHost An interface used for handling issues related to any dialog pops up that requires so...
Definition: seq_glyph.hpp:399
static string MergeAnnotAndFilter(const string &annot, const string &filter)
create a new name based on annotation name and fitler string.
static void GetMatchedAnnots(const TAnnotMetaDataList &src_annots, const vector< string > &target_annots, const string &annot_type, const string &track_type, TAnnotNameTitleMap &out_annots)
Help function to find matched annotations.
virtual void LTH_PopupMenu(wxMenu *menu)=0
show track-specific context menu.
virtual void LTH_PushEventHandler(wxEvtHandler *handler)=0
virtual void LTH_PopEventHandler()=0
ISGDSManager is seqgraphic data source manage that serves as an data source context.
virtual CIRef< ISGDataSource > GetDS(const string &type, SConstScopedObject &object)=0
Get a seqgraphic data source instance of the specified type.
void erase(iterator pos)
Definition: map.hpp:167
const_iterator begin() const
Definition: map.hpp:151
const_iterator end() const
Definition: map.hpp:152
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
bool empty() const
Definition: map.hpp:149
const_iterator find(const key_type &key) const
Definition: map.hpp:153
Definition: set.hpp:45
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
void clear()
Definition: set.hpp:153
bool empty() const
Definition: set.hpp:133
struct config config
int main(int argc, const char *argv[])
#define A(i)
Definition: ecp_curves.c:936
#define false
Definition: bool.h:36
#define option
CStaticArrayMap< string, CGeneModelConfig::EMergeStyle > TStyleMap
USING_SCOPE(objects)
static const string kTrackName
static const size_t kMaxGenesOverviewRows
static const size_t kMaxCompactRows
static const int kMaxID
static const size_t kContentBaseID
CGeneModelTrack.
static const string kGeneIdDb("GeneID")
static const size_t kCompactThreshold
static const string kBaseKey
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
#define NULL
Definition: ncbistd.hpp:225
#define Handle
Definition: ncbistd.hpp:119
#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
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
Definition: utils.cpp:167
static string GetAnnotName(const objects::CSeq_annot_Handle &annot_handle)
static const string & GetUnnamedAnnot()
Get the commonly used symbol representing a unnnamed annotation.
Definition: utils.hpp:531
static bool IsUnnamed(const string &annot)
check if a given annotation is a unnamed annotation.
Definition: utils.hpp:525
static TAnnotNameType NameTypeStrToValue(const string &type)
Definition: utils.cpp:140
static void SetResolveDepth(objects::SAnnotSelector &sel, bool adaptive, int depth=-1)
help function for setting selector resolve depth.
Definition: utils.cpp:405
@ eAnnot_Unnamed
unnamed annotation
Definition: utils.hpp:133
void SetRight(T right)
Definition: glrect.hpp:114
T Top() const
Definition: glrect.hpp:84
IRender & GetGl()
convenience function for getting current render manager
virtual bool IsPrinterFriendly() const =0
void SetLeft(T left)
Definition: glrect.hpp:112
void SetTop(T top)
Definition: glrect.hpp:115
void Set(float r, float g, float b)
set the color from an Fl_Color
Definition: rgba_color.cpp:226
CRef< CObject > GetResult() const
returns non-null pointer only if Completed or Running and has temporary results available
@ eContent
Definition: label.hpp:62
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
string GetLabel(const CSeq_id &id)
@ fFGL_Content
Include its content if there is any.
Definition: feature.hpp:73
SAnnotSelector & SetFeatType(TFeatType type)
Set feature type (also set annotation type to feat)
const CSeq_feat & GetMappedFeature(void) const
Feature mapped to the master sequence.
SAnnotSelector & SetFeatSubtype(TFeatSubtype subtype)
Set feature subtype (also set annotation and feat type)
bool Empty(void) const THROWS_NONE
Check if CConstRef is empty – not pointing to any object which means having a null value.
Definition: ncbiobj.hpp:1385
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
Definition: ncbiobj.hpp:2015
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool Empty(void) const
Definition: range.hpp:148
#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 string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
Definition: ncbistr.cpp:2751
static const string BoolToString(bool value)
Convert bool to string.
Definition: ncbistr.cpp:2815
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
static string & ToLower(string &str)
Convert string to lower case – string& version.
Definition: ncbistr.cpp:405
static const char label[]
void SetFrom(TFrom value)
Assign a value to From data member.
Definition: Range_.hpp:231
void SetTo(TTo value)
Assign a value to To data member.
Definition: Range_.hpp:278
const TTag & GetTag(void) const
Get the Tag member data.
Definition: Dbtag_.hpp:267
bool IsSetTag(void) const
appropriate tag Check if a value has been assigned to Tag data member.
Definition: Dbtag_.hpp:255
Tdata & Set(void)
Assign a value to data member.
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_annot_.cpp:244
list< CRef< CSeq_feat > > TFtable
Definition: Seq_annot_.hpp:193
END_EVENT_TABLE()
for(len=0;yy_str[len];++len)
int i
#define wxT(x)
Definition: muParser.cpp:41
void GetSubtypesForType(set< objects::CSeqFeatData::ESubtype > &subtypes, objects::CSeqFeatData::E_Choice feat)
range(_Ty, _Ty) -> range< _Ty >
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
unsigned int a
Definition: ncbi_localip.c:102
switch(yytype)
Definition: newick.tab.cpp:737
T max(T x_, T y_)
vector< SFeatBatchJobRequest > TFeatBatchJobRequests
EVT_MENU_RANGE(MID_SHOW_TITLES, MID_HIDE_TITLES, ViewerWindowBase::OnTitleView) EVT_MENU_RANGE(MID_ENABLE_EDIT
A help struct for storing information about a icon.
extra parameter for initializing a track.
bool m_Adaptive
Adaptive/Exact selector.
TAnnots m_Annots
particular annotations the track will be looking at.
string m_Filter
potential track-specific filter.
string m_SortBy
potential track-specific sort_by.
int m_Level
layout level that limits feature retrieving used by annotation selector.
TSeqRange m_Range
The requested range we want to look at.
bool m_DataTypeCheck
Flag indicating if track data should be checked against declared track type.
string m_Subkey
A subkey for creating feature-specific layout track for a generic layout track type.
bool m_SkipGenuineCheck
Flag indicating if track verification is required.
SAnnotSelector –.
bool operator()(CRef< CSeqGlyph > o1, CRef< CSeqGlyph > o2)
Definition: type.c:6
#define _ASSERT
else result
Definition: token2.c:20
#define ftable
Definition: utilfeat.h:37
static const char *const features[]
void UseDefaultMarginWidth(wxMenu &menu)
Using default menu item margin width.
Definition: wx_utils.cpp:693
#define const
Definition: zconf.h:232
Modified on Wed Apr 17 13:10:30 2024 by modify_doxy.py rev. 669887