tile_metric.h
Go to the documentation of this file.
1 
8 #pragma once
13 
14 
15 namespace illumina { namespace interop { namespace logic { namespace metric
16 {
17 
23  inline ::uint32_t lane_from_name(const std::string& tile_name)
24  {
25  if(tile_name=="") return 0;
26  const size_t n = tile_name.find('_');
27  if(n == std::string::npos) return 0;
28  return util::lexical_cast< ::uint32_t >(tile_name.substr(0, n));
29  }
35  inline ::uint32_t tile_from_name(const std::string& tile_name)
36  {
37  if(tile_name=="") return 0;
38  const size_t n = tile_name.find('_');
39  if(n == std::string::npos) return 0;
40  return util::lexical_cast< ::uint32_t >(tile_name.substr(n+1));
41  }
42 
49  {
50  if( metric.tile() > 9999) return constants::FiveDigit;
51  if( metric.tile() > 999) return constants::FourDigit;
52  if( metric.tile() <= 99) return constants::Absolute;
54  }
60  template<class Metric>
62  {
63  if(metric_set.size() == 0 ) return constants::UnknownTileNamingMethod;
64  return tile_naming_method_from_metric(metric_set[0]);
65  }
72  inline ::uint32_t number(const ::uint32_t tile_id, const constants::tile_naming_method)
73  {
74  return tile_id%100;
75  }
82  inline ::uint32_t section(const ::uint32_t tile_id, const constants::tile_naming_method method)
83  {
84  if( method == constants::FiveDigit ) return (tile_id / 100) % 10;
85  return std::numeric_limits< ::uint32_t >::min();
86  }
93  inline ::uint32_t surface(const ::uint32_t tile_id, const constants::tile_naming_method method)
94  {
95  if(method == constants::FiveDigit) return (tile_id / 10000);
96  if(method == constants::FourDigit) return tile_id / 1000;
97  return 1;
98  }
105  inline ::uint32_t swath(const ::uint32_t tile_id, const constants::tile_naming_method method)
106  {
107  if(method == constants::FiveDigit) return (tile_id / 1000) % 10;
108  if(method == constants::FourDigit) return (tile_id / 100) % 10;
109  return 1;
110  }
119  inline ::uint32_t physical_location_column(const ::uint32_t tile_id,
120  const constants::tile_naming_method method,
121  const ::uint32_t swath_count,
122  const bool all_surfaces)
123  {
124  if(!(method == constants::FiveDigit || method == constants::FourDigit)) return 0;
125  ::uint32_t col = swath(tile_id, method);
126  if(all_surfaces && surface(tile_id, method)==2) col += swath_count;
127  return col-1;
128  }
137  inline ::uint32_t physical_location_row(const ::uint32_t tile_id,
138  const constants::tile_naming_method method,
139  const ::uint32_t section_per_lane,
140  const ::uint32_t tile_count)
141  {
142  switch(method)
143  {
145  {
146  ::uint32_t section = ((tile_id % 1000) - (tile_id % 100)) / 100;
147  if (section == 4) section = 6;
148  else if (section == 6) section = 4;
149  section = (section - 1) * section_per_lane;
150  return (section * tile_count) + (tile_id % 100) - 1;
151  }
153  return tile_id % 100-1;
154  default:
155  return tile_id-1;
156  }
157  }
165  inline ::uint32_t physical_location_column(const ::uint32_t tile_id,
166  const model::run::flowcell_layout& layout,
167  const bool all_surfaces)
168  {
169  return physical_location_column(tile_id,
170  layout.naming_method(),
171  layout.swath_count(),
172  all_surfaces);
173  }
180  inline ::uint32_t physical_location_row(const ::uint32_t tile_id,
181  const model::run::flowcell_layout& layout)
182  {
183  return physical_location_row(tile_id, layout.naming_method(), layout.sections_per_lane(), layout.tile_count());
184  }
185 
186 }}}}
187 
188 
189 
inline::uint32_t number(const ::uint32_t tile_id, const constants::tile_naming_method)
Definition: tile_metric.h:72
Definition: enum_description.h:15
uint_t tile() const
Definition: base_metric.h:284
tile_naming_method_t naming_method() const
Definition: flowcell_layout.h:150
constants::tile_naming_method tile_naming_method_from_metric(const model::metric_base::base_metric &metric)
Definition: tile_metric.h:48
inline::uint32_t swath(const ::uint32_t tile_id, const constants::tile_naming_method method)
Definition: tile_metric.h:105
inline::uint32_t surface(const ::uint32_t tile_id, const constants::tile_naming_method method)
Definition: tile_metric.h:93
uint_t swath_count() const
Definition: flowcell_layout.h:109
inline::uint32_t physical_location_row(const ::uint32_t tile_id, const constants::tile_naming_method method, const ::uint32_t section_per_lane, const ::uint32_t tile_count)
Definition: tile_metric.h:137
size_t size() const
Definition: metric_set.h:519
inline::uint32_t section(const ::uint32_t tile_id, const constants::tile_naming_method method)
Definition: tile_metric.h:82
inline::uint32_t lane_from_name(const std::string &tile_name)
Definition: tile_metric.h:23
inline::uint32_t tile_from_name(const std::string &tile_name)
Definition: tile_metric.h:35
uint_t sections_per_lane() const
Definition: flowcell_layout.h:124
Definition: flowcell_layout.h:20
uint_t tile_count() const
Definition: flowcell_layout.h:116
tile_naming_method
Definition: enums.h:294
Destination lexical_cast(const Source &src)
Definition: lexical_cast.h:264
inline::uint32_t physical_location_column(const ::uint32_t tile_id, const constants::tile_naming_method method, const ::uint32_t swath_count, const bool all_surfaces)
Definition: tile_metric.h:119