Genome Analysis Toolkit

Variant Discovery in High-Throughput Sequencing Data

GATK process banner

Need Help?

Search our documentation

Community Forum

Hi, How can we help?

Developed in the Data Sciences Platform at the Broad Institute, the toolkit offers a wide variety of tools with a primary focus on variant discovery and genotyping. Its powerful processing engine and high-performance computing features make it capable of taking on projects of any size. Learn more

VariantFiltration with VariantContext expression runs with a warning "unknown, ambiguous or inaccessible method getGenotype"

0

4 comments

  • Avatar
    Gökalp Çelik

    Hi again. 

    In order to reach the Genotype attributes using JEXL you need to add the 

    .getGenotype(samplename)

    invocation. Otherwise variant context object can only reach INFO attributes. 

    Regards.

    1
    Comment actions Permalink
  • Avatar
    Sofya Dubovskova

    I did as you suggested and now VariantFiltration runs without the warning, thanks! But it behaves not as I expected. I wanted to check if filtering expressions work fine so I rewrote them to mark rows with AF > 0, therefore all rows with requested genotypes. But it marked only 1 row.

    The command:

    sample='M08260_9_000000000-LFLJ3_1_'

    gatk VariantFiltration \
    --genotype-filter-name "LowAlleleFrac1Var" \
    --genotype-filter-expression "((vc.getGenotype('${sample}').isHet() || vc.getGenotype('${sample}').isHomVar()) && (! vc.getGenotype('${sample}').isHetNonRef())) && (vc.getGenotype('${sample}').getAD().1 / vc.getGenotype('${sample}').getDP() > 0.0)" \
    --genotype-filter-name "LowAlleleFrac2Var" \
    --genotype-filter-expression "vc.getGenotype('${sample}').isHetNonRef() && (vc.getGenotype('${sample}').getAD().1 / vc.getGenotype('${sample}').getDP() > 0.0) && (vc.getGenotype('${sample}').getAD().2 / vc.getGenotype('${sample}').getDP() > 0.0)" \
    --variant $annotated_vcf_filepath \
    --output $filtered_vcf_filepath

    The row this command marked:

    13      32355095        .       A       G       174     PASS    QD=34.80;SOR=1.022      GT:ACN:AD:BSDP:DP:FT:GQ:PL      1/1:0,2:0,5:0,0,5,0:5:LowAlleleFrac1Var:42:174,15,0

    Other rows:

    13      32337044        .       G       C,A     255     PASS    BaseQRankSum=-1.090;QD=12.14;ReadPosRankSum=-4.327;SOR=0.495;TYPE=MULTISNV      GT:ACN:AD:BSDP:DP:GQ:PL      1/2:0,1,1:7,8,6:8,8,4,0:20:99:556,314,417,314,187,417
    13      32337048        .       G       A       64      PASS    BaseQRankSum=0.136;QD=0.01;ReadPosRankSum=-19.770;SOR=0.685     GT:ACN:AD:BSDP:DP:GQ:PL 0/1:1,1:9035,24:12,0,95,0:107:64:418,322,3290
    13      32337066        .       G       A       73      PASS    BaseQRankSum=0.846;QD=0.01;ReadPosRankSum=-0.429;SOR=1.027      GT:ACN:AD:BSDP:DP:GQ:PL 0/1:1,1:8214,73:12,6,92,0:110:73:626,522,3380
    17      43071077        .       T       C       123     PASS    BaseQRankSum=-0.147;QD=6.47;ReadPosRankSum=1.026;SOR=1.265      GT:ACN:AD:BSDP:DP:GQ:PL 0/1:1,1:13,6:0,6,0,12:18:99:209,54,401
    17      43106426        .       C       G       50      PASS    BaseQRankSum=-2.617;QD=3.13;ReadPosRankSum=-3.756;SOR=2.774     GT:ACN:AD:BSDP:DP:GQ:PL 0/1:1,1:13,3:0,4,3,0:7:50:103,21,139

    Please, help me to rewrite this command in the way that will make it output an expected result.

    0
    Comment actions Permalink
  • Avatar
    Gökalp Çelik

    Hi Sofya Dubovskova

    FORMAT/AD and FORMAT/DP  fields contain integer values which java treats them as regular integers during math operation. 

    ##FORMAT=<ID=AD,Number=R,Type=Integer,Description="Allelic depths for the ref and alt alleles in the order listed">
    ##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Approximate read depth (reads with MQ=255 Or with bad mates are filtered)">

    If you wish to get a fraction out of your math operations you need to cast any of those fields to float using an encapsulation. I put an example below. Casting one is enough to get the math operation to return a floating point number. 

    (double) vc.getGenotype('${sample}').getAD().1

    Also you may need to pay attention to your logical operations. Combining multiple logical statements without order will almost always return an unexpected false or true due to unhandled cases. You may need to put your logical operations into parantheses for those that you wish to get evaluated first.

    I hope this helps.

    Regards. 

     

     

    1
    Comment actions Permalink
  • Avatar
    Sofya Dubovskova

    Thank you!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk