Reporting simple statistics

Now, let us consider how to summarize the data using simple statistics.

C++

#include <iostream>
using namespace illumina::interop::io;
using namespace illumina::interop::util;
using namespace illumina::interop;
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], corrected_intensity_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;
}
// Member function that takes a single argument
float avg = mean<float>(corrected_intensity_metric_set.begin(),
corrected_intensity_metric_set.end(),
op::const_member_function(constants::A, &corrected_intensity_metric::percentBase));
float standard_dev = std::sqrt(variance<float>(corrected_intensity_metric_set.begin(),
corrected_intensity_metric_set.end(),
op::const_member_function(constants::A, &corrected_intensity_metric::percentBase)));
// Member function that takes no arguments
float avg_no_call = mean<float>(corrected_intensity_metric_set.begin(),
corrected_intensity_metric_set.end(),
op::const_member_function(&corrected_intensity_metric::no_calls));
std::cout << "Mean of percent base for A " << avg << std::endl;
std::cout << "Standard Deviation of percent base for A " << standard_dev << std::endl;
std::cout << "Mean of no call" << avg_no_call << std::endl;
return 0;
}