Question: Replace missing SNPs of one individual with reference alleles in a VCF file
gravatar for amitgourav.ghosh12
17 months ago by
amitgourav.ghosh1270 wrote:


I have a vcf file of about 565 individuals. I want to replace the missing SNPs of one of them (Ancient sample) with the reference alleles.

I was thinking about trying out the following-

$ bcftools +fixploidy phasedVCF-short02.vcf.gz -- -f 2|bcftools +missing2ref - -- -p > phasedVCF-short03.vcf

But it will probably replace the missing sites in all the individuals.

I am bit confused if there is any function in vcftools or bcftools which would specify to do this operation in only one individual instead of all.

ADD COMMENTlink modified 17 months ago by zx87549.7k • written 17 months ago by amitgourav.ghosh1270

Does it make sense to fix it for just one sample?

ADD REPLYlink written 17 months ago by finswimmer13k

Good question, I am not so sure. Let me find out how the PCA comes out.

Meanwhile, I have figured out a possible way to do it. I converted my ld-pruned bed, bim and fam file to vcf file in plink. It only has the genotypes without the quality parameters. Probably it would be much easier to convert the "./." to "0/0" using awk for my target sample.

ADD REPLYlink written 17 months ago by amitgourav.ghosh1270

The reason to do so because of that sample being an ancient individual had many missing genotypes, thereby messing up my final pca output.

ADD REPLYlink written 16 months ago by amitgourav.ghosh1270
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1688 users visited in the last hour