Add HiddenMarkovModel class
[jalview.git] / src / jalview / datamodel / HiddenMarkovModel.java
1 package jalview.datamodel;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 /**
7  * Data structure to hold a HMM file
8  */
9 /**
10  * @author TZVanaalten
11  * 
12  */
13 public class HiddenMarkovModel
14 {
15
16   // Stores file properties
17   private Map<String, String> fileProperties = new HashMap<>();
18
19   public String getAccessionNumber()
20   {
21     return fileProperties.get("ACC");
22   }
23
24   public String getDescription()
25   {
26     return fileProperties.get("DESC");
27   }
28
29   public int getModelLength()
30   {
31     return Integer.parseInt(fileProperties.get("LENG"));
32   }
33
34   public int getMaxInstanceLength()
35   {
36     return Integer.parseInt(fileProperties.get("MAXL"));
37   }
38
39   // gets type of symbol alphabet - "amino", "DNA", "RNA"
40   public String getAlphabetType()
41   {
42     return fileProperties.get("ALPH");
43   }
44
45   // returns boolean indicating whether the reference annotation character field
46   // for each match state is valid or ignored
47   public boolean getReferenceAnnotationFlag()
48   {
49     if (fileProperties.get("RF") == "yes")
50     {
51       return true;
52     }
53     return false;
54   }
55
56   // returns boolean indicating whether the model mask annotation character
57   // field
58   // for each match state is valid or ignored
59   public boolean getModelMaskedFlag()
60   {
61     if (fileProperties.get("MM") == "yes")
62     {
63       return true;
64     }
65     return false;
66   }
67
68   // returns boolean indicating whether the consensus residue field
69   // for each match state is valid or ignored
70   public boolean getConsensusResidueAnnotationFlag()
71   {
72     if (fileProperties.get("CONS") == "yes")
73     {
74       return true;
75     }
76     return false;
77   }
78
79   // returns boolean indicating whether the consensus structure character field
80   // for each match state is valid or ignored
81   public boolean getConsensusStructureAnnotationFlag()
82   {
83     if (fileProperties.get("CS") == "yes")
84     {
85       return true;
86     }
87     return false;
88   }
89
90   // returns boolean indicating whether the model mask annotation character
91   // field
92   // for each match state is valid or ignored
93   public boolean getMapAnnotationFlag()
94   {
95     if (fileProperties.get("MAP") == "yes")
96     {
97       return true;
98     }
99     return false;
100   }
101
102   // not sure whether to implement this
103   // public Date getDate()
104   // {
105
106   // }
107
108   // not sure whether to implement this
109   // public String getCommandLineLog()
110   // {
111
112   // }
113
114   // gets the number of sequences that the HMM was trained on
115   public int getSequenceNumber()
116   {
117     return Integer.parseInt(fileProperties.get("NSEQ"));
118   }
119
120   // gets the effective number determined during sequence weighting
121   public int getEffectiveSequenceNumber()
122   {
123     return Integer.parseInt(fileProperties.get("EFFN"));
124   }
125
126   public int getCheckSum()
127   {
128     return Integer.parseInt(fileProperties.get("CKSUM"));
129   }
130
131   // need to ask if BigDecimal is best decimal type for this purpose
132   // and how to limit number of decimals
133   public double getGatheringThresholdGA1()
134   {
135     return Double.parseDouble((fileProperties.get("GA1")));
136   }
137
138   public void put(String key, String value)
139   {
140     fileProperties.put(key, value);
141   }
142
143 }