当前位置: 首页>>代码示例>>Java>>正文


Java SamReader.Type方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:39,代码来源:SplitReadsIntegrationTest.java

示例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
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:11,代码来源:SplitReadsIntegrationTest.java

示例3: isReferenceRequired

import htsjdk.samtools.SamReader; //导入方法依赖的package包/类
private boolean isReferenceRequired(final SamReader.Type type) {
    return type == SamReader.Type.CRAM_TYPE;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:4,代码来源:SplitReadsIntegrationTest.java

示例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);
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:49,代码来源:SplitReadsIntegrationTest.java


注:本文中的htsjdk.samtools.SamReader.Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。