Reading/Writing Binary InterOp files

Functions

template<class MetricSet >
size_t compute_buffer_size (const MetricSet &metrics) INTEROP_THROW_SPEC((io
 
template<class MetricSet >
size_t write_interop_to_buffer (const MetricSet &metrics,::uint8_t *buffer, const size_t buffer_size)
 
template<class MetricSet >
void read_interop_from_buffer (::uint8_t *buffer, const size_t buffer_size, MetricSet &metrics) INTEROP_THROW_SPEC((interop
 
template<class MetricSet >
void read_interop_from_string (const std::string &buffer, MetricSet &metrics, const bool rebuild=true) INTEROP_THROW_SPEC((interop
 
template<class MetricSet >
void write_interop_to_string (std::string &buffer, const MetricSet &metrics, const ::int16_t version=-1) INTEROP_THROW_SPEC((interop
 
template<class MetricSet >
size_t read_header_from_string (const std::string &buffer, MetricSet &metrics) INTEROP_THROW_SPEC((interop
 
template<class MetricSet >
void write_header_to_string (std::string &buffer, const MetricSet &metrics,::int16_t version=-1) INTEROP_THROW_SPEC((interop
 
template<class MetricSet >
void read_interop (const std::string &run_directory, MetricSet &metrics, const bool use_out=true) INTEROP_THROW_SPEC((io
 
template<class MetricSet >
bool write_interop (const std::string &run_directory, const MetricSet &metrics, const bool use_out=true, const ::int16_t version=-1) INTEROP_THROW_SPEC((io
 
template<class MetricType >
void write_interop_header (const std::string &run_directory, const ::int16_t version=-1, const typename MetricType::header_type &header=typename MetricType::header_type(), const bool use_out=true) INTEROP_THROW_SPEC((io
 
template<class MetricSet >
bool interop_exists (const std::string &run_directory, MetricSet &, const bool use_out=true) INTEROP_THROW_SPEC((io
 
template<class MetricSet >
void list_interop_filenames (std::vector< std::string > &files, const std::string &run_directory, const size_t last_cycle=0, const bool use_out=true, const bool add=false)
 
template<class MetricSet >
void read_interop_by_cycle (const std::string &run_directory, MetricSet &metrics, const size_t last_cycle, const bool use_out=true) INTEROP_THROW_SPEC((interop
 
template<class MetricSet >
bool interop_exists (const std::string &run_directory, MetricSet &, const size_t last_cycle, const bool use_out=true) INTEROP_THROW_SPEC((io
 

Detailed Description

These functions can be used to read or write a binary InterOp file.

Function Documentation

size_t illumina::interop::io::compute_buffer_size ( const MetricSet &  metrics)

Compute the number of bytes to write

Parameters
metricsmetric set
Returns
number of bytes required
bool illumina::interop::io::interop_exists ( const std::string &  run_directory,
MetricSet &  ,
const bool  use_out = true 
)

Check for the existence of the binary InterOp file into the given metric set

Note
The 'Out' suffix (parameter: use_out) is appended when we read the file. We excluded the Out in certain conditions when writing the file.
Parameters
run_directoryfile path to the run directory
use_outuse the copied version
bool illumina::interop::io::interop_exists ( const std::string &  run_directory,
MetricSet &  ,
const size_t  last_cycle,
const bool  use_out = true 
)

Check for the existence of the binary InterOp file into the given metric set

Note
The 'Out' suffix (parameter: use_out) is appended when we read the file. We excluded the Out in certain conditions when writing the file.
Parameters
run_directoryfile path to the run directory
last_cyclelast cycle to check
use_outuse the copied version
void illumina::interop::io::list_interop_filenames ( std::vector< std::string > &  files,
const std::string &  run_directory,
const size_t  last_cycle = 0,
const bool  use_out = true,
const bool  add = false 
)

List all possible InterOp file names

Note
The first filename is the legacy name

We could also specialize this for index_metrics.

Parameters
filesdestination list of files
run_directoryfile path to the run directory
last_cyclelast cycle to check
use_outuse the copied version
addif true, do not clear, add more
size_t illumina::interop::io::read_header_from_string ( const std::string &  buffer,
MetricSet &  metrics 
)

Read the binary InterOp file into the given metric set

Parameters
bufferstring holding a byte buffer
metricsmetric set
Exceptions
bad_format_exception
incomplete_file_exception
model::index_out_of_bounds_exception
void illumina::interop::io::read_interop ( const std::string &  run_directory,
MetricSet &  metrics,
const bool  use_out = true 
)

Read the binary InterOp file into the given metric set

#include <iostream>
using namespace illumina::interop::io;
int check_args(int argc);
int main(int argc, char** argv)
{
int ret;
if((ret = check_args(argc)) != 0) return ret;
try {
read_interop(argv[1], tile_metric_set);
}
catch(const incomplete_file_exception&){}// Ignore incomplete files
catch(const bad_format_exception& ex) // Something catastrophic happened to the file
{
std::cerr << "InterOp did not have the expected format: " << ex.what() << std::endl;
return 1;
}
catch(const file_not_found_exception& ex)
{
std::cerr << "Count not find InterOp file: " << ex.what() << std::endl;
return 1;
}
std::cout << "Tile metric set contains " << tile_metric_set.size() << " metrics" << std::endl;
return 0;
}
Note
The 'Out' suffix (parameter: use_out) is appended when we read the file. We excluded the Out in certain conditions when writing the file.
Parameters
run_directoryfile path to the run directory
metricsmetric set
use_outuse the copied version
Exceptions
file_not_found_exception
bad_format_exception
incomplete_file_exception
void illumina::interop::io::read_interop_by_cycle ( const std::string &  run_directory,
MetricSet &  metrics,
const size_t  last_cycle,
const bool  use_out = true 
)

Read the binary InterOp file into the given metric set

#include <iostream>
using namespace illumina::interop::io;
int check_args(int argc);
int main(int argc, char** argv)
{
int ret;
if((ret = check_args(argc)) != 0) return ret;
try {
read_interop(argv[1], tile_metric_set);
}
catch(const incomplete_file_exception&){}// Ignore incomplete files
catch(const bad_format_exception& ex) // Something catastrophic happened to the file
{
std::cerr << "InterOp did not have the expected format: " << ex.what() << std::endl;
return 1;
}
catch(const file_not_found_exception& ex)
{
std::cerr << "Count not find InterOp file: " << ex.what() << std::endl;
return 1;
}
std::cout << "Tile metric set contains " << tile_metric_set.size() << " metrics" << std::endl;
return 0;
}
Note
The 'Out' suffix (parameter: use_out) is appended when we read the file. We excluded the Out in certain conditions when writing the file.
Parameters
run_directoryfile path to the run directory
metricsmetric set
last_cyclelast cycle to check
use_outuse the copied version
Exceptions
file_not_found_exception
bad_format_exception
incomplete_file_exception
void illumina::interop::io::read_interop_from_buffer ( ::uint8_t *  buffer,
const size_t  buffer_size,
MetricSet &  metrics 
)

Read the binary InterOp file into the given metric set

Parameters
bufferbyte buffer
buffer_sizelength of the byte buffer
metricsmetric set
Exceptions
bad_format_exception
incomplete_file_exception
void illumina::interop::io::read_interop_from_string ( const std::string &  buffer,
MetricSet &  metrics,
const bool  rebuild = true 
)

Read the binary InterOp file into the given metric set

Parameters
bufferstring holding a byte buffer
metricsmetric set
rebuildwhether to rebuild the id map
Exceptions
bad_format_exception
incomplete_file_exception
model::index_out_of_bounds_exception
void illumina::interop::io::write_header_to_string ( std::string &  buffer,
const MetricSet &  metrics,
::int16_t  version = -1 
)

Write the binary InterOp file header into a string from the given metric set

Parameters
bufferstring holding a byte buffer
metricsmetric set
Exceptions
bad_format_exception
incomplete_file_exception
model::index_out_of_bounds_exception
bool illumina::interop::io::write_interop ( const std::string &  run_directory,
const MetricSet &  metrics,
const bool  use_out = true,
const ::int16_t  version = -1 
)

Write the metric set to a binary InterOp file

Note
The 'Out' suffix (parameter: use_out) is appended when we read the file. We excluded the Out in certain conditions when writing the file.
Parameters
run_directoryfile path to the run directory
metricsmetric set
use_outuse the copied version
versionversion of format to write
Returns
true if write is successful
void illumina::interop::io::write_interop_header ( const std::string &  run_directory,
const ::int16_t  version = -1,
const typename MetricType::header_type &  header = typename MetricType::header_type(),
const bool  use_out = true 
)

Write only the header to a binary InterOp file

Note
The 'Out' suffix (parameter: use_out) is appended when we read the file. We excluded the Out in certain conditions when writing the file.
Parameters
run_directoryfile path to the run directory
versionversion of format to write
headerheader of the metric set
use_outuse the copied version
size_t illumina::interop::io::write_interop_to_buffer ( const MetricSet &  metrics,
::uint8_t *  buffer,
const size_t  buffer_size 
)

Write the metric to a binary byte buffer

Parameters
metricsmetric set
bufferdestination binary buffer
buffer_sizemaximum size of binary buffer
Returns
number of bytes written
void illumina::interop::io::write_interop_to_string ( std::string &  buffer,
const MetricSet &  metrics,
const ::int16_t  version = -1 
)

Write the binary InterOp file into the given string using the given metric set

Parameters
bufferstring holding a byte buffer
metricsmetric set
versionversion of the format to write (-1 means use latest)
Exceptions
bad_format_exception
incomplete_file_exception
model::index_out_of_bounds_exception