public boolean isCalled() { return ! isNoCall(); }
public boolean isCalled() { return ! isNoCall(); }
public boolean isCalled() { return ! isNoCall(); }
/** * Return the DNA bases segregating in this allele in String format. * This is useful, because toString() adds a '*' to reference alleles and getBases() returns garbage when you call toString() on it. * * @return the segregating bases */ public String getBaseString() { return isNoCall() ? NO_CALL_STRING : new String(getBases()); }
/** * Return the DNA bases segregating in this allele in String format. * This is useful, because toString() adds a '*' to reference alleles and getBases() returns garbage when you call toString() on it. * * @return the segregating bases */ public String getBaseString() { return isNoCall() ? NO_CALL_STRING : new String(getBases()); }
private ArrayList<Double> calculateMLEAlleleFrequencies(List<Integer> alleleCountsofMLE, GenotypesContext genotypes) { int AN = 0; for (final Genotype g : genotypes) for (final Allele a : g.getAlleles()) if (!a.isNoCall()) AN++; final ArrayList<Double> MLEfrequencies = new ArrayList<>(alleleCountsofMLE.size()); // the MLEAC is allowed to be larger than the AN (e.g. in the case of all PLs being 0, the GT is ./. but the exact model may arbitrarily choose an AC>1) for (final int AC : alleleCountsofMLE ) MLEfrequencies.add(Math.min(1.0, (double)AC / (double)AN)); return MLEfrequencies; }
/** * This is a utility method that will convert a list of alleles into a list of base strings. Reference status * is ignored when creating these strings (i.e. 'A', not 'A*'). These strings should be sufficient * to recreate an Allele using Allele.create() * * @param alleles The list of alleles * @return A list of strings representing the bases of the input alleles. */ protected static List<String> allelesToStringList(final List<Allele> alleles) { final List<String> ret = new ArrayList<>(); alleles.forEach(a -> ret.add(a.isNoCall() ? Allele.NO_CALL_STRING : a.getDisplayString())); return ret; }
/** * Return the DNA bases segregating in this allele in String format. * This is useful, because toString() adds a '*' to reference alleles and getBases() returns garbage when you call toString() on it. * * @return the segregating bases */ public String getBaseString() { return isNoCall() ? NO_CALL_STRING : new String(getBases()); }
/** * This is a utility method that will convert a list of alleles into a list of base strings. Reference status * is ignored when creating these strings (i.e. 'A', not 'A*'). These strings should be sufficient * to recreate an Allele using Allele.create() * * @param alleles The list of alleles * @return A list of strings representing the bases of the input alleles. */ protected static List<String> allelesToStringList(final List<Allele> alleles) { final List<String> ret = new ArrayList<>(); alleles.forEach(a -> ret.add(a.isNoCall() ? Allele.NO_CALL_STRING : a.getDisplayString())); return ret; }
private void validateAlleles() { boolean alreadySeenRef = false; for ( final Allele allele : alleles ) { // make sure there's only one reference allele if ( allele.isReference() ) { if ( alreadySeenRef ) throw new IllegalArgumentException("BUG: Received two reference tagged alleles in VariantContext " + alleles + " this=" + this); alreadySeenRef = true; } if ( allele.isNoCall() ) { throw new IllegalArgumentException("BUG: Cannot add a no call allele to a variant context " + alleles + " this=" + this); } } // make sure there's one reference allele if ( ! alreadySeenRef ) throw new IllegalArgumentException("No reference allele found in VariantContext"); }
/** * parse a single allele, given the allele list * @param alleles the alleles available * @param alt the allele to parse * @param lineNo the line number for this record */ private static void parseSingleAltAllele(List<Allele> alleles, String alt, int lineNo) { checkAllele(alt, false, lineNo); Allele allele = Allele.create(alt, false); if ( ! allele.isNoCall() ) alleles.add(allele); }
/** * parse a single allele, given the allele list * @param alleles the alleles available * @param alt the allele to parse * @param lineNo the line number for this record */ private static void parseSingleAltAllele(List<Allele> alleles, String alt, int lineNo) { checkAllele(alt, false, lineNo); Allele allele = Allele.create(alt, false); if ( ! allele.isNoCall() ) alleles.add(allele); }
/** * parse a single allele, given the allele list * @param alleles the alleles available * @param alt the allele to parse * @param lineNo the line number for this record */ private static void parseSingleAltAllele(List<Allele> alleles, String alt, int lineNo) { checkAllele(alt, false, lineNo); Allele allele = Allele.create(alt, false); if ( ! allele.isNoCall() ) alleles.add(allele); }
public String toString() { return ( isNoCall() ? NO_CALL_STRING : getDisplayString() ) + (isReference() ? "*" : ""); }
public String toString() { return ( isNoCall() ? NO_CALL_STRING : getDisplayString() ) + (isReference() ? "*" : ""); }
public String toString() { return ( isNoCall() ? NO_CALL_STRING : getDisplayString() ) + (isReference() ? "*" : ""); }
/** * Returns the number of chromosomes carrying any allele in the genotypes (i.e., excluding NO_CALLS) * * @param sampleIds IDs of samples to take into account. If empty then all samples are included. * @return chromosome count */ public int getCalledChrCount(Set<String> sampleIds) { int n = 0; GenotypesContext genotypes = sampleIds.isEmpty() ? getGenotypes() : getGenotypes(sampleIds); for ( final Genotype g : genotypes) { for ( final Allele a : g.getAlleles() ) n += a.isNoCall() ? 0 : 1; } return n; }
/** * Returns the number of chromosomes carrying any allele in the genotypes (i.e., excluding NO_CALLS) * * @param sampleIds IDs of samples to take into account. If empty then all samples are included. * @return chromosome count */ public int getCalledChrCount(Set<String> sampleIds) { int n = 0; GenotypesContext genotypes = sampleIds.isEmpty() ? getGenotypes() : getGenotypes(sampleIds); for ( final Genotype g : genotypes) { for ( final Allele a : g.getAlleles() ) n += a.isNoCall() ? 0 : 1; } return n; }
/** * Returns the number of chromosomes carrying any allele in the genotypes (i.e., excluding NO_CALLS) * * @param sampleIds IDs of samples to take into account. If empty then all samples are included. * @return chromosome count */ public int getCalledChrCount(Set<String> sampleIds) { int n = 0; GenotypesContext genotypes = sampleIds.isEmpty() ? getGenotypes() : getGenotypes(sampleIds); for ( final Genotype g : genotypes) { for ( final Allele a : g.getAlleles() ) n += a.isNoCall() ? 0 : 1; } return n; }
@Test public void testCreatingNoCallAlleles() { Assert.assertTrue(NoCall.isNonReference()); Assert.assertFalse(NoCall.isReference()); Assert.assertFalse(NoCall.basesMatch(Allele.NO_CALL_STRING)); Assert.assertEquals(NoCall.length(), 0); Assert.assertTrue(NoCall.isNoCall()); Assert.assertFalse(NoCall.isCalled()); }