If you happen to see a question you know the answer to, please do chime in and help your fellow community members. We encourage our fourm members to be more involved, jump in and help out your fellow researchers with their questions. GATK forum is a community forum and helping each other with using GATK tools and research is the cornerstone of our success as a genomics research community.We appreciate your help!

Test-drive the GATK tools and Best Practices pipelines on Terra

Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.

java.lang.RuntimeException: Error processing input from file.bam: Invalid reference index -1

I'm getting the error above when I run Genome Strip discovery pipeline. I would appreciate help troubleshooting. Below are the lines in the output beginning with the first error through the end of the output, which include the stack trace. Thank you in advance.

ERROR 20:21:24,583 FunctionEdge - Error:  'java'  '-Xmx4096m'  '-XX:+UseParallelOldGC'  '-XX:ParallelGCThreads=4'  '-XX:GCTimeLimit=50'  '-XX:GCHeapFreeLimit=10'  ''  '-cp' '/data/ernestjb/svtoolkit/lib/SVToolkit.jar:/data/ernestjb/svtoolkit/lib/gatk/GenomeAnalysisTK.jar:/data/ernestjb/svtoolkit/lib/gatk/Queue.jar' '-T' 'SVDiscoveryWalker'  '-R' '/scratch/ernestjb/Homo_sapiens_assembly19/Homo_sapiens_assembly19.fasta'  '-I' 'bamFiles.1.2017-05-15.list'  '-O' '/scratch/ernestjb/genomeStrip.2017-07-10/discovery/P0085.discovery.vcf.gz'  '-disableGATKTraversal' 'true'  '-md' '/scratch/ernestjb/genomeStrip.2017-07-10/preprocess'  '-configFile' '/data/ernestjb/svtoolkit/conf/genstrip_parameters.txt'  '-runDirectory' '/scratch/ernestjb/genomeStrip.2017-07-10/discovery'  '-genderMapFile' '/scratch/ernestjb/genomeStrip.2017-07-10/preprocess/'  '-genomeMaskFile' '/scratch/ernestjb/Homo_sapiens_assembly19/Homo_sapiens_assembly19.svmask.fasta'  '-partitionName' 'P0085'  '-runFilePrefix' 'P0085'  '-storeReadPairFile' 'true'  -L NC_007605:1-171823 -searchLocus NC_007605:1-171823 -searchWindow NC_007605:1-171823 -searchMinimumSize 100 -searchMaximumSize 100000
ERROR 20:21:24,590 FunctionEdge - Contents of /spin1/home/linux/ernestjb/code/genomeStrip/SVDiscovery-85.out:
INFO  20:21:14,689 HelpFormatter - -----------------------------------------------------------------------------------------
INFO  20:21:14,692 HelpFormatter - The Genome Analysis Toolkit (GATK) v3.5.GS-r1732-0-gf101448, Compiled 2017/04/18 15:39:27
INFO  20:21:14,692 HelpFormatter - Copyright (c) 2010 The Broad Institute
INFO  20:21:14,692 HelpFormatter - For support and documentation go to
INFO  20:21:14,696 HelpFormatter - Program Args: -T SVDiscoveryWalker -R /scratch/ernestjb/Homo_sapiens_assembly19/Homo_sapiens_assembly19.fasta -O /scratch/ernestjb/genomeStrip.2017-07-10/discovery/P0085.discovery.vcf.gz -disableGATKTraversal true -md /scratch/ernestjb/genomeStrip.2017-07-10/preprocess -configFile /data/ernestjb/svtoolkit/conf/genstrip_parameters.txt -runDirectory /scratch/ernestjb/genomeStrip.2017-07-10/discovery -genderMapFile /scratch/ernestjb/genomeStrip.2017-07-10/preprocess/ -genomeMaskFile /scratch/ernestjb/Homo_sapiens_assembly19/Homo_sapiens_assembly19.svmask.fasta -partitionName P0085 -runFilePrefix P0085 -storeReadPairFile true -L NC_007605:1-171823 -searchLocus NC_007605:1-171823 -searchWindow NC_007605:1-171823 -searchMinimumSize 100 -searchMaximumSize 100000
INFO  20:21:14,701 HelpFormatter - Executing as [email protected] on Linux 2.6.32-642.3.1.el6.x86_64 amd64; Java HotSpot(TM) 64-Bit Server VM 1.8.0_92-b14.
INFO  20:21:14,701 HelpFormatter - Date/Time: 2017/08/16 20:21:14
INFO  20:21:14,701 HelpFormatter - -----------------------------------------------------------------------------------------
INFO  20:21:14,701 HelpFormatter - -----------------------------------------------------------------------------------------
INFO  20:21:15,048 16-Aug-2017 GenomeAnalysisEngine - Strictness is SILENT
INFO  20:21:15,194 16-Aug-2017 GenomeAnalysisEngine - Downsampling Settings: No downsampling
INFO  20:21:15,233 16-Aug-2017 IntervalUtils - Processing 171823 bp from intervals
INFO  20:21:15,320 16-Aug-2017 GenomeAnalysisEngine - Preparing for traversal
INFO  20:21:15,322 16-Aug-2017 GenomeAnalysisEngine - Done preparing for traversal
INFO  20:21:15,322 16-Aug-2017 ProgressMeter -                 | processed |    time |    per 1M |           |   total | remaining
INFO  20:21:15,322 16-Aug-2017 ProgressMeter -        Location |     reads | elapsed |     reads | completed | runtime |   runtime
INFO  20:21:15,322 16-Aug-2017 SVDiscovery - Initializing SVDiscovery ...
INFO  20:21:15,322 16-Aug-2017 SVDiscovery - Reading configuration file ...
INFO  20:21:15,328 16-Aug-2017 SVDiscovery - Read configuration file.
INFO  20:21:15,328 16-Aug-2017 SVDiscovery - Opening reference sequence ...
INFO  20:21:15,329 16-Aug-2017 SVDiscovery - Opened reference sequence.
INFO  20:21:15,329 16-Aug-2017 SVDiscovery - Opening genome mask ...
INFO  20:21:15,336 16-Aug-2017 SVDiscovery - Opened genome mask.
INFO  20:21:15,336 16-Aug-2017 SVDiscovery - Initializing input data set ...
INFO  20:21:15,433 16-Aug-2017 SVDiscovery - Initialized data set: 16 files, 93 read groups, 16 samples.
INFO  20:21:15,434 16-Aug-2017 MetaData - Opening metadata ...
INFO  20:21:15,436 16-Aug-2017 MetaData - Adding metadata directory /scratch/ernestjb/genomeStrip.2017-07-10/preprocess ...
INFO  20:21:15,453 16-Aug-2017 MetaData - Opened metadata.
INFO  20:21:15,457 16-Aug-2017 SVDiscovery - Opened metadata.
INFO  20:21:15,462 16-Aug-2017 MetaData - Loading insert size distributions ...
INFO  20:21:15,637 16-Aug-2017 SVDiscovery - Processing locus: NC_007605:1-171823:100-100000
INFO  20:21:15,638 16-Aug-2017 SVDiscovery - Locus search window: NC_007605:1-171823
Caught exception while processing read: null
##### ERROR ------------------------------------------------------------------------------------------
##### ERROR stack trace
java.lang.RuntimeException: Error processing input from /scratch/ernestjb/sfari/11002/BAM/Sample_SSC03070/analysis/ Invalid reference index -1
  at org.broadinstitute.gatk.engine.executive.Accumulator$StandardAccumulator.finishTraversal(
  at org.broadinstitute.gatk.engine.executive.LinearMicroScheduler.execute(
  at org.broadinstitute.gatk.engine.GenomeAnalysisEngine.execute(
  at org.broadinstitute.gatk.engine.CommandLineExecutable.execute(
  at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(
  at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(
Caused by: java.lang.IllegalArgumentException: Invalid reference index -1
  at htsjdk.samtools.QueryInterval.<init>(
  at htsjdk.samtools.SamReader$PrimitiveSamReaderToSamReaderAdapter.query(
  at htsjdk.samtools.SamReader$PrimitiveSamReaderToSamReaderAdapter.queryContained(
  ... 11 more
##### ERROR ------------------------------------------------------------------------------------------
##### ERROR A GATK RUNTIME ERROR has occurred (version 3.5.GS-r1732-0-gf101448):
##### ERROR
##### ERROR This might be a bug. Please check the documentation guide to see if this is a known problem.
##### ERROR If not, please post the error message, with stack trace, to the GATK forum.
##### ERROR Visit our website and forum for extensive documentation and answers to
##### ERROR commonly asked questions
##### ERROR
##### ERROR MESSAGE: Error processing input from /scratch/ernestjb/sfari/11002/BAM/Sample_SSC03070/analysis/ Invalid reference index -1
##### ERROR ------------------------------------------------------------------------------------------
INFO  20:21:24,591 QGraph - Writing incremental jobs reports...
INFO  20:21:24,591 QJobsReporter - Writing JobLogging GATKReport to file /spin1/home/linux/ernestjb/code/genomeStrip/SVDiscovery.jobreport.txt
INFO  20:21:24,598 QGraph - 5 Pend, 0 Run, 1 Fail, 84 Done
INFO  20:21:24,599 QCommandLine - Writing final jobs report...
INFO  20:21:24,600 QJobsReporter - Writing JobLogging GATKReport to file /spin1/home/linux/ernestjb/code/genomeStrip/SVDiscovery.jobreport.txt
INFO  20:21:24,604 QJobsReporter - Plotting JobLogging GATKReport to file /spin1/home/linux/ernestjb/code/genomeStrip/SVDiscovery.jobreport.pdf
WARN  20:21:26,315 RScriptExecutor - RScript exited with 1. Run with -l DEBUG for more info.
INFO  20:21:26,318 QCommandLine - Done with errors
INFO  20:21:26,342 QGraph - -------
INFO  20:21:26,344 QGraph - Failed:   'java'  '-Xmx4096m'  '-XX:+UseParallelOldGC'  '-XX:ParallelGCThreads=4'  '-XX:GCTimeLimit=50'  '-XX:GCHeapFreeLimit=10'  ''  '-cp' '/data/ernestjb/svtoolkit/lib/SVToolkit.jar:/data/ernestjb/svtoolkit/lib/gatk/GenomeAnalysisTK.jar:/data/ernestjb/svtoolkit/lib/gatk/Queue.jar' '-T' 'SVDiscoveryWalker'  '-R' '/scratch/ernestjb/Homo_sapiens_assembly19/Homo_sapiens_assembly19.fasta'  '-I' 'bamFiles.1.2017-05-15.list'  '-O' '/scratch/ernestjb/genomeStrip.2017-07-10/discovery/P0085.discovery.vcf.gz'  '-disableGATKTraversal' 'true'  '-md' '/scratch/ernestjb/genomeStrip.2017-07-10/preprocess'  '-configFile' '/data/ernestjb/svtoolkit/conf/genstrip_parameters.txt'  '-runDirectory' '/scratch/ernestjb/genomeStrip.2017-07-10/discovery'  '-genderMapFile' '/scratch/ernestjb/genomeStrip.2017-07-10/preprocess/'  '-genomeMaskFile' '/scratch/ernestjb/Homo_sapiens_assembly19/Homo_sapiens_assembly19.svmask.fasta'  '-partitionName' 'P0085'  '-runFilePrefix' 'P0085'  '-storeReadPairFile' 'true'  -L NC_007605:1-171823 -searchLocus NC_007605:1-171823 -searchWindow NC_007605:1-171823 -searchMinimumSize 100 -searchMaximumSize 100000
INFO  20:21:26,344 QGraph - Log:     /spin1/home/linux/ernestjb/code/genomeStrip/SVDiscovery-85.out
INFO  20:21:26,347 QCommandLine - Script failed: 5 Pend, 0 Run, 1 Fail, 84 Done


  • Update: the error was from chromosomes/contigs in my reference genome that were not in my bam headers. In this case, it was the Eptein-Barr virus, NC_007605, which you can see in this log info. I fixed the issue by writing a script that filters out unwanted chromosomes/contigs from all files in the metadata bundle.

Sign In or Register to comment.