Perplexing error substituting a JEXL stamement in a shell script (SelectVariants)
Hi All,
When executed 'interactively' from the prompt, the command below behaves as expected:
# command1
gatk SelectVariants \
-R Homo_sapiens_assembly38.fasta \
-V in.vcf.gz \
-O out.vcf.gz \
--se AAC \
--select 'vc.getGenotype("AAC0009").isCalled() && ! vc.getGenotype("AAC0009").isHomRef()'
Similarly, when executed from a shell script with 'hardcoded' SampleIDs in the JEXL statement, it produces the expected output:
#!/bin/bash -e
module load GATK/4.6.2.0
gatk --java-options '-DGATK_STACKTRACE_ON_USER_EXCEPTION=true' SelectVariants \
-R Homo_sapiens_assembly38.fasta \
-V in.vcf.gz \
-O out.vcf.gz \
--se AAC \
--select 'vc.getGenotype("AAC0009").isCalled() && ! vc.getGenotype("AAC0009").isHomRef()'
Perplexingly, susbtituting the SampleIDs in the expression produces the following error (full stack trace below):
A USER ERROR has occurred: Illegal argument value: Positional arguments were provided ',&&{!{vc.getGenotype("AAC009").isHomRef()'}' but no positional argument is defined for this tool.
#!/bin/bash -e
PROBANDID=AAC0009
SelectionExpression="'vc.getGenotype(\"$PROBANDID\").isCalled() && ! vc.getGenotype(\"$PROBANDID\").isHomRef()'"
module load GATK/4.6.2.0-foss-2023a
gatk --java-options '-DGATK_STACKTRACE_ON_USER_EXCEPTION=true' SelectVariants -R Homo_sapiens_assembly38.fasta -V in.vcf.gz -O out.vcf.gz --se AAC --select $SelectionExpression
echo "From script: >"$SelectionExpression"<" # just to check successful substitution
This depite the variable substitution (apparently) generating the corrext JEXL string (enclosed in '><' to identify leading trailing non-char):
From script: >'vc.getGenotype("AAC0009").isCalled() && ! vc.getGenotype("AAC0009").isHomRef()'<
More perplexingly, copying and executing at the prompt the command returned by SelectVariants ('Running') after executing the failing script, works fine!
# command 4
gatk SelectVariants -R Homo_sapiens_assembly38.fasta -V in.vcf.gz -O out.vcf.gz --se AAC --select 'vc.getGenotype("AAC0009").isCalled() && ! vc.getGenotype("AAC0009").isHomRef()'
Yet command1 (working fine) and is identical to command4 (what gatk 'confirmed' when the failing script (substititued SampleIDs) was executed - 'diff' comfrms identity and both work!
I can't understand why the variable substitution creates a command resulting in a GATK error, while it (apparently) has substituted OK.
Any ideas??
Many thanks in advance!
REQUIRED for all errors and issues:
a) GATK version used: 4.6.2.0
b) Exact command used: see message
c) Entire program log (failing script):
bash Extract.sh
Using GATK jar /opt/nesi/zen3/GATK/4.6.2.0-foss-2023a/gatk-package-4.6.2.0-local.jar
Running:
java -Dsamjdk.use_async_io_read_samtools=false -Dsamjdk.use_async_io_write_samtools=true -Dsamjdk.use_async_io_write_tribble=false -Dsamjdk.compression_level=2 -DGATK_STACKTRACE_ON_USER_EXCEPTION=true -jar /opt/nesi/zen3/GATK/4.6.2.0-foss-2023a/gatk-package-4.6.2.0-local.jar SelectVariants -R Homo_sapiens_assembly38.fasta -V in.vcf.gz -O out.vcf.gz --se AAC --select 'vc.getGenotype("AAC009").isCalled() && ! vc.getGenotype("AAC009").isHomRef()'
USAGE: SelectVariants [arguments]
This tool makes it possible to select a subset of variants based on various criteria in order to facilitate certain
analyses. Examples include comparing and contrasting cases vs. controls, extracting variant or non-variant loci that
meet certain requirements, or troubleshooting some unexpected results, to name a few.
Version:4.6.2.0
Required Arguments:
--output,-O <GATKPath> Path to which variants should be written Required.
--variant,-V <GATKPath> A VCF file containing variants Required.
Optional Arguments: #omitted for brevity
***********************************************************************
A USER ERROR has occurred: Illegal argument value: Positional arguments were provided ',&&{!{vc.getGenotype("AAC009").isHomRef()'}' but no positional argument is defined for this tool.
***********************************************************************
org.broadinstitute.barclay.argparser.CommandLineException$BadArgumentValue: Illegal argument value: Positional arguments were provided ',&&{!{vc.getGenotype("AAC009").isHomRef()'}' but no positional argument is defined for this tool.
at org.broadinstitute.barclay.argparser.CommandLineArgumentParser.propagateParsedValues(CommandLineArgumentParser.java:514)
at org.broadinstitute.barclay.argparser.CommandLineArgumentParser.parseArguments(CommandLineArgumentParser.java:170)
at org.broadinstitute.hellbender.cmdline.CommandLineProgram.parseArgs(CommandLineProgram.java:244)
at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:218)
at org.broadinstitute.hellbender.Main.runCommandLineProgram(Main.java:166)
at org.broadinstitute.hellbender.Main.mainEntry(Main.java:209)
at org.broadinstitute.hellbender.Main.main(Main.java:306)
Please sign in to leave a comment.
0 comments