This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bcftools stats: definition of indel type

Hi,

I'm trying to figure out how the INDEL type is defined in bcftools stats. With some help I found the bcf_get_variant_types function (https://github.com/samtools/htslib/blob/958e6fa708d1914bc46d9f8e9411987402468153/vcf.c#L4247), but it is C and I can't figure out when a variant is considered an indel.

I mostly wonder about when a variant is considered and indel vs structural variation, for which the length cutoff is usually at 50bp.

vcf bcftools

Yes, but I cannot figure out in which cases the INDEL type is assigned:

    if ( *a && !*r )
    {
        if ( *a==']' || *a=='[' ) { var->type = VCF_BND; return; }
        while ( *a ) a++;
        var->n = (a-alt)-(r-ref); var->type = VCF_INDEL; return;
    }
    else if ( *r && !*a )
    {
        while ( *r ) r++;
        var->n = (a-alt)-(r-ref); var->type = VCF_INDEL; return;
    }
    else if ( !*r && !*a )
    {
        var->n = 0; var->type = VCF_REF; return;
    }

so looking quickly an indel is when this is not a symbolic allele (<BND>) and the length of REF and the current ALT are not the same.

// i and j are the position in the  alt and ref string

    if ( a[i]!=END_OF_STRING && r[j]==END_OF-STRING )
        {
            if ( a[i]==']' || a[i]=='[' ) { var->type = VCF_BND; return; }
            while ( a[i]!=END_OF_STRING ) i++;
            var->n = (i-alti)-(j-refj); var->type = VCF_INDEL; return;
        }

0 answers

No answers yet.

Log in to answer this question.