q_metrics_test.h
Go to the documentation of this file.
1 
9 #pragma once
13 #include "interop/util/length_of.h"
14 
15 
16 namespace illumina{ namespace interop { namespace unittest
17 {
18 
24  struct q_metric_v4 : metric_test<model::metrics::q_metric, 4>
25  {
31  {
32  metrics = metric_set_t(VERSION);
33 
34  typedef metric_t::uint_t uint_t;
36  const q_val hist1[] = {q_val(6,21208), q_val(19,8227), q_val(32,73051), q_val(37,2339486)};
37  const q_val hist2[] = {q_val(6,22647), q_val(19,9570), q_val(32,81839), q_val(37,2413227)};
38  const q_val hist3[] = {q_val(6,18878), q_val(19,8168), q_val(32,72634), q_val(37,2342292)};
39 
40  metrics.insert(metric_t(1, 1104, 1, to_vector(hist1)));
41  metrics.insert(metric_t(1, 1106, 1, to_vector(hist2)));
42  metrics.insert(metric_t(1, 1104, 2, to_vector(hist3)));
43  }
48  template<class Collection>
49  static void create_binary_data(Collection& buffer)
50  {
51  const signed char tmp[] =
52  {
53  4
54  ,-50,1,0,80,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
55  ,0,0,0,0,0,0,0,0,0,0,0,-40,82,0,0,0,0,0,0,0
56  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
57  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
58  ,0,0,0,35,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
59  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
60  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,91,29,1,0,0
61  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-98,-78,35,0,0
62  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
63  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
64  ,0,0,0,0,0,0,0,1,0,82,4,1,0,0,0,0,0,0,0,0
65  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,88,0
66  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
67  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
68  ,0,0,0,0,0,0,0,0,0,98,37,0,0,0,0,0,0,0,0,0
69  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
70  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
71  ,0,-81,63,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
72  ,0,-85,-46,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
73  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
74  ,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,80,4,2,0,0
75  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
76  ,0,0,0,-66,73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
77  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
78  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-24,31,0,0,0
79  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
80  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
81  ,0,0,0,0,0,0,0,-70,27,1,0,0,0,0,0,0,0,0,0,0
82  ,0,0,0,0,0,0,0,-108,-67,35,0,0,0,0,0,0,0,0,0,0
83  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
84  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
85  };
86  buffer.assign(tmp, tmp+util::length_of(tmp));
87  }
92  {
93  const size_t lane_count = 1;
94  const size_t surface_count = 2;
95  const size_t channel_count = 2;
96  const model::run::read_info reads[]={
97  model::run::read_info(1, 1, 3, false)
98  };
99  const float q30 = 98.803192138671875f;
100  summary.initialize(to_vector(reads), lane_count, surface_count, channel_count);
101  summary[0][0].tile_count(2);
102  summary[0][0].projected_yield_g(0.0098816361278295517);
103  summary[0][0].yield_g(0.0074112270958721638f);
104  summary[0][0].percent_gt_q30(q30);
105  summary[0][0][0].tile_count(2);
106  summary[0][0][0].projected_yield_g(0.0098816361278295517);
107  summary[0][0][0].yield_g(0.0074112270958721638f);
108  summary[0][0][0].percent_gt_q30(q30);
110  summary[0].summary().projected_yield_g(0.0098816361278295517);
111  summary[0].summary().yield_g(0.0074112270958721638f);
112  summary[0].summary().percent_gt_q30(q30);
113  summary.total_summary().percent_gt_q30(q30);
114  summary.total_summary().projected_yield_g(0.0098816361278295517);
115  summary.total_summary().yield_g(0.0074112270958721638f);
116  summary.nonindex_summary().percent_gt_q30(q30);
117  summary.nonindex_summary().projected_yield_g(0.0098816361278295517);
118  summary.nonindex_summary().yield_g(0.0074112270958721638f);
120  }
121  };
122 
128  struct q_metric_v5 : metric_test<model::metrics::q_metric, 5>
129  {
135  {
136  typedef header_t::qscore_bin_vector_type qscore_bin_vector_type;
137  typedef header_t::bin_t bin_t;
138  typedef bin_t::bin_type ushort_t;
139  typedef metric_t::uint_t uint_t;
140  const uint_t bin_count = 7;
141  ushort_t lower[] = {1, 10, 20, 25, 30, 35, 40};
142  ushort_t upper[] = {9, 19, 24, 29, 34, 39, 41};
143  ushort_t value[] = {1, 14, 22, 27, 33, 37, 40};
144  qscore_bin_vector_type headervec;
145  for(uint_t i=0;i<bin_count;i++)
146  headervec.push_back(bin_t(lower[i], upper[i], value[i]));
147  metrics = metric_set_t(header_t(headervec), VERSION);
148  typedef metric_t::uint_t uint_t;
149  typedef sparse_value<uint_t, 7> q_val;
150 
151  const q_val hist1[] = {q_val(1,45272), q_val(3,33369), q_val(4,1784241)};
152  const q_val hist2[] = {q_val(1,45229), q_val(3,34304), q_val(4,1792186)};
153  const q_val hist3[] = {q_val(1,49152), q_val(3,37440), q_val(4,1806479)};
154 
155  metrics.insert(metric_t(1, 1103, 1, to_vector(hist1)));
156  metrics.insert(metric_t(1, 1104, 1, to_vector(hist2)));
157  metrics.insert(metric_t(1, 1108, 1, to_vector(hist3)));
158  }
163  template<class Collection>
164  static void create_binary_data(Collection& buffer)
165  {
166  const signed char tmp[] =
167  {
168  5
169  ,-50,1,7,1,10,20,25,30,35,40,9,19,24,29,34,39,41,1,14,22
170  ,27,33,37,40,1,0,79,4,1,0,0,0,0,0,0,0,0,0,0,0
171  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
172  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
173  ,0,0,-40,-80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
174  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
175  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,-126,0,0,0,0
176  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-79,57
177  ,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
178  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
179  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
180  ,0,0,0,0,0,0,0,0,0,0,1,0,80,4,1,0,0,0,0,0
181  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
182  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
183  ,0,0,0,0,0,0,0,0,-83,-80,0,0,0,0,0,0,0,0,0,0
184  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
185  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
186  ,0,-122,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
187  ,0,0,0,0,-70,88,27,0,0,0,0,0,0,0,0,0,0,0,0,0
188  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
189  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
190  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,84,4
191  ,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
192  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
193  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-64,0,0,0,0
194  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
195  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
196  ,0,0,0,0,0,0,64,-110,0,0,0,0,0,0,0,0,0,0,0,0
197  ,0,0,0,0,0,0,0,0,0,0,-113,-112,27,0,0,0,0,0,0,0
198  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
199  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
200  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
201  ,0,0
202  };
203  buffer.assign(tmp, tmp+util::length_of(tmp));
204  }
209  {
210  const size_t lane_count = 1;
211  const size_t surface_count = 2;
212  const size_t channel_count = 2;
213  const model::run::read_info reads[]={
214  model::run::read_info(1, 1, 2, false)
215  };
216  summary.initialize(to_vector(reads), lane_count, surface_count, channel_count);
217  summary[0][0].tile_count(3);
218  summary[0][0].projected_yield_g(0.0056276721879839897f);
219  summary[0][0].yield_g(0.0056276721879839897f);
220  summary[0][0].percent_gt_q30(95.650672912597656f);
221  summary[0][0][0].tile_count(3);
222  summary[0][0][0].projected_yield_g(0.0056276721879839897f);
223  summary[0][0][0].yield_g(0.0056276721879839897f);
224  summary[0][0][0].percent_gt_q30(95.650672912597656f);
226  summary[0].summary().projected_yield_g(0.0056276721879839897f);
227  summary[0].summary().yield_g(0.0056276721879839897f);
228  summary[0].summary().percent_gt_q30(95.650672912597656f);
229  summary.total_summary().percent_gt_q30(95.650672912597656f);
230  summary.total_summary().projected_yield_g(0.0056276721879839897f);
231  summary.total_summary().yield_g(0.0056276721879839897);
232  summary.nonindex_summary().percent_gt_q30(95.650672912597656f);
233  summary.nonindex_summary().projected_yield_g(0.0056276721879839897f);
234  summary.nonindex_summary().yield_g(0.0056276721879839897);
236  }
237  };
238 
244  struct q_metric_v6 : metric_test<model::metrics::q_metric, 6>
245  {
251  {
252  typedef header_t::qscore_bin_vector_type qscore_bin_vector_type;
253  typedef header_t::bin_t bin_t;
254  typedef bin_t::bin_type ushort_t;
255  typedef metric_t::uint_t uint_t;
256  const uint_t bin_count = 7;
257 
258  const ushort_t lower[] = {2, 10, 20, 25, 30, 35, 40};
259  const ushort_t upper[] = {9, 19, 24, 29, 34, 39, 40};
260  const ushort_t value[] = {2, 14, 21, 27, 32, 36, 40};
261  qscore_bin_vector_type headervec;
262  for(uint_t i=0;i<bin_count;i++)
263  headervec.push_back(bin_t(lower[i], upper[i], value[i]));
264  metrics = metric_set_t(header_t(headervec), VERSION);
265  typedef metric_t::uint_t uint_t;
266 
267  const uint_t hist_all1[] = {0, 267962, 118703, 4284, 2796110, 0, 0};
268  const uint_t hist_all2[] = {0,241483, 44960, 1100, 2899568, 0 ,0};
269  const uint_t hist_all3[] = {0,212144, 53942, 427, 2920598, 0, 0};
270 
271  metrics.insert(metric_t(7, 1114, 1, to_vector(hist_all1)));
272  metrics.insert(metric_t(7, 1114, 2, to_vector(hist_all2)));
273  metrics.insert(metric_t(7, 1114, 3,to_vector(hist_all3)));
274  }
279  template<class Collection>
280  static void create_binary_data(Collection& buffer)
281  {
282  const signed char tmp[] =
283  {
284  6,34,1,7,2,10,20,25,30,35,40,9,19,24,29,34,39,40,2,14,21,27,32,36,40
285  ,7,0,90,4,1,0,0,0,0,0,-70,22,4,0,-81,-49,1,0,-68,16,0,0,78,-86,42,0,0,0,0,0,0,0,0,0
286  ,7,0,90,4,2,0,0,0,0,0,75,-81,3,0,-96,-81,0,0,76,4,0,0,112,62,44,0,0,0,0,0,0,0,0,0
287  ,7,0,90,4,3,0,0,0,0,0,-80,60,3,0,-74,-46,0,0,-85,1,0,0,-106,-112,44,0,0,0,0,0,0,0,0,0
288  };
289  buffer.assign(tmp, tmp+util::length_of(tmp));
290  }
295  {
296  const size_t lane_count = 1;
297  const size_t surface_count = 2;
298  const size_t channel_count = 2;
299  const model::run::read_info reads[]={
300  model::run::read_info(1, 1, 4, false)
301  };
302  summary.initialize(to_vector(reads), lane_count, surface_count, channel_count);
303  summary[0][0].lane(7);
304  summary[0][0].tile_count(1);
305  summary[0][0].projected_yield_g(0.0095612816512584686f);
306  summary[0][0].yield_g(0.009561280719935894f);
307  summary[0][0].percent_gt_q30(90.1163330078125f);
308  summary[0][0][0].tile_count(1);
309  summary[0][0][0].projected_yield_g(0.0095612816512584686f);
310  summary[0][0][0].yield_g(0.009561280719935894f);
311  summary[0][0][0].percent_gt_q30(90.1163330078125f);
313  summary[0].summary().projected_yield_g(0.0095612816512584686f);
314  summary[0].summary().yield_g(0.0095612816512584686f);
315  summary[0].summary().percent_gt_q30(90.1163330078125f);
316  summary.total_summary().percent_gt_q30(90.1163330078125f);
317  summary.total_summary().projected_yield_g(0.0095612816512584686f);
318  summary.total_summary().yield_g(0.0095612816512584686f);
319  summary.nonindex_summary().percent_gt_q30(90.1163330078125f);
320  summary.nonindex_summary().projected_yield_g(0.0095612816512584686f);
321  summary.nonindex_summary().yield_g(0.0095612816512584686f);
323  }
324  };
330  struct q_metric_v6_unbinned : metric_test<model::metrics::q_metric, 6>
331  {
337  {
338  metrics = metric_set_t(VERSION);
339  typedef metric_t::uint_t uint_t;
340 
341  std::vector<uint_t> hist_tmp(model::metrics::q_metric::MAX_Q_BINS, 0);
342 
343  metrics.insert(metric_t(1, 1110, 1, hist_tmp));
344  metrics.insert(metric_t(1, 1110, 2, hist_tmp));
345  metrics.insert(metric_t(1, 1110, 3, hist_tmp));
346  }
351  template<class Collection>
352  static void create_binary_data(Collection& buffer)
353  {
354  const signed char tmp[] =
355  {
356  6,-50,0,1,0,86,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
357  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
358  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
359  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
360  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
361  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
362  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
363  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,86,4,2
364  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
365  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
366  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
367  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
368  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
369  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
370  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
371  ,0,0,0,0,0,0,0,0,0,0,0,0,1,0,86,4,3,0,0,0,0,0,0,0,0,0
372  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
373  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
374  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
375  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
376  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
377  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
378  ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
379  ,0,0,0
380  };
381  buffer.assign(tmp, tmp+util::length_of(tmp));
382  }
383  };
384 
471  struct q_metric_requirements : metric_test<model::metrics::q_metric, 6, 'c'>
472  {
478  static void create_expected(metric_set_t& metrics, const model::run::info& run_info)
479  {
480  typedef model::metrics::q_metric::uint_t uint_t;
482  {
484  model::metrics::q_score_bin(10,19,14),
485  model::metrics::q_score_bin(20,24,21),
486  model::metrics::q_score_bin(25,29,27),
487  model::metrics::q_score_bin(30,34,32),
488  model::metrics::q_score_bin(35,39,36),
490  };
491  metrics = model::metrics::q_metric::header_type(util::to_vector(bins));
492 
493  const ::uint32_t kValue1 = static_cast< ::uint32_t>(1e7);
494  const ::uint32_t kValue2 = static_cast< ::uint32_t>(2e7);
495  // >= Q30 -> 50.0
496  const ::uint32_t hist[] = {kValue2, kValue2, kValue1, 0, kValue1, kValue2, kValue2};
497  // >= Q30 -> 42.85 // 3/7
498  const ::uint32_t hist_last_cycle_of_read[] = {kValue2, kValue2, kValue2, kValue1, kValue1, kValue1, kValue1};
499  for(size_t cycle=1;cycle<=run_info.total_cycles();++cycle)
500  {
501  if(run_info.is_last_cycle_of_read(cycle))
502  {
503  metrics.insert(
504  model::metrics::q_metric(1, 1101, static_cast<uint_t>(cycle), util::to_vector(hist_last_cycle_of_read)));
505  metrics.insert( model::metrics::q_metric(1, 1102, static_cast<uint_t>(cycle), util::to_vector(hist_last_cycle_of_read)));
506  }
507  else
508  {
509  metrics.insert( model::metrics::q_metric(1, 1101, static_cast<uint_t>(cycle), util::to_vector(hist)));
510  metrics.insert( model::metrics::q_metric(1, 1102, static_cast<uint_t>(cycle), util::to_vector(hist)));
511  }
512  }
513  }
519  {
520  const size_t tile_count = 2;
521  const size_t lane_count = 1;
522  const size_t lane_number = 1;
523  const size_t surface_count = 2;
524  const size_t channel_count = 2;
525  const size_t cycles_per_read = 6;
526  const float kExpectedPercentGreaterThanOrEqualToQ30 = 50.0f;// 7 bins were half the data >= Q30
527  const float kExpectedReadYield = 1.0f; // 1e9 / 1e9
528 
529 
530  const model::run::read_info reads[]={
531  model::run::read_info(1, 1, cycles_per_read),
532  model::run::read_info(2, cycles_per_read+1, cycles_per_read*2)
533  };
534  const size_t read_count = util::length_of(reads);
535  const size_t total_cycles = cycles_per_read*read_count;
536  summary.initialize(to_vector(reads), lane_count, surface_count, channel_count);
537 
538  for(size_t read_index=0;read_index < read_count;++read_index)
539  {
540  summary[read_index][0].lane(lane_number);
541  summary[read_index][0].tile_count(tile_count);
542  summary[read_index][0][0].tile_count(tile_count);
543  // TODO: Describe?
544  summary[read_index][0].cycle_state().qscored_cycle_range(
545  model::run::cycle_range(cycles_per_read, cycles_per_read));
546  summary[read_index].summary().percent_gt_q30(kExpectedPercentGreaterThanOrEqualToQ30);
547  summary[read_index][0].percent_gt_q30(kExpectedPercentGreaterThanOrEqualToQ30);
548  summary[read_index][0][0].percent_gt_q30(kExpectedPercentGreaterThanOrEqualToQ30);
549  summary[read_index][0].yield_g(kExpectedReadYield);
550  summary[read_index][0][0].yield_g(kExpectedReadYield);
551  summary[read_index].summary().yield_g(kExpectedReadYield);
552  summary[read_index].summary().projected_yield_g(kExpectedReadYield);
553 
554  // TODO: Describe?
555  summary[read_index][0].projected_yield_g(kExpectedReadYield);
556  summary[read_index][0][0].projected_yield_g(kExpectedReadYield);
557  }
558  summary.nonindex_summary().percent_gt_q30(kExpectedPercentGreaterThanOrEqualToQ30);
559  summary.total_summary().percent_gt_q30(kExpectedPercentGreaterThanOrEqualToQ30);
560  summary.nonindex_summary().yield_g(kExpectedReadYield*read_count);
561  summary.total_summary().yield_g(kExpectedReadYield*read_count);
562  summary.total_summary().projected_yield_g(kExpectedReadYield*read_count);
563 
564  summary.nonindex_summary().projected_yield_g(kExpectedReadYield*read_count);
565  // TODO: Describe?
566  summary.cycle_state().qscored_cycle_range(model::run::cycle_range(total_cycles, total_cycles));
567  }
568  };
569 
570 
577  struct q_metric_v7 : metric_test<model::metrics::q_metric, 7>
578  {
584  {
585  typedef header_t::qscore_bin_vector_type qscore_bin_vector_type;
586  typedef header_t::bin_t bin_t;
587  typedef bin_t::bin_type ushort_t;
588  typedef metric_t::uint_t uint_t;
589  const uint_t bin_count = 7;
590 
591  const ushort_t lower[] = {2, 10, 20, 25, 30, 35, 40};
592  const ushort_t upper[] = {9, 19, 24, 29, 34, 39, 40};
593  const ushort_t value[] = {2, 14, 21, 27, 32, 36, 40};
594  qscore_bin_vector_type headervec;
595  for(uint_t i=0;i<bin_count;i++)
596  headervec.push_back(bin_t(lower[i], upper[i], value[i]));
597  metrics = metric_set_t(header_t(headervec), VERSION);
598  typedef metric_t::uint_t uint_t;
599 
600  const uint_t hist_all1[] = {0, 267962, 118703, 4284, 2796110, 0, 0};
601  const uint_t hist_all2[] = {0,241483, 44960, 1100, 2899568, 0 ,0};
602  const uint_t hist_all3[] = {0,212144, 53942, 427, 2920598, 0, 0};
603 
604  metrics.insert(metric_t(7, 111014, 1, to_vector(hist_all1)));
605  metrics.insert(metric_t(7, 111014, 2, to_vector(hist_all2)));
606  metrics.insert(metric_t(7, 111014, 3,to_vector(hist_all3)));
607  }
612  template<class Collection>
613  static void create_binary_data(Collection &buffer)
614  {
615  const signed char tmp[] =
616  {
617  7,36,1,7,2,9,2,10,19,14,20,24,21,25,29,27,30,34,32,35,39,36
618  ,40,40,40,7,0,-90,-79,1,0,1,0,0,0,0,0,-70,22,4,0,-81,-49,1
619  ,0,-68,16,0,0,78,-86,42,0,0,0,0,0,0,0,0,0,7,0,-90,-79,1,0
620  ,2,0,0,0,0,0,75,-81,3,0,-96,-81,0,0,76,4,0,0,112,62,44,0,0
621  ,0,0,0,0,0,0,0,7,0,-90,-79,1,0,3,0,0,0,0,0,-80,60,3,0,-74
622  ,-46,0,0,-85,1,0,0,-106,-112,44,0,0,0,0,0,0,0,0,0
623  };
624  buffer.assign(tmp, tmp+util::length_of(tmp));
625  }
626  };
627 }}}
628 
static void create_summary(model::summary::run_summary &summary)
Definition: q_metrics_test.h:518
const metric_summary & total_summary() const
Definition: run_summary.h:314
void insert(const metric_type &metric)
Definition: metric_set.h:267
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: q_metrics_test.h:134
float percent_gt_q30() const
Definition: metric_summary.h:78
Definition: enum_description.h:15
const run::cycle_range & qscored_cycle_range() const
Definition: cycle_state_summary.h:59
void initialize(const run::info &run_info)
Definition: run_summary.h:99
float projected_yield_g() const
Definition: metric_summary.h:99
Definition: q_metrics_test.h:128
bool is_last_cycle_of_read(const size_t cycle) const
Definition: info.h:268
static void create_binary_data(Collection &buffer)
Definition: q_metrics_test.h:613
static std::vector< T > to_vector(const T(&vals)[N])
Definition: metric_test.h:85
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: q_metrics_test.h:583
Definition: cycle_range.h:20
model::metrics::q_metric metric_t
Definition: metric_test.h:57
static void create_summary(model::summary::run_summary &summary)
Definition: q_metrics_test.h:91
q_score_header header_type
Definition: q_metric.h:264
Definition: metric_test.h:41
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: q_metrics_test.h:336
model::metric_base::metric_set< model::metrics::q_metric > metric_set_t
Definition: metric_test.h:59
static void create_binary_data(Collection &buffer)
Definition: q_metrics_test.h:164
Definition: q_metrics_test.h:244
static void create_expected(metric_set_t &metrics, const model::run::info &run_info)
Definition: q_metrics_test.h:478
::uint32_t uint_t
Definition: base_metric.h:77
static void create_summary(model::summary::run_summary &summary)
Definition: q_metrics_test.h:294
def summary(run_metrics, level='Total', columns=None, dtype='f4', ignore_missing_columns=True, extra)
Definition: core.py:217
const cycle_state_summary & cycle_state() const
Definition: run_summary.h:370
Definition: metric_test.h:22
size_t total_cycles() const
Definition: info.h:334
static void create_binary_data(Collection &buffer)
Definition: q_metrics_test.h:280
Definition: q_metrics_test.h:577
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: q_metrics_test.h:30
std::vector< q_score_bin > qscore_bin_vector_type
Definition: q_metric.h:114
static void create_summary(model::summary::run_summary &summary)
Definition: q_metrics_test.h:208
static void create_binary_data(Collection &buffer)
Definition: q_metrics_test.h:352
float yield_g() const
Definition: metric_summary.h:88
static void create_binary_data(Collection &buffer)
Definition: q_metrics_test.h:49
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: q_metrics_test.h:250
metric_t::header_type header_t
Definition: metric_test.h:61
size_t length_of(const T &val)
Definition: length_of.h:55
const metric_summary & nonindex_summary() const
Definition: run_summary.h:342
Definition: q_metrics_test.h:24