Why does GATK 4 MarkDuplicatesSpark process entire bam file even when -intervals option is given?

I am trying to understand a use case with GATK MarkDuplicatesSpark when the -intervals option is given .

I am attempting to process a small interval of a larger bam file, 1:1-1000000, for example, with the command line below. Even though I am specifying a small interval, on some level the entire bam file seems to be processed. I cannot find an option that limits the processing to the interval in question.

gatk --java-options '-Xmx32G' MarkDuplicatesSpark \
--spark-master local[5] \
--tmp-dir "/scratch/local/user123/tmp" \
--output-shard-tmp-dir "/scratch/local/user123/tmp/bam" \
--do-not-mark-unmapped-mates \
--intervals "1:1-1000000" \
-I sample.cram \
-O 12000.bam \
-M 12000_20k.txt \
-R GATKBundle/human_g1k_v37_decoy_phiXAdaptr.fasta \
--optical-duplicate-pixel-distance 12000 \
--read-name-regex '[^:]+:[^:]+:[^:]+:[^:]+:([^:]+):([^:]+):([^:]+):[^:]+'

MarkDuplicatesSpark completes within a couple of minutes when given a bam subset that includes only reads from the interval 1:1-1000000 but takes many times longer when given the entire bam file. It would be great to
1. understand why this is occurring
2. read any suggestions to change my command and reduce my processing time




  • bhanuGandhambhanuGandham Cambridge MAMember, Administrator, Broadie, Moderator admin


    When -intervals option is provided MarkDuplicatesSpark is only processing in that interval. It however takes longer than when you provide a bam subset because there is the additional time it takes to process the entire bam to look for the intervals.

Sign In or Register to comment.