本文整理汇总了Java中htsjdk.variant.variantcontext.Genotype.isHetNonRef方法的典型用法代码示例。如果您正苦于以下问题:Java Genotype.isHetNonRef方法的具体用法?Java Genotype.isHetNonRef怎么用?Java Genotype.isHetNonRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.variant.variantcontext.Genotype
的用法示例。
在下文中一共展示了Genotype.isHetNonRef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getZygosityType
import htsjdk.variant.variantcontext.Genotype; //导入方法依赖的package包/类
private String getZygosityType(Genotype gt){
if(gt.isHet())
return "het-ref";
else if(gt.isHomVar())
return "hom-alt";
else if(gt.isHetNonRef())
return "het-alt";
return ".";
}
示例2: getGenotypeCountsForRefVsAllAlts
import htsjdk.variant.variantcontext.Genotype; //导入方法依赖的package包/类
/**
* Get the genotype counts for A/A, A/B, and B/B where A is the reference and B is any alternate allele
* @param vc
* @param genotypes may be subset to just founders if a pedigree file is provided
* @return may be null, otherwise length-3 double[] representing homRef, het, and homVar counts
*/
public double[] getGenotypeCountsForRefVsAllAlts(final VariantContext vc, final GenotypesContext genotypes) {
if (genotypes == null || !vc.isVariant())
return null;
final boolean doMultiallelicMapping = !vc.isBiallelic();
int idxAA = 0, idxAB = 1, idxBB = 2;
double refCount = 0;
double hetCount = 0;
double homCount = 0;
sampleCount = 0;
for (final Genotype g : genotypes) {
if (g.isCalled() && g.hasLikelihoods() && g.getPloidy() == 2) // only work for diploid samples
sampleCount++;
else
continue;
//Need to round the likelihoods to deal with small numerical deviations due to normalizing
final double[] normalizedLikelihoodsUnrounded = GvcfMathUtils.normalizeFromLog10(g.getLikelihoods().getAsVector());
double[] normalizedLikelihoods = new double[normalizedLikelihoodsUnrounded.length];
if (returnRounded) {
for (int i = 0; i < normalizedLikelihoodsUnrounded.length; i++) {
normalizedLikelihoods[i] = Math.round(normalizedLikelihoodsUnrounded[i]);
}
} else {
normalizedLikelihoods = normalizedLikelihoodsUnrounded;
}
if (doMultiallelicMapping) {
if (g.isHetNonRef()) {
//all likelihoods go to homCount
homCount++;
continue;
}
if (!g.isHomRef()) {
//get alternate allele for each sample
final Allele a1 = g.getAllele(0);
final Allele a2 = g.getAllele(1);
final int[] idxVector = vc.getGLIndecesOfAlternateAllele(a2.isNonReference() ? a2 : a1);
idxAA = idxVector[0];
idxAB = idxVector[1];
idxBB = idxVector[2];
}
}
refCount += normalizedLikelihoods[idxAA];
hetCount += normalizedLikelihoods[idxAB];
homCount += normalizedLikelihoods[idxBB];
}
return new double[]{refCount, hetCount, homCount};
}
示例3: hasHetNonRef
import htsjdk.variant.variantcontext.Genotype; //导入方法依赖的package包/类
/**
* Check if any of the genotypes is heterozygous, non-reference (i.e. 1/2)
*
* @param genotypesContext
* genotype information
* @return true if any of the genotypes are heterozygous, non-reference,
* false otherwise
*/
private static boolean hasHetNonRef(final GenotypesContext genotypesContext) {
for (final Genotype gt : genotypesContext) {
if (gt.isHetNonRef())
return true;
}
return false;
}