public Iterable<Genotype> getGenotypesOrderedBy(Iterable<String> sampleOrdering) { return genotypes.iterateInSampleNameOrder(sampleOrdering); }
public Iterable<Genotype> getGenotypesOrderedByName() { return genotypes.iterateInSampleNameOrder(); }
public Iterable<Genotype> getGenotypesOrderedByName() { return genotypes.iterateInSampleNameOrder(); }
public Iterable<Genotype> getGenotypesOrderedBy(Iterable<String> sampleOrdering) { return genotypes.iterateInSampleNameOrder(sampleOrdering); }
public Iterable<Genotype> getGenotypesOrderedBy(Iterable<String> sampleOrdering) { return genotypes.iterateInSampleNameOrder(sampleOrdering); }
public Iterable<Genotype> getGenotypesOrderedByName() { return genotypes.iterateInSampleNameOrder(); }
/** * Iterate over the Genotypes in this context in their sample name order (A, B, C) * regardless of the underlying order in the vector of genotypes * @return a Iterable over the genotypes in this context. */ public Iterable<Genotype> iterateInSampleNameOrder() { return iterateInSampleNameOrder(getSampleNamesOrderedByName()); }
/** * Iterate over the Genotypes in this context in their sample name order (A, B, C) * regardless of the underlying order in the vector of genotypes * @return a Iterable over the genotypes in this context. */ public Iterable<Genotype> iterateInSampleNameOrder() { return iterateInSampleNameOrder(getSampleNamesOrderedByName()); }
/** * Iterate over the Genotypes in this context in their sample name order (A, B, C) * regardless of the underlying order in the vector of genotypes * @return a Iterable over the genotypes in this context. */ public Iterable<Genotype> iterateInSampleNameOrder() { return iterateInSampleNameOrder(getSampleNamesOrderedByName()); }
@Override public String toString() { final List<String> gS = new ArrayList<String>(); for ( final Genotype g : this.iterateInSampleNameOrder() ) gS.add(g.toString()); return "[" + join(",", gS) + "]"; }
@Override public String toString() { final List<String> gS = new ArrayList<String>(); for ( final Genotype g : this.iterateInSampleNameOrder() ) gS.add(g.toString()); return "[" + join(",", gS) + "]"; }
@Override public String toString() { final List<String> gS = new ArrayList<String>(); for ( final Genotype g : this.iterateInSampleNameOrder() ) gS.add(g.toString()); return "[" + join(",", gS) + "]"; }
/** * 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) < GATKVariantContextUtils.SUM_GL_THRESH_NOCALL || keepUninformative ) genotypeLikelihoods.add(gls); } } return genotypeLikelihoods; }
final List<Double> altQuals = new ArrayList<>(); for ( final Genotype genotype : genotypes.iterateInSampleNameOrder() ) {
builder.loc(context.getChr(),context.getStart(),context.getEnd()); List<Genotype> newGeno = new ArrayList<Genotype>(context.getNSamples()); for ( Genotype g : context.getGenotypes().iterateInSampleNameOrder() ) { newGeno.add(GenotypeBuilder.create(g.getSampleName(),new ArrayList<Allele>()));
testIterable(gc.iterateInSampleNameOrder(), genotypeNames); testIterable(gc, genotypeNames); testIterable(gc.iterateInSampleNameOrder(genotypeNames), genotypeNames); if ( ! genotypeNames.isEmpty() ) { Set<String> first = Collections.singleton(genotypeNames.iterator().next()); testIterable(gc.iterateInSampleNameOrder(first), first); Assert.assertTrue(ParsingUtils.isSorted(gc.iterateInSampleNameOrder())); Assert.assertTrue(gc.containsSamples(genotypeNames));
@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; } }
@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 (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; } }
combinedPoolLikelihoods.add(set); for (final Genotype genotype : GLs.iterateInSampleNameOrder()) {