q_collapsed_metric.h
Go to the documentation of this file.
1 
13 #pragma once
20 
21 namespace illumina { namespace interop { namespace model { namespace metrics {
22 
26  {
27  public:
30  q_collapsed_header() : m_record_size(0) {}
35  q_collapsed_header(const qscore_bin_vector_type& bins) : q_score_header(bins), m_record_size(0){}
41  {
42  return q_collapsed_header();
43  }
46  void clear()
47  {
48  m_record_size=0;
50  }
51  private:
52  ::uint32_t m_record_size; // Hack to support this format
53  private:
54  template<class MetricType, int Version>
55  friend struct io::generic_layout;
56  };
60  {
61  public:
62  enum{
67  };
69  typedef ::uint64_t ulong_t;
72  public:
76  metric_base::base_cycle_metric(0,0,0),
77  m_q20(0),
78  m_q30(0),
79  m_total(0),
80  m_median_qscore(0),
81  m_cumulative_q20(0),
82  m_cumulative_q30(0),
83  m_cumulative_total(0) {}
86  q_collapsed_metric(const header_type&) :
87  metric_base::base_cycle_metric(0,0,0),
88  m_q20(0),
89  m_q30(0),
90  m_total(0),
91  m_median_qscore(0),
92  m_cumulative_q20(0),
93  m_cumulative_q30(0),
94  m_cumulative_total(0) {}
106  const uint_t tile,
107  const uint_t cycle,
108  const uint_t q20,
109  const uint_t q30,
110  const uint_t total,
111  const uint_t median_qscore) :
112  metric_base::base_cycle_metric(lane, tile, cycle),
113  m_q20(q20),
114  m_q30(q30),
115  m_total(total),
116  m_median_qscore(median_qscore),
117  m_cumulative_q20(0),
118  m_cumulative_q30(0),
119  m_cumulative_total(0)
120 
121  {
122  }
123 
124  public:
138  uint_t q20()const
139  {
140  return m_q20;
141  }
146  uint_t q30()const
147  {
148  return m_q30;
149  }
154  uint_t total()const
155  {
156  return m_total;
157  }
163  {
164  return m_median_qscore;
165  }
170  float median_qscore_flt()const
171  {
172  if (m_median_qscore == std::numeric_limits<uint_t>::max() || m_median_qscore == 0)
173  return std::numeric_limits<float>::quiet_NaN();
174  return static_cast<float>(m_median_qscore);
175  }
180  ulong_t cumulative_q20()const
181  {
182  return m_cumulative_q20;
183  }
188  ulong_t cumulative_q30()const
189  {
190  return m_cumulative_q30;
191  }
196  ulong_t cumulative_total()const
197  {
198  return m_cumulative_total;
199  }
204  float percent_over_q20()const
205  {
206  return 100.0f * m_q20 / m_total;
207  }
212  float percent_over_q30()const
213  {
214  return 100.0f * m_q30 / m_total;
215  }
221  {
222  return 100.0f * m_cumulative_q20 / m_cumulative_total;
223  }
229  {
230  return 100.0f * m_cumulative_q30 / m_cumulative_total;
231  }
239  void accumulate(const q_collapsed_metric& metric)
240  {
241  m_cumulative_q20 = m_q20;
242  m_cumulative_q30 = m_q30;
243  m_cumulative_total = m_total;
244  if(&metric != this) {
245  m_cumulative_q20 += metric.m_cumulative_q20;
246  m_cumulative_q30 += metric.m_cumulative_q30;
247  m_cumulative_total += metric.m_cumulative_total;
248  }
249  }
250 
251  public:
256  static const char* prefix(){return "Q";}
261  static const char* suffix(){return "2030";}
262 
263  private:
264  uint_t m_q20;
265  uint_t m_q30;
266  uint_t m_total;
267  uint_t m_median_qscore;
268  ulong_t m_cumulative_q20;
269  ulong_t m_cumulative_q30;
270  ulong_t m_cumulative_total;
271 
272  private:
273  template<class MetricType, int Version>
274  friend struct io::generic_layout;
275  };
276 
277 
278 }}}}
279 
void clear()
Definition: q_collapsed_metric.h:46
::uint32_t uint_t
Definition: base_metric.h:144
q_collapsed_header(const qscore_bin_vector_type &bins)
Definition: q_collapsed_metric.h:35
uint_t median_qscore() const
Definition: q_collapsed_metric.h:162
q_collapsed_metric(const header_type &)
Definition: q_collapsed_metric.h:86
Definition: enum_description.h:15
void accumulate(const q_collapsed_metric &metric)
Definition: q_collapsed_metric.h:239
uint_t tile() const
Definition: base_metric.h:284
static q_collapsed_header default_header()
Definition: q_collapsed_metric.h:40
q_collapsed_header()
Definition: q_collapsed_metric.h:30
static const char * suffix()
Definition: q_collapsed_metric.h:261
float percent_over_q20() const
Definition: q_collapsed_metric.h:204
::uint64_t ulong_t
Definition: q_collapsed_metric.h:69
float percent_over_q30() const
Definition: q_collapsed_metric.h:212
uint_t total() const
Definition: q_collapsed_metric.h:154
float cumulative_percent_over_q20() const
Definition: q_collapsed_metric.h:220
qscore_bin_vector_type & bins()
Definition: q_metric.h:162
uint_t q20() const
Definition: q_collapsed_metric.h:138
ulong_t cumulative_total() const
Definition: q_collapsed_metric.h:196
base_cycle_metric(const uint_t lane=0, const uint_t tile=0, const uint_t cycle=0)
Definition: base_cycle_metric.h:90
uint_t cycle() const
Definition: base_cycle_metric.h:131
float median_qscore_flt() const
Definition: q_collapsed_metric.h:170
q_collapsed_metric()
Definition: q_collapsed_metric.h:75
::uint32_t uint_t
Definition: base_metric.h:77
ulong_t cumulative_q30() const
Definition: q_collapsed_metric.h:188
Definition: generic_layout.h:24
uint_t lane() const
Definition: base_metric.h:269
float cumulative_percent_over_q30() const
Definition: q_collapsed_metric.h:228
ulong_t cumulative_q20() const
Definition: q_collapsed_metric.h:180
void clear()
Definition: q_metric.h:223
std::vector< q_score_bin > qscore_bin_vector_type
Definition: q_metric.h:114
q_collapsed_metric(const uint_t lane, const uint_t tile, const uint_t cycle, const uint_t q20, const uint_t q30, const uint_t total, const uint_t median_qscore)
Definition: q_collapsed_metric.h:105
static const char * prefix()
Definition: q_collapsed_metric.h:256
uint_t q30() const
Definition: q_collapsed_metric.h:146
q_collapsed_header header_type
Definition: q_collapsed_metric.h:71