src/c++/include/common/BCFHelpers.hh
/**
 * Compare bcf records by position
 * @param hdr bcf header
 * @param a first bcf record
 * @param b second bcf record
 * @return true if a < b else false
 */
Compare bcf records by position
@param hdr bcf header
@param a first bcf record
@param b second bcf record
@return true if a < b else false
Compare bcf records by position @param hdr bcf header @param a first bcf record @param b second bcf record @return true if a < b else false
bool inline compare(bcf_hdr_t* hdr, bcf1_t* a, bcf1_t* b)
{
    if (a->pos == b->pos)
    {
        int* gt = NULL;
        int ngt = 0;
        int na = bcf_get_genotypes(hdr, a, &gt, &ngt);
        int nb = bcf_get_genotypes(hdr, b, &gt, &ngt);
        free(gt);
        return (a->n_allele < b->n_allele && na >= nb);
    }
    else
    {
        return (a->pos < b->pos);
    }
}
bool inline compare ( bcf_hdr_t * hdr , bcf1_t * a , bcf1_t * b ) { if ( a -> pos == b -> pos ) { int * gt = NULL ; int ngt = 0 ; int na = bcf_get_genotypes ( hdr , a , & gt , & ngt ) ; int nb = bcf_get_genotypes ( hdr , b , & gt , & ngt ) ; free ( gt ) ; return ( a -> n_allele < b -> n_allele && na >= nb ) ; } else { return ( a -> pos < b -> pos ) ; } }
Compare bcf records by position
 @param hdr bcf header
 @param a first bcf record
 @param b second bcf record
 @return true if a < b else false
Compare bcf records by position @param hdr bcf header @param a first bcf record @param b second bcf record @return true if a < b else false