/** * Calculates the best symbol for a collection of compounds. For example * if you gave this method a AC it will return a M which is the ambiguity * symbol for these compounds. * * @param compounds Compounds to calculate ambiguity for * @return The ambiguity symbol which represents this set of nucleotides best */ public NucleotideCompound getAmbiguity(NucleotideCompound... compounds) { Set<NucleotideCompound> settedCompounds = new HashSet<NucleotideCompound>(); for(NucleotideCompound compound: compounds) { for(NucleotideCompound subCompound: compound.getConstituents()) { settedCompounds.add(getCompoundForString(subCompound.getBase().toUpperCase())); } } for(NucleotideCompound compound: getAllCompounds()) { if(compound.getConstituents().equals(settedCompounds)) { return compound; } } return null; }
/** * Calculates the best symbol for a collection of compounds. For example * if you gave this method a AC it will return a M which is the ambiguity * symbol for these compounds. * * @param compounds Compounds to calculate ambiguity for * @return The ambiguity symbol which represents this set of nucleotides best */ public NucleotideCompound getAmbiguity(NucleotideCompound... compounds) { Set<NucleotideCompound> settedCompounds = new HashSet<NucleotideCompound>(); for(NucleotideCompound compound: compounds) { for(NucleotideCompound subCompound: compound.getConstituents()) { settedCompounds.add(getCompoundForString(subCompound.getBase().toUpperCase())); } } for(NucleotideCompound compound: getAllCompounds()) { if(compound.getConstituents().equals(settedCompounds)) { return compound; } } return null; }
Set<NucleotideCompound> compoundConstituents = sourceCompound.getConstituents(); for(NucleotideCompound targetCompound: ambiguousCompounds) { Set<NucleotideCompound> targetConstituents = targetCompound.getConstituents(); if(targetConstituents.containsAll(compoundConstituents)) { NucleotideCompound lcSourceCompound = toLowerCase(sourceCompound);
Set<NucleotideCompound> compoundConstituents = sourceCompound.getConstituents(); for(NucleotideCompound targetCompound: ambiguousCompounds) { Set<NucleotideCompound> targetConstituents = targetCompound.getConstituents(); if(targetConstituents.containsAll(compoundConstituents)) { NucleotideCompound lcSourceCompound = toLowerCase(sourceCompound);