當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。