calc_pi: Calculate partition index

Description Usage Arguments Details Value See Also Examples

View source: R/calc_ed.R

Description

Computes the encoding distance between two encodings.

Usage

1
calc_pi(a, b)

Arguments

a

encoding (see validate_encoding for more information about the required structure of encoding).

b

encoding to which a should be compared. Must have equal number of groups or less than a. Both a and b must have the the same number of elements.

Details

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.

Value

an encoding distance.

See Also

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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) 
    
# the encoding distance between two identical encodings is 0
calc_pi(aa1, aa1) 
 

biogram documentation built on March 31, 2020, 5:14 p.m.