1. Modified vcf_parse to update rlen only when an END INFO tag is seen -

Issue: https://github.com/broadinstitute/gamgee/issues/191
1. Modified vcf_parse to update rlen only when an END INFO tag is seen -the END tag is NOT encoded into v->shared.s
2. Modified vcf_write to add END INFO tag if required

In theory the END tag simply denotes a block. The block could have as many
alleles as needed, as long as all the samples share that particular block.

In practice though, we are only using it for reference blocks, which as
you've noted, only has 2 alleles (the reference and the "other" allele). So
this would be okay for our use case but in the future we may hit it as a
bug without knowing why it's there.

Is there any reason in your code (sorry I didn't have time to fully review
-- on vacation) for this limitation? If it is arbitrary, I'd rather not
limit support to bi-allelic sites.


Mauricio Carneiro, Ph.D.
http://www.broadinstitute.org/~carneiro/


On Wed, Sep 3, 2014 at 4:31 PM, kgururaj <notifications@github.com> wrote:

> In vcf.c:
>
> > @@ -1993,6 +2002,12 @@ int vcf_format(const bcf_hdr_t *h, const bcf1_t *v, kstring_t *s)
> >  {
> >      int i;
> >      bcf_unpack((bcf1_t*)v, BCF_UN_ALL);
> > +    //2 alleles, first is REF and 2nd is NON_REF and rlen > 1, update END tag in INFO
> > +    if(v->n_allele == 2 &&  v->rlen > 1 && (strcmp(v->d.allele[1], "<NON_REF>") == 0))
>
> I assumed that the END tag is only useful for genomic intervals with the
> single alternate allele . Is it possible to have a genomic interval with 3
> alleles (reference + 2 alternate)? Single site records with multiple
> alleles are possible, but for these records the END tag is useless.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/broadinstitute/htslib/pull/5/files#r17084996>.
>