/** * Adds the given program record to the header, and assigns the PG tag to any SAMRecords * created after it has been added. May be called multiple times in order to assign different * PG IDs to different SAMRecords. programRecord may be null to stop assignment of PG tag. * It is up to the caller to ensure that program record IDs do not collide. */ public void setProgramRecord(final SAMProgramRecord programRecord) { this.programRecord = programRecord; if (programRecord != null) { this.header.addProgramRecord(programRecord); } }
/** * Adds the given program record to the header, and assigns the PG tag to any SAMRecords * created after it has been added. May be called multiple times in order to assign different * PG IDs to different SAMRecords. programRecord may be null to stop assignment of PG tag. * It is up to the caller to ensure that program record IDs do not collide. */ public void setProgramRecord(final SAMProgramRecord programRecord) { this.programRecord = programRecord; if (programRecord != null) { this.header.addProgramRecord(programRecord); } }
/** * Adds the given program record to the header, and assigns the PG tag to any SAMRecords * created after it has been added. May be called multiple times in order to assign different * PG IDs to different SAMRecords. programRecord may be null to stop assignment of PG tag. * It is up to the caller to ensure that program record IDs do not collide. */ public void setProgramRecord(final SAMProgramRecord programRecord) { this.programRecord = programRecord; if (programRecord != null) { this.header.addProgramRecord(programRecord); } }
protected void setProgramRecord(final SAMProgramRecord pg) { if (this.programRecord != null) { throw new IllegalStateException("Cannot set program record more than once on alignment merger."); } this.programRecord = pg; this.header.addProgramRecord(pg); SAMUtils.chainSAMProgramRecord(header, pg); }
protected void setProgramRecord(final SAMProgramRecord pg) { if (this.programRecord != null) { throw new IllegalStateException("Cannot set program record more than once on alignment merger."); } this.programRecord = pg; this.header.addProgramRecord(pg); SAMUtils.chainSAMProgramRecord(header, pg); }
/** * @return a new SAMProgramRecord with an ID guaranteed to not exist in this SAMFileHeader */ public SAMProgramRecord createProgramRecord() { for (int i = 0; i < Integer.MAX_VALUE; ++i) { final String s = Integer.toString(i); if (!this.mProgramRecordMap.containsKey(s)) { final SAMProgramRecord ret = new SAMProgramRecord(s); addProgramRecord(ret); return ret; } } throw new IllegalStateException("Surprising number of SAMProgramRecords"); }
/** * @return a new SAMProgramRecord with an ID guaranteed to not exist in this SAMFileHeader */ public SAMProgramRecord createProgramRecord() { for (int i = 0; i < Integer.MAX_VALUE; ++i) { final String s = Integer.toString(i); if (!this.mProgramRecordMap.containsKey(s)) { final SAMProgramRecord ret = new SAMProgramRecord(s); addProgramRecord(ret); return ret; } } throw new IllegalStateException("Surprising number of SAMProgramRecords"); }
/** * @return a new SAMProgramRecord with an ID guaranteed to not exist in this SAMFileHeader */ public SAMProgramRecord createProgramRecord() { for (int i = 0; i < Integer.MAX_VALUE; ++i) { final String s = Integer.toString(i); if (!this.mProgramRecordMap.containsKey(s)) { final SAMProgramRecord ret = new SAMProgramRecord(s); addProgramRecord(ret); return ret; } } throw new IllegalStateException("Surprising number of SAMProgramRecords"); }
public static SAMFileHeader buildSAMFileHeader(AlignmentHeader alignmentHeader){ SAMFileHeader samFileHeader = new SAMFileHeader(); for(Map.Entry<String, String> entry : alignmentHeader.getAttributes().entrySet()) { samFileHeader.setAttribute(entry.getKey(), entry.getValue()); } for(AlignmentHeader.SequenceRecord sq : alignmentHeader.getSequenceDiccionary()){ SAMSequenceRecord samSequenceRecord = new SAMSequenceRecord(sq.getSequenceName(), sq.getSequenceLength()); for(Map.Entry<String, String> entry : sq.getAttributes().entrySet()) samSequenceRecord.setAttribute(entry.getKey(), entry.getValue()); samFileHeader.addSequence(samSequenceRecord); } for(AlignmentHeader.ReadGroup rg : alignmentHeader.getReadGroups()){ SAMReadGroupRecord samReadGroupRecord = new SAMReadGroupRecord(rg.getId()); for(Map.Entry<String, String> entry : rg.getAttributes().entrySet()){ samReadGroupRecord.setAttribute(entry.getKey(), entry.getValue()); } samFileHeader.addReadGroup(samReadGroupRecord); } for(AlignmentHeader.ProgramRecord pg : alignmentHeader.getProgramRecords()){ SAMProgramRecord samProgramRecord = new SAMProgramRecord(pg.getId()); for(Map.Entry<String, String> entry : pg.getAttributes().entrySet()){ samProgramRecord.setAttribute(entry.getKey(), entry.getValue()); } samFileHeader.addProgramRecord(samProgramRecord); } samFileHeader.setComments(alignmentHeader.getComments()); return samFileHeader; } public static AlignmentHeader buildAlignmentHeader(SAMFileHeader samHeader, String studyName){
private void parsePGLine(final ParsedHeaderLine parsedHeaderLine) { assert(HeaderRecordType.PG.equals(parsedHeaderLine.getHeaderRecordType())); if (!parsedHeaderLine.requireTag(SAMProgramRecord.PROGRAM_GROUP_ID_TAG)) { return; } final SAMProgramRecord programRecord = new SAMProgramRecord(parsedHeaderLine.removeValue(SAMProgramRecord.PROGRAM_GROUP_ID_TAG)); transferAttributes(programRecord, parsedHeaderLine.mKeyValuePairs); mFileHeader.addProgramRecord(programRecord); }
private void parsePGLine(final ParsedHeaderLine parsedHeaderLine) { assert(HeaderRecordType.PG.equals(parsedHeaderLine.getHeaderRecordType())); if (!parsedHeaderLine.requireTag(SAMProgramRecord.PROGRAM_GROUP_ID_TAG)) { return; } final SAMProgramRecord programRecord = new SAMProgramRecord(parsedHeaderLine.removeValue(SAMProgramRecord.PROGRAM_GROUP_ID_TAG)); transferAttributes(programRecord, parsedHeaderLine.mKeyValuePairs); mFileHeader.addProgramRecord(programRecord); }
private void parsePGLine(final ParsedHeaderLine parsedHeaderLine) { assert(HeaderRecordType.PG.equals(parsedHeaderLine.getHeaderRecordType())); if (!parsedHeaderLine.requireTag(SAMProgramRecord.PROGRAM_GROUP_ID_TAG)) { return; } final SAMProgramRecord programRecord = new SAMProgramRecord(parsedHeaderLine.removeValue(SAMProgramRecord.PROGRAM_GROUP_ID_TAG)); transferAttributes(programRecord, parsedHeaderLine.mKeyValuePairs); mFileHeader.addProgramRecord(programRecord); }
programRecord.setProgramName(PROGRAM_GROUP_NAME); programRecord.setPreviousProgramGroupId(existingId); outputHeader.addProgramRecord(programRecord);
programRecord.setProgramName(PROGRAM_GROUP_NAME); programRecord.setPreviousProgramGroupId(existingId); outputHeader.addProgramRecord(programRecord);
@Test public void testChainProgramRecord() { SAMFileHeader header = new SAMFileHeader(); SAMProgramRecord first = header.createProgramRecord(); SAMUtils.chainSAMProgramRecord(header, first); Assert.assertEquals(header.getProgramRecords().size(), 1); Assert.assertNull(first.getPreviousProgramGroupId()); SAMProgramRecord second = header.createProgramRecord(); SAMUtils.chainSAMProgramRecord(header, second); Assert.assertEquals(header.getProgramRecords().size(), 2); Assert.assertNull(first.getPreviousProgramGroupId()); Assert.assertEquals(second.getPreviousProgramGroupId(), first.getProgramGroupId()); SAMProgramRecord third = new SAMProgramRecord("3"); SAMUtils.chainSAMProgramRecord(header, third); header.addProgramRecord(third); Assert.assertEquals(header.getProgramRecords().size(), 3); Assert.assertNull(first.getPreviousProgramGroupId()); Assert.assertEquals(second.getPreviousProgramGroupId(), first.getProgramGroupId()); Assert.assertEquals(third.getPreviousProgramGroupId(), second.getProgramGroupId()); } }
this.mergedHeader.addProgramRecord(program);
this.mergedHeader.addProgramRecord(program);
programRecord.setCommandLine(getCommandLine()); programRecord.setProgramVersion(getVersion()); header.addProgramRecord(programRecord);
programRecord.setCommandLine(getCommandLine()); programRecord.setProgramVersion(getVersion()); header.addProgramRecord(programRecord);
private static SAMFileHeader mergeHeaders(List<RecordSource> sources) { SAMFileHeader header = new SAMFileHeader(); for (RecordSource source : sources) { SAMFileHeader h = source.reader.getFileHeader(); for (SAMSequenceRecord seq : h.getSequenceDictionary().getSequences()) { if (header.getSequenceDictionary().getSequence(seq.getSequenceName()) == null) header.addSequence(seq); } for (SAMProgramRecord pro : h.getProgramRecords()) { if (header.getProgramRecord(pro.getProgramGroupId()) == null) header.addProgramRecord(pro); } for (String comment : h.getComments()) header.addComment(comment); for (SAMReadGroupRecord rg : h.getReadGroups()) { if (header.getReadGroup(rg.getReadGroupId()) == null) header.addReadGroup(rg); } } return header; }