Java Code Examples for htsjdk.samtools.SAMFileHeader#setProgramRecords()
The following examples show how to use
htsjdk.samtools.SAMFileHeader#setProgramRecords() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HaplotypeBAMDestination.java From gatk with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Create a new HaplotypeBAMDestination * * @param sourceHeader SAMFileHeader used to seed the output SAMFileHeader for this destination. * @param haplotypeReadGroupID read group ID used when writing haplotypes as reads */ protected HaplotypeBAMDestination(SAMFileHeader sourceHeader, final String haplotypeReadGroupID) { Utils.nonNull(sourceHeader, "sourceHeader cannot be null"); Utils.nonNull(haplotypeReadGroupID, "haplotypeReadGroupID cannot be null"); this.haplotypeReadGroupID = haplotypeReadGroupID; bamOutputHeader = new SAMFileHeader(); bamOutputHeader.setSequenceDictionary(sourceHeader.getSequenceDictionary()); bamOutputHeader.setSortOrder(SAMFileHeader.SortOrder.coordinate); final List<SAMReadGroupRecord> readGroups = new ArrayList<>(); readGroups.addAll(sourceHeader.getReadGroups()); // include the original read groups // plus an artificial read group for the haplotypes final SAMReadGroupRecord rgRec = new SAMReadGroupRecord(getHaplotypeReadGroupID()); rgRec.setSample(haplotypeSampleTag); rgRec.setSequencingCenter("BI"); readGroups.add(rgRec); bamOutputHeader.setReadGroups(readGroups); final List<SAMProgramRecord> programRecords = new ArrayList<>(sourceHeader.getProgramRecords()); programRecords.add(new SAMProgramRecord("HaplotypeBAMWriter")); bamOutputHeader.setProgramRecords(programRecords); }
Example 2
Source File: RevertSam.java From picard with MIT License | 5 votes |
private SAMFileHeader createOutHeader( final SAMFileHeader inHeader, final SAMFileHeader.SortOrder sortOrder, final boolean removeAlignmentInformation) { final SAMFileHeader outHeader = new SAMFileHeader(); outHeader.setSortOrder(sortOrder); if (!removeAlignmentInformation) { outHeader.setSequenceDictionary(inHeader.getSequenceDictionary()); outHeader.setProgramRecords(inHeader.getProgramRecords()); } return outHeader; }