private void checkProgramRecords() { final SamReader in = SamReaderFactory .makeDefault() .referenceSequence(REFERENCE_SEQUENCE) .open(INPUT); for (final SAMProgramRecord pg : in.getFileHeader().getProgramRecords()) { if (pg.getProgramName() != null && pg.getProgramName().equals(PG_PROGRAM_NAME)) { final String outText = "Found previous Program Record that indicates that this BAM has been downsampled already with this program. Operation not supported! Previous PG: " + pg.toString(); if (ALLOW_MULTIPLE_DOWNSAMPLING_DESPITE_WARNINGS) { log.warn(outText); } else { log.error(outText); throw new PicardException(outText); } } } CloserUtil.close(in); }
private void checkProgramRecords() { final SamReader in = SamReaderFactory .makeDefault() .referenceSequence(REFERENCE_SEQUENCE) .open(INPUT); for (final SAMProgramRecord pg : in.getFileHeader().getProgramRecords()) { if (pg.getProgramName() != null && pg.getProgramName().equals(PG_PROGRAM_NAME)) { final String outText = "Found previous Program Record that indicates that this BAM has been downsampled already with this program. Operation not supported! Previous PG: " + pg.toString(); if (ALLOW_MULTIPLE_DOWNSAMPLING_DESPITE_WARNINGS) { log.warn(outText); } else { log.error(outText); throw new PicardException(outText); } } } CloserUtil.close(in); }
for (final HeaderRecordAndFileHeader<SAMProgramRecord> pair : programGroupsLeftToProcess) { final SAMProgramRecord record = pair.getHeaderRecord(); errorMsg.append("@PG ID:" + record.getProgramGroupId() + " PN:" + record.getProgramName() + " PP:" + record.getPreviousProgramGroupId() + "\n");
for (final HeaderRecordAndFileHeader<SAMProgramRecord> pair : programGroupsLeftToProcess) { final SAMProgramRecord record = pair.getHeaderRecord(); errorMsg.append("@PG ID:" + record.getProgramGroupId() + " PN:" + record.getProgramName() + " PP:" + record.getPreviousProgramGroupId() + "\n");
for( final HeaderRecordAndFileHeader<SAMProgramRecord> pair : programGroupsLeftToProcess ) { final SAMProgramRecord record = pair.getHeaderRecord(); errorMsg.append("@PG ID:"+record.getProgramGroupId()+" PN:"+record.getProgramName()+" PP:"+record.getPreviousProgramGroupId() +"\n");
for (final ExpectedPnAndVn expected : expectedList) { final SAMProgramRecord programRecord = header.getProgramRecord(pgId); if (expected.expectedPn != null) Assert.assertEquals(programRecord.getProgramName(), expected.expectedPn); if (expected.expectedVn != null) Assert.assertEquals(programRecord.getProgramVersion(), expected.expectedVn); pgId = programRecord.getPreviousProgramGroupId();
Assert.assertEquals(pg.getProgramVersion(), "1.0"); Assert.assertEquals(pg.getCommandLine(), "align!"); Assert.assertEquals(pg.getProgramName(), "myAligner"); Assert.assertNull(pg.getCommandLine(), "Program command line not picked up correctly from aligned BAM"); Assert.assertEquals(pg.getProgramName(), "Hey!", "Program name not picked up correctly from aligned BAM");