From 2520395d9763dab7ee9be282b1a7e3a7842e96a4 Mon Sep 17 00:00:00 2001 From: TZVanaalten Date: Thu, 20 Jul 2017 12:07:43 +0100 Subject: [PATCH] JAL-2599 small code improvements --- src/jalview/datamodel/HiddenMarkovModel.java | 55 ++++++-------------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/src/jalview/datamodel/HiddenMarkovModel.java b/src/jalview/datamodel/HiddenMarkovModel.java index 0aee77a..0dcc72e 100644 --- a/src/jalview/datamodel/HiddenMarkovModel.java +++ b/src/jalview/datamodel/HiddenMarkovModel.java @@ -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); -- 1.7.10.2