I am sure I set the path right but whatever I am trying the command not working

Any help please?

[fi1d18@cyan02 fi1d18]$ picard MarkDuplicates \
    I=DNA.dupmarked.bam \
    O=DNA.dupmarked1.bam \
    M= marked-dup-metrics.txt 
[Thu Mar 07 17:33:42 GMT 2019] picard.sam.markduplicates.MarkDuplicates INPUT=[/temp/hgig/fi1d18/1631_WTSI-OESO_005_a_DNA/mapped_sample/HUMAN_1000Genomes_hs37d5_genomic_WTSI-OESO_005_a_DNA.dupmarked.bam] OUTPUT=/temp/hgig/fi1d18/1631_WTSI-OESO_005_a_DNA/mapped_sample/HUMAN_1000Genomes_hs37d5_genomic_WTSI-OESO_005_a_DNA.dupmarked1.bam METRICS_FILE=marked-dup-metrics.txt MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP=50000 MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=8000 SORTING_COLLECTION_SIZE_RATIO=0.25 REMOVE_SEQUENCING_DUPLICATES=false TAGGING_POLICY=DontTag REMOVE_DUPLICATES=false ASSUME_SORTED=false DUPLICATE_SCORING_STRATEGY=SUM_OF_BASE_QUALITIES PROGRAM_RECORD_ID=MarkDuplicates PROGRAM_GROUP_NAME=MarkDuplicates READ_NAME_REGEX=<optimized capture of last three ':' separated fields as numeric values> OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false GA4GH_CLIENT_SECRETS=client_secrets.json
[Thu Mar 07 17:33:42 GMT 2019] Executing as fi1d18@cyan02 on Linux 2.6.32-754.el6.x86_64 amd64; Java HotSpot(TM) 64-Bit Server VM 1.8.0_51-b16; Picard version: 2.8.3-SNAPSHOT
INFO 2019-03-07 17:33:42 MarkDuplicates Start of doWork freeMemory: 2012347496; totalMemory: 2027945984; maxMemory: 3817865216
INFO 2019-03-07 17:33:42 MarkDuplicates Reading input file and constructing read end information.
INFO 2019-03-07 17:33:42 MarkDuplicates Will retain up to 14684096 data points before spilling to disk.
WARNING: BAM index file /temp/hgig/fi1d18/1631_WTSI-OESO_005_a_DNA/mapped_sample/HUMAN_1000Genomes_hs37d5_genomic_WTSI-OESO_005_a_DNA.dupmarked.bam.bai is older than BAM /temp/hgig/fi1d18/1631_WTSI-OESO_005_a_DNA/mapped_sample/HUMAN_1000Genomes_hs37d5_genomic_WTSI-OESO_005_a_DNA.dupmarked.bam
[Thu Mar 07 17:33:42 GMT 2019] picard.sam.markduplicates.MarkDuplicates done. Elapsed time: 0.01 minutes.
To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp
Exception in thread "main" htsjdk.samtools.SAMFormatException: SAM validation error: ERROR: Record 3752, Read name HX3_22030:3:2114:23155:23319, bin field of BAM record does not equal value computed based on alignment start and end, and length of sequence to which read is aligned
at htsjdk.samtools.SAMUtils.processValidationErrors(SAMUtils.java:448)
at htsjdk.samtools.BAMFileReader$BAMFileIterator.advance(BAMFileReader.java:665)
at htsjdk.samtools.BAMFileReader$BAMFileIterator.next(BAMFileReader.java:650)
at htsjdk.samtools.BAMFileReader$BAMFileIterator.next(BAMFileReader.java:620)
at htsjdk.samtools.SamReader$AssertingIterator.next(SamReader.java:569)
at htsjdk.samtools.SamReader$AssertingIterator.next(SamReader.java:543)
at picard.sam.markduplicates.MarkDuplicates.buildSortedReadEndLists(MarkDuplicates.java:438)
at picard.sam.markduplicates.MarkDuplicates.doWork(MarkDuplicates.java:222)
at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:205)
at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:94)
at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:104)
[fi1d18@cyan02 fi1d18]$

The error message is:

Exception in thread "main" htsjdk.samtools.SAMFormatException: validation error: ERROR: Record 3752, Read name HX3_22030:3:2114:23155:23319, bin field of BAM record does not equal value computed based on alignment start and end, and length of sequence to which read is aligned


[fi1d18@cyan02 sambamba]$ samtools view -H /temp/hgig/fi1d18/1631_WTSI-OESO_005_a_DNA/mapped_sample/HUMAN_1000Genomes_hs37d5_genomic_WTSI-OESO_005_a_DNA.dupmarked.bam
[W::bam_hdr_read] EOF marker is absent. The input is probably truncated.
@HD     VN:1.5  SO:coordinate
@SQ     SN:1    LN:249250621    AS:NCBI37       M5:1b22b98cdeb4a9304cb5d48026a85128     SP:Human  UR:/lustre/scratch117/core/sciops_repository/references/Homo_sapiens/1000Genomes_hs37d5/all/fasta/hs37d5.fa
@SQ     SN:2    LN:243199373    AS:NCBI37       M5:a0d9851da00400dec1098a9255ac712e     SP:Human  UR:/lustre/scratch117/core/sciops_repository/references/Homo_sapiens/1000Genomes_h
  • $\begingroup$ The java executable is not on your PATH. $\endgroup$
    – user172818
    Mar 7, 2019 at 15:19
  • $\begingroup$ Thank you but when I loaded likely related module I got another error in edited post $\endgroup$
    – Zizogolu
    Mar 7, 2019 at 15:42
  • 1
    $\begingroup$ Can you post what that line of the bam looks like? Did you try remaking the bam index, since the software complained about it? $\endgroup$
    – swbarnes2
    Mar 7, 2019 at 23:17
  • 1
    $\begingroup$ Have you considered just using sambamba to mark duplicates? It tends to be faster and less picky. There were a couple old versions of samtools that were messing up the bin assigned to some records, so make sure you use the most recent version in the future if you're not already doing so. $\endgroup$
    – Devon Ryan
    Mar 7, 2019 at 23:39
  • $\begingroup$ Sorry I pasted a few lines of my bam in my main post please consider $\endgroup$
    – Zizogolu
    Mar 8, 2019 at 10:58

1 Answer 1


We've seen this error before on the GATK forum; if you google "bin field of BAM record does not equal value computed based on alignment start and end" you will find this forum thread:


This part of the last post should help you solve this:

The only way I can think of to fix this is to fix the BAM. In order to do that, you would need to convert to SAM format, which does not have a field for indexing bin, and then back to BAM. That would be the safest thing, followed by recreating the BAI. So you can do this with GATK tools using the following commands.

gatk SamFormatConverter - to convert Bam to Sam

gatk SamFormatConverter - to convert Sam back to Bam

gatk BuildBamIndex - to create the Bam index file.

Also, please make sure your Picardtools and GATK versions are up to date to the most recent versions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.