{
this.insertEmissions = insertEmissionsL;
}
+
public List<Double> getStateTransitions()
{
return stateTransitions;
}
- public void setStateTransitions(List<Double> stateTransitionsL)
+ public void setStateTransitions(List<Double> stateTransitionsM)
{
- this.stateTransitions = stateTransitionsL;
+ this.stateTransitions = stateTransitionsM;
}
public Integer getAlignmentColumn()
private final String MASKED_VALUE = "MM";
- final static String[] TRANSITION_TYPES = new String[] { "m->m", "m->i",
- "m->d", "i->m", "i->i", "d->m", "d->d" };
+ public static final int MATCHTOMATCH = 0;
- public String getTransitionType(int index)
- {
- return TRANSITION_TYPES[index];
- }
+ public static final int MATCHTOINSERT = 1;
+
+ public static final int MATCHTODELETE = 2;
+
+ public static final int INSERTTOMATCH = 3;
+
+ public static final int INSERTTOINSERT = 4;
+
+ public static final int DELETETOMATCH = 5;
+
+ public static final int DELETETODELETE = 6;
public Map<Integer, Integer> getNodeLookup()
{
this.nodeLookup = nodeLookup;
}
- public String[] getTransitionTypes()
- {
- return TRANSITION_TYPES;
- }
-
public List<Character> getSymbols()
{
return symbols;
* @return
*/
public Double getStateTransitionProbability(int alignColumn,
- String transition)
+ int transition)
{
int transitionIndex;
int nodeIndex;
Double probability;
- transitionIndex = getTransitionType(transition);
if (nodeLookup.containsKey(alignColumn + 1))
{
nodeIndex = nodeLookup.get(alignColumn + 1);
probability = getNode(nodeIndex).getStateTransitions()
- .get(transitionIndex);
+ .get(transition);
return probability;
}
else
}
/**
- *
- * @param transition
- * type of transition occuring
- * @return index value representing position along stateTransition array.
- */
- public Integer getTransitionType(String transition)
- {
- Integer index;
- switch (transition)
- {
- case "mm":
- index = 0;
- break;
- case "mi":
- index = 1;
- break;
- case "md":
- index = 2;
- break;
- case "im":
- index = 3;
- break;
- case "ii":
- index = 4;
- break;
- case "dm":
- index = 5;
- break;
- case "dd":
- index = 6;
- break;
- default:
- index = null;
- }
- return index;
- }
-
- /**
* find the index of the node in a hidden Markov model based on the column in
* the alignment
*
}
/**
- * creates the HMM annotation
- *
* @return
*/
public AlignmentAnnotation createAnnotation(int length)
private final String EMPTY = "";
+ private static final String TRANSITIONTYPELINE = "m->m m->i m->d i->m i->i d->m d->d";
+
public HMMFile(FileParse source) throws IOException
{
super(false, source);
strSymbols = charListToStringList(charSymbols);
symbolLine += addData(11, 9, strSymbols);
file.append(symbolLine + NEW_LINE);
-
- String transitionTypeLine = "";
- List<String> transitionTypes;
- transitionTypes = stringArrayToStringList(hmm.getTransitionTypes());
- transitionTypeLine += addData(16, 9, transitionTypes);
- file.append(transitionTypeLine + NEW_LINE);
+ file.append(TRANSITIONTYPELINE + NEW_LINE);
int length = hmm.getLength();
}
@Test
- public void testGetTransitionType()
- {
- HiddenMarkovModel hmm = fn3.getHMM();
- assertEquals(hmm.getTransitionType("mm").intValue(), 0);
- assertEquals(hmm.getTransitionType("mi").intValue(), 1);
- assertEquals(hmm.getTransitionType("md").intValue(), 2);
- assertEquals(hmm.getTransitionType("im").intValue(), 3);
- assertEquals(hmm.getTransitionType("ii").intValue(), 4);
- assertEquals(hmm.getTransitionType("dm").intValue(), 5);
- assertEquals(hmm.getTransitionType("dd").intValue(), 6);
- assertNull(hmm.getTransitionType("df"));
-
- }
-
- @Test
public void testFillList()
{
Scanner scanner1 = new Scanner("1.3 2.4 5.3 3.9 9.8 4.7 4.3 2.3 6.9");