本文整理汇总了Java中htsjdk.samtools.SAMFileHeader.addProgramRecord方法的典型用法代码示例。如果您正苦于以下问题:Java SAMFileHeader.addProgramRecord方法的具体用法?Java SAMFileHeader.addProgramRecord怎么用?Java SAMFileHeader.addProgramRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.samtools.SAMFileHeader
的用法示例。
在下文中一共展示了SAMFileHeader.addProgramRecord方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetProgramRecord
import htsjdk.samtools.SAMFileHeader; //导入方法依赖的package包/类
@Test
public void testGetProgramRecord() {
final ReadToolsProgram program = new TestProgram();
final String programName = "ReadTools TestProgram";
// test the program record for an empty header
final SAMFileHeader header = new SAMFileHeader();
SAMProgramRecord pg0 = program.getProgramRecord(header);
Assert.assertEquals(pg0.getId(), programName);
Assert.assertEquals(pg0.getProgramName(), programName);
// test adding more program records
for (int i = 1; i < 5; i++) {
header.addProgramRecord(pg0);
pg0 = program.getProgramRecord(header);
Assert.assertEquals(pg0.getId(), programName + "." + i);
Assert.assertEquals(pg0.getProgramName(), programName);
}
}
示例2: testWritingHeader
import htsjdk.samtools.SAMFileHeader; //导入方法依赖的package包/类
@Test(dataProvider = "outputWriterProvider")
public void testWritingHeader(final File outputFile, final SAMProgramRecord record,
final boolean addProgramGroup) throws Exception {
Assert.assertFalse(outputFile.exists(),
"broken test: test output file exists " + outputFile);
final RTOutputBamArgumentCollection args = new RTOutputBamArgumentCollection();
args.outputName = outputFile.getAbsolutePath();
args.addOutputSAMProgramRecord = addProgramGroup;
final GATKReadWriter writer =
args.outputWriter(new SAMFileHeader(), (record == null) ? null : () -> record, true,
null
);
writer.close();
Assert.assertTrue(outputFile.exists(), "not output written");
final SAMFileHeader writtenHeader =
SamReaderFactory.makeDefault().getFileHeader(outputFile);
final SAMFileHeader expectedHeader = new SAMFileHeader();
expectedHeader.setSortOrder(SAMFileHeader.SortOrder.unsorted);
if (addProgramGroup && record != null) {
expectedHeader.addProgramRecord(record);
}
Assert.assertEquals(writtenHeader, expectedHeader);
}
示例3: updateHeader
import htsjdk.samtools.SAMFileHeader; //导入方法依赖的package包/类
/**
* Updates the header with the program record if {@link #addOutputSAMProgramRecord} is
* {@code true} and the supplier is not {@code null}.
*/
@Override
protected final void updateHeader(final SAMFileHeader header,
final Supplier<SAMProgramRecord> programRecord) {
if (addOutputSAMProgramRecord && programRecord != null) {
header.addProgramRecord(programRecord.get());
}
}