bcftools icon indicating copy to clipboard operation
bcftools copied to clipboard

bcftools +fixref -- -m ref-alt -d [Enhancement]

Open freeseek opened this issue 2 years ago • 0 comments

I am trying to use the +fixref plugin to fix a VCF after a liftOver operation. I have two issues.

The first issue relates to the following code:

    else if ( args.mode==MODE_REF_ALT ) // only change the REF/ALT column, leave the genotypes as is
    {
        if ( ir==ia ) return ret;
        if ( ir==ib ) { args.nswap++; return set_ref_alt(&args,rec,int2nt(ib),int2nt(ia),0); }
        if ( ir==revint(ia) ) { args.nflip++; return set_ref_alt(&args,rec,int2nt(revint(ia)),int2nt(revint(ib)),0); }
        if ( ir==revint(ib) ) { args.nflip_swap++; return set_ref_alt(&args,rec,int2nt(revint(ib)),int2nt(revint(ia)),0); }
        error("FIXME: this should not happen %s:%"PRId64"\n", bcf_seqname(args.hdr,rec),(int64_t) rec->pos+1);
    }

puzzles me as I do not want to alleles to be flipped, only swapped. Second, in the case of some rare A/T and C/G SNPs, none of the above conditions is satisfied but even if I use the --discard option, the program still fails rather than discarding a site that could not be resolved.

The second issue relates to the fact that when a swapping occurs, I want some INFO or FORMAT fields to change. I don't expect +fixref to understand what I want to change, but since I don't know what variants were swapped, it becomes impossible to make the change after running the plugin. It would be useful if +fixref had an option to add an INFO field recording what change was made (none, swap, flip, flip+swap) or two binary info fields (for swap and flip).

freeseek avatar Jun 27 '22 15:06 freeseek