protected int doWork() {
IOUtil.assertFileIsReadable(INPUT);
IOUtil.assertFileIsWritable(OUTPUT);
if (INPUT.getAbsolutePath().endsWith(".sam")) {
throw new PicardException("SAM files are not supported");
}
final SAMFileHeader samFileHeader = new SAMFileReader(INPUT).getFileHeader();
for (final String comment : COMMENT) {
if (comment.contains("\n")) {
throw new PicardException("Comments can not contain a new line");
}
samFileHeader.addComment(comment);
}
BamFileIoUtils.reheaderBamFile(samFileHeader, INPUT, OUTPUT, CREATE_MD5_FILE, CREATE_INDEX);