application.h
Go to the documentation of this file.
1 
10 #pragma once
12 
13 
17 {
32 };
33 
44 inline int read_run_metrics(const char* filename,
46  const size_t thread_count,
47  const bool check_empty=true)
48 {
49  using namespace illumina::interop;
50  using namespace illumina::interop::model;
51  try
52  {
53  metrics.read(filename, thread_count);
54  }
55  catch(const xml::xml_file_not_found_exception& ex)
56  {
57  std::cerr << ex.what() << std::endl;
58  return MISSING_RUNINFO_XML;
59  }
60  catch(const xml::xml_parse_exception& ex)
61  {
62  std::cerr << ex.what() << std::endl;
63  return MALFORMED_XML;
64  }
65  catch(const io::bad_format_exception& ex)
66  {
67  std::cerr << ex.what() << std::endl;
68  return BAD_FORMAT;
69  }
71  {
72  std::cerr << ex.what() << std::endl;
73  }
74  catch(const std::exception& ex)
75  {
76  std::cerr << ex.what() << std::endl;
77  return UNEXPECTED_EXCEPTION;
78  }
79  if(check_empty && metrics.empty())
80  {
81  std::cerr << "No InterOp files found" << std::endl;
82  return EMPTY_INTEROP;
83  }
84  return SUCCESS;
85 }
97 inline int read_run_metrics(const char* filename,
99  const std::vector<unsigned char>& valid_to_load,
100  const size_t thread_count,
101  const bool check_empty=true)
102 {
103 // @ [Reading a subset of run metrics in C++]
104  using namespace illumina::interop;
105  using namespace illumina::interop::model;
106  try
107  {
108  metrics.clear();
109  metrics.read(filename, valid_to_load, thread_count);
110  }
111  catch(const xml::xml_file_not_found_exception& ex)
112  {
113  std::cerr << ex.what() << std::endl;
114  return MISSING_RUNINFO_XML;
115  }
116  catch(const xml::xml_parse_exception& ex)
117  {
118  std::cerr << ex.what() << std::endl;
119  return MALFORMED_XML;
120  }
121  catch(const io::bad_format_exception& ex)
122  {
123  std::cerr << ex.what() << std::endl;
124  return BAD_FORMAT;
125  }
127  {
128  std::cerr << ex.what() << std::endl;
129  }
130  catch(const std::exception& ex)
131  {
132  std::cerr << ex.what() << std::endl;
133  return UNEXPECTED_EXCEPTION;
134  }
135  if(check_empty && metrics.empty())
136  {
137  std::cerr << "No InterOp files found" << std::endl;
138  return EMPTY_INTEROP;
139  }
140 // @ [Reading a subset of run metrics in C++]
141  return SUCCESS;
142 }
Definition: imaging_table_csv.h:13
Definition: application.h:27
void read(const std::string &run_folder, const size_t thread_count=1) INTEROP_THROW_SPEC((xml void read(const std::string &run_folder, const std::vector< unsigned char > &valid_to_load, const size_t thread_count=1, const bool skip_loaded=false) INTEROP_THROW_SPEC((xml size_t read_xml(const std::string &run_folder) INTEROP_THROW_SPEC((io void read_run_info(const std::string &run_folder) INTEROP_THROW_SPEC((xml size_t read_run_parameters(const std::string &run_folder, const bool force_load=false) INTEROP_THROW_SPEC((io void finalize_after_load(size_t count=std::numeric_limits< size_t >::max()) INTEROP_THROW_SPEC((model bool empty() const
Definition: run_metrics.h:223
void clear()
Definition: run_metrics.cpp:557
Definition: enum_description.h:15
Definition: application.h:21
exit_codes
Definition: application.h:16
int read_run_metrics(const char *filename, illumina::interop::model::metrics::run_metrics &metrics, const size_t thread_count, const bool check_empty=true)
Definition: application.h:44
Definition: application.h:25
Definition: application.h:23
Definition: stream_exceptions.h:59
Definition: application.h:31
Definition: application.h:19
Definition: application.h:29
Definition: xml_exceptions.h:50