This is a test version of Biostars. For the public version, visit https://www.biostars.org.
gatk Hardfilter Error

Hello, I run the code but I got the Error. Could you pls help me with this issue? How can I fix it?

 gatk VariantFiltration
  -R reference. fasta
  -V input.vcf
  --filter-expression "FILTER == 'PASS' && (QUAL < 30.0 || QD < 2.0 || FS > 60.0 || MQ < 40.0 || MQRankSum < -12.5 || ReadPosRankSum < -8.0)"
  --filter-name "FILTER_NAME"
  -O filtered.vcf
hardfilter

A USER ERROR has occurred: Argument output was missing: Argument 'output' is required.


Set the system property GATK_STACKTRACE_ON_USER_EXCEPTION (--java-options '-DGATK_STACKTRACE_ON_USER_EXCEPTION=true') to print the stack trace. zsh: command not found: -R zsh: command not found: -V zsh: command not found: --filter-expression zsh: command not found: -O

the formatting is missing in your question. how do you break lines ? did you add a antislash at the end of the lines ? didn't you forgot the last antislash before your option -O ?

Actually, I didn't forget, I added it, I tried, then I removed it, but I still got an error.

show us the very complete command line, including the antislash, including the error.

gatk VariantFiltration \
   -R reference.fasta \
   -V input.vcf.gz \
   -O output.vcf.gz \
   --filterExpression "AB < 0.2 || MQ0 > 50" \
   --filterName "my_filters"
/Users/uguremre/opt/anaconda3/bin/gatk:80: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(args) is 0 or (len(args) is 1 and (args[0] == "--help" or args[0] == "-h")):
/Users/uguremre/opt/anaconda3/bin/gatk:80: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(args) is 0 or (len(args) is 1 and (args[0] == "--help" or args[0] == "-h")):
/Users/uguremre/opt/anaconda3/bin/gatk:117: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(args) is 1 and args[0] == "--list":
/Users/uguremre/opt/anaconda3/bin/gatk:301: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if call(["gsutil", "-q", "stat", gcsjar]) is 0:
/Users/uguremre/opt/anaconda3/bin/gatk:305: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if call(["gsutil", "cp", jar, gcsjar]) is 0:
/Users/uguremre/opt/anaconda3/bin/gatk:458: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if not len(properties) is 0:
/Users/uguremre/opt/anaconda3/bin/gatk:462: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if not len(filesToAdd) is 0:
Using GATK jar /Users/uguremre/opt/anaconda3/share/gatk4-4.0.5.1-0/gatk-package-4.0.5.1-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 -jar /Users/uguremre/opt/anaconda3/share/gatk4-4.0.5.1-0/gatk-package-4.0.5.1-local.jar VariantFiltration -R reference.fasta -V input.vcf.gz -O output.vcf.gz --filterExpression AB < 0.2 || MQ0 > 50 --filterName my_filters

USAGE: VariantFiltration [arguments]

Edited by GenoMax : Remainder of message was redacted since it was a print-out of in-line help for this tool.


A USER ERROR has occurred: filterExpression is not a recognized option


Set the system property GATK_STACKTRACE_ON_USER_EXCEPTION (--java-options '-DGATK_STACKTRACE_ON_USER_EXCEPTION=true') to print the stack trace.

A USER ERROR has occurred: filterExpression is not a recognized option

This is the only important message here.

Are you copying and pasting this command from a document? in macOS?

Are you copying and pasting this command from a document? in macOS? Looks like something in your command is not being recognized as a proper option (hyphens or quotes).

This may sound odd but can you turn-off "smart quotes and dashes" option in System Preferences and then type the hyphens and quotes in command by hand?

I tried it but unfortunately, still not working

Are you getting the same error or has that changed?

Have you re-typed every hyphen, quote and = (including one in middle of --filter-expression_?

Yes I re-typed the manual

Can you take out the --filter-expression option and see if the command works?

it worked when I remove it

That goes to show that there is something incorrect about the option in your command line. You will need to fix that.

The example given in the documentation is wrong, the parameters are --filter-expression and --filter-name as listed below, not --filterExpression. I parameter names might have changed between versions and the example hasn't been updated" Michael replied below. I changed them. It. worked thank you so much for your help.

I guess you changed the command in the original post since?

I moved @Michael's comment to an answer. You can accept it (green check mark) to provide closure to this thread.

1 answer

The example given in the documentation is wrong, the parameters are --filter-expression and --filter-name as listed below, not --filterExpression. Parameter names might have changed between versions and the example hasn't been updated.

Thank you so much it worked:)

Log in to answer this question.