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


Java SamReaderFactory.referenceSequence方法代码示例

本文整理汇总了Java中htsjdk.samtools.SamReaderFactory.referenceSequence方法的典型用法代码示例。如果您正苦于以下问题:Java SamReaderFactory.referenceSequence方法的具体用法?Java SamReaderFactory.referenceSequence怎么用?Java SamReaderFactory.referenceSequence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在htsjdk.samtools.SamReaderFactory的用法示例。


在下文中一共展示了SamReaderFactory.referenceSequence方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeReads

import htsjdk.samtools.SamReaderFactory; //导入方法依赖的package包/类
/**
 * Initialize our source of reads data (or set it to null if no reads argument(s) were provided).
 *
 * Package-private so that engine classes can access it, but concrete tool child classes cannot.
 * May be overridden by traversals that require custom initialization of the reads data source.
 */
void initializeReads() {
    if (! readArguments.getReadFiles().isEmpty()) {
        SamReaderFactory factory = SamReaderFactory.makeDefault().validationStringency(readArguments.getReadValidationStringency());
        if (hasReference()) { // pass in reference if available, because CRAM files need it
            factory = factory.referenceSequence(referenceArguments.getReferencePath());
        }
        else if (hasCramInput()) {
            throw new UserException.MissingReference("A reference file is required when using CRAM files.");
        }

        if(bamIndexCachingShouldBeEnabled()) {
            factory = factory.enable(SamReaderFactory.Option.CACHE_FILE_BASED_INDEXES);
        }

        reads = new ReadsDataSource(readArguments.getReadPaths(), readArguments.getReadIndexPaths(), factory, cloudPrefetchBuffer,
            (cloudIndexPrefetchBuffer < 0 ? cloudPrefetchBuffer : cloudIndexPrefetchBuffer));
    }
    else {
        reads = null;
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:28,代码来源:GATKTool.java

示例2: getDuplicateCountForBam

import htsjdk.samtools.SamReaderFactory; //导入方法依赖的package包/类
private static int getDuplicateCountForBam(final File bam, final File referenceFile) throws IOException {
    int duplicateCount = 0;
    final SamReaderFactory factory = SamReaderFactory.makeDefault();
    if(referenceFile != null) {
        factory.referenceSequence(referenceFile);
    }
    try ( final SamReader reader = factory.open(bam) ) {
        for ( SAMRecord read : reader ) {
            if ( read.getDuplicateReadFlag() ) {
                ++duplicateCount;
            }
        }
    }

    return duplicateCount;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:17,代码来源:UnmarkDuplicatesIntegrationTest.java

示例3: testReadFilters

import htsjdk.samtools.SamReaderFactory; //导入方法依赖的package包/类
@Test(dataProvider = "readFilterTestData")
public void testReadFilters(
        final String input,
        final String reference,
        final String extOut,
        final List<String> inputArgs,
        final int expectedCount) throws IOException
{
    final File outFile = createTempFile("testReadFilter", extOut);

    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("-I"); args.add(new File(TEST_DATA_DIR, input).getAbsolutePath());
    args.add("-O"); args.add(outFile.getAbsolutePath());
    if ( reference != null ) {
        args.add("-R"); args.add(new File(TEST_DATA_DIR, reference).getAbsolutePath());
    }
    for (final String filter : inputArgs) {
        args.add(filter);
    }

    runCommandLine(args);


    SamReaderFactory factory = SamReaderFactory.makeDefault();
    if (reference != null) {
        factory = factory.referenceSequence(new File(TEST_DATA_DIR, reference));
    }
    int count = 0;
    try (final SamReader reader = factory.open(outFile)) {
        Iterator<SAMRecord> it = reader.iterator();
        while (it.hasNext()) {
            SAMRecord rec = it.next();
            count++;
        }
    }
    Assert.assertEquals(count, expectedCount);
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:38,代码来源:PrintReadsIntegrationTest.java

示例4: testReadFilters

import htsjdk.samtools.SamReaderFactory; //导入方法依赖的package包/类
@Test(dataProviderClass = org.broadinstitute.hellbender.tools.PrintReadsIntegrationTest.class, dataProvider = "readFilterTestData", groups = "spark")
public void testReadFilters(
        final String input,
        final String reference,
        final String extOut,
        final List<String> inputArgs,
        final int expectedCount) throws IOException
{
    final File outFile = createTempFile("testReadFilter", extOut);

    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("-I"); args.add(new File(TEST_DATA_DIR, input).getAbsolutePath());
    args.add("-O"); args.add(outFile.getAbsolutePath());
    if ( reference != null ) {
        args.add("-R"); args.add(new File(TEST_DATA_DIR, reference).getAbsolutePath());
    }
    for (final String filter : inputArgs) {
        args.add(filter);
    }

    runCommandLine(args);


    SamReaderFactory factory = SamReaderFactory.makeDefault();
    if (reference != null) {
        factory = factory.referenceSequence(new File(TEST_DATA_DIR, reference));
    }
    int count = 0;
    try (final SamReader reader = factory.open(outFile)) {
        Iterator<SAMRecord> it = reader.iterator();
        while (it.hasNext()) {
            SAMRecord rec = it.next();
            count++;
        }
    }
    Assert.assertEquals(count, expectedCount);
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:38,代码来源:PrintReadsSparkIntegrationTest.java


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