Reporting Tile Metrics

Now, let us consider how to summarize the data into useful reporting metrics. This example continues with tile metrics, which can be used to report cluster PF on a per lane basis (similar to SAV, except we do not consider reads in this example).

C#

using System;
using System.Collections.Generic;
using Illumina.InterOp.Run;
using Illumina.InterOp.Metrics;
using Illumina.InterOp.Comm;
class TileSummary
{
public float cluster_count;
public float cluster_count_pf;
public uint tile_count;
};
class Example2
{
static int Main(string[] args)
{
int ret;
if((ret = Helper.CheckArguments(args)) != 0) return ret;
base_tile_metrics tile_metric_set = new base_tile_metrics ();
if ((ret = Helper.ReadInterop (args [0], tile_metric_set)) != 0)
return ret;
Dictionary<uint, TileSummary> lane_summary_map = new Dictionary<uint, TileSummary>();
foreach(var metric in tile_metric_set.metrics())
{
if (!lane_summary_map.ContainsKey (metric.lane ()))
lane_summary_map.Add (metric.lane (), new TileSummary ());
lane_summary_map[metric.lane()].cluster_count += metric.clusterCount();
lane_summary_map[metric.lane()].cluster_count_pf += metric.clusterCountPf();
lane_summary_map[metric.lane()].tile_count += 1;
}
foreach (KeyValuePair<uint, TileSummary> pair in lane_summary_map)
{
Console.WriteLine("Lane: {0}", pair.Key);
Console.WriteLine("Tiles: {0}", pair.Value.tile_count);
Console.WriteLine("Cluster PF (%): {0}", pair.Value.cluster_count_pf / pair.Value.cluster_count * 100);
}
return 0;
}
}

C++

#include <iostream>
#include <map>
using namespace illumina::interop::io;
int read_interop_file(const char* filename, metric_set<tile_metric>& tile_metric_set);
int check_args(int argc);
struct tile_summary
{
tile_summary():cluster_count(0), cluster_count_pf(0), tile_count(0){}
float cluster_count;
float cluster_count_pf;
size_t tile_count;
};
typedef std::map<size_t, tile_summary> lane_summary_map_t;
int main(int argc, char** argv)
{
int ret;
if((ret = check_args(argc)) != 0) return ret;
if((ret = read_interop_file(argv[1], tile_metric_set)) != 0) return ret;
lane_summary_map_t lane_summary_map;
for(metric_set<tile_metric>::metric_array_t::const_iterator beg = tile_metric_set.begin(), end = tile_metric_set.end();beg != end;++beg)
{
lane_summary_map[beg->lane()].cluster_count += beg->cluster_count();
lane_summary_map[beg->lane()].cluster_count_pf += beg->cluster_count_pf();
lane_summary_map[beg->lane()].tile_count += 1;
}
for(lane_summary_map_t::const_iterator beg = lane_summary_map.begin(), end = lane_summary_map.end();beg != end;++beg)
{
std::cout << "Lane: " << beg->first << std::endl;
std::cout << "Tiles " << beg->second.tile_count << std::endl;
std::cout << "Cluster PF (%): " << beg->second.cluster_count_pf / beg->second.cluster_count * 100 << std::endl;
}
return 0;
}