Skip to contents

Row-binds one or more tales objects into one, reconciling the invariants that a plain bind_rows would not check: array_id uniqueness across inputs, the dom_code namespace, and the group column. A single input is accepted: it goes through the same reconciliation and re-validation, harmlessly.

Usage

tales_bind(..., on_namespace_mismatch = c("recode", "error"), sanitize = FALSE)

Arguments

...

One or more tales objects (not tales_msa).

on_namespace_mismatch

What to do when the inputs' dom_code namespaces (see tales_namespace) disagree. "recode" (default) drops the stale dom_code column and calls tales_assign_domain_codes on the bound result, over the union of aa_seq; "error" aborts instead, for callers who want that stricter behaviour.

sanitize

Passed to tales for the final construction: FALSE, TRUE or "canonical".

Value

A validated tales object.

Details

There is no c() method: base c() can silently drop attributes when a tales is mixed with another object, and its signature has no room for on_namespace_mismatch.

tales_msa inputs are refused: alignment_width and alignment_position are a coordinate system specific to one alignment run, and binding two runs' matrices would produce an object that misdescribes what a given column means in each row. Demote explicitly with as_tales first if that is really what you want.

group is dropped from the result whenever present on any input: it is a clustering result over one specific distance matrix and one specific set of arrays, so two "group 1"s from separate tales_group_hclust/tales_group_kmedoids calls are not comparable. Recompute it with either on the bound result, after re-running tales_compare_distal.

tale_distances/domain_distances are untouched: this function only binds tales data. A companion distance table from either input does not describe the bound object; re-run tales_compare_distal if you need one.

Examples

a <- tales(data.frame(
  array_id = "A1", position_in_array = 1:2,
  rvd = c("NTERM", "HD")
))
b <- tales(data.frame(
  array_id = "A2", position_in_array = 1:2,
  rvd = c("NTERM", "NI")
))
tales_bind(a, b)
#> <tales> 2 arrays, 4 parts
#>   layers: rvd
#>       rvd
#>   A1  NTERM HD
#>   A2  NTERM NI