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


Java GenotypeType类代码示例

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


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

示例1: testIndelLikelihoods

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
@Test
    public void testIndelLikelihoods() {
        GenotypeLikelihoods prev = model.getIndelPLs(HomoSapiensConstants.DEFAULT_PLOIDY,0);
        Assert.assertEquals(prev.getAsPLs(), new int[]{0, 0, 0});
        Assert.assertEquals(-10 * GenotypeLikelihoods.getGQLog10FromLikelihoods(GenotypeType.HOM_REF.ordinal()-1, prev.getAsVector()), 0.0);

        for ( int i = 1; i <= ReferenceConfidenceModel.MAX_N_INDEL_INFORMATIVE_READS; i++ ) {
            final GenotypeLikelihoods current = model.getIndelPLs(HomoSapiensConstants.DEFAULT_PLOIDY,i);
            final double prevGQ = -10 * GenotypeLikelihoods.getGQLog10FromLikelihoods(GenotypeType.HOM_REF.ordinal()-1, prev.getAsVector());
            final double currGQ = -10 * GenotypeLikelihoods.getGQLog10FromLikelihoods(GenotypeType.HOM_REF.ordinal()-1, current.getAsVector());
            Assert.assertTrue(prevGQ < currGQ, "GQ Failed with prev " + prev + " curr " + current + " at " + i);
            Assert.assertTrue(prev.getAsPLs()[1] < current.getAsPLs()[1], "het PL failed with prev " + prev + " curr " + current + " at " + i);
            Assert.assertTrue(prev.getAsPLs()[2] < current.getAsPLs()[2], "hom-var PL Failed with prev " + prev + " curr " + current + " at " + i);
//            logger.warn("result at " + i + " is " + current);
            prev = current;
        }
    }
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:18,代码来源:ReferenceConfidenceModelUnitTest.java

示例2: testAnalyseInheritanceModes_SingleSample_OnePassedVariant_HET

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
@Test
public void testAnalyseInheritanceModes_SingleSample_OnePassedVariant_HET() {
    List<Allele> alleles = buildAlleles("A", "T");
    // build Genotype
    Genotype genotype = buildSampleGenotype("Adam", alleles.get(0), alleles.get(1));
    assertThat(genotype.getType(), equalTo(GenotypeType.HET));

    VariantContext variantContext = buildVariantContext(1, 12345, alleles, genotype);
    System.out.println("Built variant context " + variantContext);

    Gene gene = newGene();
    gene.addVariant(filteredVariant(1, 12345, "A", "T", FilterResult.pass(FilterType.FREQUENCY_FILTER), variantContext));

    Pedigree pedigree = Pedigree.constructSingleSamplePedigree("Adam");


    InheritanceModeAnalyser instance = new InheritanceModeAnalyser(ModeOfInheritance.AUTOSOMAL_DOMINANT, pedigree);
    instance.analyseInheritanceModes(gene);
    assertThat(gene.isCompatibleWith(ModeOfInheritance.ANY), is(false));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(true));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(false));
}
 
开发者ID:exomiser,项目名称:Exomiser,代码行数:23,代码来源:InheritanceModeAnalyserTest.java

示例3: testAnalyseInheritanceModes_SingleSample_OnePassedVariant_HOM_REF_ShouldBeIncompatibleWith_RECESIVE

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
@Test
public void testAnalyseInheritanceModes_SingleSample_OnePassedVariant_HOM_REF_ShouldBeIncompatibleWith_RECESIVE() {
    List<Allele> alleles = buildAlleles("A", "T");

    //HomRef 0/0 or 0|0 variants really shouldn't be causing rare diseases so we need to ensure these are removed
    Genotype genotype = buildSampleGenotype("Adam", alleles.get(0), alleles.get(0));
    assertThat(genotype.getType(), equalTo(GenotypeType.HOM_REF));

    VariantContext variantContext = buildVariantContext(1, 12345, alleles, genotype);
    System.out.println("Built variant context " + variantContext);

    Gene gene = newGene();
    gene.addVariant(filteredVariant(1, 12345, "A", "T", FilterResult.pass(FilterType.FREQUENCY_FILTER), variantContext));

    Pedigree pedigree = Pedigree.constructSingleSamplePedigree("Adam");

    InheritanceModeAnalyser instance = new InheritanceModeAnalyser(ModeOfInheritance.AUTOSOMAL_RECESSIVE, pedigree);
    instance.analyseInheritanceModes(gene);
    assertThat(gene.isCompatibleWith(ModeOfInheritance.ANY), is(false));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(false));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(false));
}
 
开发者ID:exomiser,项目名称:Exomiser,代码行数:23,代码来源:InheritanceModeAnalyserTest.java

示例4: testAnalyseInheritanceModes_SingleSample_OnePassedVariant_HOM_REF_ShouldBeIncompatibleWith_DOMINANT

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
@Test
public void testAnalyseInheritanceModes_SingleSample_OnePassedVariant_HOM_REF_ShouldBeIncompatibleWith_DOMINANT() {
    List<Allele> alleles = buildAlleles("A", "T");

    //HomRef 0/0 or 0|0 variants really shouldn't be causing rare diseases so we need to ensure these are removed
    Genotype genotype = buildSampleGenotype("Adam", alleles.get(0), alleles.get(0));
    assertThat(genotype.getType(), equalTo(GenotypeType.HOM_REF));

    VariantContext variantContext = buildVariantContext(1, 12345, alleles, genotype);
    System.out.println("Built variant context " + variantContext);

    Gene gene = newGene();
    gene.addVariant(filteredVariant(1, 12345, "A", "T", FilterResult.pass(FilterType.FREQUENCY_FILTER), variantContext));

    Pedigree pedigree = Pedigree.constructSingleSamplePedigree("Adam");

    InheritanceModeAnalyser instance = new InheritanceModeAnalyser(ModeOfInheritance.AUTOSOMAL_DOMINANT, pedigree);
    instance.analyseInheritanceModes(gene);
    assertThat(gene.isCompatibleWith(ModeOfInheritance.ANY), is(false));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(false));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(false));

    gene.getPassedVariantEvaluations()
            .forEach(variant -> assertThat(variant.getInheritanceModes().isEmpty(), is(true)));
}
 
开发者ID:exomiser,项目名称:Exomiser,代码行数:26,代码来源:InheritanceModeAnalyserTest.java

示例5: testAnalyseInheritanceModes_SingleSample_OnePassedVariant_HOM_VAR

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
@Test
public void testAnalyseInheritanceModes_SingleSample_OnePassedVariant_HOM_VAR() {
    List<Allele> alleles = buildAlleles("A", "T");
    //HOM_ALT
    Genotype genotype = buildSampleGenotype("Adam", alleles.get(1), alleles.get(1));
    assertThat(genotype.getType(), equalTo(GenotypeType.HOM_VAR));

    VariantContext variantContext = buildVariantContext(1, 12345, alleles, genotype);
    System.out.println("Built variant context " + variantContext);

    Gene gene = newGene();
    gene.addVariant(filteredVariant(1, 12345, "A", "T", FilterResult.pass(FilterType.FREQUENCY_FILTER), variantContext));

    Pedigree pedigree = Pedigree.constructSingleSamplePedigree("Adam");

    InheritanceModeAnalyser instance = new InheritanceModeAnalyser(ModeOfInheritance.AUTOSOMAL_DOMINANT, pedigree);
    instance.analyseInheritanceModes(gene);
    assertThat(gene.isCompatibleWith(ModeOfInheritance.ANY), is(false));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(false));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(false));

    gene.getPassedVariantEvaluations()
            .forEach(variant -> assertThat(variant.getInheritanceModes().isEmpty(), is(true)));
}
 
开发者ID:exomiser,项目名称:Exomiser,代码行数:25,代码来源:InheritanceModeAnalyserTest.java

示例6: makeGenotypePie

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
private PieChart makeGenotypePie(final VariantContext ctx) {
    final Counter<GenotypeType> countTypes= new Counter<>();
    if(ctx!=null) {
    	for(final Genotype g:ctx.getGenotypes())
{
    		// ignore genotype if not displayed
    		final SampleDef sampleDef= this.name2sampledef.get(g.getSampleName());
    		if(sampleDef==null || !sampleDef.isDisplayed()) continue;

    		countTypes.incr(g.getType());
}
    	}
	final ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
	for(final GenotypeType t:GenotypeType.values())
		{
		
		int c= (int)countTypes.count(t);
		if(c==0) continue;
		pieChartData.add(new PieChart.Data(
				t.name()+" = "+c,
				c));
		}
    final PieChart chart = new PieChart(pieChartData);
    chart.setLegendVisible(false);
    return chart;
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:27,代码来源:VcfStage.java

示例7: distance

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
double distance(final Call c2) {
int n=0;
double d=0;
for(final GenotypeType gt1:this.genotypes)
	{
	for(final GenotypeType gt2:c2.genotypes)
		{
		final GTPair gtpair = new GTPair(gt1, gt2);
		final Double score = VcfPhyloTree.this.gtype2score.get(gtpair);
		if(score ==null) throw new RuntimeException("diff score between "+gt1+" and "+gt2+" is not defined");
		d+=score.doubleValue();
		++n;
		}
	}
return d/n;
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:17,代码来源:VcfPhyloTree.java

示例8: VcfPhyloTree

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
private VcfPhyloTree()
{
for(GenotypeType gt1:GenotypeType.values())
	{
	for(GenotypeType gt2:GenotypeType.values())
		{
		double score=5;
		if(gt1.equals(gt2))
			{
			score=0;
			}
		final  GTPair p=new GTPair(gt1, gt2);
		this.gtype2score.put(p, score);
		}
	}
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:17,代码来源:VcfPhyloTree.java

示例9: basicStatics

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
private boolean[] basicStatics(Genotype gt, IntArray array, Allele Ref,GenotypeType type) {
	boolean[] conf = new boolean[4];
	Arrays.fill(conf, false);

	List<Allele> alts = gt.getAlleles();
	if(type == GenotypeType.NO_CALL || type == GenotypeType.HOM_REF)
		return conf;
	boolean isBiallelic = determinePolymorphicType(Ref, alts, conf);
	if(!isBiallelic)
		return new boolean[]{false,false,false,false};
	
	array.incr(VariantEnum.VARIANTS);
	if (conf[0])
		array.incr(VariantEnum.SNPS);
	if (conf[1])
		array.incr(VariantEnum.MNPS);
	if (conf[2]) {
		array.incr(VariantEnum.INSERTIONS);
	}
	if (conf[3]) {
		array.incr(VariantEnum.DELETIONS);
	}

	if (conf[2] || conf[3])
		array.incr(VariantEnum.INDELS);

	if (conf[0] && isBiallelic && isTransition(alts.get(0),alts.get(1))) {
		array.incr(VariantEnum.TRANSITIONS);
	} else if (conf[0] && isBiallelic)
		array.incr(VariantEnum.TRANSVERSIONS);

	return conf;
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:34,代码来源:VariantBasicStatistic.java

示例10: determineType

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
private GenotypeType determineType(final List<Allele> alleles) {
    if ( alleles.isEmpty() )
        return GenotypeType.UNAVAILABLE;

    boolean sawNoCall = false, sawMultipleAlleles = false;
    Allele observedAllele = null;

    for ( final Allele allele : alleles ) {
        if ( allele.isNoCall() )
            sawNoCall = true;
        else if ( observedAllele == null )
            observedAllele = allele;
        else if ( !allele.equals(observedAllele) )
            sawMultipleAlleles = true;
    }

    if ( sawNoCall ) {
        if ( observedAllele == null )
            return GenotypeType.NO_CALL;
        return GenotypeType.MIXED;
    }

    if ( observedAllele == null )
        throw new IllegalStateException("BUG: there are no alleles present in this genotype but the alleles list is not null");

    return sawMultipleAlleles ? GenotypeType.HET : observedAllele.isReference() ? GenotypeType.HOM_REF : GenotypeType.HOM_VAR;
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:28,代码来源:VariantBasicStatistic.java

示例11: VariantReviewDialog

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
public VariantReviewDialog(Frame owner, VariantContext vc, String dbSpecPath) {
    super(owner);
    initComponents();

    truthField.setModel(new DefaultComboBoxModel(TruthStatus.values()));
    genotypeTypeField.setModel(new DefaultComboBoxModel(GenotypeType.values()));
    this.variantContext = vc;
    this.userName = System.getProperty("user.name", "unknown");
    this.dbSpecPath = dbSpecPath;

    initComponentData(vc);
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:13,代码来源:VariantReviewDialog.java

示例12: okButtonActionPerformed

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
/**
 * Save information to Mongo
 *
 * @param e
 */
private void okButtonActionPerformed(ActionEvent e) {

    String callsetName = callsetField.getText();
    TruthStatus truthStatus = (TruthStatus) truthField.getSelectedItem();
    boolean isComplexEvent = isComplexEventCB.isSelected();

    int allele0 = -1;
    int allele1 = -1;

    GenotypeType gtt = (GenotypeType) genotypeTypeField.getSelectedItem();
    switch (gtt) {
        case HOM_REF:
            allele0 = allele1 = 0;
            break;
        case HOM_VAR:
            allele0 = allele1 = 1;
            break;
        case HET:
            allele0 = 0;
            allele1 = 1;
            break;
    }

    MongoVariantContext mvc = VariantReviewSource.createMVC(allele0, allele1, callsetName, sampleVC, truthStatus, isComplexEvent);
    String errorMessage = addCall(this.dbSpecPath, mvc);

    if (errorMessage != null) {
        MessageUtils.showErrorMessage(errorMessage, new IOException(errorMessage));
    } else {
        setVisible(false);
        //Find the track showing results, clear it to force a refresh
        for (Track t : IGV.getInstance().getFeatureTracks()) {
            if (t instanceof VariantTrack) {
                ((VariantTrack) t).clearPackedFeatures();
            }
        }
        IGV.getInstance().repaintDataPanels();
    }
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:45,代码来源:VariantReviewDialog.java

示例13: truthFieldItemStateChanged

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
private void truthFieldItemStateChanged(ItemEvent e) {
    if (truthField.getSelectedItem() == TruthStatus.FALSE_POSITIVE) {
        genotypeTypeField.setSelectedItem(GenotypeType.NO_CALL);
        genotypeTypeField.setEnabled(false);
    } else {
        genotypeTypeField.setEnabled(true);
        initGenotypeTypeField(this.variantContext);
    }

}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:11,代码来源:VariantReviewDialog.java

示例14: initGenotypeTypeField

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
private void initGenotypeTypeField(VariantContext variant) {
    String mutationString = null;
    GenotypeType gtt = GenotypeType.NO_CALL;
    String prefSampleName = VariantReviewPlugin.getPreferentialSampleName();

    //If there is only one sample, or we find the preferential sample,
    //use that data.
    for (String sampleName : variant.getSampleNamesOrderedByName()) {
        boolean isPref = sampleName.equalsIgnoreCase(prefSampleName);
        if (isPref || mutationString == null) {
            if(!variantContext.isBiallelic())
                sampleVC = variantContext.subContextFromSamples(Collections.singleton(sampleName), true);
            else
                sampleVC = variantContext;

            mutationString = ParsingUtils.join(",", ParsingUtils.sortList(sampleVC.getAlleles()));
            Genotype genotype = sampleVC.getGenotype(sampleName);
            gtt = genotype.getType();
            if (isPref) break;
        } else {
            //If we have several samples with different mutations, don't know which
            //to pick. Make that obvious to the user
            if (gtt != sampleVC.getGenotype(sampleName).getType()) {
                mutationString = "./.";
                gtt = GenotypeType.UNAVAILABLE;
            }
        }
    }

    genotypeTypeField.setSelectedItem(gtt);
    mutField.setText(mutationString);
    mutField.setToolTipText(mutationString);
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:34,代码来源:VariantReviewDialog.java

示例15: testAnalyseInheritanceModes_MultiSample_OnePassedVariant_HOM_VAR_shouldBeCompatibelWith_RECESSIVE

import htsjdk.variant.variantcontext.GenotypeType; //导入依赖的package包/类
@Test
public void testAnalyseInheritanceModes_MultiSample_OnePassedVariant_HOM_VAR_shouldBeCompatibelWith_RECESSIVE() {
    Gene gene = newGene();
    List<Allele> alleles = buildAlleles("A", "T");
    // build Genotype
    //HomVar 1/1 or 1|1 variants are a really likely candidate for recessive rare diseases
    Genotype proband = buildSampleGenotype("Cain", alleles.get(1), alleles.get(1));
    assertThat(proband.getType(), equalTo(GenotypeType.HOM_VAR));

    Genotype mother = buildSampleGenotype("Eve", alleles.get(0), alleles.get(1));
    assertThat(mother.getType(), equalTo(GenotypeType.HET));

    Genotype father = buildSampleGenotype("Adam", alleles.get(1), alleles.get(0));
    assertThat(father.getType(), equalTo(GenotypeType.HET));

    VariantContext variantContext = buildVariantContext(1, 12345, alleles, proband, mother, father);
    System.out.println("Built variant context " + variantContext);

    gene.addVariant(filteredVariant(1, 12345, "A", "T", FilterResult.pass(FilterType.FREQUENCY_FILTER), variantContext));

    PedPerson probandPerson = new PedPerson("Family", "Cain", "Adam", "Eve", Sex.MALE, Disease.AFFECTED, new ArrayList<String>());
    PedPerson motherPerson = new PedPerson("Family", "Eve", "0", "0", Sex.FEMALE, Disease.UNAFFECTED, new ArrayList<String>());
    PedPerson fatherPerson = new PedPerson("Family", "Adam", "0", "0", Sex.MALE, Disease.UNAFFECTED, new ArrayList<String>());
    Pedigree pedigree = buildPedigree(probandPerson, motherPerson, fatherPerson);

    InheritanceModeAnalyser instance = new InheritanceModeAnalyser(ModeOfInheritance.AUTOSOMAL_RECESSIVE, pedigree);
    instance.analyseInheritanceModes(gene);
    assertThat(gene.isCompatibleWith(ModeOfInheritance.ANY), is(false));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(false));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(true));

    gene.getPassedVariantEvaluations()
            .forEach(variant -> assertThat(variant.getInheritanceModes(), hasItem(ModeOfInheritance.AUTOSOMAL_RECESSIVE)));
}
 
开发者ID:exomiser,项目名称:Exomiser,代码行数:35,代码来源:InheritanceModeAnalyserTest.java


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