Merges multiple SAM and/or BAM files into a single file. This tool is used for combining SAM and/or BAM files from different runs or read groups, similarly to the "merge" function of Samtools (http://www.htslib.org/doc/samtools.html). Note that to prevent errors in downstream processing, it is critical to identify/label read groups appropriately. If different samples contain identical read group IDs, this tool will avoid collisions by modifying the read group IDs to be unique. For more information about read groups, see the GATK Dictionary entry.
java -jar picard.jar MergeSamFiles I=input_1.bam I=input_2.bam O=merged_files.bam
INPUT (File) SAM or BAM input file Default value: null. This option must be specified at least 1 times.
OUTPUT (File) SAM or BAM file to write merged result to Required.
SORT_ORDER (SortOrder) Sort order of output file Default value: coordinate. This option can be set to 'null' to clear the default value. Possible values: {unsorted, queryname, coordinate, duplicate}
ASSUME_SORTED (Boolean) If true, assume that the input files are in the same sort order as the requested output sort order, even if their headers say otherwise. Default value: false. This option can be set to 'null' to clear the default value. Possible values: {true, false}
MERGE_SEQUENCE_DICTIONARIES (Boolean) Merge the sequence dictionaries Default value: false. This option can be set to 'null' to clear the default value. Possible values: {true, false}
USE_THREADING (Boolean) Option to create a background thread to encode, compress and write to disk the output file. The threaded version uses about 20% more CPU and decreases runtime by ~20% when writing out a compressed BAM file. Default value: false. This option can be set to 'null' to clear the default value. Possible values: {true, false}
COMMENT (String) Comment(s) to include in the merged output file's header. Default value: null. This option may be specified 0 or more times.
INTERVALS (File) An interval list file that contains the locations of the positions to merge. Assume bam are sorted and indexed. The resulting file will contain alignments that may overlap with genomic regions outside the requested region. Unmapped reads are discarded. Default value: null.