@Override public SAMProgramRecord createRecord(final String id, final SAMProgramRecord srcProgramRecord) { return new SAMProgramRecord(id, srcProgramRecord); } };
@Override public SAMProgramRecord createRecord(final String id, final SAMProgramRecord srcProgramRecord) { return new SAMProgramRecord(id, srcProgramRecord); } };
public SAMProgramRecord createRecord(final String id, final SAMProgramRecord srcProgramRecord) { return new SAMProgramRecord(id, srcProgramRecord); } };
@Override AbstractSAMHeaderRecord newGroup(String id) { return new SAMProgramRecord(id); }
/** * @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"); }
/** * Creates a program record (@PG) tag * * @param toolkit the engine * @param walker the walker object (so we can extract the command line) * @param PROGRAM_RECORD_NAME the name for the PG tag * @return a program record for the tool */ public static SAMProgramRecord createProgramRecord(GenomeAnalysisEngine toolkit, Object walker, String PROGRAM_RECORD_NAME) { final SAMProgramRecord programRecord = new SAMProgramRecord(PROGRAM_RECORD_NAME); try { programRecord.setProgramVersion(CommandLineProgram.getVersionNumber()); } catch (MissingResourceException e) { // couldn't care less if the resource is missing... } programRecord.setCommandLine(toolkit.createApproximateCommandLineArgumentString(toolkit, walker)); return programRecord; }
private SAMProgramRecord createProgramRecord() { if ( NO_PG_TAG ) return null; final SAMProgramRecord programRecord = new SAMProgramRecord(PROGRAM_RECORD_NAME); try { programRecord.setProgramVersion(CommandLineProgram.getVersionNumber()); } catch (MissingResourceException e) { // this is left empty on purpose (perhaps Andrey knows why?) } programRecord.setCommandLine(getToolkit().createApproximateCommandLineArgumentString(getToolkit(), this)); return 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); }
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); }
@Test public void testGetSAMString() { SAMProgramRecord r = new SAMProgramRecord("SW-eIV"); r.setProgramName("telnet"); r.setProgramVersion("0.17-40"); r.setCommandLine("telnet towel.blinkenlights.nl"); Assert.assertEquals("@PG\tID:SW-eIV\tPN:telnet\tVN:0.17-40\tCL:telnet towel.blinkenlights.nl", r.getSAMString()); } }
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); }
final String newPgId = pgIdGenerator.getNonCollidingId(PROGRAM_RECORD_ID); chainedPgIds.put(existingId, newPgId); final SAMProgramRecord programRecord = new SAMProgramRecord(newPgId); programRecord.setProgramVersion(PROGRAM_GROUP_VERSION); programRecord.setCommandLine(PROGRAM_GROUP_COMMAND_LINE);
final String newPgId = pgIdGenerator.getNonCollidingId(PROGRAM_RECORD_ID); chainedPgIds.put(existingId, newPgId); final SAMProgramRecord programRecord = new SAMProgramRecord(newPgId); programRecord.setProgramVersion(PROGRAM_GROUP_VERSION); programRecord.setCommandLine(PROGRAM_GROUP_COMMAND_LINE);
@Override List<? extends AbstractSAMHeaderRecord> createGroups(final String[] groupIds) { final List<SamReader> readers = new ArrayList<SamReader>(); for (final String groupId : groupIds) { final SamReader samReader = newFileReader(); final List<SAMProgramRecord> records = new ArrayList<SAMProgramRecord>(); final SAMProgramRecord record = new SAMProgramRecord(groupId); records.add(record); samReader.getFileHeader().setProgramRecords(records); readers.add(samReader); } final List<SAMFileHeader> headers = new ArrayList<SAMFileHeader>(); for (final SamReader reader : readers) { headers.add(reader.getFileHeader()); } CloserUtil.close(readers); final SamFileHeaderMerger fileHeaderMerger = new SamFileHeaderMerger(SAMFileHeader.SortOrder.coordinate, headers, false); return fileHeaderMerger.getMergedHeader().getProgramRecords(); }
prod = new SAMProgramRecord(PROGRAM_RECORD_ID); prod.setProgramVersion(PROGRAM_GROUP_VERSION); prod.setCommandLine(PROGRAM_GROUP_COMMAND_LINE);
@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()); } }
final SAMProgramRecord programRecord = new SAMProgramRecord(pgIdGenerator.getNonCollidingId(PG_PROGRAM_NAME));