How to filter out passed SNVs to create new files using bcftools isec.
1
0
Entering edit mode
5 weeks ago

So I have 2 vcf files, I need to make 3 files, where one is unique to file1.vcf and the other is unique to file2.vcf and the last is all common variants that are shared by both files. I need to this all by filtering out the passed SNVs only for each file. I just got started with bcftools yesterday, so I am very new here, but this is my closest attempt on making it happen.

bcftools isec -f 'PASS,.' --types 'snps' [file1.vcf.gz] [file2.vcf.gz] -p dir


isec snv • 292 views
1
Entering edit mode

Where did you get the --types argument from? Which version of bcftools are you using?

1
Entering edit mode
5 weeks ago

Take a look at the bcftools isec documentation, in particular to the --exclude expression. According to the documentation:

exclude sites for which EXPRESSION is true. If -e (or -i) appears only once, the same filtering expression will be applied to all input files. [...] For valid expressions see EXPRESSIONS.

If you look at the EXPRESSIONS list, you can find the TYPE expression, which refers to the variant type.

Your command then should look like this one:

bcftools isec -f 'PASS,.' -e 'TYPE!="snp"' [file1.vcf.gz] [file2.vcf.gz] -p dir


This will exclude all the variants that are not SNVs.

0
Entering edit mode

Thank you sooo much!