/** * comparable genotypes -> compareTo on the sample names * @param genotype * @return */ @Override public int compareTo(final Genotype genotype) { return getSampleName().compareTo(genotype.getSampleName()); }
/** * comparable genotypes -> compareTo on the sample names * @param genotype * @return */ @Override public int compareTo(final Genotype genotype) { return getSampleName().compareTo(genotype.getSampleName()); }
public static Set<String> genotypeNames(final Collection<Genotype> genotypes) { final Set<String> names = new HashSet<String>(genotypes.size()); for ( final Genotype g : genotypes ) names.add(g.getSampleName()); return names; }
public static Set<String> genotypeNames(final Collection<Genotype> genotypes) { final Set<String> names = new HashSet<String>(genotypes.size()); for ( final Genotype g : genotypes ) names.add(g.getSampleName()); return names; }
public static Set<String> genotypeNames(final Collection<Genotype> genotypes) { final Set<String> names = new HashSet<String>(genotypes.size()); for ( final Genotype g : genotypes ) names.add(g.getSampleName()); return names; }
/** * @param g Genotype * @return sample Object with this ID, or null if this does not exist */ public Sample getSample(final Genotype g) { return getSample(g.getSampleName()); }
@Override public Genotype set(final int i, final Genotype genotype) { checkImmutability(); final Genotype prev = getGenotypes().set(i, genotype); invalidateSampleOrdering(); if ( sampleNameToOffset != null ) { // update the name map by removing the old entry and replacing it with the new one sampleNameToOffset.remove(prev.getSampleName()); sampleNameToOffset.put(genotype.getSampleName(), i); } return prev; }
@Override public Genotype set(final int i, final Genotype genotype) { checkImmutability(); final Genotype prev = getGenotypes().set(i, genotype); invalidateSampleOrdering(); if ( sampleNameToOffset != null ) { // update the name map by removing the old entry and replacing it with the new one sampleNameToOffset.remove(prev.getSampleName()); sampleNameToOffset.put(genotype.getSampleName(), i); } return prev; }
@Override public Genotype set(final int i, final Genotype genotype) { checkImmutability(); final Genotype prev = getGenotypes().set(i, genotype); invalidateSampleOrdering(); if ( sampleNameToOffset != null ) { // update the name map by removing the old entry and replacing it with the new one sampleNameToOffset.remove(prev.getSampleName()); sampleNameToOffset.put(genotype.getSampleName(), i); } return prev; }
protected void ensureSampleOrdering() { if ( sampleNamesInOrder == null ) { sampleNamesInOrder = new ArrayList<String>(size()); for ( int i = 0; i < size(); i++ ) { sampleNamesInOrder.add(getGenotypes().get(i).getSampleName()); } Collections.sort(sampleNamesInOrder); } }
protected void ensureSampleOrdering() { if ( sampleNamesInOrder == null ) { sampleNamesInOrder = new ArrayList<String>(size()); for ( int i = 0; i < size(); i++ ) { sampleNamesInOrder.add(getGenotypes().get(i).getSampleName()); } Collections.sort(sampleNamesInOrder); } }
protected void ensureSampleNameMap() { if ( sampleNameToOffset == null ) { sampleNameToOffset = new HashMap<String, Integer>(size()); for ( int i = 0; i < size(); i++ ) { sampleNameToOffset.put(getGenotypes().get(i).getSampleName(), i); } } }
protected void ensureSampleNameMap() { if ( sampleNameToOffset == null ) { sampleNameToOffset = new HashMap<String, Integer>(size()); for ( int i = 0; i < size(); i++ ) { sampleNameToOffset.put(getGenotypes().get(i).getSampleName(), i); } } }
@Ensures({"sampleNamesInOrder != null"}) protected void ensureSampleOrdering() { if ( sampleNamesInOrder == null ) { sampleNamesInOrder = new ArrayList<String>(size()); for ( int i = 0; i < size(); i++ ) { sampleNamesInOrder.add(getGenotypes().get(i).getSampleName()); } Collections.sort(sampleNamesInOrder); } }
private final static void assertGenotypesAreInOrder(Iterable<Genotype> gIt, List<String> names) { int i = 0; for ( final Genotype g : gIt ) { Assert.assertEquals(g.getSampleName(), names.get(i), "Unexpected genotype ordering"); i++; } }
@Ensures({"sampleNameToOffset != null"}) protected void ensureSampleNameMap() { if ( sampleNameToOffset == null ) { sampleNameToOffset = new HashMap<String, Integer>(size()); for ( int i = 0; i < size(); i++ ) { sampleNameToOffset.put(getGenotypes().get(i).getSampleName(), i); } } }
private final static void testIterable(Iterable<Genotype> genotypeIterable, Set<String> expectedNames) { int count = 0; for ( final Genotype g : genotypeIterable ) { Assert.assertTrue(expectedNames.contains(g.getSampleName())); count++; } Assert.assertEquals(count, expectedNames.size(), "Iterable returned unexpected number of genotypes"); }
public String toString() { return String.format("[%s %s%s%s%s%s%s%s]", getSampleName(), getGenotypeString(false), toStringIfExists(VCFConstants.GENOTYPE_QUALITY_KEY, getGQ()), toStringIfExists(VCFConstants.DEPTH_KEY, getDP()), toStringIfExists(VCFConstants.GENOTYPE_ALLELE_DEPTHS, getAD()), toStringIfExists(VCFConstants.GENOTYPE_PL_KEY, getPL()), toStringIfExists(VCFConstants.GENOTYPE_FILTER_KEY, getFilters()), sortedString(getExtendedAttributes())); }
public String toString() { return String.format("[%s %s%s%s%s%s%s%s]", getSampleName(), getGenotypeString(false), toStringIfExists(VCFConstants.GENOTYPE_QUALITY_KEY, getGQ()), toStringIfExists(VCFConstants.DEPTH_KEY, getDP()), toStringIfExists(VCFConstants.GENOTYPE_ALLELE_DEPTHS, getAD()), toStringIfExists(VCFConstants.GENOTYPE_PL_KEY, getPL()), toStringIfExists(VCFConstants.GENOTYPE_FILTER_KEY, getFilters()), sortedString(getExtendedAttributes())); }
public String toString() { return String.format("[%s %s%s%s%s%s%s%s]", getSampleName(), getGenotypeString(false), toStringIfExists(VCFConstants.GENOTYPE_QUALITY_KEY, getGQ()), toStringIfExists(VCFConstants.DEPTH_KEY, getDP()), toStringIfExists(VCFConstants.GENOTYPE_ALLELE_DEPTHS, getAD()), toStringIfExists(VCFConstants.GENOTYPE_PL_KEY, getPL()), toStringIfExists(VCFConstants.GENOTYPE_FILTER_KEY, getFilters()), sortedString(getExtendedAttributes())); }