Skip to contents

This feature calculates the cosine distance matrix between two HMMs \(A\) and \(B\) before dynamic time warp is applied to the distance matrix calculate the cumulative distance between the HMMs, which acts as a measure of similarity, The cosine distance matrix \(D\) is found to be \(D[a_i, b_j] = 1 - \frac{a_ib_j^{T}}{a_ia_i^Tb_jb_j^T}\), in which \(a_i\) and \(a_i\) refer to row vectors of \(A\) and \(B\) respectively. This in turn means that \(D\) is of dimensions \(nrow(A), nrow(b)\). Dynamic time warp then calculates the cumulative distance by calculating matrix \(C[i, j] = min(C[i-1, j], C[i, j-1], C[i-1, j-1]) + D[i, j]\), where \(C_{i,j}\) is 0 when \(i\) or \(j\) are less than 1. The lower rightmost point of the matrix \(C\) is then returned as the cumulative distance between proteins.

Usage

hmm_distance(hmm_1, hmm_2)

Arguments

hmm_1

The name of a profile hidden markov model file.

hmm_2

The name of another profile hidden markov model file.

Value

A double that indicates distance between the two proteins.

References

Lyons, J., Paliwal, K. K., Dehzangi, A., Heffernan, R., Tsunoda, T., & Sharma, A. (2016). Protein fold recognition using HMM–HMM alignment and dynamic programming. Journal of Theoretical Biology, 393, 67–74.

Examples

h<- hmm_distance(system.file("extdata", "1DLHA2-7", package="protHMM"),
system.file("extdata", "1TEN-7", package="protHMM"))