+ * Returns the full set of profiles for a hidden Markov model. The underlying
+ * data is the raw probabilities of a residue being emitted at each node,
+ * however the profiles returned by this function contain the percentage
+ * chance of a residue emission.
+ *
+ * @param hmm
+ * @param width
+ * The width of the Profile array (Profiles) to be returned.
+ * @param start
+ * The alignment column on which the first profile is based.
+ * @param end
+ * The alignment column on which the last profile is based.
+ * @param removeBelowBackground
+ * if true, symbols with a match emission probability less than
+ * background frequency are ignored
+ * @return
+ */
+ public static ProfilesI calculateHMMProfiles(final HiddenMarkovModel hmm,
+ int width, int start, int end, boolean removeBelowBackground,
+ boolean infoLetterHeight)
+ {
+ ProfileI[] result = new ProfileI[width];
+ char[] symbols = hmm.getSymbols().toCharArray();
+ int symbolCount = symbols.length;
+ for (int column = start; column < end; column++)
+ {
+ ResidueCount counts = new ResidueCount();
+ for (char symbol : symbols)
+ {
+ int value = getAnalogueCount(hmm, column, symbol,
+ removeBelowBackground, infoLetterHeight);
+ counts.put(symbol, value);
+ }
+ int maxCount = counts.getModalCount();
+ String maxResidue = counts.getResiduesForCount(maxCount);
+ int gapCount = counts.getGapCount();
+ ProfileI profile = new Profile(symbolCount, gapCount, maxCount,
+ maxResidue);
+ profile.setCounts(counts);
+
+ result[column] = profile;
+ }
+ return new Profiles(result);
+ }
+
+ /**