Summary
This section introduces the way SAV calculates the summary tab. This introduces a limited set of functions. The key classes used below are:
run_metrics
: model holding the binary InterOp datarun_summary
: model holding the derived summary metricsvalid_to_load
: byte array (std::vector<unsigned char>
oruchar_vector
) indicating which InterOp files to load
The primary functions used below are:
run_metrics::read
: read the InterOp files from disksummarize_run_metrics
: summarize the SAV run metrics
C#
If you have not installed InterOp, see Install InterOp From NuGet
using System;
class SummaryExample
{
static int Main(string[] args)
{
if (args.Length != 1)
{
if (args.Length < 1)
Console.WriteLine ("No run folder");
else
Console.WriteLine ("Too many arguments");
return 1;
}
run_metrics metrics = new run_metrics();
metrics.read(args[0]);
run_summary summary = new run_summary();
c_csharp_summary.summarize_run_metrics(metrics, summary);
Console.WriteLine("Yield: {0}", summary.total_summary().yield_g());
return 0;
}
}
Python
If you have not installed InterOp, see Install InterOp From a Wheel
See new interop.core
C++
The following shows how to calculate the summary metrics:
std::vector<unsigned char> valid_to_load;
logic::utils::list_summary_metrics_to_load(valid_to_load); // Only load the InterOp files required
std::cout << "# Version: " << INTEROP_VERSION << std::endl;
for(int i=1;i<argc;i++)
{
run_metrics run;
std::cout << io::basename(argv[i]) << std::endl;
int ret = read_run_metrics(argv[i], run, valid_to_load, thread_count);
if(ret != SUCCESS)
{
return UNEXPECTED_EXCEPTION;
}
run_summary summary;
try
{
summarize_run_metrics(run, summary, skip_median_calculation);
}
catch(const std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return UNEXPECTED_EXCEPTION;
}
try
{
print_summary(std::cout, summary, information_level, csv_format!=0);
}
catch(const std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return UNEXPECTED_EXCEPTION;
}
}
The following shows the implementation of read_run_metrics
above and how to read the InterOp data from disk:
using namespace illumina::interop;
using namespace illumina::interop::model;
try
{
metrics.clear();
metrics.read(filename, valid_to_load, thread_count);
}
{
std::cerr << ex.what() << std::endl;
return MISSING_RUNINFO_XML;
}
{
std::cerr << ex.what() << std::endl;
return MALFORMED_XML;
}
{
std::cerr << ex.what() << std::endl;
return BAD_FORMAT;
}
{
std::cerr << ex.what() << std::endl;
}
catch(const std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return UNEXPECTED_EXCEPTION;
}
if(check_empty && metrics.empty())
{
std::cerr << "No InterOp files found" << std::endl;
return EMPTY_INTEROP;
}