pcingola / SnpSift

Other
33 stars 20 forks source link

Missing usage documentation on gtfilter #88

Open IdoBar opened 1 month ago

IdoBar commented 1 month ago

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 commented 4 weeks ago

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])"