4.8 mergeOverlappingReads

Merging paired-end reads in BAM file

mergeOverlappingReads detects overlapping bases between paired‑end reads and soft‑clips all bases in the overlap. This ensures that no base is counted twice when both mates cover the same genomic position. By soft-clipping instead of removing the bases, they are ignored by downstream analyses while preserving the original read structure. It is advisable to run this task before any consecutive variant discovery or population genetic tool if reads weren’t merged yet.

4.8.1 Merging Methods

middle Keep half of the overlapping positions of each mate.
keepFirst Keep read of first mate at overlapping positions
keepSecond Keep read of second mate at overlapping positions.
keepFwd Keep read of forward strand at overlapping positions.
keepRev Keep read of reversed strand at overlapping positions.
random Keep random read for all overlapping positions.

4.8.2 Parameters

4.8.2.1 Input

--bam Input_bam_file.bam Input BAM file

4.8.2.2 Specific Parameters

Parameter Description Default
--mergingMethod method Specify the method to be used for merging. Options: middle, keepFirst, keepSecond, keepFwd, keepRev, random (See the merging methods table). middle
--filterFragmentMismatches [float_value1,float_value2] Remove all fragments whose ratio of number of mismatches to the combined mapped length outside of the specified range. keep all

4.8.3 Output

*_merged.bam A BAM file with merged reads.
*_merged.bam.bai Index files for merged BAM files.

4.8.4 Usage Example

# Simulate a BAM File with paired end reads
atlas simulate --seqType "paired"

# Merge reads
atlas mergeOverlappingReads --bam ATLAS_simulations.bam --fasta ATLAS_simulations.fasta