index_lane_summary.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <algorithm>
11 #include "interop/util/cstdint.h"
12 #include "interop/util/exception.h"
15 
16 namespace illumina { namespace interop { namespace model { namespace summary {
17 
21  {
22  public:
24  typedef std::vector<index_count_summary> count_summary_vector_t;
25  public:
27  typedef count_summary_vector_t::reference reference;
29  typedef count_summary_vector_t::const_reference const_reference;
31  typedef count_summary_vector_t::iterator iterator;
33  typedef count_summary_vector_t::const_iterator const_iterator;
35  typedef count_summary_vector_t::size_type size_type;
37  typedef ::uint64_t read_count_t;
38 
39  public:
49  index_lane_summary(const read_count_t total_reads=0,
50  const read_count_t total_pf_reads=0,
51  const float total_fraction_mapped_reads=0,
52  const float mapped_reads_cv=0,
53  const float min_mapped_reads=0,
54  const float max_mapped_reads=0) : m_total_reads(total_reads),
55  m_total_pf_reads(total_pf_reads),
56  m_total_fraction_mapped_reads(total_fraction_mapped_reads),
57  m_mapped_reads_cv(mapped_reads_cv),
58  m_min_mapped_reads(min_mapped_reads),
59  m_max_mapped_reads(max_mapped_reads)
60  {
61  }
62 
63  public:
68  void resize(const size_type n)
69  {
70  m_count_summaries.resize(n);
71  }
76  void reserve(const size_type n)
77  {
78  m_count_summaries.reserve(n);
79  }
85  void push_back(const index_count_summary& count_summary)
86  {
87  m_count_summaries.push_back(count_summary);
88  }
93  size_type size()const
94  {
95  return m_count_summaries.size();
96  }
101  iterator begin()
102  {
103  return m_count_summaries.begin();
104  }
109  iterator end()
110  {
111  return m_count_summaries.end();
112  }
117  const_iterator begin()const
118  {
119  return m_count_summaries.begin();
120  }
125  const_iterator end()const
126  {
127  return m_count_summaries.end();
128  }
129 
130  public:
147  {
148  INTEROP_BOUNDS_CHECK(n, m_count_summaries.size(), "Index sequence index exceeds index sequence count");
149  return m_count_summaries[n];
150  }
159  {
160  INTEROP_BOUNDS_CHECK(n, m_count_summaries.size(), "Index sequence index exceeds index sequence count");
161  return m_count_summaries[n];
162  }
170  {
171  INTEROP_BOUNDS_CHECK(n, m_count_summaries.size(), "Index sequence index exceeds index sequence count");
172  return m_count_summaries[n];
173  }
180  const_reference at(const size_type n)const INTEROP_THROW_SPEC(( model::index_out_of_bounds_exception ))
181  {
182  INTEROP_BOUNDS_CHECK(n, m_count_summaries.size(), "Index sequence index exceeds index sequence count");
183  return m_count_summaries[n];
184  }
189  read_count_t total_reads()const
190  {
191  return m_total_reads;
192  }
197  read_count_t total_pf_reads()const
198  {
199  return m_total_pf_reads;
200  }
208  {
209  return m_total_fraction_mapped_reads;
210  }
217  float mapped_reads_cv()const
218  {
219  return m_mapped_reads_cv;
220  }
225  float min_mapped_reads()const
226  {
227  return m_min_mapped_reads;
228  }
233  float max_mapped_reads()const
234  {
235  return m_max_mapped_reads;
236  }
239  public:
240 
243  void sort()
244  {
245  std::stable_sort(begin(), end());
246  }
256  void set(const ::uint64_t total_mapped_reads,
257  const read_count_t pf_cluster_count_total,
258  const read_count_t cluster_count_total,
259  const float min_fraction_mapped,
260  const float max_fraction_mapped,
261  const float cv_fraction_mapped)
262  {
263  m_total_reads = cluster_count_total;
264  m_total_pf_reads = pf_cluster_count_total;
265  m_total_fraction_mapped_reads = (pf_cluster_count_total == 0) ? 0 :
266  roundf(static_cast<float>(100.0*total_mapped_reads/pf_cluster_count_total)*10000)/10000;
267  m_mapped_reads_cv = roundf(cv_fraction_mapped*10000)/10000;
268  m_min_mapped_reads = (m_total_reads==0) ? 0 : roundf(min_fraction_mapped*10000)/10000;
269  m_max_mapped_reads = (m_total_reads==0) ? 0 : roundf(max_fraction_mapped*10000)/10000;
270  }
273  void clear()
274  {
275  m_count_summaries.clear();
276  m_total_reads = 0;
277  m_total_pf_reads = 0;
278  m_total_fraction_mapped_reads = 0;
279  m_mapped_reads_cv = 0;
280  m_min_mapped_reads = 0;
281  m_max_mapped_reads = 0;
282  }
283 
284  private:
285  count_summary_vector_t m_count_summaries;
286 
287  private:
288  read_count_t m_total_reads;
289  read_count_t m_total_pf_reads;
290  float m_total_fraction_mapped_reads;
291  float m_mapped_reads_cv;
292  float m_min_mapped_reads;
293  float m_max_mapped_reads;
294 
295  template<class MetricType, int Version>
296  friend struct io::generic_layout;
297  };
298 
299 }}}}
300 
read_count_t total_reads() const
Definition: index_lane_summary.h:189
Definition: enum_description.h:15
count_summary_vector_t::size_type size_type
Definition: index_lane_summary.h:35
#define INTEROP_THROW_SPEC(SPEC)
Definition: exception_specification.h:15
index_count_summary & at(const size_t n) INTEROP_THROW_SPEC((model
Definition: index_lane_summary.h:169
const_iterator end() const
Definition: index_lane_summary.h:125
iterator end()
Definition: index_lane_summary.h:109
size_type size() const
Definition: index_lane_summary.h:93
index_lane_summary(const read_count_t total_reads=0, const read_count_t total_pf_reads=0, const float total_fraction_mapped_reads=0, const float mapped_reads_cv=0, const float min_mapped_reads=0, const float max_mapped_reads=0)
Definition: index_lane_summary.h:49
iterator begin()
Definition: index_lane_summary.h:101
void clear()
Definition: index_lane_summary.h:273
def summary(run_metrics, level='Total', columns=None, dtype='f4', ignore_missing_columns=True, extra)
Definition: core.py:217
Definition: generic_layout.h:24
void resize(const size_type n)
Definition: index_lane_summary.h:68
const index_count_summary & operator[](const size_t n) const INTEROP_THROW_SPEC((model
Definition: index_lane_summary.h:158
void reserve(const size_type n)
Definition: index_lane_summary.h:76
void push_back(const index_count_summary &count_summary)
Definition: index_lane_summary.h:85
float total_fraction_mapped_reads() const
Definition: index_lane_summary.h:207
index_count_summary & operator[](const size_type n) INTEROP_THROW_SPEC((model
Definition: index_lane_summary.h:146
Definition: index_count_summary.h:17
count_summary_vector_t::const_reference const_reference
Definition: index_lane_summary.h:29
count_summary_vector_t::reference reference
Definition: index_lane_summary.h:27
read_count_t total_pf_reads() const
Definition: index_lane_summary.h:197
float max_mapped_reads() const
Definition: index_lane_summary.h:233
float mapped_reads_cv() const
Definition: index_lane_summary.h:217
#define INTEROP_BOUNDS_CHECK(VALUE, RANGE, MESSAGE)
Definition: exception.h:24
count_summary_vector_t::iterator iterator
Definition: index_lane_summary.h:31
void set(const ::uint64_t total_mapped_reads, const read_count_t pf_cluster_count_total, const read_count_t cluster_count_total, const float min_fraction_mapped, const float max_fraction_mapped, const float cv_fraction_mapped)
Definition: index_lane_summary.h:256
count_summary_vector_t::const_iterator const_iterator
Definition: index_lane_summary.h:33
void sort()
Definition: index_lane_summary.h:243
::uint64_t read_count_t
Definition: index_lane_summary.h:37
const_reference at(const size_type n) const INTEROP_THROW_SPEC((model
Definition: index_lane_summary.h:180
const_iterator begin() const
Definition: index_lane_summary.h:117
float min_mapped_reads() const
Definition: index_lane_summary.h:225
std::vector< index_count_summary > count_summary_vector_t
Definition: index_lane_summary.h:24