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


Java GenotypesContext.iterateInSampleNameOrder方法代码示例

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


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

示例1: getGLs

import htsjdk.variant.variantcontext.GenotypesContext; //导入方法依赖的package包/类
/**
 * Unpack GenotypesContext into arraylist of doubel values
 * @param GLs            Input genotype context
 * @return               ArrayList of doubles corresponding to GL vectors
 */
protected static ArrayList<double[]> getGLs(final GenotypesContext GLs, final boolean includeDummy) {
    final ArrayList<double[]> genotypeLikelihoods = new ArrayList<>(GLs.size() + 1);

    if ( includeDummy ) genotypeLikelihoods.add(new double[]{0.0,0.0,0.0}); // dummy
    for ( Genotype sample : GLs.iterateInSampleNameOrder() ) {
        if ( sample.hasLikelihoods() ) {
            final double[] gls = sample.getLikelihoods().getAsVector();

            if ( MathUtils.sum(gls) < GATKVariantContextUtils.SUM_GL_THRESH_NOCALL )
                genotypeLikelihoods.add(gls);
        }
    }

    return genotypeLikelihoods;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:21,代码来源:ExactAFCalculator.java

示例2: reduceScopeCalculateLikelihoodSums

import htsjdk.variant.variantcontext.GenotypesContext; //导入方法依赖的package包/类
@Override
protected void reduceScopeCalculateLikelihoodSums(final VariantContext vc, final int defaultPloidy, final LikelihoodSum[] likelihoodSums) {
    final int numOriginalAltAlleles = likelihoodSums.length;
    final GenotypesContext genotypes = vc.getGenotypes();
    for (final Genotype genotype : genotypes.iterateInSampleNameOrder()) {
        if (!genotype.hasPL())
            continue;
        final double[] gls = genotype.getLikelihoods().getAsVector();
        if (MathUtils.sum(gls) >= GATKVariantContextUtils.SUM_GL_THRESH_NOCALL)
            continue;

        final int PLindexOfBestGL = MathUtils.maxElementIndex(gls);

        final double bestToHomRefDiffGL = PLindexOfBestGL == PL_INDEX_OF_HOM_REF ? 0.0 : gls[PLindexOfBestGL] - gls[PL_INDEX_OF_HOM_REF];
        final int declaredPloidy = genotype.getPloidy();
        final int ploidy = declaredPloidy <= 0 ? defaultPloidy : declaredPloidy;

        final int[] acCount = GeneralPloidyGenotypeLikelihoods.getAlleleCountFromPLIndex(1 + numOriginalAltAlleles, ploidy, PLindexOfBestGL);
        // by convention, first count coming from getAlleleCountFromPLIndex comes from reference allele
        for (int k = 1; k < acCount.length; k++)
            if (acCount[k] > 0)
                likelihoodSums[k - 1].sum += acCount[k] * bestToHomRefDiffGL;
    }
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:25,代码来源:GeneralPloidyExactAFCalculator.java

示例3: getGLs

import htsjdk.variant.variantcontext.GenotypesContext; //导入方法依赖的package包/类
/**
 * Unpack GenotypesContext into arraylist of double values
 * @param GLs            Input genotype context
 * @param keepUninformative Don't filter out uninformative genotype likelihoods (i.e. all log likelihoods near 0)
 *                          This is useful for VariantContexts with a NON_REF allele
 * @return               ArrayList of doubles corresponding to GL vectors
 */
protected static ArrayList<double[]> getGLs(final GenotypesContext GLs, final boolean includeDummy, final boolean keepUninformative) {
    final ArrayList<double[]> genotypeLikelihoods = new ArrayList<>(GLs.size() + 1);

    if ( includeDummy ) genotypeLikelihoods.add(new double[]{0.0,0.0,0.0}); // dummy
    for ( Genotype sample : GLs.iterateInSampleNameOrder() ) {
        if ( sample.hasLikelihoods() ) {
            final double[] gls = sample.getLikelihoods().getAsVector();
            
            if ( MathUtils.sum(gls) < GaeaGvcfVariantContextUtils.SUM_GL_THRESH_NOCALL || keepUninformative )
                genotypeLikelihoods.add(gls);
        }
    }

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

示例4: reduceScopeCalculateLikelihoodSums

import htsjdk.variant.variantcontext.GenotypesContext; //导入方法依赖的package包/类
@Override
protected void reduceScopeCalculateLikelihoodSums(final VariantContext vc, final int defaultPloidy, final LikelihoodSum[] likelihoodSums) {
    final int numOriginalAltAlleles = likelihoodSums.length;
    final GenotypesContext genotypes = vc.getGenotypes();
    for ( final Genotype genotype : genotypes.iterateInSampleNameOrder() ) {
        if (!genotype.hasPL())
            continue;
        final double[] gls = genotype.getLikelihoods().getAsVector();
        if (MathUtils.sum(gls) >= GaeaGvcfVariantContextUtils.SUM_GL_THRESH_NOCALL)
            continue;

        final int PLindexOfBestGL = MathUtils.maxElementIndex(gls);

        final double bestToHomRefDiffGL = PLindexOfBestGL == PL_INDEX_OF_HOM_REF ? 0.0 : gls[PLindexOfBestGL] - gls[PL_INDEX_OF_HOM_REF];
        final int declaredPloidy = genotype.getPloidy();
        final int ploidy = declaredPloidy <= 0 ? defaultPloidy : declaredPloidy;

        final int[] acCount = GeneralPloidyGenotypeLikelihoods.getAlleleCountFromPLIndex(1 + numOriginalAltAlleles, ploidy, PLindexOfBestGL);
        // by convention, first count coming from getAlleleCountFromPLIndex comes from reference allele
        for (int k=1; k < acCount.length;k++)
            if (acCount[k] > 0 )
                likelihoodSums[k-1].sum += acCount[k] * bestToHomRefDiffGL;
    }
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:25,代码来源:GeneralPloidyExactAFCalculator.java

示例5: reduceScopeCalculateLikelihoodSums

import htsjdk.variant.variantcontext.GenotypesContext; //导入方法依赖的package包/类
@Override
@Requires("vc != null && likelihoodSums != null")
protected void reduceScopeCalculateLikelihoodSums(final VariantContext vc, final int defaultPloidy, final LikelihoodSum[] likelihoodSums) {
    final int numOriginalAltAlleles = likelihoodSums.length;
    final GenotypesContext genotypes = vc.getGenotypes();
    for ( final Genotype genotype : genotypes.iterateInSampleNameOrder() ) {
        if (!genotype.hasPL())
            continue;
        final double[] gls = genotype.getLikelihoods().getAsVector();
        if (GvcfMathUtils.sum(gls) >= GaeaGvcfVariantContextUtils.SUM_GL_THRESH_NOCALL)
            continue;

        final int PLindexOfBestGL = GvcfMathUtils.maxElementIndex(gls);

        final double bestToHomRefDiffGL = PLindexOfBestGL == PL_INDEX_OF_HOM_REF ? 0.0 : gls[PLindexOfBestGL] - gls[PL_INDEX_OF_HOM_REF];
        final int declaredPloidy = genotype.getPloidy();
        final int ploidy = declaredPloidy <= 0 ? defaultPloidy : declaredPloidy;

        final int[] acCount = GeneralPloidyGenotypeLikelihoods.getAlleleCountFromPLIndex(1 + numOriginalAltAlleles, ploidy, PLindexOfBestGL);
        // by convention, first count coming from getAlleleCountFromPLIndex comes from reference allele
        for (int k=1; k < acCount.length;k++)
            if (acCount[k] > 0 )
                likelihoodSums[k-1].sum += acCount[k] * bestToHomRefDiffGL;
    }
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:26,代码来源:IndependentAllelesExactAFCalculator.java

示例6: combineSinglePools

import htsjdk.variant.variantcontext.GenotypesContext; //导入方法依赖的package包/类
/**
 * Simple non-optimized version that combines GLs from several pools and produces global AF distribution.
 *
 * @param GLs                        Inputs genotypes context with per-pool GLs
 * @param numAlleles                 Number of alternate alleles
 * @param log10AlleleFrequencyPriors Frequency priors
 */
protected void combineSinglePools(final GenotypesContext GLs,
                                  final int defaultPloidy,
                                  final int numAlleles,
                                  final double[] log10AlleleFrequencyPriors) {

    // Combine each pool incrementally - likelihoods will be renormalized at each step

    // first element: zero ploidy, e.g. trivial degenerate distribution
    final int numAltAlleles = numAlleles - 1;
    final int[] zeroCounts = new int[numAlleles];
    final ExactACset set = new ExactACset(1, new ExactACcounts(zeroCounts));
    set.getLog10Likelihoods()[0] = 0.0;
    final StateTracker stateTracker = getStateTracker(false, numAltAlleles);
    int combinedPloidy = 0;
    CombinedPoolLikelihoods combinedPoolLikelihoods = new CombinedPoolLikelihoods();
    combinedPoolLikelihoods.add(set);

    for (final Genotype genotype : GLs.iterateInSampleNameOrder()) {
        // recover gls and check if they qualify.
        if (!genotype.hasPL())
            continue;
        final double[] gls = genotype.getLikelihoods().getAsVector();
        if (MathUtils.sum(gls) >= GATKVariantContextUtils.SUM_GL_THRESH_NOCALL)
            continue;
        stateTracker.reset();
        final int declaredPloidy = genotype.getPloidy();
        final int ploidy = declaredPloidy < 1 ? defaultPloidy : declaredPloidy;
        // they do qualify so we proceed.
        combinedPoolLikelihoods = fastCombineMultiallelicPool(combinedPoolLikelihoods, gls,
                combinedPloidy, ploidy, numAlleles, log10AlleleFrequencyPriors, stateTracker);
        combinedPloidy = ploidy + combinedPloidy; // total number of chromosomes in combinedLikelihoods
    }
    if (combinedPloidy == 0)
        stateTracker.setLog10LikelihoodOfAFzero(0.0);
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:43,代码来源:GeneralPloidyExactAFCalculator.java

示例7: getGLs

import htsjdk.variant.variantcontext.GenotypesContext; //导入方法依赖的package包/类
/**
 * Unpack GenotypesContext into arraylist of doubel values
 * @param GLs            Input genotype context
 * @return               ArrayList of doubles corresponding to GL vectors
 */
protected static ArrayList<double[]> getGLs(final GenotypesContext GLs, final boolean includeDummy) {
    ArrayList<double[]> genotypeLikelihoods = new ArrayList<double[]>(GLs.size() + 1);
    if ( includeDummy ) genotypeLikelihoods.add(new double[]{0.0,0.0,0.0}); // dummy
    for ( Genotype sample : GLs.iterateInSampleNameOrder() ) {
    	if ( sample.hasLikelihoods() ) {
            double[] gls = sample.getLikelihoods().getAsVector();
            if ( MathUtils.sum(gls) < GaeaVariantContextUtils.SUM_GL_THRESH_NOCALL )
                genotypeLikelihoods.add(gls);
        }
    }

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

示例8: combineSinglePools

import htsjdk.variant.variantcontext.GenotypesContext; //导入方法依赖的package包/类
/**
 * Simple non-optimized version that combines GLs from several pools and produces global AF distribution.
 * @param GLs                              Inputs genotypes context with per-pool GLs
 * @param numAlleles                       Number of alternate alleles
 * @param log10AlleleFrequencyPriors       Frequency priors
 */
protected void combineSinglePools(final GenotypesContext GLs,
                                  final int defaultPloidy,
                                  final int numAlleles,
                                  final double[] log10AlleleFrequencyPriors) {

    // Combine each pool incrementally - likelihoods will be renormalized at each step

    // first element: zero ploidy, e.g. trivial degenerate distribution
    final int numAltAlleles = numAlleles - 1;
    final int[] zeroCounts = new int[numAlleles];
    final ExactACset set = new ExactACset(1, new ExactACcounts(zeroCounts));
    set.getLog10Likelihoods()[0] = 0.0;
    final StateTracker stateTracker = getStateTracker(false,numAltAlleles);
    int combinedPloidy = 0;
    CombinedPoolLikelihoods combinedPoolLikelihoods = new CombinedPoolLikelihoods();
    combinedPoolLikelihoods.add(set);

    for (final Genotype genotype : GLs.iterateInSampleNameOrder()) {
        // recover gls and check if they qualify.
        if (!genotype.hasPL())
            continue;
        final double[] gls = genotype.getLikelihoods().getAsVector();
        if (MathUtils.sum(gls) >= GaeaGvcfVariantContextUtils.SUM_GL_THRESH_NOCALL)
            continue;
        stateTracker.reset();
        final int declaredPloidy = genotype.getPloidy();
        final int ploidy = declaredPloidy < 1 ? defaultPloidy : declaredPloidy;
        // they do qualify so we proceed.
        combinedPoolLikelihoods = fastCombineMultiallelicPool(combinedPoolLikelihoods, gls,
                combinedPloidy, ploidy, numAlleles, log10AlleleFrequencyPriors, stateTracker);
        combinedPloidy = ploidy + combinedPloidy; // total number of chromosomes in combinedLikelihoods
    }
    if (combinedPloidy == 0)
        stateTracker.setLog10LikelihoodOfAFzero(0.0);
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:42,代码来源:GeneralPloidyExactAFCalculator.java


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