How to filter variants called within n base pairs of each other
1
1
Entering edit mode
6.1 years ago
phongphak.06 ▴ 10

I've filtered variants based on quality and depth using bcftools, but I also want to filter them that were called within 5 base pairs of each other. Is there any tools that can do this?

Example

Before filter:

1 153489 A T 
1 154895 C T
1 154898 G C
1 157355 C A

After filter:

1 153489 A T 
1 157355 C A
vcf SNP sequencing next-gen • 1.2k views
ADD COMMENT
0
Entering edit mode
6.1 years ago

using vcffilterjdk: http://lindenb.github.io/jvarkit/VcfFilterJdk.html

$ java -jar dist/vcffilterjdk.jar --body -e 'String prev_contig=null;int prev_end=-1; public Object apply(final VariantContext vc) {boolean ret=!(vc.getContig().equals(prev_contig)  && vc.getStart() - prev_end <=5); prev_contig=vc.getContig();prev_end=vc.getEnd();return ret; }'  in.vcf
ADD COMMENT
0
Entering edit mode

Thank you so much, I'll try this :)

ADD REPLY

Login before adding your answer.

Traffic: 1627 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