Checks the structure of an encoding.
validate_encoding(x, u)
x | encoding. |
---|---|
u |
|
TRUE
if the x
is a correctly reduced u
,
FALSE
in any other cases.
The encoding is a list of groups to which elements of an alphabet should be reduced. All elements of the alphabet (all amino acids or all nucleotides) should appear in the encoding.
calc_ed
: calculate the encoding distance between two encodings.
encoding2df
: converts an encoding to a data frame.
enc1 = list(`1` = c("a", "t"), `2` = c("g", "c")) # see if enc1 is the correctly reduced nucleotide (DNA) alphabet validate_encoding(enc1, c("a", "c", "g", "t"))#> [1] TRUE# enc1 is not the RNA alphabet, so the results is FALSE validate_encoding(enc1, c("a", "c", "g", "u"))#> [1] FALSE# validate_encoding works also on other notations enc2 = list(a = c(1, 4), b = c(2, 3)) validate_encoding(enc2, 1L:4)#> [1] TRUE