Purpose
Replace Sam Header with the header from another sam file. The tool does not do any significant validation, so it's up to the user to make sure that the elements in the header are relevant and that the new header has all the required things.
Replace the SAMFileHeader in a SAM file with the given header. Validation is minimal. It is up to the user to ensure that all the elements referred to in the SAMRecords are present in the new header. Sort order of the two input files must be the same.
Picard documentation
This is a Galaxy wrapper for ReplaceSamHeader, a part of the external package Picard-tools.
Inputs and outputs
Either a sam file or a bam file is required as the file whose header will be replaced. The header file is also required and can also be either sam or bam (it does not have to be the same type as the other file). In both cases, if a bam file is used, it must be coordinate-sorted. Galaxy currently coordinate-sorts all bam files.
The tool will output either bam (the default) or sam. Bam is recommended since it is smaller.
Warning on SAM/BAM quality
Many SAM/BAM files produced externally and uploaded to Galaxy do not fully conform to SAM/BAM specifications. Galaxy deals with this by using the LENIENT flag when it runs Picard, which allows reads to be discarded if they're empty or don't map. This appears to be the only way to deal with SAM/BAM that cannot be parsed.