當前位置: 首頁>>代碼示例>>Java>>正文


Java ReferenceMemorySource類代碼示例

本文整理匯總了Java中org.broadinstitute.hellbender.engine.ReferenceMemorySource的典型用法代碼示例。如果您正苦於以下問題:Java ReferenceMemorySource類的具體用法?Java ReferenceMemorySource怎麽用?Java ReferenceMemorySource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ReferenceMemorySource類屬於org.broadinstitute.hellbender.engine包,在下文中一共展示了ReferenceMemorySource類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processElement

import org.broadinstitute.hellbender.engine.ReferenceMemorySource; //導入依賴的package包/類
@Override
public void processElement(ProcessContext c) throws Exception {
    // can't set things up in startBundle because it doesn't have our side input yet.
    // So instead we're doing it here in processElement.
    if (firstInBundle) {
        init(c);
        onTraversalStart();
        firstInBundle = false;
    }

    AddContextDataToReadOptimized.ContextShard shard = c.element();

    for (int i=0; i<shard.reads.size(); i++) {
        GATKRead read = shard.reads.get(i);
        // Reads are shipped without the header -- put it back in
        ReadUtils.restoreHeaderIfNecessary(read, header);

        ReadContextData rc = shard.readContext.get(i);
        Iterable<Variant> variants = rc.getOverlappingVariants();
        final ReferenceBases refBases = rc.getOverlappingReferenceBases();
        ReferenceDataSource refDS = new ReferenceMemorySource(refBases, referenceSequenceDictionary);
        recalibrationEngine.processRead(read, refDS, variants);
        nReadsProcessed++;
    }
}
 
開發者ID:broadinstitute,項目名稱:gatk-dataflow,代碼行數:26,代碼來源:BaseRecalibratorOptimizedFn.java

示例2: processElement

import org.broadinstitute.hellbender.engine.ReferenceMemorySource; //導入依賴的package包/類
@Override
public void processElement(ProcessContext c) throws Exception {
    // can't set things up in startBundle because it doesn't have our side input yet.
    // So instead we're doing it here in processElement.
    if (firstInBundle) {
        init(c);
        onTraversalStart();
        firstInBundle = false;
    }

    GATKRead read = c.element().getKey();
    // Reads are shipped without the header -- put it back in
    ReadUtils.restoreHeaderIfNecessary(read, header);

    ReadContextData rc = c.element().getValue();
    Iterable<Variant> variants = rc.getOverlappingVariants();
    final ReferenceBases refBases = rc.getOverlappingReferenceBases();
    ReferenceDataSource refDS = new ReferenceMemorySource(refBases, referenceSequenceDictionary);

    recalibrationEngine.processRead(read, refDS, variants);
    nReadsProcessed++;
}
 
開發者ID:broadinstitute,項目名稱:gatk-dataflow,代碼行數:23,代碼來源:BaseRecalibratorFn.java

示例3: referenceHelperForTestCalculateGcContent

import org.broadinstitute.hellbender.engine.ReferenceMemorySource; //導入依賴的package包/類
private static ReferenceContext referenceHelperForTestCalculateGcContent(final String sequence,
                                                                         final String contigName,
                                                                         final int refStartPos,
                                                                         final int refEndPos) {
    // Create an in-memory ReferenceContext:
    final SimpleInterval wholeReferenceInterval = new SimpleInterval( contigName, 1, sequence.length() );

    return new ReferenceContext(
            new ReferenceMemorySource(
                    new ReferenceBases(sequence.getBytes(), wholeReferenceInterval),
                    new SAMSequenceDictionary(
                            Collections.singletonList(
                                    new SAMSequenceRecord(contigName, sequence.length())
                            )
                    )
            ),
            new SimpleInterval( contigName, refStartPos, refEndPos )
    );
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:20,代碼來源:GencodeFuncotationFactoryUnitTest.java

示例4: makeAnnotatedCall

import org.broadinstitute.hellbender.engine.ReferenceMemorySource; //導入依賴的package包/類
protected VariantContext makeAnnotatedCall(byte[] ref, SimpleInterval refLoc, FeatureContext tracker, SAMFileHeader header, VariantContext mergedVC, ReadLikelihoods<Allele> readAlleleLikelihoods, VariantContext call) {
    final SimpleInterval locus = new SimpleInterval(mergedVC.getContig(), mergedVC.getStart(), mergedVC.getEnd());
    final SimpleInterval refLocInterval= new SimpleInterval(refLoc);
    final ReferenceDataSource refData = new ReferenceMemorySource(new ReferenceBases(ref, refLocInterval), header.getSequenceDictionary());
    final ReferenceContext referenceContext = new ReferenceContext(refData, locus, refLocInterval);

    final VariantContext untrimmedResult =  annotationEngine.annotateContext(call, tracker, referenceContext, readAlleleLikelihoods, a -> true);
    return call.getAlleles().size() == mergedVC.getAlleles().size() ? untrimmedResult
            : GATKVariantContextUtils.reverseTrimAlleles(untrimmedResult);
}
 
開發者ID:broadinstitute,項目名稱:gatk-protected,代碼行數:11,代碼來源:HaplotypeCallerGenotypingEngine.java

示例5: apply

import org.broadinstitute.hellbender.engine.ReferenceMemorySource; //導入依賴的package包/類
public static RecalibrationReport apply( final JavaPairRDD<GATKRead, ReadContextData> readsWithContext, final SAMFileHeader header, final SAMSequenceDictionary referenceDictionary, final RecalibrationArgumentCollection recalArgs ) {
    JavaRDD<RecalibrationTables> unmergedTables = readsWithContext.mapPartitions(readWithContextIterator -> {
        final BaseRecalibrationEngine bqsr = new BaseRecalibrationEngine(recalArgs, header);
        bqsr.logCovariatesUsed();

        while ( readWithContextIterator.hasNext() ) {
            final Tuple2<GATKRead, ReadContextData> readWithData = readWithContextIterator.next();
            Iterable<GATKVariant> variants = readWithData._2().getOverlappingVariants();
            final ReferenceBases refBases = readWithData._2().getOverlappingReferenceBases();
            ReferenceDataSource refDS = new ReferenceMemorySource(refBases, referenceDictionary);

            bqsr.processRead(readWithData._1(), refDS, variants);
        }
        return Arrays.asList(bqsr.getRecalibrationTables()).iterator();
    });

    final RecalibrationTables emptyRecalibrationTable = new RecalibrationTables(new StandardCovariateList(recalArgs, header));
    final RecalibrationTables combinedTables = unmergedTables.treeAggregate(emptyRecalibrationTable,
            RecalibrationTables::inPlaceCombine,
            RecalibrationTables::inPlaceCombine,
            Math.max(1, (int)(Math.log(unmergedTables.partitions().size()) / Math.log(2))));

    BaseRecalibrationEngine.finalizeRecalibrationTables(combinedTables);

    final QuantizationInfo quantizationInfo = new QuantizationInfo(combinedTables, recalArgs.QUANTIZING_LEVELS);

    final StandardCovariateList covariates = new StandardCovariateList(recalArgs, header);
    return RecalUtils.createRecalibrationReport(recalArgs.generateReportTable(covariates.covariateNames()), quantizationInfo.generateReportTable(), RecalUtils.generateReportTables(combinedTables, covariates));
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:30,代碼來源:BaseRecalibratorSparkFn.java

示例6: testCalculateIsIndel

import org.broadinstitute.hellbender.engine.ReferenceMemorySource; //導入依賴的package包/類
@Test(dataProvider = "CalculateIsIndelData")
public void testCalculateIsIndel(final String cigar, final boolean negStrand, final EventType mode, final int[] expected) {
    final GATKRead read = ArtificialReadUtils.createArtificialRead(TextCigarCodec.decode(cigar));
    read.setIsReverseStrand(negStrand);
    // Fake reference data, since the indel calculation does not use the reference at all.
    final ReferenceDataSource refSource = new ReferenceMemorySource(new ReferenceBases(Utils.repeatBytes((byte)'A', read.getEnd() - read.getStart() + 1), new SimpleInterval(read)), ArtificialReadUtils.createArtificialSamHeader().getSequenceDictionary());

    int[] isSNP = new int[read.getLength()];
    int[] isInsertion = new int[isSNP.length];
    int[] isDeletion = new int[isSNP.length];
    BaseRecalibrationEngine.calculateIsSNPOrIndel(read, refSource, isSNP, isInsertion, isDeletion);
    final int[] actual = (mode == EventType.BASE_INSERTION ? isInsertion : isDeletion);
    Assert.assertEquals(actual, expected, "calculateIsSNPOrIndel() failed with " + mode + " and cigar " + cigar + " Expected " + Arrays.toString(expected) + " but got " + Arrays.toString(actual));
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:15,代碼來源:BaseRecalibrationEngineUnitTest.java

示例7: createData1

import org.broadinstitute.hellbender.engine.ReferenceMemorySource; //導入依賴的package包/類
@DataProvider(name = "data")
public Object[][] createData1() {
    List<BAQTest> params = new ArrayList<>();

    SAMSequenceDictionary dict= new SAMSequenceDictionary();
    dict.addSequence(new SAMSequenceRecord("1", Integer.MAX_VALUE));

    params.add(new BAQTest(
            "GCTGCTCCTGGTACTGCTGGATGAGGGCCTCGATGAAGCTAAGCTTTTTCTCCTGCTCCTGCGTGATCCGCTGCAG",
            "GCTGCTCCTGGTACTGCTGGATGAGGGCCTCGATGAAGCTAAGCTTTTCCTCCTGCTCCTGCGTGATCCGCTGCAG",
            "?BACCB[email protected]IGIHCG",
            "?BACCB[email protected]IGIHCE"));

    params.add(new BAQTest(
            "GCTTTTTCTCCTCCTG",
            "GCTTTTCCTCCTCCTG",
            "IIHGGGIHHIIHHIIH",
            "EI410..0HIIHHIIE"));

    final String refString1 = "AAATTCAAGATTTCAAAGGCTCTTAACTGCTCAAGATAATTTTTTTTTTTTGAGACAGAGTCTTGCTGTGTTGCCCAGGCTGGAGTGCAGTGGCGTGATCTTGGCTCACTGCAAGCTCCGCCTCCCGGGTTCACGCCATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGACTACAGGCACCCACCACCACGCCTGGCCAATTTTTTTGTATTTTTAGTAGAGATAG";
    final ReferenceDataSource rds1 = new ReferenceMemorySource(new ReferenceBases(refString1.getBytes(), new SimpleInterval("1", 9999807, 10000032)), dict);

    // big and complex, also does a cap from 3 to 4!
    params.add(new BAQTest(-3, 9999810L, "49M1I126M1I20M1I25M",
            refString1,
            "TTCAAGATTTCAAAGGCTCTTAACTGCTCAAGATAATTTTTTTTTTTTGTAGACAGAGTCTTGCTGTGTTGCCCAGGCTGGAGTGCAGTGGCGTGATCTTGGCTCACTGCAAGCTCCGCCTCCCGGGTTCACGCCATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGACTACAGGCCACCCACCACCACGCCTGGCCTAATTTTTTTGTATTTTTAGTAGAGA",
            ">IHFECEBDBBCBCABABAADBD?AABBACEABABC?>?B>@[email protected]@>A?B3BBC?CBDBAABBBBBAABAABBABDACCCBCDAACBCBABBB:[email protected]@;?<[email protected];CBBBAB=;A>[email protected]@<?>>AAA<[email protected][email protected]<@C<>5;<A5=A;>=64>???B>=6497<<;;<;>2?>[email protected]??A6<<A59",
            ">EHFECEBDBBCBCABABAADBD?AABBACEABABC?>?B>@[email protected]@>A?838BC?CBDBAABBBBBAABAABBABDACCCBCDAACBCBABBB:[email protected]@;?<[email protected];CBBBAB=;A>[email protected]@<?>>AAA<[email protected][email protected]<@%<>5;<A5=A;>=64>???B;86497<<;;<;>2?>[email protected]??A6<<A59",
            rds1));

    final String refString2 = "CCGAGTAGCTGGGACTACAGGCACCCACCACCACGCCTGGCC";
    final ReferenceDataSource rds2 = new ReferenceMemorySource(new ReferenceBases(refString2.getBytes(), new SimpleInterval("1", 9999963, 10000004)), dict);

    // now changes
    params.add(new BAQTest(-3, 9999966L, "36M",
            refString2,
            "AGTAGCTGGGACTACAGGCACCCACCACCACGCCTG",
            "A?>>@>[email protected]@>A?>[email protected]?>@>>?=>?'>?=>7=?A9",
            "A?>>@>[email protected]@>A?>[email protected]?>@>>?=>?'>?=>7=?A9",
            rds2));

    final String refString3 = "CCACCACGCCTGGCCAATTTTTTTGTATTTTTAGTAGAGATA";
    final ReferenceDataSource rds3 = new ReferenceMemorySource(new ReferenceBases(refString3.getBytes(), new SimpleInterval("1", 9999990, 10000031)), dict);

    // raw base qualities are low -- but they shouldn't be capped
    params.add(new BAQTest(-3, 9999993L, "4=13X2=3X1=4X2=4X1=2X",
            refString3,
            "CCACGCTTGGCAAAGTTTTCCGTACGTTTAGCCGAG",
            "33'/(7+270&4),(&&-)$&,%7$',-/61(,6?8",
            "33'/(7+270&4),(&&-)$&,%7$',-/61(,6?8",
            rds3));

    List<Object[]> params2 = new ArrayList<>();
    for (BAQTest x : params) params2.add(new Object[]{x});
    return params2.toArray(new Object[][]{});
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:57,代碼來源:BAQUnitTest.java


注:本文中的org.broadinstitute.hellbender.engine.ReferenceMemorySource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。