Is there a tool already established to "swap" the ref/alt information in the GT
, AD
and PL
fields of a vcf
file?
For the GT
field, I need to transform: 0/0 -> 1/1
; 1/1 -> 0/0
; 0/1 -> 1/0
; and finally 1/0 -> 0/1
For the AD
field, I need to swap the columns: x,y -> y,x
For the PL
field, I need to swap the columns: x,y,z -> z,y,x
Sample input:
Contig111 11 Contig111_11_T_G T G 4278.22 PASS AC=8;AF=0.073;AN=110;BaseQRankSum=1.35;DP=1176;ExcessHet=0.1448;FS=1.841;InbreedingCoeff=0.1904;QD=13.41;ReadPosRankSum=0.351;set=Intersection GT:AD:DP:GQ:PL 0/0:17,0:17:48:0,48,720 0/1:14,8:22:99:167,0,347 .....
Sample output:
Contig111 11 Contig111_11_T_G T G 4278.22 PASS AC=8;AF=0.073;AN=110;BaseQRankSum=1.35;DP=1176;ExcessHet=0.1448;FS=1.841;InbreedingCoeff=0.1904;QD=13.41;ReadPosRankSum=0.351;set=Intersection GT:AD:DP:GQ:PL 1/1:0,17:17:48:720,48,0 1/0:8,14:22:99:347,0,167 .....
note: the same operations will need to be carried out for all samples if the VCF file has multiple samples (the ...
stand for other potential samples).
Before I dive into scripting ( basically playing with regex), I would like to know if something to process this is already available. I looked into bcftools and fixref but they don't seem to help for this.
GT:AD:DP:GQ:PL
) or do we also need to be able to cope with different orders (so need to infer the position of the AD field from the INFO field)? $\endgroup$