Skip to contents

The number of columns in the alignment, including those that are all gaps in the object at hand. It is stored with the object, because subsetting arrays can empty the last column, which would silently shrink max(alignment_position). A plain tales has no width.

Usage

tales_msa_width(x)

Arguments

x

A tales_msa object.

Value

An integer scalar, or NULL if unset.

Examples

# A2 has no C-terminus, so the last column holds A1's alone.
aligned <- data.frame(
  array_id = c("A1", "A1", "A1", "A1", "A2", "A2"),
  position_in_array = c(1L, 2L, 3L, 4L, 1L, 2L),
  alignment_position = c(1L, 2L, 3L, 4L, 1L, 2L),
  rvd = c("NTERM", "HD", "NI", "CTERM", "NTERM", "HD")
)
msa <- tales_msa(aligned)
tales_msa_width(msa)
#> [1] 4
# Keeping A2 alone empties columns 3 and 4; the width is still 4.
a2 <- msa[msa$array_id == "A2", ]
max(a2$alignment_position)
#> [1] 2
tales_msa_width(a2)
#> [1] 4