I have a bunch of files (vcf format) each containing site and sample annotations of a copy number variant (following example is part of one of my files, I am showing 11 individuals but they are nearly 900 individuals)
16 32328771 esv3638416;esv3638417;esv3638418;esv3638419;esv3638420 A <CN0>,<CN2>,<CN3>,<CN4>,<CN5> 100 PASS AC=27,84,3220,20,26;AF=0.00539137,0.0167732,0.642971,0.00399361,0.00519169;AN=5008;CS=DUP_gs;END=32370968;NS=2504;SVTYPE=CNV;DP=26381;EAS_AF=0.0099,0.0188,0.5427,0.004,0.0089;AMR_AF=0.0101,0.0058,0.4063,0,0.0014;AFR_AF=0.0015,0.0371,0.8374,0.003,0.003;EUR_AF=0.003,0.0089,0.5189,0.005,0.005;SAS_AF=0.0051,0.0031,0.7791,0.0072,0.0072;VT=SV GT 3|3 3|1 0|3 3|3 3|3 3|0 0|3 3|3 0|0 3|3 1|3
I want to count each allele of CNV in each individual(sample) if there are 0, 1 or 2 copies! this is my desired output (rows are individuals):
CN0 CN2 CN3 CN4 CN5
0 0 2 0 0
1 0 1 0 0
0 0 1 0 0
0 0 2 0 0
0 0 2 0 0
0 0 1 0 0
0 0 1 0 0
0 0 2 0 0
0 0 0 0 0
0 0 2 0 0
1 0 1 0 0
Any idea how to do that?