X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAAFrequency.java;h=900209d34fa6b0ee0eb23e40d8cde607ff50b7ef;hb=e5cba1e6a138feeeb8cf5b5823b3cafc89e71b9f;hp=3cc57bf17c1eb4e4d9acd1d7c57f2926e7d56ae9;hpb=96356075a122b745936738f478a8ee33ac7e0f0a;p=jalview.git diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index 3cc57bf..900209d 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -61,6 +61,8 @@ public class AAFrequency private static final String DNA = "DNA"; + private static final String RNA = "RNA"; + /* * Quick look-up of String value of char 'A' to 'Z' */ @@ -107,6 +109,7 @@ public class AAFrequency } } + /** * Calculate the consensus symbol(s) for each column in the given range. * @@ -727,23 +730,21 @@ public class AAFrequency } /** - * produces a HMM profile for a column in an alignment + * Produces a HMM profile for a column in an alignment * * @param aa - * Alignment annotation for which the profile is being calculated + * Alignment annotation for which the profile is being calculated. * @param column - * column in the alignment the profile is being made for + * Column in the alignment the profile is being made for. * @param removeBelowBackground - * boolean, indicating whether to ignore residues with probabilities - * less than their background frequencies + * Boolean indicating whether to ignore residues with probabilities + * less than their background frequencies. * @return */ - public static int[] getHMMProfileFor(AlignmentAnnotation aa, int column, + public static int[] getHMMProfileFor(HiddenMarkovModel hmm, int column, boolean removeBelowBackground) { - HiddenMarkovModel hmm; - hmm = aa.getHMM(); if (hmm != null) { String alph = hmm.getAlphabetType(); @@ -762,7 +763,7 @@ public class AAFrequency value = hmm.getMatchEmissionProbability(column, symbol); double freq; - if (alph == AMINO && removeBelowBackground) + if (AMINO.equals(alph) && removeBelowBackground) { freq = ResidueProperties.aminoBackgroundFrequencies.get(symbol); if (value < freq) @@ -770,9 +771,17 @@ public class AAFrequency value = 0d; } } - else if (alph == DNA && removeBelowBackground) + else if (DNA.equals(alph) && removeBelowBackground) + { + freq = ResidueProperties.dnaBackgroundFrequencies.get(symbol); + if (value < freq) + { + value = 0d; + } + } + else if (RNA.equals(alph) && removeBelowBackground) { - freq = ResidueProperties.nucleotideBackgroundFrequencies + freq = ResidueProperties.rnaBackgroundFrequencies .get(symbol); if (value < freq) {