作者:拍友2702938227 | 来源:互联网 | 2023-08-17 14:41
本文整理了Java中htsjdk.variant.variantcontext.Genotype.sameGenotype()
方法的一些代码示例,展示了Genotype.sameGenotype()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Genotype.sameGenotype()
方法的具体详情如下:
包路径:htsjdk.variant.variantcontext.Genotype
类名称:Genotype
方法名:sameGenotype
Genotype.sameGenotype介绍
暂无
代码示例
代码示例来源:origin: samtools/htsjdk
public boolean sameGenotype(final Genotype other) {
return sameGenotype(other, true);
}
代码示例来源:origin: com.github.samtools/htsjdk
public boolean sameGenotype(final Genotype other) {
return sameGenotype(other, true);
}
代码示例来源:origin: org.seqdoop/htsjdk
public boolean sameGenotype(final Genotype other) {
return sameGenotype(other, true);
}
代码示例来源:origin: samtools/htsjdk
Assert.assertTrue( ((Genotype) jEXLContext.get("g")).sameGenotype(gt, false));
Assert.assertEquals(jEXLContext.get("isHom"), VariantJEXLContext.false_string);
Assert.assertEquals(jEXLContext.get("isHomRef"), VariantJEXLContext.false_string);
代码示例来源:origin: broadinstitute/picard
@Test(dataProvider = "updatePLsAndADData")
public void testUpdatePLsAndADData(final VariantContext originalVC,
final VariantContext selectedVC,
final List expectedGenotypes) {
// initialize cache of allele anyploid indices
for (final Genotype genotype : originalVC.getGenotypes()) {
GenotypeLikelihoods.initializeAnyploidPLIndexToAlleleIndices(originalVC.getNAlleles() - 1, genotype.getPloidy());
}
final VariantContext selectedVCwithGTs = new VariantContextBuilder(selectedVC).genotypes(originalVC.getGenotypes()).make();
final GenotypesContext oldGs = selectedVCwithGTs.getGenotypes();
final GenotypesContext actual = selectedVCwithGTs.getNAlleles() == originalVC.getNAlleles() ? oldGs :
AlleleSubsettingUtils.subsetAlleles(oldGs, originalVC.getAlleles(),
selectedVCwithGTs.getAlleles());
Assert.assertEquals(actual.size(), expectedGenotypes.size());
for (final Genotype expected : expectedGenotypes) {
final Genotype actualGT = actual.get(expected.getSampleName());
Assert.assertNotNull(actualGT);
Assert.assertTrue(actualGT.sameGenotype(expected), String.format("expected same genotypes, found: %s and expected: %s", actual.toString(), expected.toString()));
}
}
代码示例来源:origin: broadgsa/gatk-protected
@Test
public void TestReallyMergeIntoMNP( ){
final VariantContext vc = PhasingUtils.reallyMergeIntoMNP(vc1, vc2, referenceFile);
final List alleleList = Arrays.asList(Allele.create("TG", true), Allele.create("TA", false), Allele.create("CG", false));
final Map attributes = new HashMap(){{
put("AC", new ArrayList(Arrays.asList(1, 1)));
put("AF", new ArrayList(Arrays.asList(0.5, 0.5)));
put("AN", 2);
}};
final Map extendedAttributes = new HashMap(){{
put("PQ", 100.0); put("HP", new String[]{"10-1", "10-2"});
}};
final List alleleListMeged = Arrays.asList(Allele.create("TA"), Allele.create("CG"));
final Genotype genotype = new GenotypeBuilder().name("sample").attributes(extendedAttributes).alleles(alleleListMeged).make();
final VariantContext vcExpected = new VariantContextBuilder().chr(contig).id("id1;id2").source("TC_GA").start(start).stop(start+1).alleles(alleleList).genotypes(genotype).attributes(attributes).make();
Assert.assertTrue(genotype.sameGenotype(vcExpected.getGenotypes().get("sample")));
Assert.assertTrue(vcExpected.hasSameAllelesAs(vc));
Assert.assertEquals(vcExpected.getChr(), vc.getChr());
Assert.assertEquals(vcExpected.getStart(), vc.getStart());
Assert.assertEquals(vcExpected.getEnd(), vc.getEnd());
Assert.assertEquals(vcExpected.getID(), vc.getID());
Assert.assertEquals(vcExpected.getSource(), vc.getSource());
Assert.assertEquals(vcExpected.isFiltered(), vc.isFiltered());
Assert.assertEquals(vcExpected.getPhredScaledQual(), vc.getPhredScaledQual());
Assert.assertEquals(vcExpected.getAttribute("PQ"), vc.getAttribute("PQ"));
Assert.assertEquals(vcExpected.getAttribute("HP"), vc.getAttribute("HP"));
}
代码示例来源:origin: broadgsa/gatk-protected
@Test
public void TestMergeIntoMNP(){
final AlwaysTrueMergeRule alleleMergeRule = new AlwaysTrueMergeRule();
final VariantContext vc = PhasingUtils.mergeIntoMNP(genomeLocParser, vc1, vc2, referenceFile, alleleMergeRule);
final List alleleList = Arrays.asList(Allele.create("TG", true), Allele.create("TA", false), Allele.create("CG", false));
final Map attributes = new HashMap(){{
put("AC", new ArrayList(Arrays.asList(1, 1)));
put("AF", new ArrayList(Arrays.asList(0.5, 0.5)));
put("AN", 2);
}};
final Map extendedAttributes = new HashMap(){{
put("PQ", 100.0); put("HP", new String[]{"10-1", "10-2"});
}};
final List alleleListMeged = Arrays.asList(Allele.create("TA"), Allele.create("CG"));
final Genotype genotype = new GenotypeBuilder().name("sample").attributes(extendedAttributes).alleles(alleleListMeged).make();
final VariantContext vcExpected = new VariantContextBuilder().chr(contig).id("id1;id2").source("TC_GA").start(start).stop(start+1).alleles(alleleList).genotypes(genotype).attributes(attributes).make();
Assert.assertTrue(genotype.sameGenotype(vcExpected.getGenotypes().get("sample")));
Assert.assertTrue(vcExpected.hasSameAllelesAs(vc));
Assert.assertEquals(vcExpected.getChr(), vc.getChr());
Assert.assertEquals(vcExpected.getStart(), vc.getStart());
Assert.assertEquals(vcExpected.getEnd(), vc.getEnd());
Assert.assertEquals(vcExpected.getID(), vc.getID());
Assert.assertEquals(vcExpected.getSource(), vc.getSource());
Assert.assertEquals(vcExpected.isFiltered(), vc.isFiltered());
Assert.assertEquals(vcExpected.getPhredScaledQual(), vc.getPhredScaledQual());
Assert.assertEquals(vcExpected.getAttribute("PQ"), vc.getAttribute("PQ"));
Assert.assertEquals(vcExpected.getAttribute("HP"), vc.getAttribute("HP"));
}