validate_encoding: Validate encoding

Description Usage Arguments Details Value See Also Examples

View source: R/create_encoding.R

Description

Checks the structure of an encoding.

Usage

1

Arguments

x

encoding.

u

integer, numeric or character vector of all elements belonging to the encoding. See Details.

Details

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.

Value

TRUE if the x is a correctly reduced u, FALSE in any other cases.

See Also

calc_ed: calculate the encoding distance between two encodings. encoding2df: converts an encoding to a data frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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"))

# enc1 is not the RNA alphabet, so the results is FALSE
validate_encoding(enc1, c("a", "c", "g", "u"))

# validate_encoding works also on other notations
enc2 = list(a = c(1, 4),
            b = c(2, 3))
validate_encoding(enc2, 1L:4)

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