Step 3 of tales_compare_distal(). Aligns the arrays against each other as
strings of domain codes, using the domain distances from step 2 as the
cost of substituting one domain for another.
Arguments
- x
A tales object carrying
dom_code.- domain_distances
A domain_distances object for the same
x, as returned bytales_domain_distances().
Value
A tale_distances object, keyed by array_id.
Details
The two arguments are not independent, and that is the point. Each
array's sequence of dom_codes is aligned against every other's; what it
costs to align one domain against a different one is taken from
domain_distances, so the TALE-level comparison is built on the
domain-level one.
The alignment is the minisatellite map alignment of ARLEM (Abouelhoda,
Giegerich, Behzadi and Steyaert,
2009), which DisTAL used
because repeat arrays evolve like minisatellites: besides substitutions,
a run of domains that one array has and the other lacks can be explained
as tandem duplications of a neighbouring domain, each copy then free to
diverge. tantale computes it in R with the costs DisTAL gave ARLEM: a
duplication costs 10 plus the substitution cost between the copy and its
source, and a domain inserted from elsewhere costs 10. The scores are
identical to those of the original ARLEM program. arlem_score is the cost of the best
alignment, and dissim divides it by the length of the longer array.
The domain distances are first passed through a Minkowski distance
(p = 3.5) between their rows and rescaled to 0-100. That step matters:
the alignment needs substitution costs satisfying the triangle inequality,
and raw pairwise alignment dissimilarities do not.
Both arguments must come from the same call
domain_distances is keyed by dom_code, and those codes mean what they
mean only within the call that minted them
(tales_assign_domain_codes()). Passing distances from one run with codes
from another silently compares the wrong domains, which is why both
objects carry a namespace stamp and this function refuses when they
disagree.
See also
tales_compare_distal(), which runs all three steps.
Other pairwise distances:
[.pairwise_distances(),
as.matrix.pairwise_distances(),
distances_assert_square(),
distances_restrict(),
is_pairwise_distances(),
pairwise_distances(),
rvd_dna_specificity,
tales_assign_domain_codes(),
tales_compare_distal(),
tales_compare_functal(),
tales_domain_distances(),
tales_group_hclust(),
tales_group_kmedoids(),
validate_pairwise_distances()
Examples
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput",
package = "tantale"))
xa <- tales_assign_domain_codes(x)
dd <- tales_domain_distances(xa)
#> Computing a distance matrix between TALE parts amino acid sequences using:
#> DECIPHER
tales_tale_distances(xa, dd)
#> Deriving domain substitution costs that meet the triangle inequality (Minkowski
#> distance between domain distance profiles).
#> Aligning 4 TALE arrays pairwise (6 pairs).