/** * @param other the other allele * * @return true if these alleles are equal */ public boolean equals(Object other) { return ( ! (other instanceof Allele) ? false : equals((Allele)other, false) ); }
/** * @param other the other allele * * @return true if these alleles are equal */ public boolean equals(Object other) { return ( ! (other instanceof Allele) ? false : equals((Allele)other, false) ); }
/** * @param other the other allele * * @return true if these alleles are equal */ public boolean equals(Object other) { return ( ! (other instanceof Allele) ? false : equals((Allele)other, false) ); }
private static int indexOfEqualAllele(final VariantContext vc, final Allele allele, final boolean ignoreRefState, final boolean considerRefAllele) { int i = 0; for (final Allele a : vc.getAlleles()) if (a.equals(allele,ignoreRefState)) return i == 0 ? (considerRefAllele ? 0 : -1) : i; else i++; return -1; }
/** * Returns how many times allele appears in this genotype object? * * @param allele * @return a value >= 0 indicating how many times the allele occurred in this sample's genotype */ public int countAllele(final Allele allele) { int c = 0; for ( final Allele a : getAlleles() ) if ( a.equals(allele) ) c++; return c; }
/** * Returns how many times allele appears in this genotype object? * * @param allele * @return a value >= 0 indicating how many times the allele occurred in this sample's genotype */ public int countAllele(final Allele allele) { int c = 0; for ( final Allele a : getAlleles() ) if ( a.equals(allele) ) c++; return c; }
private boolean hasAllele(final Allele allele, final boolean ignoreRefState, final boolean considerRefAllele) { if ( (considerRefAllele && allele == REF) || allele == ALT ) // optimization for cached cases return true; final List<Allele> allelesToConsider = considerRefAllele ? getAlleles() : getAlternateAlleles(); for (int i = 0, allelesToConsiderSize = allelesToConsider.size(); i < allelesToConsiderSize; i++) { Allele anAllelesToConsider = allelesToConsider.get(i); if (anAllelesToConsider.equals(allele, ignoreRefState)) return true; } return false; }
private boolean hasAllele(final Allele allele, final boolean ignoreRefState, final boolean considerRefAllele) { if ( (considerRefAllele && allele == REF) || allele == ALT ) // optimization for cached cases return true; final List<Allele> allelesToConsider = considerRefAllele ? getAlleles() : getAlternateAlleles(); for (int i = 0, allelesToConsiderSize = allelesToConsider.size(); i < allelesToConsiderSize; i++) { Allele anAllelesToConsider = allelesToConsider.get(i); if (anAllelesToConsider.equals(allele, ignoreRefState)) return true; } return false; }
private int findNonRefAllele(final AlleleList<A> alleles) { final int alleleCount = alleles.alleleCount(); for (int i = alleleCount - 1; i >= 0; i--) { if (alleles.alleleAt(i).equals(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE)) return i; } return - 1; }
private boolean hasAllele(final Allele allele, final boolean ignoreRefState, final boolean considerRefAllele) { if ( (considerRefAllele && allele == REF) || allele == ALT ) // optimization for cached cases return true; final List<Allele> allelesToConsider = considerRefAllele ? getAlleles() : getAlternateAlleles(); for ( Allele a : allelesToConsider ) { if ( a.equals(allele, ignoreRefState) ) return true; } return false; }
public static boolean allelesAreSubset(VariantContext vc1, VariantContext vc2) { // if all alleles of vc1 are a contained in alleles of vc2, return true if (!vc1.getReference().equals(vc2.getReference())) return false; for (final Allele a :vc1.getAlternateAlleles()) { if (!vc2.getAlternateAlleles().contains(a)) return false; } return true; }
/** * @param other VariantContext whose alleles to compare against * @return true if this VariantContext has the same alleles (both ref and alts) as other, * regardless of ordering. Otherwise returns false. */ public boolean hasSameAllelesAs ( final VariantContext other ) { return hasSameAlternateAllelesAs(other) && other.getReference().equals(getReference(), false); }
private VariantContext getMatchingSnpEffRecord ( List<VariantContext> snpEffRecords, VariantContext vc ) { for ( VariantContext snpEffRecord : snpEffRecords ) { if ( snpEffRecord.hasSameAlternateAllelesAs(vc) && snpEffRecord.getReference().equals(vc.getReference()) ) { return snpEffRecord; } } return null; }
/** * @param other VariantContext whose alleles to compare against * @return true if this VariantContext has the same alleles (both ref and alts) as other, * regardless of ordering. Otherwise returns false. */ public boolean hasSameAllelesAs ( final VariantContext other ) { return hasSameAlternateAllelesAs(other) && other.getReference().equals(getReference(), false); }
/** * @param other VariantContext whose alleles to compare against * @return true if this VariantContext has the same alleles (both ref and alts) as other, * regardless of ordering. Otherwise returns false. */ public boolean hasSameAllelesAs ( final VariantContext other ) { return hasSameAlternateAllelesAs(other) && other.getReference().equals(getReference(), false); }
static private AlleleMapper resolveIncompatibleAlleles(final Allele refAllele, final VariantContext vc, final LinkedHashSet<Allele> allAlleles) { if ( refAllele.equals(vc.getReference()) ) return new AlleleMapper(vc); else { final Map<Allele, Allele> map = createAlleleMapping(refAllele, vc, allAlleles); map.put(vc.getReference(), refAllele); return new AlleleMapper(map); } }