src/c++/lib/genotyping/BreakpointStatistics.cpp
/**
 * Add edge counts from paragraph output
 * @param paragraph_json JSON output from alignAndDisambiguate
 */
Add edge counts from paragraph output
@param paragraph_json JSON output from alignAndDisambiguate
Add edge counts from paragraph output @param paragraph_json JSON output from alignAndDisambiguate
void BreakpointStatistics::addCounts(Json::Value const& paragraph_json)
{
    if (!paragraph_json.isMember("read_counts_by_edge"))
    {
        error("Cannot find key read_counts_by_edge in JSON");
    }
    for (auto const& edge_name : edge_names)
    {
        const auto e_it = edge_name_to_index.find(edge_name);
        assert(e_it != edge_name_to_index.end());
        const int this_edge_count = paragraph_json["read_counts_by_edge"].isMember(edge_name)
            ? paragraph_json["read_counts_by_edge"][edge_name].asInt()
            : 0;
        if (this_edge_count == 0)
        {
            continue;
        }
        if (edge_counts.size() <= e_it->second)
        {
            edge_counts.resize(edge_names.size(), 0);
            assert(edge_counts.size() > e_it->second);
        }
        edge_counts[e_it->second] += this_edge_count;
        for (const auto& allele : edgename_to_alleles[edge_name])
        {
            if (allele_counts.size() <= allele)
            {
                allele_counts.resize(canonical_allele_names.size(), 0);
                assert(allele_counts.size() > allele);
            }
            allele_counts[allele] += this_edge_count;
        }
    }
}
void BreakpointStatistics :: addCounts ( Json :: Value const & paragraph_json ) { if ( ! paragraph_json . isMember ( " " ) ) { error ( " " ) ; } for ( auto const & edge_name : edge_names ) { const auto e_it = edge_name_to_index . find ( edge_name ) ; assert ( e_it != edge_name_to_index . end ( ) ) ; const int this_edge_count = paragraph_json [ " " ] . isMember ( edge_name ) ? paragraph_json [ " " ] [ edge_name ] . asInt ( ) : 0 ; if ( this_edge_count == 0 ) { continue ; } if ( edge_counts . size ( ) <= e_it -> second ) { edge_counts . resize ( edge_names . size ( ) , 0 ) ; assert ( edge_counts . size ( ) > e_it -> second ) ; } edge_counts [ e_it -> second ] += this_edge_count ; for ( const auto & allele : edgename_to_alleles [ edge_name ] ) { if ( allele_counts . size ( ) <= allele ) { allele_counts . resize ( canonical_allele_names . size ( ) , 0 ) ; assert ( allele_counts . size ( ) > allele ) ; } allele_counts [ allele ] += this_edge_count ; } } }
Add edge counts from paragraph output
 @param paragraph_json JSON output from alignAndDisambiguate
Add edge counts from paragraph output @param paragraph_json JSON output from alignAndDisambiguate
// add counts for canonical alleles also