How to filter out passed SNVs to create new files using bcftools isec.
1
0
Entering edit mode
2.5 years ago
addamyeo • 0

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

Please help me out. My internship depends on it. Thanks!

isec snv • 926 views
ADD COMMENT
1
Entering edit mode

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

ADD REPLY
1
Entering edit mode
2.5 years 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.

ADD COMMENT
0
Entering edit mode

Thank you sooo much!

ADD REPLY

Login before adding your answer.

Traffic: 1759 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6