Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

merge

Category: ALIGNMENT

Merge pre-sorted BAM files into a single sorted BAM

Description

Merge pre-sorted BAM files into a single sorted BAM.

Performs a k-way merge of multiple BAM files that are already sorted in the same order, producing a single merged output that preserves the sort order. Similar to samtools merge, but supports template-coordinate order.

Input files must all be sorted in the specified sort order.

EXAMPLES:

Merge coordinate-sorted BAMs

fgumi merge -o merged.bam sorted1.bam sorted2.bam sorted3.bam

Merge template-coordinate sorted BAMs

fgumi merge -o merged.bam –order template-coordinate tc1.bam tc2.bam

Merge from a file listing input BAMs (one per line)

fgumi merge -o merged.bam -b input_list.txt –order queryname

Merge with multiple threads

fgumi merge -o merged.bam -@ 4 sorted1.bam sorted2.bam

Arguments

FlagDescriptionDefault
-o, --output <OUTPUT>Output BAM filerequired
inputs <INPUTS>Input BAM files to merge (positional)
-b, --input-list <INPUT_LIST>File containing a list of input BAM paths, one per line
--order <ORDER>Sort order of the input filestemplate-coordinate
-@, --threads <THREADS>Number of threads for parallel operations1
--compression-level <COMPRESSION_LEVEL>Compression level for output BAM (1-12)6