Skip to contents

Step 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.

Usage

tales_assign_domain_codes(x)

Arguments

x

A tales object carrying an aa_seq column.

Value

x with a dom_code column and a dom_code_namespace stamp.

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().

Examples

x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput",
                                      package = "tantale"))
xa <- tales_assign_domain_codes(x)
tales_namespace(xa)
#> [1] "7377e3f80aa36898"