Reporting simple statistics
Now, let us consider how to summarize the data using simple statistics.
C++
#include <iostream>
#include "interop/model/metric_base/metric_set.h"
#include "interop/io/metric_file_stream.h"
#include "interop/util/statistics.h"
using namespace illumina::interop::model::metric_base;
using namespace illumina::interop::model::metrics;
using namespace illumina::interop::io;
using namespace illumina::interop::util;
using namespace illumina::interop;
{
int ret;
try {
read_interop(argv[1], corrected_intensity_metric_set);
}
{
std::cerr << "InterOp did not have the expected format: " << ex.what() << std::endl;
return 1;
}
{
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;
}