*
* @param originalHeader original header
* @param programRecord the program record for this program
*/
public static SAMFileHeader setupWriter(final SAMFileHeader originalHeader, final SAMProgramRecord programRecord) {
final SAMFileHeader header = originalHeader.clone();
final List<SAMProgramRecord> oldRecords = header.getProgramRecords();
final List<SAMProgramRecord> newRecords = new ArrayList<SAMProgramRecord>(oldRecords.size()+1);
for ( SAMProgramRecord record : oldRecords )
if ( (programRecord != null && !record.getId().startsWith(programRecord.getId())))
newRecords.add(record);
if (programRecord != null) {
newRecords.add(programRecord);
header.setProgramRecords(newRecords);
}
return header;
}