Eliminating calls for a particular chromosome, per sample, in a multisample VCF
1
0
Entering edit mode
7.6 years ago
mmats010 ▴ 80

Hello,

I generated a multisample VCF file using GATK's HaplotypeCaller/GenotypeGCVFs method. In my multisample VCF file, some samples have aneuploid chromosome numbers. For example, Sample1 might be 2N for chr1, chr2, and chr3. Sample2, however, might be 2N for chr1 and chr3, but 3N for chr2.

Is there a way to selectively exclude all of the sample genotypes for Sample2/chr2, while leaving all other sample genotypes for chr2 (and all other chromosomes for Sample2) intact?

I already tried removing the individual chromosomes in the sample .g.vcf files using vcftools and the "--not-chr" options, then re-running GenotypeGVCFs. However, this still included calls for the excluded chromosomes for all of the specified samples, and I can't figure out where the calls themselves were originating from.

Perhaps there is a way to set sample genotypes to "NoCall" for individual chromosomes?

Thanks, Mike

(As a bonus, could a given solution take advantage of a list of chromosomes? Each "chromosome" (chr2, in the above example) is a pseudochromosome scaffold of contigs, and the genotype calls in the VCF refer to the contig names, not the pseudochromosome name. Each pseudochromosome consists of ~20 contigs.)

>less chr2.list
ctg3
ctg78
ctg23
ctg746
...
SNP vcf aneuploid • 1.7k views
ADD COMMENT
1
Entering edit mode
7.6 years ago

This kind of awk script will remove all the genotypes from your vcf for sample "S1" on any chromosome but the chromosome 2. Adjust it to your needs. Note that it doesn't change some values like "DP", .. in the INFO column.

awk -F '\t' '/^#CHROM/ {split($0,header);} /^#/ {print;next;} /^2\t/ { print;next;} {for(i=1;i<=NF;++i) {printf("%s%s",(i>1?"\t":""),(i>9 && header[i]!="S1"?".":$i));}printf("\n"); }'
ADD COMMENT
0
Entering edit mode

Thanks, but does this mean that it will remove every call for every chromosome EXCEPT for chr2, Sample 1? I need to remove the Sample1/chr2 calls themselves, not everything else.

Further, where in your script would I refer to the main "allsamples.vcf" file? Finally, I imagine that the "2" in this part of the script "/^2\t/" is where the chromosome number is specified?

ADD REPLY

Login before adding your answer.

Traffic: 2499 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6