## Merge aligned and unaligned BAM

### Description

This Picard tool merges alignment data from a normal aligned BAM file with data in an unmapped BAM file. Before merging, the tool also sorts the aligned BAM file by queryname (QNAME), so that merging is possible. This tool produces a new BAM file that includes all aligned and unaligned reads and also carries forward additional read attributes from the unmapped BAM (attributes that are otherwise lost in the process of alignment). The purpose of this tool is to use information from the unmapped BAM to fix up aligner output. In short, this tool can be used to add the cell and molecular barcode and other tags that were lost during the alignment to the aligned BAM file.

Note that this tool ignores secondary alignments.

Make sure you choose the same reference that was used in the alignment, and check that the input files are assigned correctly!

For more details, please check the home page of Picard tools.

### Parameters

- Reference [Homo_sapiens.GRCh38] (Homo_sapiens.GRCh38, Mus_musculus.GRCm38)

### Output

- merged.bam: Merged BAM