This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Filter VCF File by VCF Format Variants

I am trying to filter a VCF file to only include variants that are within another file, which is a txt file with VCF formatted columns (CHR POS REF ALT). I have been having a hard time finding a way to filter by REF and ALT, in addition to CHR POS (which can be accomplished in plink). Anyone have tips?

snpsift plink bcftools

2 answers

The usual way to do this with plink2 is to first use --set-all-var-ids to make all your variant IDs based on position+alleles, and then use --extract for the filtering step. Note that you can use --recover-var-ids at a later time to restore your original variant IDs when you need them.

convert your tab delimited file to VCF by adding a dummy VCF header and some empty columns (.). You can then use tools like bcftools isec --collapse none .

Log in to answer this question.