Line 1: |
Line 1: |
| + | = Overview of the <code>mergeBam</code> function of <code>bamUtil</code> = |
| + | The <code>mergeBam</code> option on the [[bamUtil]] executable merges multiple BAM files appending ReadGroup IDs if necessary. |
| | | |
− | rgMergeBam merges multiple sorted BAM files into one BAM file like 'samtools merge' command, but merges BAM headers. | + | As of version 1.0.7, this program was renamed from rgMergeBam to mergeBam. |
− | * 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
| |
| | | |
| + | mergeBam merges multiple sorted SAM/BAM files into one BAM file like 'samtools merge' command, but merges BAM headers. |
| + | * Checks that the non RG header fields are identical across the BAM files |
| + | * Checks that the input SAM/BAM records are sorted |
| + | * If --list option is used: |
| + | ** Ensures that the headers are identical across the input 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 |
| + | * If --in is used: |
| + | ** Merges the RG headers from the files, checking that they RG IDs are unique or if they are the same that the rest of the fields are the same |
| | | |
− | === Usage===
| + | |
| + | = Usage= |
| <pre> | | <pre> |
− | RGAMerge [-v] [-l listFile] [-o outFile] [-L logFile] [inputBAMfile1] [inputBAMfile2] ... | + | mergeBam [-v] [--log logFile] [--ignorePI] --list <listFile> --out <outFile> |
| + | </pre> |
| | | |
− | Required arguments: | + | =Parameters= |
− | -l listFile : File containing RG tags including [BAM] [ID] [SM] [LB]
| + | <pre> |
− | -o outFile : output BAM file name
| + | Required parameters : |
− | Optional arguments:
| + | --out/-o : Output BAM file (sorted) |
− | -L logFile : log file name. default is listFile.log
| + | --in/-i : BAM file to be input, must be more than one of these options. |
− | -v : turn on verbose mode
| + | cannot be used with --list/-l |
| + | --list/-l : RGAList File. Tab-delimited list consisting of following columns (with headers): |
| + | BAM* : Input BAM file name to be merged |
| + | ID* : Unique read group identifier |
| + | SM* : Sample name |
| + | LB : Library name |
| + | DS : Description |
| + | PU : Platform unit |
| + | PI : Predicted median insert size |
| + | CN : Name of sequencing center producing the read |
| + | DT : Date the rn was produced |
| + | PL : Platform/technology used to produce the read |
| + | * (Required fields) |
| + | Optional parameters : |
| + | --ignorePI/-I : Ignore the RG PI field when comparing headers |
| + | --log/-L : Log file |
| + | --verbose/-v : Turn on verbose mode |
| </pre> | | </pre> |
| + | {{PhoneHomeParamDesc}} |
| + | |
| + | == Required Parameters== |
| + | |
| + | === Input Files (<code>--in</code>, <code>--list</code>) === |
| + | |
| + | Use multiple <code>--in</code> parameters each followed by an input file name to specify the SAM/BAM input files (more than one <code>--in</code> must be specified). |
| + | |
| + | Alternatively, a RGAList file can be specified using <code>--list</code>. The specified file contains a header row with a tab delimited list of the included columns followed by a row for each BAM file with a tab-delimited list of the values for each column. |
| + | |
| + | The possible header column name are (* indicates required fields): |
| + | * BAM* : Input BAM file name to be merged |
| + | * ID* : Unique read group identifier |
| + | * SM* : Sample name |
| + | * LB : Library name |
| + | * DS : Description |
| + | * PU : Platform unit |
| + | * PI : Predicted median insert size |
| + | * CN : Name of sequencing center producing the read |
| + | * DT : Date the rn was produced |
| + | * PL : Platform/technology used to produce the read |
| + | |
| + | |
| + | The program automatically determines if your input files are SAM/BAM/uncompressed BAM. |
| + | |
| + | {{OutBAMOutputFile}} |
| + | |
| + | == Optional Parameters == |
| + | === Specify Log Filename (<code>--ignorePI</code> or <code>-I</code>) === |
| + | Use <code>--ignorePI</code> to ignore the RG PI field when comparing headers. The field from the first header will be used in the output file. |
| + | |
| + | This parameter was added in version 1.0.10. |
| + | |
| + | === Specify Log Filename (<code>--log</code>) === |
| + | Use <code>--log</code> followed by the log filename to specify the log filename. Default is the output file basename with a <code>.log</code> extension |
| + | |
| + | === Verbose (<code>--verbose</code>) === |
| + | Use <code>--verbose</code> to turn on verbose mode. |
| + | |
| + | |
| + | {{PhoneHomeParameters}} |
| + | |
| + | |
| + | = Return Value = |
| + | Returns 0 on success, non-0 on failure. |
| + | |
| + | |
| + | [[Category:BamUtil|mergeBam]] |
| + | [[Category:BAM Software]] |
| + | [[Category:Software]] |