This function generates combinations of amino acids in pairs. By default, it generates all pair combinations of the 20 standard amino acids.
Usage
amino_acid_pairs(
x = amino_acids(),
y = amino_acids(),
keep_self = TRUE,
keep_duplicates = TRUE,
keep_reverses = TRUE
)
Arguments
- x
A character vector of amino acids (three-letter codes).
- y
Another character vector of amino acids (three-letter codes).
- keep_self
Whether to keep pairs involving the same amino acid.
- keep_duplicates
Whether to keep duplicated pairs.
- keep_reverses
Whether to keep pairs that are reversed versions of others. E.g. if
keep_reverses
isTRUE
the pairs"Ser"
-"Arg"
and"Arg"
-"Ser"
will be kept in the returned tibble; however, ifkeep_reverses
isFALSE
, only the first pair is preserved in the output.
Value
A tibble of amino acid pairs.
Examples
# Generate all pairs of the 20 standard amino acids
amino_acid_pairs()
#> # A tibble: 400 × 2
#> x y
#> <chr> <chr>
#> 1 Ser Ser
#> 2 Ser Arg
#> 3 Ser Leu
#> 4 Ser Pro
#> 5 Ser Thr
#> 6 Ser Ala
#> 7 Ser Val
#> 8 Ser Gly
#> 9 Ser Ile
#> 10 Ser Phe
#> # ℹ 390 more rows
# Remove the self-to-self pairs
amino_acid_pairs(keep_self = FALSE)
#> # A tibble: 380 × 2
#> x y
#> <chr> <chr>
#> 1 Ser Arg
#> 2 Ser Leu
#> 3 Ser Pro
#> 4 Ser Thr
#> 5 Ser Ala
#> 6 Ser Val
#> 7 Ser Gly
#> 8 Ser Ile
#> 9 Ser Phe
#> 10 Ser Tyr
#> # ℹ 370 more rows
# Generate specific combinations of Ser against Ala and Trp.
amino_acid_pairs(x = "Ser", y = c("Ala", "Trp"))
#> # A tibble: 2 × 2
#> x y
#> <chr> <chr>
#> 1 Ser Ala
#> 2 Ser Trp