Skip to content

behavior of bcftools norm and -i option to restrict variants collapsed #2415

Description

@jcm6t

Just tested this on bcftools 1.22

Ran the following command to restrict norm actions to selected variants in a bcf file. I want to separately collapse SNPs and INDELs

bcftools norm -m +both -i "ID=@$VARIDFILE" -Ob in.bcf > out.bcf

What I hoped would happen is that norm would only collapse variants with IDs in the VARIDFILE and pass all other variants to the output unchanged even if those variants were located at the same position as one of the variants in the file but it seems to ignore the VARIDFILE (and no errors)

Not sure if I am pushing norm to do something it is not able to support currently but I will say this would be very very helpful for surgically managing which variants to collapse or expand. Without this I would have to extract variants to a separate bcf file, remove those variants from the primary file, run norm on the extracted variant subset file and then I guess try to concat/sort those variants back into the primary bcf.

Top of in.bcf

#CHROM  POS     ID      REF     ALT     QUAL
22      10510105        22_10510105_T_A T       A       8.33
22      10510113        22_10510113_C_T C       T       17.93
22      10510212        22_10510212_A_T A       T       13.59
22      10510258        22_10510258_C_T C       T       41.37
22      10510341        22_10510341_C_G C       G       6.8
22      10510352        22_10510352_AT_A        AT      A       15.8
22      10510352        22_10510352_ATAAT_A     ATAAT   A       10.95
22      10510355        22_10510355_AT_A        AT      A       12.48
22      10510356        22_10510356_T_A T       A       46.64
22      10510445        22_10510445_A_G A       G       21.9
22      10510463        22_10510463_C_G C       G       42.9
22      10510518        22_10510518_G_GAA       G       GAA     9.7
22      10510518        22_10510518_G_GAAA      G       GAAA    9.7
22      10510569        22_10510569_G_A G       A       9.4
22      10510597        22_10510597_C_T C       T       38.27
22      10510620        22_10510620_C_T C       T       11.2

The first 4 variants in the VARIDFILE are:

22_10515040_TAAGAAAGA_TAAGA
22_10515040_TA_T
22_10515068_A_G
22_10515074_A_G

The motivation here is to use this as a tool to post-process duplicate variants (duplicate POS, REF, ALT and hence duplicate ID).

in the out.bcf POS 10510352 was collapsed even though these IDs weren't in the IDFILE

#CHROM  POS     ID      REF     ALT     QUAL
22      10510105        22_10510105_T_A T       A       8.33
22      10510113        22_10510113_C_T C       T       17.93
22      10510212        22_10510212_A_T A       T       13.59
22      10510258        22_10510258_C_T C       T       41.37
22      10510341        22_10510341_C_G C       G       6.8
22      10510352        22_10510352_AT_A;22_10510352_ATAAT_A    ATAAT   AAAT,A  15.8
22      10510355        22_10510355_AT_A        AT      A       12.48
22      10510356        22_10510356_T_A T       A       46.64
22      10510445        22_10510445_A_G A       G       21.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions