SnpSift icon indicating copy to clipboard operation
SnpSift copied to clipboard

Missing usage documentation on gtfilter

Open IdoBar opened this issue 1 year ago • 1 comments

Hi, I'm trying to use gtfilter (or Filter GT) module to set individual genotype calls to missing (".") if they match a certain criteria. I managed to do so when filtering based on a minimum depth with:

SnpSift gtfilter -gv './.' "( DP<5 )" file.vcf

However, when I try to also check if the individual genotype is Heterozygote then it fails with an error:

SnpSift gtfilter -gv './.' "( DP<$IND_DP & isHet())"

java.lang.NullPointerException
        at org.snpsift.lang.LangFactory.functionBoolGenotypeFactory(LangFactory.java:369)
        at org.snpsift.lang.LangFactory.functionFactory(LangFactory.java:397)
        at org.snpsift.lang.LangFactory.expressionFactory(LangFactory.java:252)
        at org.snpsift.lang.LangFactory.expressionFactory(LangFactory.java:159)
        at org.snpsift.lang.LangFactory.expressionFactory(LangFactory.java:166)
        at org.snpsift.lang.LangFactory.expressionFactory(LangFactory.java:157)
        at org.snpsift.lang.LangFactory.compile(LangFactory.java:134)
        at org.snpsift.SnpSiftCmdFilterGt.parseExpression(SnpSiftCmdFilterGt.java:256)
        at org.snpsift.SnpSiftCmdFilterGt.run(SnpSiftCmdFilterGt.java:284)
        at org.snpsift.SnpSiftCmdFilterGt.run(SnpSiftCmdFilterGt.java:269)
        at org.snpsift.SnpSift.run(SnpSift.java:579)
        at org.snpsift.SnpSift.main(SnpSift.java:75)
SnpSift FilterGt -gv ./. ( DP<7 ) & (isHet())

How do I tell gtfilter to check the genotype?

Thanks, Ido

IdoBar avatar Jun 17 '24 06:06 IdoBar

If anyone ends up here looking for the same issue, I managed to get it to perform the task with

SnpSift FilterGt -gv ./. " DP<10  | isHet(GEN[0])"

IdoBar avatar Jun 25 '24 02:06 IdoBar