JAL-2599 add ability to process RNA HMMer files
[jalview.git] / src / jalview / schemes / HMMERColourScheme.java
index f545fe6..09092a6 100644 (file)
@@ -51,11 +51,35 @@ public class HMMERColourScheme extends ResidueColourScheme
     }
     Double prob;
     prob = hmm.getMatchEmissionProbability(position, symbol);
+    double freq = 0;
+    if ("amino".equals(hmm.getAlphabetType()))
+    {
+      if (!ResidueProperties.aminoBackgroundFrequencies.containsKey(symbol))
+      {
+        return Color.white;
+      }
+      freq = ResidueProperties.aminoBackgroundFrequencies.get(symbol);
+    }
+    else if ("DNA".equals(hmm.getAlphabetType()))
+    {
+      if (!ResidueProperties.dnaBackgroundFrequencies.containsKey(symbol))
+      {
+        return Color.white;
+      }
+      freq = ResidueProperties.dnaBackgroundFrequencies.get(symbol);
+    }
+    else if ("RNA".equals(hmm.getAlphabetType()))
+    {
+      if (!ResidueProperties.rnaBackgroundFrequencies.containsKey(symbol))
+      {
+        return Color.white;
+      }
+      freq = ResidueProperties.rnaBackgroundFrequencies.get(symbol);
+    }
     if (prob == 0)
     {
       return Color.red;
     }
-    double freq = ResidueProperties.aminoBackgroundFrequencies.get(symbol);
     Double value = Math.log(prob / freq);
     Color colour = null;
     if (value > 0)