markdup

View as Markdown

Mark duplicated reads in a BAM/CRAM file.

This tool locates and tags duplicate reads in a BAM or CRAM file, where duplicate reads are defined as originating from a single fragment of DNA.

The input BAM/CRAM must be sorted by queryname. If it is not, run Parabricks bamsort with --sort-order queryname to preprocess the input file. Input BAM/CRAMs must also have at least one read group line.

The behavior of GATK MarkDuplicates differs slightly based on whether its input was coordinate or queryname sorted. By default, markdup matches the output of GATK MarkDuplicates as if it were run with a coordinate-sorted BAM. When using --markdups-assume-sortorder-queryname, markdup matches the output of GATK MarkDuplicates as if it were run with a queryname-sorted BAM.

The Fasta reference input --ref is required for CRAM file support and BAM/CRAM header verification.

Refer to the markdup Reference section for a detailed listing of all available options.

Quick Start

1# This command assumes all the inputs are in the current working directory and all the outputs go to the same place.
2docker run --rm --gpus all --volume $(pwd):/workdir --volume $(pwd):/outputdir \
3 --workdir /workdir \
4 nvcr.io/nvidia/clara/clara-parabricks:4.7.1-1 \
5 pbrun markdup \
6 --ref /workdir/${REFERENCE_FILE} \
7 --in-bam /workdir/${INPUT_BAM} \
8 --out-bam /outputdir/${OUTPUT_BAM}

Compatible Baseline Command

The commands below are the GATK counterparts of the Parabricks command above. By default, markdup matches the coordinate sort order baseline; however, note that Parabricks markdup requires a queryname sorted input. Use the queryname sort order baseline if running with --markdups-assume-sortorder-queryname. The gatk SortSam commands are included to guarantee the input sort order for MarkDuplicates; they can be skipped if your file is already in the correct order.

Coordinate Sort Order

1gatk SortSam \
2 -R <INPUT_DIR>/${REFERENCE_FILE} \
3 -I <INPUT_DIR>/${INPUT_BAM} \
4 -O <INPUT_DIR>/${SORTED_BAM} \
5 -SO coordinate
6
7gatk MarkDuplicates \
8 -I <INPUT_DIR>/${SORTED_BAM} \
9 -O <OUTPUT_DIR>/${MARKED_BAM} \
10 -M <OUTPUT_DIR>/${METRICS_FILE} \
11 -ASO coordinate

Queryname Sort Order

1gatk SortSam \
2 -R <INPUT_DIR>/${REFERENCE_FILE} \
3 -I <INPUT_DIR>/${INPUT_BAM} \
4 -O <INPUT_DIR>/${SORTED_BAM} \
5 -SO queryname
6
7gatk MarkDuplicates \
8 -I <INPUT_DIR>/${SORTED_BAM} \
9 -O <OUTPUT_DIR>/${MARKED_BAM} \
10 -M <OUTPUT_DIR>/${METRICS_FILE} \
11 -ASO queryname
12
13gatk SortSam \
14 -R <INPUT_DIR>/${REFERENCE_FILE} \
15 -I <OUTPUT_DIR>/${MARKED_BAM} \
16 -O <OUTPUT_DIR>/${FINAL_BAM} \
17 -SO coordinate

Options

TypeNameRequired?Description
I/O--in-bam IN_BAMYesPath of BAM/CRAM for marking duplicate. Need to be sorted by queryname already. This option is required.
I/O--out-bam OUT_BAMYesPath of BAM/CRAM file after marking duplicate.
I/O--ref REFYesPath to the reference file.
I/O--out-duplicate-metrics OUT_DUPLICATE_METRICSNoPath of duplicate metrics file after marking duplicates.
Tool--markdups-assume-sortorder-querynameNoAssume the reads are sorted by queryname for marking duplicates. This will mark secondary, supplementary, and unmapped reads as duplicates as well. This flag will not impact variant calling while increasing processing times.
Tool--optical-duplicate-pixel-distance OPTICAL_DUPLICATE_PIXEL_DISTANCENoThe maximum offset between two duplicate clusters in order to consider them optical duplicates.
Tool--markdups-single-ended-start-endNoMark duplicate on single-ended reads by 5' and 3' end.
Tool--ignore-rg-markdups-single-endedNoIgnore read group info in marking duplicates on single-ended reads. This option must be used with `--markdups-single-ended-start-end`.
Performance--num-zip-threads NUM_ZIP_THREADSNoNumber of CPUs to use for zipping BAM/CRAM files in a run (default 10).
Performance--num-worker-threads NUM_WORKER_THREADSNoNumber of CPUs to use for markdup in a run (default 10).
Performance--mem-limit MEM_LIMITNoMemory limit in GBs during sorting and postsorting. By default, the limit is half of the total system memory. (default: 62)
Performance--gpuwriteNoUse one GPU to accelerate writing final BAM/CRAM.
Performance--gpuwrite-deflate-algo GPUWRITE_DEFLATE_ALGONoChoose the nvCOMP DEFLATE algorithm to use with --gpuwrite. Note these options do not correspond to CPU DEFLATE options. Valid options are 1, 2, and 4. Option 1 is fastest, while options 2 and 4 have progressively lower throughput but higher compression ratios. The default value is 1 when the user does not provide an input (i.e., None)
Performance--gpusortNoUse GPUs to accelerate sorting and marking.
Runtime--verboseNoEnable verbose output.
Runtime--x3NoShow full command line arguments.
Runtime--logfile LOGFILENoPath to the log file. If not specified, messages will only be written to the standard error output.
Runtime--tmp-dir TMP_DIRNoFull path to the directory where temporary files will be stored. (default: .)
Runtime--with-petagene-dir WITH_PETAGENE_DIRNoFull path to the PetaGene installation directory. By default, this should have been installed at /opt/petagene. Use of this option also requires that the PetaLink library has been preloaded by setting the LD_PRELOAD environment variable. Optionally set the PETASUITE_REFPATH and PGCLOUD_CREDPATH environment variables that are used for data and credentials. Optionally set the PetaLinkMode environment variable that is used to further configure PetaLink, notably setting it to "+write" to enable outputting compressed BAM and .fastq files.
Runtime--keep-tmpNoDo not delete the directory storing temporary files after completion.
Runtime--no-seccomp-overrideNoDo not override seccomp options for docker.
Runtime--versionNoView compatible software versions.
Runtime--preserve-file-symlinksNoOverride default behavior to keep file symlinks intact and *not* resolve the symlink.