/** * 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()); }
public List<String> getSampleNamesOrderedByName() { return getGenotypes().getSampleNamesOrderedByName(); }
public List<String> getSampleNamesOrderedByName() { return getGenotypes().getSampleNamesOrderedByName(); }
public List<String> getSampleNamesOrderedByName() { return getGenotypes().getSampleNamesOrderedByName(); }
/** * Fix the AD for the GenotypesContext of a VariantContext that has been subset * * @param originalGs the original GenotypesContext * @param originalVC the original VariantContext * @param allelesToUse the new (sub)set of alleles to use * @return a new non-null GenotypesContext */ public static GenotypesContext fixADFromSubsettedAlleles(final GenotypesContext originalGs, final VariantContext originalVC, final List<Allele> allelesToUse) { if (originalGs == null) throw new IllegalArgumentException("the original Gs cannot be null"); if (originalVC == null) throw new IllegalArgumentException("the original VC cannot be null"); if (allelesToUse == null) throw new IllegalArgumentException("the alleles to use list cannot be null"); // the bitset representing the allele indexes we want to keep final BitSet alleleIndexesToUse = getAlleleIndexBitset(originalVC, allelesToUse); // the new genotypes to create final GenotypesContext newGTs = GenotypesContext.create(originalGs.size()); // the samples final List<String> sampleIndices = originalGs.getSampleNamesOrderedByName(); // create the new genotypes for ( int k = 0; k < originalGs.size(); k++ ) { final Genotype g = originalGs.get(sampleIndices.get(k)); newGTs.add(fixAD(g, alleleIndexesToUse)); } return newGTs; }
public static void assertEquals(final GenotypesContext actual, final GenotypesContext expected) { if (expected == null) { Assert.assertNull(actual); return; } Assert.assertEquals(actual.getSampleNamesOrderedByName(), expected.getSampleNamesOrderedByName(), "Sample names differ"); for (final String name : expected.getSampleNamesOrderedByName()) { Assert.assertEquals(actual.get(name).getAlleles(), expected.get(name).getAlleles(), "Alleles differ for sample " + name); Assert.assertEquals(actual.get(name).getAD(), expected.get(name).getAD()); Assert.assertEquals(actual.get(name).getPL(), expected.get(name).getPL()); } }
Assert.assertTrue(ParsingUtils.isSorted(gc.getSampleNamesOrderedByName())); Assert.assertTrue(ParsingUtils.isSorted(gc.iterateInSampleNameOrder())); Assert.assertTrue(gc.containsSamples(genotypeNames));
final List<String> sampleIndices = originalGs.getSampleNamesOrderedByName();
final List<String> sampleIndices = oldGTs.getSampleNamesOrderedByName();