![]() |
![]()
| ![]() |
![]()
NAMEsamtools markdup - mark duplicate alignments in a coordinate sorted file SYNOPSISsamtools markdup [-l length] [-r] [-T] [-S] [-s] [-f file] [--json] [-d distance] [-c] [-t] [---duplicate-count] [-m] [--mode] [--include-fails] [--no-PG] [-u] [--no-multi-dup] [--read-coords] [--coords-order] [--barcode-tag] [--barcode-name] [--barcode-rgx] [--use-read-groups] in.algsort.bam out.bam DESCRIPTIONMark duplicate alignments from a coordinate sorted file that has been run through samtools fixmate with the -m option. This program relies on the MC and ms tags that fixmate provides. Duplicates are found by using the alignment data for each read (and its mate for paired reads). Position and orientation (which strand it aligns against and in what direction) are used to to compare the reads against one another. If two (or more) reads have the same values then the one with the highest base qualities is held to be the original and the others are the duplicates. It should be noted that samtools markdup looks for duplication first and then classifies the type of duplication afterwards. If your process does not care whether duplication is PCR or optical then it is faster if you do not use the optical duplicate option. Duplicates are marked by setting the alignment's DUP flag. For more details please see: <http://www.htslib.org/algorithms/duplicate.html> OPTIONS
STATISTICSEntries are:
Estimated library size makes various assumptions e.g. the library consists of unique fragments that are randomly selected (with replacement) with equal probability. This is unlikely to be true in practice. However it can provide a useful guide into how many unique read pairs are likely to be available. In particular it can be used to determine how much more data might be obtained by further sequencing of the library. Excluded reads are those marked as secondary, supplementary or unmapped. By default QC failed reads are also excluded but can be included as an option. Excluded reads are not used for calculating duplicates. They can optionally be marked as duplicates if they have a primary that is also a duplicate. EXAMPLESThis first collate command can be omitted if the file is already name ordered or collated:
samtools collate -o namecollate.bam example.bam
Add ms and MC tags for markdup to use later:
samtools fixmate -m namecollate.bam fixmate.bam
Markdup needs position order:
samtools sort -o positionsort.bam fixmate.bam
Finally mark duplicates:
samtools markdup positionsort.bam markdup.bam
Typically the fixmate step would be applied immediately after sequence alignment and the markdup step after sorting by chromosome and position. Thus no additional sort steps are normally needed. To use the regex to obtain coordinates from reads, two or three values have to be captured. To mimic the normal behaviour and match a read name of the format machine:run:flowcell:lane:tile:x:y use:
--read-coords '([!-9;-?A-~]+:[0-9]+:[0-9]+:[0-9]+:[0-9]+):([0-9]+):([0-9]+)' --coords-order txy To match only the coordinates of x:y:randomstuff use:
--read-coords '^([[:digit:]]+):([[:digit:]]+)' --coords-order xy To use a barcode from the read name matching the Illumina example of NDX550136:7:H2MTNBDXX:1:13302:3141:10799:AAGGATG+TCGGAGA use:
--barcode-rgx '[0-9A-Za-z]+:[0-9]+:[0-9A-Za-z]+:[0-9]+:[0-9]+:[0-9]+:[0-9]+:([!-?A-~]+)'
It is possible that complex regular expressions may slow the running of the program. It would be best to keep them simple. AUTHORWritten by Andrew Whitwham from the Sanger Institute. SEE ALSOsamtools(1), samtools-sort(1), samtools-collate(1), samtools-fixmate(1) Samtools website: <http://www.htslib.org/>
|