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


Java FeatureManager类代码示例

本文整理汇总了Java中org.broadinstitute.hellbender.engine.FeatureManager的典型用法代码示例。如果您正苦于以下问题:Java FeatureManager类的具体用法?Java FeatureManager怎么用?Java FeatureManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: doWork

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
@Override
protected Object doWork() {
    final FeatureCodec<? extends Feature, ?> codec = FeatureManager.getCodecForFile(inputBedFile);
    final Class<? extends Feature> featureType = codec.getFeatureType();
    if (BEDFeature.class.isAssignableFrom(featureType)) {
        final FeatureDataSource<? extends BEDFeature> source = new FeatureDataSource<>(inputBedFile);
        try {
            final List<Target> targets = StreamSupport.stream(source.spliterator(), false).map(ConvertBedToTargetFile::createTargetFromBEDFeature)
                    .collect(Collectors.toList());
            TargetWriter.writeTargetsToFile(outFile, targets);
        } catch (final TribbleException e) {
            throw new UserException.BadInput(String.format("'%s' has a .bed extension but does not seem to be a valid BED file.", inputBedFile.getAbsolutePath()));
        }
    } else {
        throw new UserException.BadInput(String.format("'%s' does not seem to be a BED file.", inputBedFile.getAbsolutePath()));
    }
    return "SUCCESS";
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:19,代码来源:ConvertBedToTargetFile.java

示例2: doWork

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
@Override
protected Object doWork() {
    if (!featureFile.canRead()) {
        throw new UserException.CouldNotReadInputFile(featureFile);
    }

    // Get the right codec for the file to be indexed. This call will throw an appropriate exception
    // if featureFile is not in a supported format or is unreadable.
    final FeatureCodec<? extends Feature, ?> codec = new ProgressReportingDelegatingCodec<>(FeatureManager.getCodecForFile(featureFile), ProgressMeter.DEFAULT_SECONDS_BETWEEN_UPDATES);

    final Index index = createAppropriateIndexInMemory(codec);
    final File indexFile = determineFileName(index);

    try {
        index.write(indexFile);
    } catch (final IOException e) {
        throw new UserException.CouldNotCreateOutputFile("Could not write index to file " + indexFile.getAbsolutePath(), e);
    }

    logger.info("Successfully wrote index to " + indexFile.getAbsolutePath());
    return indexFile.getAbsolutePath();
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:23,代码来源:IndexFeatureFile.java

示例3: verifyFileType

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
private void verifyFileType(
        final File resultVCFFile,
        final String outputExtension) {
    final FeatureCodec<? extends Feature, ?> featureCodec = FeatureManager.getCodecForFile(resultVCFFile);

    if (outputExtension.equals(".vcf") ||
        outputExtension.equals(".vcf.bgz") ||
        outputExtension.equals(".vcf.gz") ||
        outputExtension.equals(".tmp"))
    {
        Assert.assertEquals(featureCodec.getClass(), VCFCodec.class,
                "Wrong codec selected for file " + resultVCFFile.getAbsolutePath());
    }
    else if (outputExtension.equals(".bcf")) {
        Assert.assertEquals(featureCodec.getClass(), BCF2Codec.class,
                "Wrong codec selected for file " + resultVCFFile.getAbsolutePath());
    }
    else {
        throw new IllegalArgumentException("Unknown file extension in createVCFWriter test validation");
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:22,代码来源:GATKVariantContextUtilsUnitTest.java

示例4: getCodecForVariantSource

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static FeatureCodec<VariantContext, ?> getCodecForVariantSource( final String variantSource ) {
    final FeatureCodec<? extends Feature, ?> codec = FeatureManager.getCodecForFile(new File(variantSource));
    if ( !VariantContext.class.isAssignableFrom(codec.getFeatureType()) ) {
        throw new UserException(variantSource + " is not in a format that produces VariantContexts");
    }
    return (FeatureCodec<VariantContext, ?>)codec;
}
 
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:9,代码来源:VariantsDataflowSource.java

示例5: testRsIDFeatureContext

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
@Test(dataProvider = "AnnotateRsIDData")
public void testRsIDFeatureContext(final VariantContext toAnnotate, final List<VariantContext> dbSNPRecords, final String expectedID, final boolean expectOverlap) throws Exception {
    final File file= new File(publicTestDir + "Homo_sapiens_assembly19.dbsnp135.chr1_1M.exome_intervals.vcf");
    final FeatureContext ctx = new FeatureContext(new FeatureManager(new ArtificialFeatureContainingCommandLineProgram_ForVariantOverlap(file)), new SimpleInterval(toAnnotate));
    final VariantOverlapAnnotator annotator = makeAnnotator(file, "dbsnp");
    final VariantContext annotated = annotator.annotateRsID(ctx, toAnnotate);
    Assert.assertNotNull(annotated);
    Assert.assertEquals(annotated, toAnnotate);   //nothing at given position
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:10,代码来源:VariantOverlapAnnotatorUnitTest.java

示例6: testRsIDFeatureContextWith2Sets

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
@Test(dataProvider = "AnnotateRsIDData")
public void testRsIDFeatureContextWith2Sets(final VariantContext toAnnotate, final List<VariantContext> dbSNPRecords, final String expectedID, final boolean expectOverlap) throws Exception {
    final File file= new File(publicTestDir + "Homo_sapiens_assembly19.dbsnp135.chr1_1M.exome_intervals.vcf");
    final FeatureContext ctx = new FeatureContext(new FeatureManager(new ArtificialFeatureContainingCommandLineProgram_ForVariantOverlap(file)), new SimpleInterval(toAnnotate));
    final VariantOverlapAnnotator annotator = makeAnnotator(file, "dbsnp", "binding");
    final VariantContext annotated = annotator.annotateRsID(ctx, toAnnotate);
    Assert.assertNotNull(annotated);
    Assert.assertEquals(annotated, toAnnotate);   //nothing at given position
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:10,代码来源:VariantOverlapAnnotatorUnitTest.java

示例7: testRsIDFeatureContextWithNoDBSnP

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
@Test(dataProvider = "AnnotateRsIDData")
public void testRsIDFeatureContextWithNoDBSnP(final VariantContext toAnnotate, final List<VariantContext> dbSNPRecords, final String expectedID, final boolean expectOverlap) throws Exception {
    final File file= new File(publicTestDir + "Homo_sapiens_assembly19.dbsnp135.chr1_1M.exome_intervals.vcf");
    final FeatureContext ctx = new FeatureContext(new FeatureManager(new ArtificialFeatureContainingCommandLineProgram_ForVariantOverlap(file)), new SimpleInterval(toAnnotate));
    final VariantOverlapAnnotator annotator = makeAnnotator(file, null, "binding");
    final VariantContext annotated = annotator.annotateRsID(ctx, toAnnotate);
    Assert.assertNotNull(annotated);
    Assert.assertEquals(annotated, toAnnotate);   //nothing at given position
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:10,代码来源:VariantOverlapAnnotatorUnitTest.java

示例8: testAnnotateOverlapsFeatureContext

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
@Test(dataProvider = "AnnotateRsIDData")
public void testAnnotateOverlapsFeatureContext(final VariantContext toAnnotate, final List<VariantContext> records, final String expectedID, final boolean expectOverlap) throws Exception {
    final File file= new File(publicTestDir + "Homo_sapiens_assembly19.dbsnp135.chr1_1M.exome_intervals.vcf");
    final FeatureContext ctx = new FeatureContext(new FeatureManager(new ArtificialFeatureContainingCommandLineProgram_ForVariantOverlap(file)), new SimpleInterval(toAnnotate));
    final VariantOverlapAnnotator annotator = makeAnnotator(file, "dbsnp");
    final VariantContext annotated = annotator.annotateOverlaps(ctx, toAnnotate);
    Assert.assertEquals(annotated, toAnnotate);   //nothing at given position
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:9,代码来源:VariantOverlapAnnotatorUnitTest.java

示例9: testAnnotateOverlapsFeatureContextWith2Sets

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
@Test(dataProvider = "AnnotateRsIDData")
public void testAnnotateOverlapsFeatureContextWith2Sets(final VariantContext toAnnotate, final List<VariantContext> records, final String expectedID, final boolean expectOverlap) throws Exception {
    final File file= new File(publicTestDir + "Homo_sapiens_assembly19.dbsnp135.chr1_1M.exome_intervals.vcf");
    final FeatureContext ctx = new FeatureContext(new FeatureManager(new ArtificialFeatureContainingCommandLineProgram_ForVariantOverlap(file)), new SimpleInterval(toAnnotate));
    final VariantOverlapAnnotator annotator = makeAnnotator(file, "dbsnp", "binding");
    final VariantContext annotated = annotator.annotateOverlaps(ctx, toAnnotate);
    Assert.assertEquals(annotated, toAnnotate);   //nothing at given position
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:9,代码来源:VariantOverlapAnnotatorUnitTest.java

示例10: initializeFeatures

import org.broadinstitute.hellbender.engine.FeatureManager; //导入依赖的package包/类
/**
 * Initialize our source of Feature data (or set it to null if no Feature 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 Feature data sources.
 *
 * By default, this method initializes the FeatureManager to use the lookahead cache of {@link FeatureDataSource#DEFAULT_QUERY_LOOKAHEAD_BASES} bases.
 */
void initializeFeatures() {
    features = new FeatureManager(this);
    if ( features.isEmpty() ) {  // No available sources of Features discovered for this tool
        features = null;
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:15,代码来源:GATKSparkTool.java


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