JAL-2599 small code improvements
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Thu, 20 Jul 2017 11:07:43 +0000 (12:07 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Thu, 20 Jul 2017 11:07:43 +0000 (12:07 +0100)
src/jalview/datamodel/HiddenMarkovModel.java

index 0aee77a..0dcc72e 100644 (file)
@@ -837,14 +837,7 @@ public class HiddenMarkovModel
    */
   public void setMAPStatus(boolean status)
   {
-    if (status == true)
-    {
-      fileProperties.put(MAP, YES);
-    }
-    else
-    {
-      fileProperties.put(MAP, NO);
-    }
+    fileProperties.put(MAP, status ? YES : NO);
   }
 
   /**
@@ -854,14 +847,7 @@ public class HiddenMarkovModel
    */
   public void setReferenceAnnotationStatus(boolean status)
   {
-    if (status == true)
-    {
-      fileProperties.put(REFERENCE_ANNOTATION, YES);
-    }
-    else
-    {
-      fileProperties.put(REFERENCE_ANNOTATION, NO);
-    }
+    fileProperties.put(REFERENCE_ANNOTATION, status ? YES : NO);
   }
 
   /**
@@ -871,14 +857,7 @@ public class HiddenMarkovModel
    */
   public void setMaskedValueStatus(boolean status)
   {
-    if (status == true)
-    {
-      fileProperties.put(MASKED_VALUE, YES);
-    }
-    else
-    {
-      fileProperties.put(MASKED_VALUE, NO);
-    }
+    fileProperties.put(MASKED_VALUE, status ? YES : NO);
   }
 
   /**
@@ -888,14 +867,7 @@ public class HiddenMarkovModel
    */
   public void setConsensusResidueStatus(boolean status)
   {
-    if (status == true)
-    {
-      fileProperties.put(CONSENSUS_RESIDUE, YES);
-    }
-    else
-    {
-      fileProperties.put(CONSENSUS_RESIDUE, NO);
-    }
+    fileProperties.put(CONSENSUS_RESIDUE, status ? YES : NO);
   }
 
   /**
@@ -905,14 +877,7 @@ public class HiddenMarkovModel
    */
   public void setConsensusStructureStatus(boolean status)
   {
-    if (status == true)
-    {
-      fileProperties.put(CONSENSUS_STRUCTURE, YES);
-    }
-    else
-    {
-      fileProperties.put(CONSENSUS_STRUCTURE, NO);
-    }
+    fileProperties.put(CONSENSUS_STRUCTURE, status ? YES : NO);
   }
 
   /**
@@ -1000,13 +965,17 @@ public class HiddenMarkovModel
     for (char symbol : symbols)
     {
       float freq = 0f;
-      if (symbols.size() == 20)
+      if ("amino".equals(getAlphabetType()))
       {
         freq = ResidueProperties.aminoBackgroundFrequencies.get(symbol);
       }
-      if (symbols.size() == 4)
+      if ("DNA".equals(getAlphabetType()))
+      {
+        freq = ResidueProperties.dnaBackgroundFrequencies.get(symbol);
+      }
+      if ("RNA".equals(getAlphabetType()))
       {
-        freq = ResidueProperties.nucleotideBackgroundFrequencies
+        freq = ResidueProperties.rnaBackgroundFrequencies
                 .get(symbol);
       }
       Double hmmProb = getMatchEmissionProbability(column, symbol);