示例#1
0
static
void
runSAS(const SASOptions& opt)
{
    static const float quantLevel[] = { 0.01f, 0.05f, 0.10f, 0.25f, 0.50f, 0.75f, 0.90f, 0.95f, 0.99f };
    static const unsigned quantLevelCount(sizeof(quantLevel)/sizeof(float));

    OutStream outs(opt.outputFilename);
    std::ostream& report_os(outs.getStream());

    ReadGroupStatsSet rgss;
    rgss.load(opt.statsFilename.c_str());

    const unsigned groupCount(rgss.size());
    for (unsigned groupIndex(0); groupIndex<groupCount; ++groupIndex)
    {
        const ReadGroupStatsSet::KeyType& key(rgss.getKey(groupIndex));
#ifdef READ_GROUPS
        report_os << "bamFile:\t" << key.bamLabel << '\n';
        report_os << "readGroup:\t" << key.rgLabel << '\n';
#else
        report_os << "group:\t" << key.bamLabel << '\n';
#endif

        const ReadGroupStats& rgs(rgss.getStats(groupIndex));
        report_os << "fragment length observations:\t" << rgs.fragStats.totalObservations() << '\n';
        report_os << "fragment length quantiles:\n";
        for (unsigned quantLevelIndex(0); quantLevelIndex<quantLevelCount; ++quantLevelIndex)
        {
            report_os << quantLevel[quantLevelIndex] << '\t' << rgs.fragStats.quantile(quantLevel[quantLevelIndex]) << '\n';
        }
        report_os << '\n';
    }
}
示例#2
0
static
void
mergeAlignmentStats(const MergeAlignmentStatsOptions& opt)
{
    if (opt.statsFiles.empty())
    {
        log_os << "ERROR: No input files specified.\n";
        exit(EXIT_FAILURE);
    }

    ReadGroupStatsSet all_rstats;
    for (const std::string& file : opt.statsFiles)
    {
        ReadGroupStatsSet rstats;
        rstats.load(file.c_str());
        all_rstats.merge(rstats);
    }

    all_rstats.save(opt.outputFilename.c_str());
}