4.9 mergeRG

Merging read groups in a BAM file

mergeRG merges together read groups that are too small for data analysis. Some data analysis tools require certain amount of reads per read group in order to work properly. Base Quality Score Recalibration (BQSR), for example, requires a minimum of around 6 million reads. If some read groups are too small, mergeRG can be used to merge them.

Read groups should be merged according to library, sequencing run and sequencing lane, in that order. The more diverse the read groups are, the less it is advised to merge them, since programs like BQSR estimate parameters that are very specific to the read group. Read groups that have different post-mortem damage patterns should not be merged. For example, read groups that were treated for post-mortem damage e.g. with Uracil-DNA glycosylase should not be merged with read groups that were not.

4.9.1 Parameters

4.9.1.1 Input

--bam Input_bam_file.bam Input bam file
--readGroups readGroups.txt Merge file. The file must contain a header with two columns: receiver (the name of the resulting read group) and donor (the read groups that will be merged into the receiver)

example readGroups file:

receiver    donor
RG1         RG2
RG3         RG4,RG5,RG6

4.9.1.2 Specific

Parameter Description Default
--outQual integer_1,integer_2 Constrain the quality scores to the indicated range (inclusive) when writing alignments. full range of quality scores
--writeBinnedQualities Write Illumina-binned quality scores. writes raw quality scores

4.9.2 Output

*_mergedRG.bam BAM file with merged Read groups.
*_mergedRG.bam.bai Index file for BAM file with merged Read groups.

4.9.3 Usage Example

# Simulate a BAM File with 3 readgroups
atlas simulate --numReadGroups 3

# Create merge-file which merges SimReadGroup2 into SimReadGroup1
echo "receiver donor" > rgs.txt
echo "SimReadGroup1 SimReadGroup2" >> rgs.txt

# Merge readgroups
atlas mergeRG --bam ATLAS_simulations.bam --readGroups rgs.txt