src/c++/lib/variant/Variant.cpp
/**
 * Get variants
 *
 * @return consolidated list of variants + depths
 */
Get variants
@return consolidated list of variants + depths
Get variants @return consolidated list of variants + depths
std::list<Variant*> VariantCandidateList::getVariants() const
{
    std::list<Variant*> result;
    for (auto const& v : _impl->variants)
    {
        auto pileup_it = _impl->variant_pileups.find(v.first);
        if (pileup_it != _impl->variant_pileups.end())
        {
            PileupData ref_pile;
            PileupData other_pile;
            int start_pos = v.second->leftmost();
            int end_pos = v.second->rightmost();
            if (end_pos < start_pos)
            {
                std::swap(start_pos, end_pos);
            }
            start_pos = std::max(0, start_pos);
            for (int pos = start_pos; pos <= end_pos; ++pos)
            {
                if (pos >= (int)_impl->reference.size())
                {
                    break;
                }
                ref_pile += _impl->reference_pileups[pos];
                other_pile += _impl->nonreference_pileups[pos];
            }
            const int reflen = end_pos - start_pos + 1;
            if (reflen > 1)
            {
                ref_pile /= reflen;
                other_pile /= reflen;
            }
            other_pile -= pileup_it->second;
            v.second->set_adr_forward(ref_pile.stranded_DP[0]);
            v.second->set_adr_backward(ref_pile.stranded_DP[1]);
            v.second->set_wadr_forward(ref_pile.qual_weighted_DP[0]);
            v.second->set_wadr_backward(ref_pile.qual_weighted_DP[1]);
            v.second->set_ado_forward(other_pile.stranded_DP[0]);
            v.second->set_ado_backward(other_pile.stranded_DP[1]);
            v.second->set_wado_forward(other_pile.qual_weighted_DP[0]);
            v.second->set_wado_backward(other_pile.qual_weighted_DP[1]);
            v.second->set_ada_forward(pileup_it->second.stranded_DP[0]);
            v.second->set_ada_backward(pileup_it->second.stranded_DP[1]);
            v.second->set_wada_forward(pileup_it->second.qual_weighted_DP[0]);
            v.second->set_wada_backward(pileup_it->second.qual_weighted_DP[1]);
        }
        result.push_back(v.second.get());
    }
    return result;
}
std :: list < Variant * > VariantCandidateList :: getVariants ( ) const { std :: list < Variant * > result ; for ( auto const & v : _impl -> variants ) { auto pileup_it = _impl -> variant_pileups . find ( v . first ) ; if ( pileup_it != _impl -> variant_pileups . end ( ) ) { PileupData ref_pile ; PileupData other_pile ; int start_pos = v . second -> leftmost ( ) ; int end_pos = v . second -> rightmost ( ) ; if ( end_pos < start_pos ) { std :: swap ( start_pos , end_pos ) ; } start_pos = std :: max ( 0 , start_pos ) ; for ( int pos = start_pos ; pos <= end_pos ; ++ pos ) { if ( pos >= ( int ) _impl -> reference . size ( ) ) { break ; } ref_pile += _impl -> reference_pileups [ pos ] ; other_pile += _impl -> nonreference_pileups [ pos ] ; } const int reflen = end_pos - start_pos + 1 ; if ( reflen > 1 ) { ref_pile /= reflen ; other_pile /= reflen ; } other_pile -= pileup_it -> second ; v . second -> set_adr_forward ( ref_pile . stranded_DP [ 0 ] ) ; v . second -> set_adr_backward ( ref_pile . stranded_DP [ 1 ] ) ; v . second -> set_wadr_forward ( ref_pile . qual_weighted_DP [ 0 ] ) ; v . second -> set_wadr_backward ( ref_pile . qual_weighted_DP [ 1 ] ) ; v . second -> set_ado_forward ( other_pile . stranded_DP [ 0 ] ) ; v . second -> set_ado_backward ( other_pile . stranded_DP [ 1 ] ) ; v . second -> set_wado_forward ( other_pile . qual_weighted_DP [ 0 ] ) ; v . second -> set_wado_backward ( other_pile . qual_weighted_DP [ 1 ] ) ; v . second -> set_ada_forward ( pileup_it -> second . stranded_DP [ 0 ] ) ; v . second -> set_ada_backward ( pileup_it -> second . stranded_DP [ 1 ] ) ; v . second -> set_wada_forward ( pileup_it -> second . qual_weighted_DP [ 0 ] ) ; v . second -> set_wada_backward ( pileup_it -> second . qual_weighted_DP [ 1 ] ) ; } result . push_back ( v . second . get ( ) ) ; } return result ; }
Get variants
 @return consolidated list of variants + depths
Get variants @return consolidated list of variants + depths
// fully trimmed insertion: use reference bases before and after