本文整理汇总了Java中htsjdk.samtools.SamReader.Type方法的典型用法代码示例。如果您正苦于以下问题:Java SamReader.Type方法的具体用法?Java SamReader.Type怎么用?Java SamReader.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.samtools.SamReader
的用法示例。
在下文中一共展示了SamReader.Type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSplitReadsByReadGroup
import htsjdk.samtools.SamReader; //导入方法依赖的package包/类
@Test(dataProvider = "splitReadsData")
public void testSplitReadsByReadGroup(final SamReader.Type type,
final String baseName,
final List<String> splitArgs,
final Map<String, Integer> splitCounts) throws Exception {
final String fileExtension = "." + type.fileExtension();
final List<String> args = new ArrayList<>();
Path outputDir = Files.createTempDirectory(
splitArgs.stream().reduce(baseName, (acc, arg) -> acc + "." + arg) + fileExtension + "."
);
outputDir.toFile().deleteOnExit();
args.add("-"+ StandardArgumentDefinitions.INPUT_SHORT_NAME);
args.add(getTestDataDir() + "/" + baseName + fileExtension);
args.add("-"+ StandardArgumentDefinitions.OUTPUT_SHORT_NAME );
args.add(outputDir.toString());
if (isReferenceRequired(type)) {
args.add("-" + StandardArgumentDefinitions.REFERENCE_SHORT_NAME );
args.add(getTestDataDir()+ "/" + getReferenceSequenceName(baseName));
}
splitArgs.forEach(arg -> {
args.add("-" + arg);
});
Assert.assertNull(runCommandLine(args));
for (final Map.Entry<String, Integer> splitCount: splitCounts.entrySet()) {
final String outputFileName = baseName + splitCount.getKey() + fileExtension;
Assert.assertEquals(
getReadCounts(outputDir, baseName, outputFileName),
(int)splitCount.getValue(),
"unexpected read count for " + outputFileName);
}
}
示例2: getSamReaderTypes
import htsjdk.samtools.SamReader; //导入方法依赖的package包/类
private static Stream<SamReader.Type> getSamReaderTypes() {
return Stream
.of(SamReader.Type.class.getFields())
.filter(f -> Modifier.isStatic(f.getModifiers()))
.filter(f -> f.getType().isAssignableFrom(SamReader.Type.class))
.map(f -> orNull(() -> f.get(null)))
.filter(v -> v instanceof SamReader.Type)
.map(v -> (SamReader.Type) v)
.filter(v -> !v.fileExtension().equals("sra")); // exclude SRA file types until we have tests
}
示例3: isReferenceRequired
import htsjdk.samtools.SamReader; //导入方法依赖的package包/类
private boolean isReferenceRequired(final SamReader.Type type) {
return type == SamReader.Type.CRAM_TYPE;
}
示例4: getSplitReadsData
import htsjdk.samtools.SamReader; //导入方法依赖的package包/类
@DataProvider(name = "splitReadsData")
public Object[][] getSplitReadsData() {
final Map<String, Integer> byNone = new TreeMap<>();
byNone.put("", 19);
final Map<String, Integer> bySample = new TreeMap<>();
bySample.put(".Momma", 17);
bySample.put(".Poppa", 2);
final Map<String, Integer> byRG = new TreeMap<>();
byRG.put(".0", 17);
byRG.put(".1", 2);
final Map<String, Integer> byLibrary = new TreeMap<>();
byLibrary.put(".whatever", 19);
final Map<String, Integer> bySampleAndRG = new TreeMap<>();
bySampleAndRG.put(".Momma.0", 17);
bySampleAndRG.put(".Poppa.1", 2);
final Map<String, Integer> bySampleAndRGAndLibrary = new TreeMap<>();
bySampleAndRGAndLibrary.put(".Momma.0.whatever", 17);
// test that reads from RGs with no library attribute are output to "unknown"
final Map<String, Integer> byUnknown = new TreeMap<>();
byUnknown.put(".whatever", 2);
byUnknown.put("." + SplitReads.UNKNOWN_OUT_PREFIX, 17);
final Function<SamReader.Type, Stream<Object[]>> argTests = t -> Stream.of(
new Object[]{t, TEST_DATA_GOOD_READS_PREFIX, Collections.<String>emptyList(), byNone},
new Object[]{t, TEST_DATA_GOOD_READS_PREFIX, Collections.singletonList(SplitReads.SAMPLE_SHORT_NAME), bySample},
new Object[]{t, TEST_DATA_GOOD_READS_PREFIX, Collections.singletonList(SplitReads.READ_GROUP_SHORT_NAME), byRG},
new Object[]{t, TEST_DATA_GOOD_READS_PREFIX, Collections.singletonList(SplitReads.LIBRARY_NAME_SHORT_NAME), byLibrary},
new Object[]{t, TEST_DATA_GOOD_READS_PREFIX, Arrays.asList(SplitReads.SAMPLE_SHORT_NAME, SplitReads.READ_GROUP_SHORT_NAME), bySampleAndRG},
new Object[]{t, TEST_DATA_GOOD_READS_PREFIX, Arrays.asList(
SplitReads.SAMPLE_SHORT_NAME,
SplitReads.READ_GROUP_SHORT_NAME,
SplitReads.LIBRARY_NAME_SHORT_NAME),
bySampleAndRGAndLibrary
},
new Object[]{t, TEST_DATA_MISSING_LIB__PREFIX, Collections.singletonList(SplitReads.LIBRARY_NAME_SHORT_NAME), byUnknown}
);
return getSamReaderTypes()
.map(argTests)
.flatMap(Function.identity())
.toArray(Object[][]::new);
}