src/c++/lib/genotyping/PopulationStatistics.cpp
/**
 * @return iterator to the lowest allele non-zero minor allele count
 */
@return iterator to the lowest allele non-zero minor allele count
@return iterator to the lowest allele non - zero minor allele count
size_t PopulationStatistics::minNonZeroAlleleIndex() const
{
    auto p_minor = std::min_element(allele_counts.begin(), allele_counts.end());
    if (*p_minor > 0)
    {
        return static_cast<size_t>(p_minor - allele_counts.begin());
    }
    p_minor = std::max_element(allele_counts.begin(), allele_counts.end());
    if (*p_minor == 0)
    {
        return static_cast<size_t>(0);
    }
    for (auto it = allele_counts.begin(); it != allele_counts.end(); it++)
    {
        if (*it < *p_minor)
        {
            p_minor = it;
        }
    }
    return static_cast<size_t>(p_minor - allele_counts.begin());
}
size_t PopulationStatistics :: minNonZeroAlleleIndex ( ) const { auto p_minor = std :: min_element ( allele_counts . begin ( ) , allele_counts . end ( ) ) ; if ( * p_minor > 0 ) { return static_cast < size_t > ( p_minor - allele_counts . begin ( ) ) ; } p_minor = std :: max_element ( allele_counts . begin ( ) , allele_counts . end ( ) ) ; if ( * p_minor == 0 ) { return static_cast < size_t > ( 0 ) ; } for ( auto it = allele_counts . begin ( ) ; it != allele_counts . end ( ) ; it ++ ) { if ( * it < * p_minor ) { p_minor = it ; } } return static_cast < size_t > ( p_minor - allele_counts . begin ( ) ) ; }
@return iterator to the lowest allele non-zero minor allele count
@return iterator to the lowest allele non - zero minor allele count