Materialises the rectangular form: one row per array, one column per alignment position, cells holding the requested layer. This is the only place the gapped matrix is built — the long object is the canonical storage.
Usage
# S3 method for class 'tales_msa'
as.matrix(x, value = NULL, gap = NA, ...)See also
Other TALE alignment:
is_tales_msa(),
tales_align(),
tales_consensus(),
tales_consensus_match(),
tales_msa(),
tales_msa_params(),
tales_msa_width(),
validate_tales_msa()
Examples
aligned <- data.frame(
array_id = c("A1", "A1", "A1", "A2", "A2"),
position_in_array = c(1L, 2L, 3L, 1L, 2L),
alignment_position = c(1L, 2L, 3L, 1L, 3L),
rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM")
)
msa <- tales_msa(aligned)
as.matrix(msa) # gaps as NA
#> 1 2 3
#> A1 "NTERM" "HD" "CTERM"
#> A2 "NTERM" NA "CTERM"
as.matrix(msa, gap = "-") # gaps as "-"
#> 1 2 3
#> A1 "NTERM" "HD" "CTERM"
#> A2 "NTERM" "-" "CTERM"