Hi,
Is there a way to set genotypes to missing for a list of positions using vcftools? Thanks!
Best,
Hi,
Is there a way to set genotypes to missing for a list of positions using vcftools? Thanks!
Best,
bcftools plugin setGT : https://samtools.github.io/bcftools/howtos/plugins.html
Sets genotypes according to the specified criteria and filtering expressions. For example, missing genotypes can be set to ref, but much more than that.
Thanks for your answer, however, these solutions all seem to rely on the info in other columns. What I want to do is to set certain genotypes to missing based solely on their position because I have a list positions (that I created using info that isn't in the other columns).
So, for instance, I have a file called X.pos that includes positions to be set to missing, it looks like below: head X.pos: 18863 34659 47022 61505 ... (each pos is a separate line)
In this link http://samtools.github.io/bcftools/bcftools.html, I saw that ID=@file
selects the lines with ID present in the file and with similar logic I tried the following to filter the positions in the file:
bcftools filter -e 'POS=@X.pos' my.vcf.gz
It is just to see if I can filter the vcf to only include the positions in the file but no luck so far. I know the number of positions in X.pos and the output generated is far larger, so I am making a mistake somewhere. maybe the X.pos format is wrong? Any idea?
If It it worked, I was going to try setGT.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
see also: How can I convert heterozygous genotype data to missing data?