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

Go to the SVN repository for this file.

1 /* $Id: align_statistics_glyph.cpp 42972 2019-05-01 15:58:38Z shkeda $
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 *
29 */
30 
31 #include <ncbi_pch.hpp>
34 #include <gui/opengl/irender.hpp>
35 #include <gui/opengl/glutils.hpp>
36 #include <gui/objutils/tooltip.hpp>
38 #include "wx_aln_stat_dlg.hpp"
39 
40 //#include <gui/widgets/wx/message_box.hpp>
41 
44 
45 static int kSmearRowHeight = 10;
46 
47 static const string kScale = "GraphScale";
48 static const string kPileUpLabel = "Pile-up";
49 static const string kPileUpColor = "0,0,255";
50 
51 
52 ///////////////////////////////////////////////////////////////////////////////
53 /// CAlnStatGlyph
54 
56  : m_DlgHost(NULL)
57  , m_StartPos(start)
58  , m_ZoomScale(scale)
59 {
60 }
61 
62 
64 {
71  if (m_DlgHost) {
73  }
74  if(dlg.ShowModal() == wxID_OK) {
81  }
82  if (m_DlgHost) {
84  }
85  return true;
86 }
87 
88 
89 bool CAlnStatGlyph::NeedTooltip(const TModelPoint& p, ITooltipFormatter& tt, string& t_title) const
90 {
91  GetTooltip(p, tt, t_title);
92  return true;
93 }
94 
95 
96 void CAlnStatGlyph::GetTooltip(const TModelPoint& p, ITooltipFormatter& tt, string& /*t_title*/) const
97 {
98  if (p.X() >= 0) {
99  TSeqPos seq_pos = (TSeqPos)p.X();
100  tt.AddSectionRow("Alignment statistics");
101 
102  tt.AddRow("Base position:", NStr::UIntToString(seq_pos + 1, NStr::fWithCommas));
103 
104  int idx = seq_pos - m_StartPos;
105  if (m_Context->GetScale() > 1.0) {
106  idx = (int)(idx / m_Context->GetScale());
107  }
108 
109  char buf[255];
110  if (idx >= 0 && idx < (int)m_StatVec.size()) {
111  const SStatStruct& stat = m_StatVec[idx];
112  int total = stat.m_Data[CAlnStatConfig::eStat_Total];
113 
114  tt.AddRow("Total count:", NStr::Int8ToString(total));
115 
116  int num = stat.m_Data[CAlnStatConfig::eStat_Match];
117  string value = NStr::Int8ToString(num);
118  if (total > 0) {
119  sprintf(buf, "%2.1f", 100.0 * num / total);
120  value += " (";
121  value += buf;
122  value += "%)";
123  }
124  tt.AddRow("Matches:", value);
125 
127  value = NStr::Int8ToString(num);
128  if (total > 0) {
129  sprintf(buf, "%2.1f", 100.0 * num / total);
130  value += " (";
131  value += buf;
132  value += "%)";
133  }
134  tt.AddRow("Mismatches:", value);
135 
136  num = stat.m_Data[CAlnStatConfig::eStat_Gap];
137  value = NStr::Int8ToString(num);
138  if (total > 0) {
139  sprintf(buf, "%2.1f", 100.0 * num / total);
140  value += " (";
141  value += buf;
142  value += "%)";
143  }
144  tt.AddRow("Gaps:", value);
145 
147  if (num > 0) {
148  value = NStr::Int8ToString(num);
149  if (total > 0) {
150  sprintf(buf, "%2.1f", 100.0 * num / total);
151  value += " (";
152  value += buf;
153  value += "%)";
154  }
155  tt.AddRow("Introns:", value);
156  }
157 
158  num = stat.m_Data[CAlnStatConfig::eStat_A];
159  value = NStr::Int8ToString(num);
160  if (total > 0) {
161  sprintf(buf, "%2.1f", 100.0 * num / total);
162  value += " (";
163  value += buf;
164  value += "%)";
165  }
166  tt.AddRow("A:", value);
167 
168  num = stat.m_Data[CAlnStatConfig::eStat_T];
169  value = NStr::Int8ToString(num);
170  if (total > 0) {
171  sprintf(buf, "%2.1f", 100.0 * num / total);
172  value += " (";
173  value += buf;
174  value += "%)";
175  }
176  tt.AddRow("T:", value);
177 
178  num = stat.m_Data[CAlnStatConfig::eStat_G];
179  value = NStr::Int8ToString(num);
180  if (total > 0) {
181  sprintf(buf, "%2.1f", 100.0 * num / total);
182  value += " (";
183  value += buf;
184  value += "%)";
185  }
186  tt.AddRow("G:", value);
187 
188  num = stat.m_Data[CAlnStatConfig::eStat_C];
189  value = NStr::Int8ToString(num);
190  if (total > 0) {
191  sprintf(buf, "%2.1f", 100.0 * num / total);
192  value += " (";
193  value += buf;
194  value += "%)";
195  }
196  tt.AddRow("C:", value);
197  }
198  tt.AddRow();
199  tt.AddRow("Double click on the statistics graph to change settings...");
200  }
201 }
202 
203 static void s_GetLabel(CHistParams::EScale scale, string& label)
204 {
206  if (scale != CHistParams::eLinear) {
207  label += ", ";
209  label += " scaled";
210  }
211 }
212 
214 {
215 
216  if (m_Config->IsBarGraph()) {
217  string label = kPileUpLabel;
218  if (m_Config->ShowCount())
220 
221  CHTMLActiveArea area;
223  area.m_PositiveStrand = true;
224  area.m_Flags =
229  area.m_Descr = label;
230 
231  Uint8 total = 0;
232  for (auto&& v : m_StatVec) {
233  total ^= v.m_Data[CAlnStatConfig::eStat_Total];
234  }
235  string id = "stat_" + NStr::NumericToString(total);
236  area.m_Signature = id;
238  // mandatory options
239  config->SetName("Alignment statistics");
240  config->SetOrder(0);
241  config->SetKey(id);
242  config->SetShown(true);
243  // Actual settings
244  config->SetChoice_list().push_back(CHistParams::CreateScaleOptions(kScale, m_GraphParams->m_Scale));
245  config->SetChoice_list().push_back(CreateDisplayOptions("StatDisplay", m_Config->m_Display));
246  area.m_Config = config;
247 
248  p_areas->push_back(area);
249 
250  {
251  TModelUnit top = 0;
252  {
253  TModelUnit left = 0;
254  x_Local2World(left, top);
255  }
257  IRender& gl = GetGl();
258 
259  TModelRange vis_r = m_Context->IntersectVisible(this);
260  int view_width = m_Context->GetViewWidth();
261  if (view_width == 0)
262  view_width = m_Context->SeqToScreen(vis_r.GetLength());
263  auto right = view_width;
264  right -= (gl.TextWidth(&font, label.c_str()) + 4);
265 
266  CHTMLActiveArea label_area;
267 
269  label_area.m_Bounds.SetTop(top);
270  label_area.m_Bounds.SetBottom(top + gl.TextHeight(&font) + 2);
271  label_area.m_Bounds.SetLeft(-1);
272  label_area.m_Bounds.SetRight(right);
277  label_area.m_Color = kPileUpColor + ",1"; // +alpha
278  label_area.m_ID = label;
279 
280  // required, but nonsense fields
281  label_area.m_PositiveStrand = true;
282  p_areas->emplace_back(label_area);
283  }
284 
285  } else {
286 
287  TModelUnit left = 0;
288  TModelUnit top = 0;
289  x_Local2World(left, top);
290  // top -= 3.0;
291 
292  vector<int> rows = x_GetShowList();
293  vector<int>::reverse_iterator iter = rows.rbegin();
294  for (; iter != rows.rend(); ++iter) {
295  CHTMLActiveArea area;
296  area.m_Bounds.SetTop(top);
297  top += kSmearRowHeight;
298  area.m_Bounds.SetBottom(top);
299  area.m_Bounds.SetLeft(-1);
300  area.m_Bounds.SetRight(0);
306 
307  area.m_ID = CAlnStatConfig::GetStatLabel(*iter);
308  if ( !m_Config->ShowCount() && *iter != CAlnStatConfig::eStat_Total) {
309  area.m_ID += "(%)";
310  }
311 
312  // required, but nonsense fields
313  area.m_PositiveStrand = true;
314  area.m_SeqRange.SetFrom(0);
315  area.m_SeqRange.SetTo(0);
316 
317  p_areas->push_back(area);
318  }
319  }
320 }
321 
322 
324 {
325  return true;
326 }
327 
328 
330 {
331  if (m_Config->IsBarGraph()) {
332  x_DrawBarGraph();
333  } else {
335  }
336 }
337 
338 
340 {
343  if (m_Config->IsBarGraph()) {
345  } else {
346  int row = (int)(x_GetShowList().size());
348  }
349 }
350 
351 static
352 double s_log_value(double value, CHistParams::EScale scale)
353 {
354 
355  switch (scale) {
356  case CHistParams::eLog10:
357  value = log10(value);
358  break;
359  case CHistParams::eLog2:
360  value = log(value)/log(2.);
361  break;
362  case CHistParams::eLoge:
363  value = log(value);
364  break;
365  default:
366  break;
367  }
368  return value;
369 
370 }
371 
372 //#define ALNSTAT_USE_LOG_SCALE
374 {
375  IRender& gl = GetGl();
376 
377  TModelUnit bottom = GetBottom();
378  TModelUnit top = GetTop();
379  TModelUnit left = GetLeft();
380  TModelUnit right = GetRight();
382  double max_t = x_GetMaxTotal();
383  double max_value = max_t;
384  bool show_count = m_Config->ShowCount();
385 
386  TModelUnit h_factor = bar_h;
387  if (show_count) {
388  max_t = max(1., s_log_value(max_t, m_GraphParams->m_Scale));
389  //max_t = ceil(max_t);
390  h_factor /= max_t;
391  }
392 
393  vector<int> show_list = x_GetShowList();
395 
396  // When the zoom level is greater than 1.0, the statistics data are computed
397  // based on screen pixel (one set of data per pixel), not the nucleotide base.
398  // So we need to use the correct offset (original scale when data are calculated),
399  // not the the current zoom scale (m_Context->GetScale()).
400  // When zoom level is less than or equal to 1.0, the statistics data are
401  // computed based on nucleotide base (on set of data per nucleotide base).
402  // So in that case, the offset will always be 1.
403  TModelUnit off = m_ZoomScale > 1.0 ? m_ZoomScale : 1.0;
404  ITERATE (TStatVec, iter, m_StatVec) {
405  x += off;
406  double total = iter->m_Data[CAlnStatConfig::eStat_Total];
407  if (total == 0) continue;
408  double total_factor = 1.0;
409  double log_total = 1.;
411  if (!show_count)
412  total_factor /= total;
413  } else {
414  if (show_count) {
415  if (total <=1) {
416  log_total = 0.5;
417  } else {
418  log_total = max(1., s_log_value(total, m_GraphParams->m_Scale));
419  }
420  }
421  total_factor /= total;
422  total_factor *= log_total;
423  }
424  TModelUnit y = bottom;
425  double curr_total= 0;
426  // in the statistics data
427  // total != (matches + mismatches + intron + gaps)
428  // but total = (matches + errors)
429  // where errors is max of mismatches, intron or gaps
430  // however, we want to preserve the rendering order as per show_list
431  // i.e. matches, mismatches, gaps, introns
432  // So we render in that order until we reach max values for the total rows
433  ITERATE (vector<int>, v_iter, show_list) {
434  double val = iter->m_Data[*v_iter];
435  if (val == 0) continue;
436  if (curr_total + val > total)
437  val = total - curr_total;
438  curr_total += val;
439  val *= total_factor;
440  TModelUnit height = val * h_factor;
441  gl.ColorC(m_Config->m_Colors[*v_iter]);
442  m_Context->DrawQuad(x - off, y, x, y - height);
443  y -= height;
444  if (curr_total >= total)
445  break;
446  }
447  //if (m_Context->WillSeqLetterFit()) {
448  // // show border
449  // gl.Color4f(0.2f, 0.2f, 0.2f, 0.8f);
450  // m_Context->DrawLine(x - 1.0, bottom, x - 1.0, y);
451  // m_Context->DrawLine(x, bottom, x, y);
452  //}
453  }
454 
455  // draw background scales.
456  // we do this only when we show the count for each individual statistics,
457  // not when we show the percentage since it will be 100% always.
458  if (show_count) {
459  double tick_dist = 30.0;
460  int tick_n = (int)(floor(bar_h / tick_dist));
461  tick_dist = bar_h / tick_n;
462 
463  CGlAttrGuard AttrGuard(GL_LINE_BIT);
464  gl.Disable(GL_LINE_SMOOTH);
465  gl.LineWidth(1.0f);
467 
468  //CRgbaColor line_color(0.7f, 0.7f, 0.7f, 0.4f);
469  //gl.ColorC(line_color);
470  m_Context->DrawLine(left, bottom, right, bottom);
471  if (max_t == 0) return;
472 
473  for (int i = 0; i < tick_n; ++i) {
474  m_Context->DrawLine(left, bottom - tick_dist * (i + 1), right, bottom - tick_dist * (i + 1));
475  }
476 
477  int ruler_n = 6;
478  TModelUnit dist_x = GetWidth() / ruler_n;
479  TModelUnit min_dist = m_Context->ScreenToSeq(400.0);
480  if (dist_x < min_dist) {
481  dist_x = min_dist;
482  ruler_n = (int)(GetWidth() / dist_x);
483  }
484  TModelUnit label_off = m_Context->ScreenToSeq(2.0);
486  TModelUnit x = left + dist_x * 0.1;
487  string max_str = NStr::NumericToString(max_value);
488  for (; x < right; x += dist_x) {
490  m_Context->DrawLine(x, top, x, bottom);
492  m_Context->TextOut(&font, max_str.c_str(), x + label_off, top + gl.TextHeight(&font) + 1, false);
493  }
494  }
495 
496  if (!m_CgiMode) {
497  string label = kPileUpLabel;
498  if (show_count)
500 
501  auto pane = m_Context->GetGlPane();
503  auto w = gl.TextWidth(&font, label.c_str());
504  auto h = gl.TextHeight(&font);
505  const TModelRect& vr = pane->GetVisibleRect();
506  auto one_px = m_Context->ScreenToSeq(1);
507  auto x = vr.Right() - ((w + 16) * one_px);
508  auto y = vr.Top() + h + 2;
510  gl.ColorC(c);
511  m_Context->TextOut(&font, label.c_str(), x, y, false);
512  }
513  /* if we need a boundary
514  {
515  const auto& pane = m_Context->GetGlPane();
516  TModelUnit y = 0, l = 0;
517  x_Local2World(l, y);
518  {
519  CGlPaneGuard GUARD(*pane, CGlPane::eOrtho);
520  y = pane->UnProjectY(y);
521  }
522  CGlPaneGuard GUARD(*pane, CGlPane::ePixels);
523  gl.ColorC(m_GraphParams->m_RulerColor);
524  const auto& vp = pane->GetViewport();
525  m_Context->DrawLine(vp.Left(), y, vp.Right(), y);
526  }
527  */
528 
529 }
530 
531 
533 {
534  IRender& gl = GetGl();
535 
536  TModelUnit bottom = GetBottom();
537  TModelUnit top = GetTop();
538  TModelUnit left = GetLeft();
539  TModelUnit right = GetRight();
540 
541  // draw boundary lines
542  {
543  CGlAttrGuard AttrGuard(GL_LINE_BIT);
544  gl.Disable(GL_LINE_SMOOTH);
545  gl.LineWidth(1.0f);
546  gl.Color4f(0.6f, 0.6f, 0.8f, 0.5f);
547  m_Context->DrawLine(left, bottom, right, bottom);
548  m_Context->DrawLine(left, top, right, top);
549  }
550 
551  int max_t = x_GetMaxTotal();
552  if (max_t == 0) return;
553 
554  TModelUnit d_factor = 1.0;
555  bool show_count = m_Config->ShowCount();
556  if (show_count) {
557  d_factor /= max_t;
558  }
559 
561 
562  vector<int> show_list = x_GetShowList();
564 
565  // See comment in CAlnStatGlyph::x_DrawBarGraph() on why offsets are different
566  // for different zoom scales.
567  TModelUnit off = m_ZoomScale > 1.0 ? m_ZoomScale : 1.0;
568 
569  ITERATE (TStatVec, iter, m_StatVec) {
570  x += off;
571  int total = iter->m_Data[CAlnStatConfig::eStat_Total];
572  if (total == 0) continue;
573 
574  double total_factor = 1.0;
575  if ( !show_count ) {
576  total_factor /= total;
577  }
578  TModelUnit y = bottom;
579  ITERATE (vector<int>, v_iter, show_list) {
580  y -= kSmearRowHeight;
581  if (iter->m_Data[*v_iter] == 0) continue;
582 
583  TModelUnit num = iter->m_Data[*v_iter];
584  TModelUnit c_factor = num;
585  if (*v_iter == CAlnStatConfig::eStat_Total) {
586  c_factor /= max_t;
587  } else {
588  c_factor *= total_factor * d_factor;
589  num *= total_factor;
590  if ( !show_count ) num *= 100;
591  }
592  CRgbaColor color_max = m_Config->m_Colors[*v_iter];
593  CRgbaColor color_min = color_max;
594  color_min.SetAlpha(0.3f);
595  CRgbaColor color(CRgbaColor::Interpolate(color_max, color_min, c_factor));
596  gl.ColorC(color);
597  m_Context->DrawQuad(x - off, y + kSmearRowHeight, x, y);
598 
599  // show count
600  if (m_Context->GetScale() <= 1.0f / 16.0) {
601  string out_text;
602  if (num > 1000.0) {
603  int num_digit = 0;
604  while (num > 10.0) {
605  ++num_digit;
606  num *= 0.1;
607  }
608  out_text = NStr::IntToString((int)num) + "e" + NStr::IntToString(num_digit);
609  } else if (num < 1.0) {
610  out_text = "<1";
611  } else {
612  out_text = NStr::IntToString((int)num);
613  }
614  color = color.ContrastingColor();
615  gl.ColorC(color);
616  m_Context->TextOut(&font, out_text.c_str(),
617  x - 0.5, y + (kSmearRowHeight + gl.TextHeight(&font)) * 0.5, true);
618 
619  }
620  }
621  }
622 
623 
624  if (m_Config->ShowLabel()) {
625  // draw labels (left-most)
626  vector<string> labels;
627  TModelUnit max_label_w = 0.0;
628  ITERATE (vector<int>, v_iter, show_list) {
629  string label = CAlnStatConfig::GetStatLabel(*v_iter);
630  if ( !show_count && *v_iter != CAlnStatConfig::eStat_Total) {
631  label += "(%)";
632  }
633  labels.push_back(label);
634  max_label_w = max(max_label_w, gl.TextWidth(&font, label.c_str()));
635  }
636 
637  x = left;
638  TModelUnit y = bottom;
639 
640  gl.Color4f(0.8f, 1.0f, 0.8f, 1.0f);
641  max_label_w += 4.0;
642  max_label_w = m_Context->ScreenToSeq(max_label_w);
643  m_Context->DrawQuad(x, y, x + max_label_w, top);
644 
645  gl.Color3f(0.0f, 0.0f, 0.0f);
646  ITERATE (vector<string>, l_iter, labels) {
647  const string& label = *l_iter;
648  TModelUnit label_w = gl.TextWidth(&font, label.c_str()) + 2.0;
649  label_w = m_Context->ScreenToSeq(label_w);
650  m_Context->TextOut(&font, label.c_str(),
651  x + max_label_w - label_w, y - (kSmearRowHeight - gl.TextHeight(&font)) * 0.5, false);
652  y -= kSmearRowHeight;
653  }
654  }
655 }
656 
657 
659 {
660  int max_t = 0;
661  ITERATE (TStatVec, iter, m_StatVec) {
662  max_t = max(max_t, iter->m_Data[CAlnStatConfig::eStat_Total]);
663  }
664  return max_t;
665 }
666 
667 
668 vector<int> CAlnStatGlyph::x_GetShowList() const
669 {
670  vector<int> show_list;
671  if ( !m_Config->IsBarGraph() && m_Config->ShowTotal() ) {
672  show_list.push_back(CAlnStatConfig::eStat_Total);
673  }
674 
675  if (m_Config->ShowAGTC()) {
676  show_list.push_back(CAlnStatConfig::eStat_A);
677  show_list.push_back(CAlnStatConfig::eStat_T);
678  show_list.push_back(CAlnStatConfig::eStat_G);
679  show_list.push_back(CAlnStatConfig::eStat_C);
680  } else {
681  show_list.push_back(CAlnStatConfig::eStat_Match);
682  show_list.push_back(CAlnStatConfig::eStat_Mismatch);
684  show_list.push_back(CAlnStatConfig::eStat_Ambig);
685  }
686  show_list.push_back(CAlnStatConfig::eStat_Gap);
687  if (m_ShowIntrons) {
688  show_list.push_back(CAlnStatConfig::eStat_Intron);
689  }
690 
691  return show_list;
692 }
693 
694 CRef<CChoice> CAlnStatGlyph::CreateDisplayOptions(const string& option_name, int display_flag)
695 {
696  auto choice = CTrackConfigUtils::CreateChoice
697  (option_name, "Pileup Display", NStr::IntToString(display_flag),
698  "Alignment Pileup Display");
699 
700  /// For bam/csra track, show alignment statistics always.
701  choice->SetValues()
703  ("15",
704  "Match/Mismatch graph (count)",
705  "Show matches, mismatches, and gaps count as bar graph",
706  ""));
707  choice->SetValues()
709  ("13",
710  "Match/Mismatch graph (percentage)",
711  "Show matches, mismatches, and gaps percentage as bar graph",
712  ""));
713  choice->SetValues()
715  ("11",
716  "ATGC graph (count)",
717  "Show A, T, G, C, and gaps count as bar graph",
718  ""));
719  choice->SetValues()
721  ("9",
722  "ATGC graph (percentage)",
723  "Show A, T, G, C, and gaps percentage as bar graph",
724  ""));
725  choice->SetValues()
727  ("14",
728  "Match/Mismatch table (count)",
729  "Show matches, mismatches, and gaps count as table",
730  ""));
731  choice->SetValues()
733  ("12",
734  "Match/Mismatch table (percentage)",
735  "Show matches, mismatches, and gaps percentage as table",
736  ""));
737  choice->SetValues()
739  ("10",
740  "ATGC table (count)",
741  "Show A, T, G, C, and gaps count as table",
742  ""));
743  choice->SetValues()
745  ("8",
746  "ATGC table (percentage)",
747  "Show A, T, G, C, and gaps percentage as table",
748  ""));
749  return choice;
750 
751 }
USING_SCOPE(objects)
static const string kScale
static const string kPileUpLabel
static const string kPileUpColor
static void s_GetLabel(CHistParams::EScale scale, string &label)
static int kSmearRowHeight
static double s_log_value(double value, CHistParams::EScale scale)
static string GetStatLabel(int stat)
@ fBarGraph
otherwise, shown as density table
@ fShowCount
otherwise, shown percentage
@ fShowMismatch
otherwise, shown individual count
void SetDisplayFlag(FDisplay bit, bool f)
int m_StatZoomLevel
at what zoom level to turn on statistics
array< CRgbaColor, eStat_Total+1 > m_Colors
color settings
@ eStat_Intron
intron (for mRNA-to-genome alignments)
@ eStat_Ambig
ambiguous consensus (for MSA pileup)
@ eStat_Mismatch
mismatches (A+G+T+C - matches)
@ eStat_Total
total alignment count at this base (A+G+T+C+Gap)
bool IsBarGraph() const
CAlnStatConfig inline method implementation.
virtual bool OnLeftDblClick(const TModelPoint &p)
virtual void GetTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
virtual void x_Draw() const
The default renderer for this layout object.
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.
virtual bool NeedTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Check if need to show tooltip.
TModelUnit m_ZoomScale
zoom scale when this statistics are computed.
void x_DrawDensityTable() const
CAlnStatGlyph(TSeqPos start, TModelUnit sacle)
CAlnStatGlyph.
vector< SStatStruct > TStatVec
CRef< CAlnStatConfig > m_Config
virtual bool IsClickable() const
Query if this glyph is clickable.
vector< int > x_GetShowList() const
CRef< CHistParams > m_GraphParams
IGlyphDialogHost * m_DlgHost
static CRef< objects::CChoice > CreateDisplayOptions(const string &option_name, int display_flag)
CGlAttrGuard - guard class for restoring OpenGL attributes.
Definition: glutils.hpp:130
string m_Descr
description that can be used as label or tooltip
@ fNoTooltip
do not request and show tooltip
@ fZoomOnDblClick
Zoom on Double click.
@ fNoPin
tooltip is not pinnable
@ 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
string m_Color
optional area color (used for legen items)
string m_ID
area identifier
int m_Flags
area flags, will need to replace m_Type
CRef< objects::CTrackConfig > m_Config
Area specific configuration settings.
bool m_PositiveStrand
the default is true
static CRef< objects::CChoice > CreateScaleOptions(const string &option_name, CHistParams::EScale option_value)
CRgbaColor m_LabelColor
CRgbaColor m_RulerColor
EScale m_Scale
requested scale
TModelUnit m_Height
static const string & ScaleValueToName(CHistParams::EScale scale)
CRef –.
Definition: ncbiobj.hpp:618
void TextOut(const CGlTextureFont *font, const char *text, TModelUnit x, TModelUnit y, bool center, bool adjust_flip=true) const
TModelUnit GetVisibleFrom() const
CGlPane * GetGlPane()
inline method implementations
const TModelRange & GetVisibleRange() const
TModelRange IntersectVisible(const CSeqGlyph *obj) const
void DrawLine(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2) const
void DrawQuad(const TModelRect &rc, bool border=false) const
const TModelUnit & GetScale() const
TModelUnit SeqToScreen(const TModelUnit &size) const
convert from sequence positions to screen pixels
TModelUnit ScreenToSeq(const TModelUnit &size) const
convert from screen pixels to sequence positions
TSeqPos GetViewWidth() const
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
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 x_OnLayoutChanged()
update the layout.
Definition: seq_glyph.cpp:353
virtual void SetHeight(TModelUnit h)
Definition: seq_glyph.hpp:650
virtual TModelUnit GetRight() const
Definition: seq_glyph.hpp:603
virtual void SetWidth(TModelUnit w)
Definition: seq_glyph.hpp:646
virtual void SetLeft(TModelUnit l)
Definition: seq_glyph.hpp:654
virtual TModelUnit GetTop() const
Definition: seq_glyph.hpp:599
void x_Local2World(TModelPoint &p) const
Transform the coordiantes from local coord. to world coord.
Definition: seq_glyph.hpp:726
virtual TModelUnit GetWidth() const
Definition: seq_glyph.hpp:591
virtual TModelUnit GetLeft() const
Definition: seq_glyph.hpp:595
vector< CHTMLActiveArea > TAreaVector
Definition: seq_glyph.hpp:84
virtual TModelUnit GetBottom() const
Definition: seq_glyph.hpp:607
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::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
void SetDisplay(bool is_graph)
void SetContent(bool is_agtc)
void SetValueType(bool is_count)
virtual void PostDialogShow()=0
Post-processing after showing a dialog.
virtual void PreDialogShow()=0
Prepare for showing a dialog.
primitive interface to arrange tabular data in the tooltips
Definition: tooltip.hpp:55
struct config config
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 NULL
Definition: ncbistd.hpp:225
GLdouble TModelUnit
Definition: gltypes.hpp:48
void SetRight(T right)
Definition: glrect.hpp:114
T X() const
Definition: glpoint.hpp:59
void SetBottom(T bottom)
Definition: glrect.hpp:113
T Top() const
Definition: glrect.hpp:84
void Color3f(GLfloat r, GLfloat g, GLfloat b)
Definition: irender.hpp:95
IRender & GetGl()
convenience function for getting current render manager
T Right() const
Definition: glrect.hpp:83
virtual TModelUnit TextHeight(const CGlTextureFont *font) const =0
virtual TModelUnit TextWidth(const CGlTextureFont *font, const char *text) const =0
void Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
Definition: irender.hpp:97
void SetLeft(T left)
Definition: glrect.hpp:112
virtual void Disable(GLenum glstate)=0
glDisable()
virtual void LineWidth(GLfloat w)=0
Set line width for drawing: glLineWidth()
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
void SetTop(T top)
Definition: glrect.hpp:115
virtual void AddRow(const string &sContents="", unsigned colspan=2)=0
add a row with a cell, spanning across all columns
void SetAlpha(float r)
Definition: rgba_color.cpp:287
static CRgbaColor Interpolate(const CRgbaColor &color1, const CRgbaColor &color2, float alpha)
Interpolate two colors.
Definition: rgba_color.cpp:444
virtual void AddSectionRow(const string &sContents)=0
add a section row
uint64_t Uint8
8-byte (64-bit) unsigned integer
Definition: ncbitype.h:105
position_type GetLength(void) const
Definition: range.hpp:158
#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 Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
Definition: ncbistr.hpp:5159
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
Definition: ncbistr.hpp:5109
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
@ fWithCommas
Use commas as thousands separator.
Definition: ncbistr.hpp:254
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
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
n background color
char * buf
int i
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
T max(T x_, T y_)
T log10(T x_)
#define row(bind, expected)
Definition: string_bind.c:73
int m_Data[CAlnStatConfig::eStat_Total+1]
Modified on Mon May 20 05:04:43 2024 by modify_doxy.py rev. 669887