We’re moving the GATK website, docs and forum to a new platform. Read the full story and breakdown of key changes on this blog.
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.
We will be out of the office for a Broad Institute event from Dec 10th to Dec 11th 2019. We will be back to monitor the GATK forum on Dec 12th 2019. In the meantime we encourage you to help out other community members with their queries.
Thank you for your patience!
GenomeLocPArser error in SplitNCigarReads

I don't understand the error message I'm getting and googling it or trying different reference and input files haven't helped.
ERROR MESSAGE: Badly formed genome loc: Parameters to GenomeLocParser are incorrect:The stop position 0 is less than start 38566563 in contig 10
Is the error within the bam file I am trying to split reads within or the reference genome I am aligning to?
Is there any quality control or cleam up method to check if the problem lies within my bam infile? I couldn't find one but when I ran BamIndexStats on the index file of the bam I was trying to use as my infile the line about contig 10 was
10 length= 104305016 Aligned= 61 Unaligned= 3
When I look at the .fai index of my reference genome it has the line
10 104305016 4 60 61
The .dict file also has
@SQ SN:10 LN:104305016 UR:file:/home/bmoran/bin/ens70/Btau.UMD3.1.70.short.fa M5:4c1ab0477783816857a28762f7630deb
When both input and reference files are using the length 104305016 for chromosome 10 I don't understand where the start 38566563 comes from in the error.
Thank you for your help and please let me know if I should supply any more information
Emma
My command
java -Xmx3g -jar /home/bmoran/bin/gatk3.1/GenomeAnalysisTK.jar
-T SplitNCigarReads
-R /home/bmoran/bin/ens70/Btau.UMD3.1.70.short.fa
-I 526_S19_align/526_S19.sort.rmdup.rgps.bam
-o 526_S19_align/526_S19.sort.rmdup.rgps.splitN.bam
-rf ReassignMappingQuality
-DMQ 60
-U ALLOW_N_CIGAR_READS
The complete error message.
INFO 11:56:59,997 GenomeAnalysisEngine - Strictness is SILENT
INFO 11:57:00,075 GenomeAnalysisEngine - Downsampling Settings: No downsampling
INFO 11:57:00,087 SAMDataSource$SAMReaders - Initializing SAMRecords in serial
INFO 11:57:00,112 SAMDataSource$SAMReaders - Done initializing BAM readers: total time 0.02
INFO 11:57:00,192 GenomeAnalysisEngine - Preparing for traversal over 1 BAM files
INFO 11:57:00,198 GenomeAnalysisEngine - Done preparing for traversal
INFO 11:57:00,198 ProgressMeter - [INITIALIZATION COMPLETE; STARTING PROCESSING]
INFO 11:57:00,198 ProgressMeter - Location processed.reads runtime per.1M.reads completed total.runtime remaining
INFO 11:57:00,227 ReadShardBalancer$1 - Loading BAM index data
INFO 11:57:00,228 ReadShardBalancer$1 - Done loading BAM index data
ERROR ------------------------------------------------------------------------------------------
##### ERROR A USER ERROR has occurred (version 3.1-1-g07a4bf8):
ERROR
ERROR This means that one or more arguments or inputs in your command are incorrect.
ERROR The error message below tells you what is the problem.
##### ERROR
ERROR If the problem is an invalid argument, please check the online documentation guide
ERROR (or rerun your command with --help) to view allowable command-line arguments for this tool.
ERROR
##### ERROR Visit our website and forum for extensive documentation and answers to
ERROR commonly asked questions http://www.broadinstitute.org/gatk
ERROR
##### ERROR Please do NOT post this error to the GATK forum unless you have really tried to fix it yourself.
ERROR
ERROR MESSAGE: Badly formed genome loc: Parameters to GenomeLocParser are incorrect:The stop position 0 is less than start 38566563 in contig 10
##### ERROR ------------------------------------------------------------------------------------------
Answers
Can you please try to run this with the latest version (3.2)? If the error persists it may be a bug, as someone else reported a similar issue recently. If so we'll need a snippet of data to reproduce the error (see http://www.broadinstitute.org/gatk/guide/?1894 for instructions).
I downloaded the latest version and get the same error, I'll submit data
[email protected]:/data/efinlay/previous_captures_Paulscript/testingfolder> java -Xmx3g -jar /data/efinlay/GenomeAnalysisTK.jar -T SplitNCigarReads -R /home/bmoran/bin/ens70/Btau.UMD3.1.70.short.fa -I 526_S19_align/526_S19.sort.rmdup.rgps.bam -o 526_S19_align/526_S19.sort.rmdup.rgps.splitN.bam -rf ReassignMappingQuality -DMQ 60 -U ALLOW_N_CIGAR_READS
ERROR MESSAGE: Badly formed genome loc: Parameters to GenomeLocParser are incorrect:The stop position 0 is less than start 38566563 in contig 10
The data in the folder SplitNCigar_EmmaFinlay.tar.gz on ftp.broadinstitute.org
Thank you
@efinlay Thanks for the test files! We have a fix for this going through code review right now. We'll make an announcement when it's available in the nightly builds.
@efinlay
Hi Emma,
This bug has been fixed in the latest nightly build. Please download it here: http://www.broadinstitute.org/gatk/nightly
-Sheila
Thank you very much, I'm no longer getting the error either
Hi, I get to see the same error with GenomeAnalysisTK-3.2-2 version as below.
ERROR MESSAGE: Badly formed genome loc: Parameters to GenomeLocParser are incorrect:The stop position 0 is less than start 12042 in contig chr1
When I tried using with GenomeAnalysisTK-nightly-2014-09-23-g971ff9b.tar.bz2 from the link Sheila has shared above, I don't get the aforesaid error. Since we are planning to use a stable version for our analysis, is it advisable to use GenomeAnalysisTK-nightly-2014-09-23-g971ff9b.tar.bz2 for our pipelines or should we wait for stable release in future. Kindly suggest. Thanks.
Regards
@Lavanya
Hi,
As the nightly builds are a beta release, it is probably best to wait for the next stable release which should be in the next three weeks.
-Sheila
Hi Shiela,
Can you please confirm whether a stable release has been released with the aforesaid bug fix? Thanks.
@Lavanya
Hi,
Yes, there is a new release (version 3.3) that contains the fix. Please download it here: https://www.broadinstitute.org/gatk/auth?package=GATK
-Sheila
Hi Sheila,
I using the version 3.3 i'm still getting the same error (in the SplitNCigarReads step)
ERROR MESSAGE: Badly formed genome loc: Parameters to GenomeLocParser are incorrect:
Regards
Naresh
@naresh4836 It may be a different underlying issue causing your problem. Can you please post your command line and the full console output please?
Command:
/usr/java/jdk1.7.0_03/bin/java -XX:CompileThreshold=1000 -XX:ReservedCodeCacheSize=128m -Djava.io.tmpdir=$k3 -Xmx20g -Xms5g -jar GenomeAnalysisTK.jar -et NO_ET -T SplitNCigarReads -R /reference/sequence/human/ncbi/37.1/allchr.fa -I mergedsort.bam -o Aligned_sort_rg_md_splitNC.bam -rf ReassignOneMappingQuality -RMQF 255 -RMQT 60 -U ALLOW_N_CIGAR_READS
Error:
INFO 16:48:51,068 ProgressMeter - chr17:48151313 1.07580413E8 83.6 m 46.0 s 82.3% 101.6 m 18.0 m
ERROR ------------------------------------------------------------------------------------------
ERROR A USER ERROR has occurred (version nightly-2015-03-25-g84882ed):
ERROR
ERROR This means that one or more arguments or inputs in your command are incorrect.
ERROR The error message below tells you what is the problem.
ERROR
ERROR If the problem is an invalid argument, please check the online documentation guide
ERROR (or rerun your command with --help) to view allowable command-line arguments for this tool.
ERROR
ERROR Visit our website and forum for extensive documentation and answers to
ERROR commonly asked questions http://www.broadinstitute.org/gatk
ERROR
ERROR Please do NOT post this error to the GATK forum unless you have really tried to fix it yourself.
ERROR
ERROR MESSAGE: Badly formed genome loc: Parameters to GenomeLocParser are incorrect:The stop position 48264257 is less than start 48264258 in contig chr17
ERROR ------------------------------------------------------------------------------------------
Hello Geraldine,
Can you please look at the error log file i send you.
@naresh4836
Hi Naresh,
You just need to add -fixNDN to your command and it will run fine. https://www.broadinstitute.org/gatk/guide/tooldocs/org_broadinstitute_gatk_engine_CommandLineGATK.php#--refactor_NDN_cigar_string
-Sheila
Hi Sheila,
I'm still getting the same error
/usr/java/jdk1.7.0_03/bin/java -XX:CompileThreshold=1000 -XX:ReservedCodeCacheSize=128m -Djava.io.tmpdir=$k3 -Xmx20g -Xms5g -jar GenomeAnalysisTK.jar -et NO_ET -T SplitNCigarReads -R /reference/sequence/human/ncbi/37.1/allchr.fa -I mergedsort.bam -o Aligned_sort_rg_md_splitNC.bam -rf ReassignOneMappingQuality -RMQF 255 -RMQT 60 -U ALLOW_N_CIGAR_READS --validation_strictness SILENT -fixNDN
ERROR ------------------------------------------------------------------------------------------
ERROR A USER ERROR has occurred (version nightly-2015-03-25-g84882ed):
ERROR
ERROR This means that one or more arguments or inputs in your command are incorrect.
ERROR The error message below tells you what is the problem.
ERROR
ERROR If the problem is an invalid argument, please check the online documentation guide
ERROR (or rerun your command with --help) to view allowable command-line arguments for this tool.
ERROR
ERROR Visit our website and forum for extensive documentation and answers to
ERROR commonly asked questions http://www.broadinstitute.org/gatk
ERROR
ERROR Please do NOT post this error to the GATK forum unless you have really tried to fix it yourself.
ERROR
ERROR MESSAGE: Badly formed genome loc: Parameters to GenomeLocParser are incorrect:The stop position 48264257 is less than start 48264258 in contig chr17
ERROR ------------------------------------------------------------------------------------------
--Naresh
@naresh4836 Can you please run Picard ValidateSAMFile on your data? I wonder if there's something wrong with some of the data in the file.
Hello Geraldine,
I got the following errors when i ran Picard ValidateSAMFile
Mate alignment does not match alignment start of mate
Mate negative strand flag does not match read negative strand flag of mate
Mate reference index (MRNM) does not match reference index of mate
Regards
Naresh
@naresh4836
Hi Naresh,
You can use Picard's FixMateInformation to fix this error.
-Sheila
Hello Sheila,
I tried the GATK splitNcigar step on the different RNASEQ gsnap aligned bam file(Some sample ran fine with out any error).I got a similar error
Command
/usr/java/jdk1.7.0_03/bin/java -XX:CompileThreshold=1000 -XX:ReservedCodeCacheSize=128m -Djava.io.tmpdir=gsnap -Xmx20g -Xms5g -jar GenomeAnalysisTK.jar -et NO_ET -K /GenomeAnalysisTK/3.1-1/Hossain.Asif_mayo.edu.key -T SplitNCigarReads -R /human/ncbi/hg19/allchr.fa -I Aligned_sort_rg_md_nochrstar_bamtools_isPairedFiltered.bam -o Aligned_sort_rg_md_splitNC.bam -rf ReassignOneMappingQuality -RMQF 255 -RMQT 60 -U ALLOW_N_CIGAR_READS
Error
ERROR ------------------------------------------------------------------------------------------
ERROR A USER ERROR has occurred (version nightly-2015-05-02-g6d40932):
ERROR
ERROR This means that one or more arguments or inputs in your command are incorrect.
ERROR The error message below tells you what is the problem.
ERROR
ERROR If the problem is an invalid argument, please check the online documentation guide
ERROR (or rerun your command with --help) to view allowable command-line arguments for this tool.
ERROR
ERROR Visit our website and forum for extensive documentation and answers to
ERROR commonly asked questions http://www.broadinstitute.org/gatk
ERROR
ERROR Please do NOT post this error to the GATK forum unless you have really tried to fix it yourself.
ERROR
ERROR MESSAGE: Badly formed genome loc: Parameters to GenomeLocParser are incorrect:The stop position 42376807 is less than start 42376808 in contig chr10
ERROR ------------------------------------------------------------------------------------------
INFO 13:39:58,091 ProgressMeter - chr10:42382840 2.22022517E8 100.8 m 27.0 s 55.5% 3.0 h 80.7 m
Can you please give your input how to slove this error
Regards
Naresh
@naresh4836
Hi Naresh,
Are you running on the same bam file from the previous comments where you already validated and fixed the mate information? You can try adding -fixNDN to your command above.
-Sheila
Hello Sheila,
This is a different sample. I tried with -fixNDN still the error persists
Command:
/usr/java/jdk1.7.0_03/bin/java -XX:CompileThreshold=1000 -XX:ReservedCodeCacheSize=128m -Djava.io.tmpdir=gsnap -Xmx20g -Xms5g -jar GenomeAnalysisTK.jar -et NO_ET -K /GenomeAnalysisTK/3.1-1/Hossain.Asif_mayo.edu.key -T SplitNCigarReads -R /human/ncbi/hg19/allchr.fa -I Aligned_sort_rg_md_nochrstar_bamtools_isPairedFiltered.bam -o Aligned_sort_rg_md_splitNC.bam -rf ReassignOneMappingQuality -RMQF 255 -RMQT 60 -U ALLOW_N_CIGAR_READS -fixNDN
Error
ERROR ------------------------------------------------------------------------------------------
ERROR A USER ERROR has occurred (version nightly-2015-05-02-g6d40932):
ERROR
ERROR This means that one or more arguments or inputs in your command are incorrect.
ERROR The error message below tells you what is the problem.
ERROR
ERROR If the problem is an invalid argument, please check the online documentation guide
ERROR (or rerun your command with --help) to view allowable command-line arguments for this tool.
ERROR
ERROR Visit our website and forum for extensive documentation and answers to
ERROR commonly asked questions http://www.broadinstitute.org/gatk
ERROR
ERROR Please do NOT post this error to the GATK forum unless you have really tried to fix it yourself.
ERROR
ERROR MESSAGE: Badly formed genome loc: Parameters to GenomeLocParser are incorrect:The stop position 42376807 is less than start 42376808 in contig chr10
ERROR ------------------------------------------------------------------------------------------
INFO 14:27:39,188 ProgressMeter - chr10:42382747 2.67018824E8 2.3 h 31.0 s 55.5% 4.2 h 111.6 m
Regards
Naresh
@naresh4836
Hi Naresh,
And, Picard's Validate Sam File gives no errors?
-Sheila
Hello Sheila,
I got the following errors when i ran Picard ValidateSAMFile
Mate alignment does not match alignment start of mate
Mate negative strand flag does not match read negative strand flag of mate
Mate reference index (MRNM) does not match reference index of mate
So i ran Picard fixmate step then it gave an error
To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp
Exception in thread "main" htsjdk.samtools.SAMException: Found two records that are paired, not supplementary, and second of the pair
at htsjdk.samtools.SamPairUtil$SetMateInfoIterator.advance(SamPairUtil.java:420)
at htsjdk.samtools.SamPairUtil$SetMateInfoIterator.next(SamPairUtil.java:454)
at htsjdk.samtools.SamPairUtil$SetMateInfoIterator.next(SamPairUtil.java:360)
at picard.sam.FixMateInformation.doWork(FixMateInformation.java:195)
at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:187)
at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:95)
at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:105)
Regards
Naresh
@naresh4836 This error suggests that there are problems in your data. You should consider using a different aligner because the one you are using is producing malformed records.
I tried Picard ValidateSAMFile on an another sample and I got the same error.But i tried GATK SPLITNCIGAR on this sample and it just ran fine with out giving any error.
Regards
Naresh
@naresh4836 It's possible to run another tool on malformed data without getting an error if that particular tool doesn't access the part of the data that is malformed. But this could mask issues that will pop up later in your analysis. Generally speaking it's safer to deal with problems up front. If your aligner is causing malformed data, you should either eliminate the malformed data, fix it or switch to a different aligner.
I have the same problem:
Running picard ValidateSamFile on the BAM in question reports no errors. I've tried to identify the offending read but have only been able to reproduce the problem with a BAM file that contains at least two reads. Each of these on its own is fine. BAM files containing one of these (but not both) reads as well as some other reads also appear to be fine but if both reads are present I get the above error. In case it helps, the CIGAR strings for these reads are
194M51N236M
and14S50M3I23M1D5M1D6M2I14M3D27M5N5I7M11N62I1M6D18M54N186M28S
.@humburg
Hi,
Can you post the exact command you ran? Please also post the entire stack trace you get before the error message.
Thanks,
Sheila
@Sheila
Here is the complete output:
@humburg
Hi,
Can you submit a bug report so I can take a look? Instructions are here.
Thanks,
Sheila
@Sheila
I uploaded an archive with the relevant files (bugreport_humburg_20170522.tar.gz) to the ftp server.
Another thing I noticed while looking at this is that for the reads that are split successfully, the MD tag is not adjusted accordingly. This leaves the BAM records in an inconsistent state.
Issue · Github
by Sheila
@humburg
Hi,
Thanks. I will have a look soon.
-Sheila
Hi @humburg, we are aware that the SplitNCigarReads tool as implemented in GATK 3.x is fairly buggy. We have reimplemented it in the soon-to-be released GATK4 and it's much better, so we won't make any improvements or fixes to the GATK 3.x version anymore. You're welcome to try out the GATK4 version; we'll have documentation coming out on it within the next couple of weeks. In the meantime, our apologies for the inconvenience.