Skip to contents

The long form of a square pairwise distance over one entity set: one row per ordered pair of entities, with a dissim value (0 for identical entities, larger for more different ones).

Usage

pairwise_distances(x, dom_code_namespace = NULL)

tale_distances(x, dom_code_namespace = NULL)

domain_distances(x, dom_code_namespace = NULL)

Arguments

x

A data frame with id1, id2 and dissim columns. The function also accepts a similarity: it converts a table carrying sim or norm_arlem_score instead of a distance into dissim and drops the similarity columns, so that only one copy of the quantity remains. It keeps any further column (arlem_score, max_length, or anything else).

dom_code_namespace

Optional scalar string identifying the run whose dom_code values this table is keyed by, see tales_namespace. Relevant for domain_distances(), whose ids are dom_codes.

Value

A validated pairwise_distances object.

Details

tale_distances() and domain_distances() are the entity-specific flavours: distances between whole TALE arrays, and between distinct domains, repeats and the two termini alike. For domain_distances, dissim is the percentage of amino acids that differ between two domains (see tales_domain_distances); for tale_distances, it is the array alignment cost between two TALEs (see tales_tale_distances). The two flavours add no structure, only meaning: every method is written once on the parent.

Examples

d <- data.frame(
  id1 = c("A1", "A1", "A2", "A2"),
  id2 = c("A1", "A2", "A1", "A2"),
  dissim = c(0, 35, 35, 0)
)
pairwise_distances(d)
domain_distances(d, dom_code_namespace = "example")

# A similarity is folded into the distance.
similar <- data.frame(id1 = "A1", id2 = "A2", sim = 65)
tale_distances(similar)