To celebrate the release of GATK 4.0, we are giving away free credits for running the GATK4 Best Practices pipelines in FireCloud, our secure online analysis portal. It’s first come first serve, so sign up now to claim your free credits worth $250. Sponsored by Google Cloud. Learn more at

[GATK] unsorted bam in mutect pipeline running in tumor-only mode with make_bamout = true


I need your help on using Mutect2. I tried to call somatic mutations using mutect2_multi_sample.wdl in tumor-only mode with make_bamout = true and scatter_count = 50.
It was failed for a small fraction of samples during the task, MergeBamOuts. It appears that, for those samples, a gathered bam file was not sorted and it failed to index the unsorted bam file.

Below is from stderr of a failed sample. Thank you!

[Mon Feb 19 22:57:09 CST 2018] picard.sam.GatherBamFiles done. Elapsed time: 0.29 minutes.
Using GATK jar mutect2-gatk4.0.1.2/wgs/tumor-only/cromwell-executions/Mutect2_Multi/5a39fcf2-c68d-4a03-b868-648c0e307351/call-Mutect2/shard-68/Mutect2/ccb28ebf-07b7-40e6-b9ef-0ae57a399b36/call-MergeBamOuts/inputs/software/GATK/gatk- defined in environment variable GATK_LOCAL_JAR
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=1 -Xmx6000m -jar gatk-package- GatherBamFiles -I {shard-0.bamout} -I {shard-1.bamout} ... -I {shard-49.bamout} -O unfiltered.vcf.gz.out.bam
-R reference.fasta
[bam_index_core] the alignment is not sorted (K00000:00:H50000000:1:1105:27438:36024): 4613952 > 4613923 in 7-th chr
[bam_index_build2] fail to index the BAM file.

Best Answer


  • SheilaSheila Broad InstituteMember, Broadie, Moderator


    Can you confirm this happens if you try running again? I need to check with the team if they are aware of this, but I have seen that sometimes re-running helps the issue go away :smile:


  • Hi @Sheila,
    Thank you for looking into it. I re-ran Mutect2 and got the error for same tumors.
    It occurred for 3 tumors out of ~50 tumors.

  • dayzcooldayzcool Member

    Thank you, @Sheila! I'll report back. (though not a big fan of homework)

  • SheilaSheila Broad InstituteMember, Broadie, Moderator

    haha @dayzcool We are pretty sure you are savvy enough to handle it :smiley: Thanks for looking into it!

  • Hi @Sheila, thank YOU for the kind help. Here's what I found.
    First, manual sorting and indexing works.
    Second, I did the homework. :wink: For context, I got this error from a different sample.

    [bam_index_core] the alignment is not sorted (HWI-D00008:700:C000000XX:1:1306:4790:41021): 66527505 > 66527490 in 7-th chr

    I was able to find the read in the error message and confirmed that the assembly regions are overlapped. (7-th chr was chr7).

    $ cat 0020-scattered.intervals
    7       4613934 66527481        +       .
    $ cat 0021-scattered.intervals
    7       66527482        128441029       +       .

    In addition, I wonder if variants can be overlapped in case assembly regions are overlapped. (I guess not?)

    Take care!

Sign In or Register to comment.