This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to filter out duplicate records in a vcf with bcftools?

Is there a bcftools command to remove duplicate records in a vcf file?

If a variant has duplicate records, I'd like to remove all entries of such variant in the vcf.

bcftools vcf

1 answer

Exactly duplicated records?

If the records are truly identical, sort the file and use uniq.

Make sure the vcf isn't compressed before you pass or pipe!

Edit: I should clarify that you don't need to use BCFtools for this. So, use good-old regular uniq not bcftools uniq; that doesn't exist.

Log in to answer this question.