samtools fixmate [-rpcmu] [-O format] in.nameSrt.bam out.bam
Fill in mate coordinates, ISIZE and mate related flags from a name-sorted or name-collated alignment.
Remove secondary and unmapped reads. If one of a pair is removed, the PAIRED flag will not be unset on the remaining read. This is a change from the older behaviour in samtools versions up to 1.20.
Disable FR proper pair check.
Add template cigar ct tag.
Add ms (mate score) tags. These are used by markdup to select the best reads to keep.
Fix any base modification tags (MM, ML and MN). If we have secondary alignments with hard-clipping and the hard clipped reads do not have an MN tag then we use the base modification tags in the primary alignment to clip the secondary alignment modifications, adding MN tags in the process.
This also does other sanity checks on the consistency of these tags.
Output uncompressed BAM or CRAM.
Write the final output as sam, bam, or cram.
By default, samtools tries to select a format based on the output filename extension; if output is to standard output or no format can be deduced, bam is selected.
Do not add a @PG line to the header of the output file.
Number of input/output compression threads to use in addition to main thread [0].
Perform basic sanitizing of records. FLAGs is a comma-separated list of keywords, defined in the samtools-view(1) man page. By default all FLAGs are enabled. Use -z off to disable this.
Written by Heng Li from the Sanger Institute.
Samtools website: <http://www.htslib.org/>
Copyright © 2023 Genome Research Limited (reg no. 2742969) is a charity registered in England with number 1021457. Terms and conditions.