From: TZVanaalten Date: Fri, 9 Jun 2017 15:26:39 +0000 (+0100) Subject: Add HiddenMarkovModel class X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=76a84b9909fa7d0f6b74c6fb6d30cac296d59586;p=jalview.git Add HiddenMarkovModel class --- diff --git a/src/jalview/datamodel/HiddenMarkovModel.java b/src/jalview/datamodel/HiddenMarkovModel.java new file mode 100644 index 0000000..b422ef1 --- /dev/null +++ b/src/jalview/datamodel/HiddenMarkovModel.java @@ -0,0 +1,143 @@ +package jalview.datamodel; + +import java.util.HashMap; +import java.util.Map; + +/** + * Data structure to hold a HMM file + */ +/** + * @author TZVanaalten + * + */ +public class HiddenMarkovModel +{ + + // Stores file properties + private Map fileProperties = new HashMap<>(); + + public String getAccessionNumber() + { + return fileProperties.get("ACC"); + } + + public String getDescription() + { + return fileProperties.get("DESC"); + } + + public int getModelLength() + { + return Integer.parseInt(fileProperties.get("LENG")); + } + + public int getMaxInstanceLength() + { + return Integer.parseInt(fileProperties.get("MAXL")); + } + + // gets type of symbol alphabet - "amino", "DNA", "RNA" + public String getAlphabetType() + { + return fileProperties.get("ALPH"); + } + + // returns boolean indicating whether the reference annotation character field + // for each match state is valid or ignored + public boolean getReferenceAnnotationFlag() + { + if (fileProperties.get("RF") == "yes") + { + return true; + } + return false; + } + + // returns boolean indicating whether the model mask annotation character + // field + // for each match state is valid or ignored + public boolean getModelMaskedFlag() + { + if (fileProperties.get("MM") == "yes") + { + return true; + } + return false; + } + + // returns boolean indicating whether the consensus residue field + // for each match state is valid or ignored + public boolean getConsensusResidueAnnotationFlag() + { + if (fileProperties.get("CONS") == "yes") + { + return true; + } + return false; + } + + // returns boolean indicating whether the consensus structure character field + // for each match state is valid or ignored + public boolean getConsensusStructureAnnotationFlag() + { + if (fileProperties.get("CS") == "yes") + { + return true; + } + return false; + } + + // returns boolean indicating whether the model mask annotation character + // field + // for each match state is valid or ignored + public boolean getMapAnnotationFlag() + { + if (fileProperties.get("MAP") == "yes") + { + return true; + } + return false; + } + + // not sure whether to implement this + // public Date getDate() + // { + + // } + + // not sure whether to implement this + // public String getCommandLineLog() + // { + + // } + + // gets the number of sequences that the HMM was trained on + public int getSequenceNumber() + { + return Integer.parseInt(fileProperties.get("NSEQ")); + } + + // gets the effective number determined during sequence weighting + public int getEffectiveSequenceNumber() + { + return Integer.parseInt(fileProperties.get("EFFN")); + } + + public int getCheckSum() + { + return Integer.parseInt(fileProperties.get("CKSUM")); + } + + // need to ask if BigDecimal is best decimal type for this purpose + // and how to limit number of decimals + public double getGatheringThresholdGA1() + { + return Double.parseDouble((fileProperties.get("GA1"))); + } + + public void put(String key, String value) + { + fileProperties.put(key, value); + } + +}