This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Filter variants by specific base change pattern

I would like to filter a VCF file by specific base change e.g. C>T & G>A. It seems that VCFtools does not allow this kind of filter. Does anyone has any idea?

Thanks heaps

snp

1 answer

using VCFfilterJs: https://github.com/lindenb/jvarkit/wiki/VCFFilterJS

java -jar dist/vcffilterjs.jar  -e 'variant.getReference().getDisplayString().equals("A") && variant.getAlternateAlleles().size()==1 && variant.getAlternateAlleles().get(0).getDisplayString().equals("C")' input.vcf

or just awk:

awk -F '\t' '($0 ~/^#/ || ($4=="A" && $5=="C"))' input.vcf

Is there is a documentation for the functions used in the filtering variant.getReference().getDisplayString() Or how to decide which argument (function/s) to pass to -e

Log in to answer this question.