RealignerTargetCreater: A USER ERROR has occurred: '-T' is not a valid command.

Hi,
I was running GATK RealignerTargetCreater . I ran the same command before with another bam file and it ran fine. Both of the bam files were produced using BWA MEM, sorted, indexed, fixed mate information (samtools) and then duplicate removed by PICARD.

My command is as follows:
java -jar GenomeAnalysisTK.jar \
-T RealignerTargetCreator \
-R reference.fasta \
-I input.bam \
--known indels.vcf \
-o forIndelRealigner.intervals

In the end, the error were occured:


A USER ERROR has occurred: '-T' is not a valid command.


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

It would be most helpful if someone can tell me how to solve this problem. Many thanks in advance.
Regards

Best Answers

  • SheilaSheila Broad Institute admin
    Accepted Answer

    @erya
    Hi,

    Have you resolved this? It looks like your command may have some extra space between GenomeAnalysisTK.jar and -T RealignerTargetCreator. Are you using the \ ? Perhaps try removing those.

    -Sheila

  • Accepted Answer

    This is the whole commend I have used:
    java -jar -Djava.io.tmpdir=./tmp/ /home/wang/Documents/gatk-4.0.1.0/gatk-package-4.0.1.0-local.jar -T RealignerTargetCreator -R /mnt/hgfs/D/analysis/populus/LG1.fasta -I bwa_aln.sorted.dedup.bam -O bwa_sorted_dedup.bam.interals

Answers

  • SheilaSheila Broad InstituteMember, Broadie, Moderator admin
    Accepted Answer

    @erya
    Hi,

    Have you resolved this? It looks like your command may have some extra space between GenomeAnalysisTK.jar and -T RealignerTargetCreator. Are you using the \ ? Perhaps try removing those.

    -Sheila

  • eryaerya Member

    There is the whole commend I have used:
    java -jar -Djava.io.tmpdir=./tmp/ /home/wang/Documents/gatk-4.0.1.0/gatk-package-4.0.1.0-local.jar -T RealignerTargetCreator -R /mnt/hgfs/D/analysis/populus/LG1.fasta -I bwa_aln.sorted.dedup.bam -o bwa_sorted_dedup.bam.interals

  • eryaerya Member
    Accepted Answer

    This is the whole commend I have used:
    java -jar -Djava.io.tmpdir=./tmp/ /home/wang/Documents/gatk-4.0.1.0/gatk-package-4.0.1.0-local.jar -T RealignerTargetCreator -R /mnt/hgfs/D/analysis/populus/LG1.fasta -I bwa_aln.sorted.dedup.bam -O bwa_sorted_dedup.bam.interals

  • eryaerya Member

    Hi, SkyWarrior, thanks for your answer. So which command should I use?

  • eryaerya Member

    Hi,
    Shelina and SkyWarrior,

    When I use other tools, just like HaplotypeCaller, there really present similar error.
    The command is:
    java -jar /home/wang/Documents/gatk-4.0.2.1/gatk-package-4.0.2.1-local.jar -R /mnt/hgfs/D/analysis/populus/Populus.fasta -T HaplotypeCaller -I bwa_aln.sorted.dedup.bam --emitRefConfidence GVCF [--dbsnp dbSNPvcf] [-L targets.interval_list] -o bwa_output.raw.snps.indels.g.vcf

    So, I think the problem is others, rather than the tool or my command. One of it probability: how to deal the problem of stack trace, as it present:
    Set the system property GATK_STACKTRACE_ON_USER_EXCEPTION (--java-options '-DGATK_STACKTRACE_ON_USER_EXCEPTION=true') to print the stack trace.

    In addition, the GATK version is 4.0.

  • SkyWarriorSkyWarrior TurkeyMember ✭✭✭

    You need to run GATK4 using the gatk script in the same folder where you extract your jar files. Calling the jar file directly is not supported.

    -T is not present in gatk script anymore. Use

    gatk HaplotypeCaller ....
    directly.

  • egst16egst16 Member

    Hello everyone,
    I'm new to gatk toolkit. I'm trying to use the option gatk HaplotypeCaller in GATK-4.0.5.0 and getting this error.

    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 /home/dell/gatk-4.0.5.0/gatk-package-4.0.5.0-local.jar HaplotypeCaller
    Exception in thread "main" java.lang.IllegalArgumentException: Allowed values request for unrecognized string argument: input
    at org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKAnnotationPluginDescriptor.getAllowedValuesForDescriptorHelp(GATKAnnotationPluginDescriptor.java:246)
    at org.broadinstitute.barclay.argparser.CommandLineArgumentParser.usageForPluginDescriptorArgumentIfApplicable(CommandLineArgumentParser.java:870)
    at org.broadinstitute.barclay.argparser.CommandLineArgumentParser.makeArgumentDescription(CommandLineArgumentParser.java:847)
    at org.broadinstitute.barclay.argparser.CommandLineArgumentParser.printArgumentUsage(CommandLineArgumentParser.java:791)
    at org.broadinstitute.barclay.argparser.CommandLineArgumentParser.lambda$printArgumentUsageBlock$2(CommandLineArgumentParser.java:276)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:352)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.broadinstitute.barclay.argparser.CommandLineArgumentParser.printArgumentUsageBlock(CommandLineArgumentParser.java:276)
    at org.broadinstitute.barclay.argparser.CommandLineArgumentParser.usage(CommandLineArgumentParser.java:308)
    at org.broadinstitute.hellbender.cmdline.CommandLineProgram.getUsage(CommandLineProgram.java:437)
    at org.broadinstitute.hellbender.Main.mainEntry(Main.java:208)
    at org.broadinstitute.hellbender.Main.main(Main.java:289)

  • SkyWarriorSkyWarrior TurkeyMember ✭✭✭

    Can you post your full command line? Also can you upgrade to 4.0.5.1?

  • egst16egst16 Member

    Thanks for the reply. Will do upgrade.

    Used command:
    java -jar /home/dell/gatk-4.0.5.0/gatk-package-4.0.5.0-local.jar HaplotypeCaller -I raw1_ind.bam -o sample_1.vcf

  • SkyWarriorSkyWarrior TurkeyMember ✭✭✭

    You need to use -O for the output switch. Also I recommend using the gatk python script file to run GATK4.

  • egst16egst16 Member

    Still i've some issues in HaplotypeCaller,

    I used this command:

    java -jar /home/dell/gatk-4.0.5.1/gatk-package-4.0.5.1-local.jar HaplotypeCaller -R /home/dell/WGS/indica/ref_file/Indica.genome.fasta -I raw1_ind.bam -O sample_1.vcf

    Error:

    17:05:14.593 INFO HaplotypeCallerEngine - Disabling physical phasing, which is supported only for reference-model confidence output
    17:05:14.608 INFO HaplotypeCaller - Shutting down engine
    [26 June, 2018 5:05:14 PM IST] org.broadinstitute.hellbender.tools.walkers.haplotypecaller.HaplotypeCaller done. Elapsed time: 0.01 minutes.
    Runtime.totalMemory()=652214272
    java.lang.IllegalArgumentException: samples cannot be empty
    at org.broadinstitute.hellbender.utils.Utils.validateArg(Utils.java:722)
    at org.broadinstitute.hellbender.tools.walkers.haplotypecaller.ReferenceConfidenceModel.(ReferenceConfidenceModel.java:177)
    at org.broadinstitute.hellbender.tools.walkers.haplotypecaller.HaplotypeCallerEngine.initialize(HaplotypeCallerEngine.java:204)
    at org.broadinstitute.hellbender.tools.walkers.haplotypecaller.HaplotypeCallerEngine.(HaplotypeCallerEngine.java:156)
    at org.broadinstitute.hellbender.tools.walkers.haplotypecaller.HaplotypeCaller.onTraversalStart(HaplotypeCaller.java:227)
    at org.broadinstitute.hellbender.engine.GATKTool.doWork(GATKTool.java:992)
    at org.broadinstitute.hellbender.cmdline.CommandLineProgram.runTool(CommandLineProgram.java:135)
    at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMainPostParseArgs(CommandLineProgram.java:180)
    at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:199)
    at org.broadinstitute.hellbender.Main.runCommandLineProgram(Main.java:160)
    at org.broadinstitute.hellbender.Main.mainEntry(Main.java:203)
    at org.broadinstitute.hellbender.Main.main(Main.java:289)

  • SkyWarriorSkyWarrior TurkeyMember ✭✭✭

    Can you try your command with the included python script only?

    Also

    java.lang.IllegalArgumentException: samples cannot be empty

    Did you preprocess your bam files according to best practices? Does your bam file include sample name tags etc...

  • egst16egst16 Member

    i didnt try with python script and what is about that script file.

    bam files were preprocessed according to best practices, Using FastaToSam and RevertSam tools mentioned.

    Error:

    A USER ERROR has occurred: Input files reference and reads have incompatible contigs: No overlapping contigs found.
    reference contigs = [10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    reads contigs = []

  • SkyWarriorSkyWarrior TurkeyMember ✭✭✭

    Looks like things are messed up at your end.

    1- FastqToSam and/or RevertSam is used to generate unmapped bam file for merging metainfo. Bam files produced from these tools cannot be used for anything other than merging metainfo. That's why your reads do not contain any contigs.

    2- Downloaded zip file from GATK main page includes a gatk file which is the runner python script to call all parameters switches and proper tools from gatk4 jar. It is not recommended to run gatk4 jar file directly but this method.

    usage is below

    path/to/gatk ToolName +
    all the required params etc...

  • egst16egst16 Member

    Used gatk file, but end up with same error.

    java.lang.IllegalArgumentException: samples cannot be empty

    Command line:

    /home/dell/gatk-4.0.5.1/gatk HaplotypeCaller -R /home/dell/reference/nippon/IRGSP-1.0_genome.fasta -I rawsample1_sorted.bam -O data1.vcf

  • SkyWarriorSkyWarrior TurkeyMember ✭✭✭

    Did you map your reads with BWA MEM?

  • egst16egst16 Member
    edited June 29

    yes, i did.

    command line:
    * bwa index ref.fa
    * bwa mem ref.fa reads.fq > sample.sam
    * samtools view -S -b sample.sam > sample.bam
    * samtools view -bF 4 sample.bam > sample_filtered.bam
    * java -jar /home/dell/picard/build/libs/picardcloud.jar SortSam \I=sample1_filtered.bam \O=sample1_sorted.bam \SORT_ORDER=coordinate
    * samtools index sample_sorted.bam

  • SkyWarriorSkyWarrior TurkeyMember ✭✭✭

    samtools view -bF 4 sample.bam > sample_filtered.bam

    Here is your culprit.

    0x4 flag is for reads that are unmapped. Do not filter your reads. HaplotypeCaller already filters them during analysis.

  • egst16egst16 Member

    Skipped flag option and corrected bam file. Also, i've done bam validation using ValidateSamFile.

    Same error comes.
    java.lang.IllegalArgumentException: samples cannot be empty

  • SkyWarriorSkyWarrior TurkeyMember ✭✭✭

    Did you add sample names to your bam file?

    If not you need to add sample names to it.

  • egst16egst16 Member

    No, i didnt..
    i've added sample names to bam file.
    Now, it's running. Thanks much @SkyWarrior for your guidance :)

Sign In or Register to comment.