This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Pruning a VCF file and extracting pruned in snps using bcftools

I am new to the field of genomics and have only once or twice uses the bcftools before. I have to run a LMM using RVtests (it takes vcf format as input) for which I need to calculate a kinship matrix. In order to estimate the kinship matrix for each chromosome, I need to prune the vcf file for each chromosome based on a r2 0.25. Going through some earlier posts, I understood that I can use bcftools query. I would really appreciate if someone can suggest me a command line option for pruning a chromosome vcf file and obtaining a file with pruned in snps.

bcftools snp

. Going through some earlier posts, I understood that I can use bcftools query.

which posts please ?

1 answer

You are right that bcftools can be used, but not query; use bcftools +prune instead.

Something like this should work for you:

bcftools +prune -l 0.25 -w 1000 input.bcf -Ob -o output.bcf

Thank you. I have bcftools-1.11 and yes the above command did work but with -m instead of -l.

Log in to answer this question.