Computes the encoding distance between two encodings.
calc_pi(a, b)
a | encoding (see |
---|---|
b | encoding to which |
an encoding distance.
The encoding distance between a
and b
is defined as the
minimum number of amino acids that have to be moved between subgroups of encoding
to make a
identical to b
(order of subgroups in the encoding and amino
acids in a group is unimportant).
If the parameter prop
is supplied, the encoding distance is normalized by the
factor equal to the sum of distances for each group in a
and the closest group
in b
. The position of a group is defined as the mean value of properties of
amino acids or nucleotides belonging the group.
See the package vignette for more details.
calc_si
: compute the similarity index of two encodings.
encoding2df
: converts an encoding to a data frame.
validate_encoding
: validate a structure of an encoding.
# calculate encoding distance between two encodings of amino acids aa1 = list(`1` = c("g", "a", "p", "v", "m", "l", "i"), `2` = c("k", "h"), `3` = c("d", "e"), `4` = c("f", "r", "w", "y", "s", "t", "c", "n", "q")) aa2 = list(`1` = c("g", "a", "p", "v", "m", "l", "q"), `2` = c("k", "h", "d", "e", "i"), `3` = c("f", "r", "w", "y", "s", "t", "c", "n")) calc_pi(aa1, aa2)#> [1] 4# the encoding distance between two identical encodings is 0 calc_pi(aa1, aa1)#> [1] 0