Assign a domain code to every distinct part sequence
Source:R/distalr.R
tales_assign_domain_codes.RdStep 1 of tales_compare_distal(). Gives each distinct aa_seq in x an
integer code, recorded in a dom_code column, so that the parts can be
compared once each rather than once per occurrence.
A code names a distinct domain sequence, repeats and termini alike: the N- and C-termini are parts like the repeats are, and they get codes too.
Arguments
- x
A tales object carrying an
aa_seqcolumn.
Details
TALEs reuse domains heavily, within an array and between arrays, so the
number of distinct sequences is far smaller than the number of parts. That
ratio is what makes tales_domain_distances() affordable: it compares each
distinct domain once.
The codes are only meaningful within one call
Codes are assigned with dplyr::cur_group_id() over the distinct aa_seq
values present in x. Add an array, remove one, or reorder the
sequences, and the same protein can get a different number. They are
positions in this table's own vocabulary.
So comparing codes between two calls is an error, and a distance
table keyed by one call's codes must never be used with another call's.
This is enforced: every object minted
here is stamped with a dom_code_namespace derived from the sequences
that produced it, and the classes refuse to join across namespaces. Read
the stamp with tales_namespace().
See also
tales_compare_distal(), which runs all three steps;
tales_domain_codes(), which reads the code-to-sequence table back out
of an object that already has codes.
Other pairwise distances:
[.pairwise_distances(),
as.matrix.pairwise_distances(),
distances_assert_square(),
distances_restrict(),
is_pairwise_distances(),
pairwise_distances(),
rvd_dna_specificity,
tales_compare_distal(),
tales_compare_functal(),
tales_domain_distances(),
tales_group_hclust(),
tales_group_kmedoids(),
tales_tale_distances(),
validate_pairwise_distances()
Examples
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput",
package = "tantale"))
xa <- tales_assign_domain_codes(x)
tales_namespace(xa)
#> [1] "7377e3f80aa36898"