BamUtil: mergeBam
From Genome Analysis Wiki
Jump to navigationJump to searchRGMergeBAM : Merge multiple BAM files appending ReadGroup IDs
rgMergeBam merges multiple sorted BAM files into one BAM file like 'samtools merge' command, but merges BAM headers.
- Checks that the HD and SQ tags are identical across the BAM files
- Adds @RG headers from a tabular input file containing the fields' info
- Adds RG:Z:[RGID] tag for each record based on the source BAM file
- Ensures that the headers are identical across the input files and that input/output BAM records are sorted
Usage
rgMergeBam [-v] [-l listFile] [-o outFile] [-L logFile] [inputBAMfile1] [inputBAMfile2] ... Required arguments: -l listFile : File containing RG tags including [BAM] [ID] [SM] [LB] -o outFile : output BAM file name Optional arguments: -L logFile : log file name. default is listFile.log -v : turn on verbose mode