illumina::interop::util Namespace Reference

Namespaces

 detail
 
 op
 

Classes

class  abstract_option
 
class  abstract_range_iterator
 
struct  base_exception
 
class  chain_range_iterator
 
class  constant_mapping
 
struct  csharp_date_time
 
class  indirect_range_iterator
 
class  invalid_option_exception
 
class  invalid_option_value_exception
 
struct  length_of_type
 
struct  length_of_type< std::vector< T > >
 
struct  lexical_cast_helper
 
struct  lexical_cast_helper< char *, Destination >
 
struct  lexical_cast_helper< char *, std::string >
 
struct  lexical_cast_helper< const char *, Destination >
 
struct  lexical_cast_helper< const char *, std::string >
 
struct  lexical_cast_helper< const Source &, std::string >
 
struct  lexical_cast_helper< Source, std::string >
 
struct  lexical_cast_helper< std::string, const char * >
 
struct  lexical_cast_helper< std::string, Destination >
 
struct  lexical_cast_helper< std::string, std::string >
 
class  option
 
class  option_exception
 
class  option_parser
 
class  scoped_timer
 
struct  StringCaseInsensitiveComparator
 
class  value_container
 
class  value_container< R(T::*)(P1) >
 

Functions

template<class Key , class Value , size_t N>
const Value & constant_mapping_get (const std::pair< Key, Value >(&pairs)[N], const Key &key, const Value &default_value)
 
template<typename T >
size_t length_of (const T &val)
 
template<typename T , size_t N>
size_t length_of (const T(&)[N])
 
template<class Destination , class Source >
Destination lexical_cast (const Source &src)
 
std::string format (const float val, const int width, const int precision, const char fill= ' ', const bool fixed=true)
 
template<typename T >
float float_cast (const T val, const T sentinel=std::numeric_limits< T >::max())
 
template<typename T , typename R , typename P1 >
value_container< R(T::*)(P1) > wrap_setter (T &obj, R(T::*func)(P1))
 
template<typename I , typename O , typename F >
void outliers_lower (I beg, I end, const F bound, O out)
 
template<typename I , typename O , typename F >
void outliers_upper (I beg, I end, const F bound, O out)
 
template<typename I >
percentile (I beg, I end, const size_t percentile)
 
template<typename I , typename Compare >
percentile (I beg, I end, const size_t percentile, Compare comp)
 
template<typename F >
interpolate_linear (const F y1, const F y2, const F x1, const F x2, const F xt)
 
template<typename F , typename I >
percentile_sorted (I beg, I end, const size_t percentile)
 
template<typename F , typename I , typename Op >
percentile_sorted (I beg, I end, const size_t percentile, Op op)
 
template<typename I , typename UnaryOp >
remove_nan (I beg, I end, UnaryOp op)
 
template<typename I >
median (I beg, I end)
 
template<typename I , typename Compare >
median (I beg, I end, Compare comp)
 
template<typename F , typename I >
median_interpolated (I beg, I end)
 
template<typename F , typename I , typename Compare >
median_interpolated (I beg, I end, Compare comp)
 
template<typename F , typename I , typename Compare , typename Op >
median_interpolated (I beg, I end, Compare comp, Op op)
 
template<typename R , typename I , typename BinaryOp >
nan_mean (I beg, I end, BinaryOp op)
 
template<typename R , typename I , typename BinaryOp >
nan_variance_with_mean (I beg, I end, const R mean_val, BinaryOp op)
 
template<typename R , typename I , typename BinaryOp >
nan_variance (I beg, I end, BinaryOp op)
 
template<typename R , typename I , typename BinaryOp >
mean (I beg, I end, BinaryOp op)
 
template<typename R , typename I , typename BinaryOp >
variance_with_mean (I beg, I end, const R mean_val, BinaryOp op)
 
template<typename R , typename I , typename BinaryOp >
variance (I beg, I end, BinaryOp op)
 
template<typename R , typename I >
mean (I beg, I end)
 
template<typename R , typename I >
variance (I beg, I end)
 
template<typename R , typename I >
variance_with_mean (I beg, I end, const R mean)
 
bool replace (std::string &str, const std::string &from, const std::string &to)
 
void camel_to (std::string &str, const std::string &sep=" ")
 
void camel_from (std::string &str, const char sep=' ')
 
bool contains_ASCII_only (const std::string &input)
 
std::string to_lower (const std::string &input)
 
bool ends_with (const std::string &input, const std::string &ending, const bool is_case_insensitive=false)
 
std::istream & cross_platform_getline (std::istream &is, std::string &line)
 
std::istream & operator>> (std::istream &in, constants::dna_bases &bases)
 
std::ostream & operator<< (std::ostream &out, const csharp_date_time &date_time)
 
std::istream & operator>> (std::istream &in, csharp_date_time &date_time)
 

Function Documentation

void illumina::interop::util::camel_from ( std::string &  str,
const char  sep = ' ' 
)
inline

Split string based on space characters and delineate with camel case

E.g. "Signal To Noise" -> "SignalToNoise"

Parameters
strsource/destination string
sepseparator string
void illumina::interop::util::camel_to ( std::string &  str,
const std::string &  sep = " " 
)
inline

Split string based on upper case characters and separate with separator string

E.g. "SignalToNoise" -> "Signal To Noise"

Parameters
strsource/destination string
sepseperator string
const Value& illumina::interop::util::constant_mapping_get ( const std::pair< Key, Value >(&)  pairs[N],
const Key &  key,
const Value &  default_value 
)

Get the value corresponding to the key or default_value if none exists

Parameters
pairsarray of values mapping Key to Value
keykey to search for in mapping
default_valuevalue to return if the key is not found
Returns
value found (or default_value)
bool illumina::interop::util::contains_ASCII_only ( const std::string &  input)
inline

Returns true iff only ASCII characters are used

Parameters
inputstring to check
std::istream& illumina::interop::util::cross_platform_getline ( std::istream &  is,
std::string &  line 
)
inline
bool illumina::interop::util::ends_with ( const std::string &  input,
const std::string &  ending,
const bool  is_case_insensitive = false 
)
inline
float illumina::interop::util::float_cast ( const T  val,
const T  sentinel = std::numeric_limits<T>::max() 
)

Cast a number to a float, return NaN if it matches the sentinel

The default sentinel is the maximum value for the type.

Template Parameters
T
Parameters
valnumber to cast
sentinelNaN sentinel, default max value
Returns
std::string illumina::interop::util::format ( const float  val,
const int  width,
const int  precision,
const char  fill = ' ',
const bool  fixed = true 
)
inline

Utility to format a floating point number as a string

Parameters
valfloating point value
widthwidth of the number
precisionnumber of digits after decimal
fillfill character
fixedif true use fixed not default
Returns
string representation of float
F illumina::interop::util::interpolate_linear ( const F  y1,
const F  y2,
const F  x1,
const F  x2,
const F  xt 
)

Perform linear interpolation between two sets of (x,y) points given a target x value

Parameters
y1y-value for point 1
y2y-value for point 2
x1x-value for point 1
x2x-value for point 2
xttarget x-value
Returns
linearly interoploate y-value for given target x value
size_t illumina::interop::util::length_of ( const T &  val)

Get the number of elements in the collection or 1 if a value

Parameters
valcollection or value
Returns
size of collection or 1 for value
size_t illumina::interop::util::length_of ( const   T(&)[N])

Get the number of elements in a stack array

Returns
size of array
Destination illumina::interop::util::lexical_cast ( const Source &  src)
inline

Cast between a string type and some arbitrary type

Note
The arbitrary type should support the std::istream >> or std::ostream << operators
Parameters
srcsource value of an arbitrary type
Returns
value of arbitrary type
R illumina::interop::util::mean ( beg,
end,
BinaryOp  op 
)

Estimate the mean of values in a given collection

Usage: std::vector<float> values = {0,1,2,3}; double mean_val = mean<double>(values.begin(), values.end());

Parameters
begiterator to start of collection
enditerator to end of collection
opfunction that takes one value and returns another value
Returns
mean of the input collection
R illumina::interop::util::mean ( beg,
end 
)

Estimate the mean of values in a given collection

Usage: std::vector<float> values = {0,1,2,3}; double mean_val = mean<double>(values.begin(), values.end());

Parameters
begiterator to start of collection
enditerator to end of collection
Returns
mean of the input collection
I illumina::interop::util::median ( beg,
end 
)

Calculate the median of the collection

Note
this will change the underlying array!
Parameters
begiterator to start of collection
enditerator to end of collection
Returns
iterator to requested percentile
I illumina::interop::util::median ( beg,
end,
Compare  comp 
)

Calculate the median of the collection

Note
this will change the underlying array!
Parameters
begiterator to start of collection
enditerator to end of collection
compcomparator between two types
Returns
iterator to requested percentile
F illumina::interop::util::median_interpolated ( beg,
end 
)

Calculate the median of the collection

Note
this will change the underlying array!
Parameters
begiterator to start of collection
enditerator to end of collection
Returns
iterator to requested percentile
F illumina::interop::util::median_interpolated ( beg,
end,
Compare  comp 
)

Calculate the median of the collection

Note
this will change the underlying array!
Parameters
begiterator to start of collection
enditerator to end of collection
compcomparator between two types
Returns
iterator to requested percentile
F illumina::interop::util::median_interpolated ( beg,
end,
Compare  comp,
Op  op 
)

Calculate the median of the collection

Note
this will change the underlying array!
Parameters
begiterator to start of collection
enditerator to end of collection
compcomparator between two types
opfunction that takes one value and returns another value
Returns
iterator to requested percentile
R illumina::interop::util::nan_mean ( beg,
end,
BinaryOp  op 
)

Estimate the mean of values in a given collection

This function skips NaN values

Usage: std::vector<float> values = {0,1,2,3}; double mean_val = nan_mean<double>(values.begin(), values.end());

Parameters
begiterator to start of collection
enditerator to end of collection
opfunction that takes one value and returns another value
Returns
mean of the input collection
R illumina::interop::util::nan_variance ( beg,
end,
BinaryOp  op 
)

Estimate the variance of values in a given collection

This function skips NaN values

Usage: std::vector<float> values = {0,1,2,3}; double var_val = nan_variance<double>(values.begin(), values.end());

Parameters
begiterator to start of collection
enditerator to end of collection
opfunction that takes one value and returns another value
Returns
variance of the input collection
R illumina::interop::util::nan_variance_with_mean ( beg,
end,
const R  mean_val,
BinaryOp  op 
)

Estimate the variance of values in a given collection

This function skips NaN values

Usage: std::vector<float> values = {0,1,2,3}; double var_val = nan_variance<double>(values.begin(), values.end());

Parameters
begiterator to start of collection
enditerator to end of collection
mean_valpre-calculated mean
opfunction that takes one value and returns another value
Returns
variance of the input collection
std::ostream& illumina::interop::util::operator<< ( std::ostream &  out,
const csharp_date_time date_time 
)

Write date type as integer to an output stream

Parameters
outoutput stream
date_timedata time object
Returns
output stream
std::istream& illumina::interop::util::operator>> ( std::istream &  in,
constants::dna_bases bases 
)
inline
std::istream& illumina::interop::util::operator>> ( std::istream &  in,
csharp_date_time date_time 
)

Read a date type from the input stream

Parameters
ininput stream
date_timedata time object
Returns
input stream
void illumina::interop::util::outliers_lower ( beg,
end,
const F  bound,
out 
)

Collect outliers below bound for a sorted collection

Parameters
begiterator to start of a sorted collection
enditerator to end of a sorted collection
boundbounding value for outliers
outoutput iterator
void illumina::interop::util::outliers_upper ( beg,
end,
const F  bound,
out 
)

Collect outliers above bound for a sorted collection

Parameters
begiterator to start of a sorted collection
enditerator to end of a sorted collection
boundbounding value for outliers
outoutput iterator
I illumina::interop::util::percentile ( beg,
end,
const size_t  percentile 
)

Calculate the given percentile

The percentile must be an integer in percent. For example the 99th percent tile would set percentile = 99.

Note
this will change the underlying array!
Parameters
begiterator to start of collection
enditerator to end of collection
percentileinteger in percent
Returns
iterator to requested percentile
I illumina::interop::util::percentile ( beg,
end,
const size_t  percentile,
Compare  comp 
)

Calculate the given percentile

The percentile must be an integer in percent. For example the 99th percent tile would set percentile = 99.

Note
this will change the underlying array!
Parameters
begiterator to start of collection
enditerator to end of collection
percentileinteger in percent
compcomparator between two types
Returns
iterator to requested percentile
F illumina::interop::util::percentile_sorted ( beg,
end,
const size_t  percentile 
)

Calculate the interpolated percentile given a sorted array

Parameters
begiterator to start of sorted array
enditerator to end of sorted array
percentiletarget percentile [0-100]
Returns
interpolated value of array corresponding to given percentile
F illumina::interop::util::percentile_sorted ( beg,
end,
const size_t  percentile,
Op  op 
)

Calculate the interpolated percentile given a sorted array

Parameters
begiterator to start of sorted array
enditerator to end of sorted array
percentiletarget percentile [0-100]
opfunction that takes one value and returns another value
Returns
interpolated value of array corresponding to given percentile
I illumina::interop::util::remove_nan ( beg,
end,
UnaryOp  op 
)

Sort NaNs to the end of the collection return iterator to first NaN value

Parameters
begiterator to start of collection
enditerator to end of collection
opfunction that takes one value and returns another value
Returns
iterator to last non-NaN element
bool illumina::interop::util::replace ( std::string &  str,
const std::string &  from,
const std::string &  to 
)
inline

Replace any first occurence of substring from with substring to

Parameters
strsource/destination string
fromsearch string
toreplacement string
Returns
true if substring was found and replaced
std::string illumina::interop::util::to_lower ( const std::string &  input)
inline
R illumina::interop::util::variance ( beg,
end,
BinaryOp  op 
)

Estimate the variance of values in a given collection

Usage: std::vector<float> values = {0,1,2,3}; double var_val = variance<double>(values.begin(), values.end());

Parameters
begiterator to start of collection
enditerator to end of collection
opfunction that takes one value and returns another value
Returns
variance of the input collection
R illumina::interop::util::variance ( beg,
end 
)

Estimate the variance of values in a given collection

Usage: std::vector<float> values = {0,1,2,3}; double mean_val = variance<double>(values.begin(), values.end());

Parameters
begiterator to start of collection
enditerator to end of collection
Returns
variance of the input collection
R illumina::interop::util::variance_with_mean ( beg,
end,
const R  mean_val,
BinaryOp  op 
)

Estimate the variance of values in a given collection

Usage: std::vector<float> values = {0,1,2,3}; double var_val = variance<double>(values.begin(), values.end());

Parameters
begiterator to start of collection
enditerator to end of collection
mean_valprecalculated mean
opfunction that takes one value and returns another value
Returns
variance of the input collection
R illumina::interop::util::variance_with_mean ( beg,
end,
const R  mean 
)

Estimate the variance of values in a given collection

Usage: std::vector<float> values = {0,1,2,3}; double mean_val = variance<double>(values.begin(), values.end());

Parameters
begiterator to start of collection
enditerator to end of collection
meanmean of the data in the collection
Returns
variance of the input collection
value_container< R (T::* )(P1) > illumina::interop::util::wrap_setter ( T &  obj,
R(T::*)(P1)  func 
)
inline

Wrapper memeber function setter

Parameters
objreference to object
funcpointer ot member function setting
Returns
value_container