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


Java GenotypeBuilder.create方法代码示例

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


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

示例1: buildAndAnnotateTruthOverlappingGenotype

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
private Genotype buildAndAnnotateTruthOverlappingGenotype(final String sample, final VariantContext truth, final List<VariantContext> calls,
                                                          final TargetCollection<Target> targets) {
    final Genotype truthGenotype = truth.getGenotype(sample);
    // if there is no truth genotype for that sample, we output the "empty" genotype.
    if (truthGenotype == null) {
        return GenotypeBuilder.create(sample, Collections.emptyList());
    }
    final int truthCopyNumber = GATKProtectedVariantContextUtils.getAttributeAsInt(truthGenotype,
            GS_COPY_NUMBER_FORMAT_KEY, truthNeutralCopyNumber);
    final CopyNumberTriStateAllele truthAllele = copyNumberToTrueAllele(truthCopyNumber);

    final List<Pair<VariantContext, Genotype>> allCalls = calls.stream()
            .map(vc -> new ImmutablePair<>(vc, vc.getGenotype(sample)))
            .filter(pair -> pair.getRight() != null)
            .filter(pair -> GATKProtectedVariantContextUtils.getAttributeAsString(pair.getRight(), XHMMSegmentGenotyper.DISCOVERY_KEY,
                    XHMMSegmentGenotyper.DISCOVERY_FALSE).equals(XHMMSegmentGenotyper.DISCOVERY_TRUE))
            .collect(Collectors.toList());

    final List<Pair<VariantContext, Genotype>> qualifiedCalls = composeQualifyingCallsList(targets, allCalls);

    return buildAndAnnotateTruthOverlappingGenotype(sample, targets, truthGenotype, truthCopyNumber,
                truthAllele, qualifiedCalls);
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:24,代码来源:EvaluateCopyNumberTriStateCalls.java

示例2: testGenotypeConcordanceDetermineStateDp

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
@Test
public void testGenotypeConcordanceDetermineStateDp() throws Exception {
    final List<Allele> allelesNormal = makeUniqueListOfAlleles(Aref, C);
    final Genotype gtNormal = GenotypeBuilder.create(TRUTH_SAMPLE_NAME, Arrays.asList(Aref, C));
    final VariantContext vcNormal = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, allelesNormal).genotypes(gtNormal).make();

    final List<Allele> allelesLowDp = makeUniqueListOfAlleles(Aref, C);
    final Genotype gtLowDp = new GenotypeBuilder(TRUTH_SAMPLE_NAME, Arrays.asList(Aref, C)).DP(4).make();
    final VariantContext vcLowDp = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, allelesLowDp).genotypes(gtLowDp).make();

    testGenotypeConcordanceDetermineState(vcLowDp, TruthState.LOW_DP, vcNormal, CallState.HET_REF_VAR1, 0, 20);
    testGenotypeConcordanceDetermineState(vcLowDp, TruthState.HET_REF_VAR1, vcLowDp, CallState.HET_REF_VAR1, 0, 2);

    testGenotypeConcordanceDetermineState(vcNormal, TruthState.HET_REF_VAR1, vcLowDp, CallState.LOW_DP, 0, 20);
    testGenotypeConcordanceDetermineState(vcNormal, TruthState.HET_REF_VAR1, vcLowDp, CallState.HET_REF_VAR1, 0, 2);

    testGenotypeConcordanceDetermineState(vcLowDp, TruthState.LOW_DP, vcLowDp, CallState.LOW_DP, 0, 20);
    testGenotypeConcordanceDetermineState(vcLowDp, TruthState.HET_REF_VAR1, vcLowDp, CallState.HET_REF_VAR1, 0, 2);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:20,代码来源:GenotypeConcordanceTest.java

示例3: testGenotypeConcordanceDetermineStateGq

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
@Test
public void testGenotypeConcordanceDetermineStateGq() throws Exception {
    final List<Allele> allelesNormal = makeUniqueListOfAlleles(Aref, C);
    final Genotype gtNormal = GenotypeBuilder.create(TRUTH_SAMPLE_NAME, Arrays.asList(Aref, C));
    final VariantContext vcNormal = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, allelesNormal).genotypes(gtNormal).make();

    final List<Allele> allelesLowGq = makeUniqueListOfAlleles(Aref, C);
    final Genotype gtLowGq = new GenotypeBuilder(TRUTH_SAMPLE_NAME, Arrays.asList(Aref, C)).GQ(4).make();
    final VariantContext vcLowGq = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, allelesLowGq).genotypes(gtLowGq).make();

    testGenotypeConcordanceDetermineState(vcLowGq, TruthState.LOW_GQ, vcNormal, CallState.HET_REF_VAR1, 20, 0);
    testGenotypeConcordanceDetermineState(vcLowGq, TruthState.HET_REF_VAR1, vcLowGq, CallState.HET_REF_VAR1, 2, 0);

    testGenotypeConcordanceDetermineState(vcNormal, TruthState.HET_REF_VAR1, vcLowGq, CallState.LOW_GQ, 20, 0);
    testGenotypeConcordanceDetermineState(vcNormal, TruthState.HET_REF_VAR1, vcLowGq, CallState.HET_REF_VAR1, 2, 0);

    testGenotypeConcordanceDetermineState(vcLowGq, TruthState.LOW_GQ, vcLowGq, CallState.LOW_GQ, 20, 0);
    testGenotypeConcordanceDetermineState(vcLowGq, TruthState.HET_REF_VAR1, vcLowGq, CallState.HET_REF_VAR1, 2, 0);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:20,代码来源:GenotypeConcordanceTest.java

示例4: trio

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
private boolean trio(
	final Genotype gChild,
	final List<Allele> fathers,
	final List<Allele> mothers
	)
{		
for(int f=0;f< fathers.size();++f)
	{
	for(int m=0;m< mothers.size();++m)
		{
		final Genotype gt=GenotypeBuilder.create(
				gChild.getSampleName(),
				Arrays.asList(fathers.get(f),mothers.get(m))
				);
		if(gt.sameGenotype(gChild,true)) return true;
		}
	}
return false;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:20,代码来源:VCFTrios.java

示例5: subsetGenotypeAlleles

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
/**
 * From a given genotype, extract a given subset of alleles and update genotype PLs and SACs.
 * @param g                                 genotype to subset
 * @param allelesToUse                      alleles to subset
 * @param vc                                variant context with alleles and genotypes
 * @param defaultPloidy                     ploidy to assume in case that {@code vc} does not contain that information for a sample.
 * @param assignGenotypes                   true: assign hard genotypes, false: leave as no-call
 * @return                                  Genotypes with new PLs and SACs
 */
private Genotype subsetGenotypeAlleles(final Genotype g, final List<Allele> allelesToUse, final VariantContext vc, final int defaultPloidy,
                                       boolean assignGenotypes) {
    final int ploidy = g.getPloidy() <= 0 ? defaultPloidy : g.getPloidy();
    if (!g.hasLikelihoods())
        return GenotypeBuilder.create(g.getSampleName(),GaeaGvcfVariantContextUtils.noCallAlleles(ploidy));
    else {
        // subset likelihood alleles
        final double[] newLikelihoods = subsetLikelihoodAlleles(g, allelesToUse, vc, ploidy);
        if (MathUtils.sum(newLikelihoods) > GaeaGvcfVariantContextUtils.SUM_GL_THRESH_NOCALL)
            return GenotypeBuilder.create(g.getSampleName(), GaeaGvcfVariantContextUtils.noCallAlleles(ploidy));
        else  // just now we would care about newSACs
            return subsetGenotypeAllelesWithLikelihoods(g, allelesToUse, vc, ploidy, assignGenotypes, newLikelihoods);
    }
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:24,代码来源:GeneralPloidyExactAFCalculator.java

示例6: basicTransitions

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
@DataProvider(name="basicTransitions")
public Object [] [] basicTransitions() {

    final List<Allele> ctoTAlleles = new ArrayList<>();
    ctoTAlleles.add(Allele.create("C", true));
    ctoTAlleles.add(Allele.create("T", false));

    final List<Allele> gtoTAlleles = new ArrayList<>();
    gtoTAlleles.add(Allele.create("G", true));
    gtoTAlleles.add(Allele.create("T", false));

    final List<Allele> gtoAAlleles = new ArrayList<>();
    gtoAAlleles.add(Allele.create("G", true));
    gtoAAlleles.add(Allele.create("A", false));

    final List<Allele> gtoCAlleles = new ArrayList<>();
    gtoCAlleles.add(Allele.create("G", true));
    gtoCAlleles.add(Allele.create("C", false));

    return new Object[] [] {
            // Genotype, transition, is in transition, is in transition or transition rc
            {GenotypeBuilder.create("DUMMYSAMPLE", ctoTAlleles), Transition.CtoT, true, true },
            {GenotypeBuilder.create("DUMMYSAMPLE", gtoTAlleles), Transition.CtoT, false, false },
            {GenotypeBuilder.create("DUMMYSAMPLE", gtoAAlleles), Transition.CtoT, false, true },
            {GenotypeBuilder.create("DUMMYSAMPLE", gtoCAlleles), Transition.CtoT, false, false },
            {GenotypeBuilder.create("DUMMYSAMPLE", ctoTAlleles), Transition.AtoT, false, false },
            {GenotypeBuilder.create("DUMMYSAMPLE", gtoTAlleles), Transition.AtoT, false, false },
            {GenotypeBuilder.create("DUMMYSAMPLE", gtoAAlleles), Transition.AtoT, false, false },
            {GenotypeBuilder.create("DUMMYSAMPLE", gtoCAlleles), Transition.AtoT, false, false }
    };
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:32,代码来源:OrientationBiasUtilsUnitTest.java

示例7: testGenotypeConcordanceDetermineState

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
@Test(dataProvider = "genotypeConcordanceDetermineStateDataProvider")
public void testGenotypeConcordanceDetermineState(final Allele truthAllele1, final Allele truthAllele2, final TruthState expectedTruthState,
                                                  final Allele callAllele1, final Allele callAllele2, final CallState expectedCallState) throws Exception {
    final List<Allele> truthAlleles = makeUniqueListOfAlleles(truthAllele1, truthAllele2);
    final Genotype truthGt = GenotypeBuilder.create(TRUTH_SAMPLE_NAME, Arrays.asList(truthAllele1, truthAllele2));

    final VariantContext truthVariantContext = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, truthAlleles).genotypes(truthGt).make();

    final List<Allele> callAlleles = makeUniqueListOfAlleles(callAllele1, callAllele2);
    final Genotype callGt = GenotypeBuilder.create(CALL_SAMPLE_NAME, Arrays.asList(callAllele1, callAllele2));
    final VariantContext callVariantContext = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, callAlleles).genotypes(callGt).make();

    testGenotypeConcordanceDetermineState(truthVariantContext, expectedTruthState, callVariantContext, expectedCallState, 0, 0);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:15,代码来源:GenotypeConcordanceTest.java

示例8: testGenotypeConcordanceDetermineStateNull

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
@Test
public void testGenotypeConcordanceDetermineStateNull() throws Exception {
    final List<Allele> alleles = makeUniqueListOfAlleles(Aref, C);
    final Genotype gt1 = GenotypeBuilder.create(TRUTH_SAMPLE_NAME, Arrays.asList(Aref, C));
    final VariantContext vc1 = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, alleles).genotypes(gt1).make();

    testGenotypeConcordanceDetermineState(null, TruthState.MISSING, null, CallState.MISSING, 0, 0);
    testGenotypeConcordanceDetermineState(vc1, TruthState.HET_REF_VAR1, null, CallState.MISSING, 0, 0);
    testGenotypeConcordanceDetermineState(null, TruthState.MISSING, vc1, CallState.HET_REF_VAR1, 0, 0);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:11,代码来源:GenotypeConcordanceTest.java

示例9: testGenotypeConcordanceDetermineStateFilter

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
@Test
public void testGenotypeConcordanceDetermineStateFilter() throws Exception {
    final Set<String> filters = new HashSet<String>(Arrays.asList("BAD!"));

    // Filtering on the variant context
    final List<Allele> alleles1 = makeUniqueListOfAlleles(Aref, C);
    final Genotype gt1 = GenotypeBuilder.create(TRUTH_SAMPLE_NAME, Arrays.asList(Aref, C));
    final VariantContext vcFiltered = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, alleles1).genotypes(gt1).filters(filters).make();

    final List<Allele> alleles2 = makeUniqueListOfAlleles(Aref, T);
    final Genotype gt2 = GenotypeBuilder.create(TRUTH_SAMPLE_NAME, Arrays.asList(Aref, T));
    final VariantContext vcNotFiltered = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, alleles2).genotypes(gt2).make();

    testGenotypeConcordanceDetermineState(vcFiltered, TruthState.VC_FILTERED, vcNotFiltered, CallState.HET_REF_VAR1, 0, 0);
    testGenotypeConcordanceDetermineState(vcNotFiltered, TruthState.HET_REF_VAR1, vcFiltered, CallState.VC_FILTERED, 0, 0);
    testGenotypeConcordanceDetermineState(vcFiltered, TruthState.VC_FILTERED, vcFiltered, CallState.VC_FILTERED, 0, 0);

    // Filtering on the genotype
    final List<String> gtFilters = new ArrayList<String>(Arrays.asList("WICKED"));
    final List<Allele> alleles3 = makeUniqueListOfAlleles(Aref, C);
    final Genotype gt3 = new GenotypeBuilder(TRUTH_SAMPLE_NAME, Arrays.asList(Aref, C)).filters(gtFilters).make();
    final VariantContext vcGtFiltered = new VariantContextBuilder("test", snpLoc, snpLocStart, snpLocStop, alleles3).genotypes(gt3).make();

    testGenotypeConcordanceDetermineState(vcGtFiltered, TruthState.GT_FILTERED, vcNotFiltered, CallState.HET_REF_VAR1, 0, 0);
    testGenotypeConcordanceDetermineState(vcNotFiltered, TruthState.HET_REF_VAR1, vcGtFiltered, CallState.GT_FILTERED, 0, 0);
    testGenotypeConcordanceDetermineState(vcGtFiltered, TruthState.GT_FILTERED, vcGtFiltered, CallState.GT_FILTERED, 0, 0);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:28,代码来源:GenotypeConcordanceTest.java

示例10: createMissingGenotype

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
private Genotype createMissingGenotype(final String sampleName,final Allele ref)
{
if(this.useHomRefForUnknown)
	{
	return GenotypeBuilder.create(sampleName, Arrays.asList(
			ref,
			ref
			));
	}
else
	{
	return GenotypeBuilder.createMissing(sampleName, 2);
	}		
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:15,代码来源:VCFMerge2.java

示例11: testFastGenotypeIsSerializable

import htsjdk.variant.variantcontext.GenotypeBuilder; //导入方法依赖的package包/类
@Test
public void testFastGenotypeIsSerializable() {
    Genotype genotype = GenotypeBuilder.create("sample1", Collections.nCopies(2, Allele.create("C", false)));
    SparkTestUtils.roundTripInKryo(genotype, genotype.getClass(), SparkContextFactory.getTestSparkContext().getConf());
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:6,代码来源:HaplotypeCallerSparkIntegrationTest.java


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