| Title: | Mining and Analysis of Transcription Activator-Like Effectors |
|---|---|
| Description: | A toolkit for the study of transcription activator-like effectors (TALEs) of Xanthomonas. tell_tales() finds TALE genes in genome assemblies and can correct the frameshifts that make them hard to annotate in error-prone long-read assemblies. TALEs are held in S3 classes that record each one as a series of parts (N-terminus, repeats with their repeat-variable diresidues (RVDs), C-terminus), with methods to validate, subset, combine and plot them. TALEs are aligned repeat by repeat, compared with R implementations of the 'DisTAL' and 'FuncTAL' distances <doi:10.3389/fpls.2015.00545>, and grouped into families by hierarchical clustering or k-medoids. Wrappers for 'AnnoTALE' <doi:10.1038/srep21077>, 'TALEcorrection' <doi:10.1186/s12864-023-09228-1>, 'TALVEZ' <doi:10.1371/journal.pone.0068464> and 'PrediTALE' <doi:10.1371/journal.pcbi.1007206> read their results into the same objects; the last two predict target sites in host genomes. |
| Authors: | Bao Tram Vi [aut] (ORCID: <https://orcid.org/0000-0002-4319-5544>), Sebastien Cunnac [aut, cre] (ORCID: <https://orcid.org/0000-0002-3695-491X>), Alvaro L. Pérez-Quintero [cph] (Author of the bundled TALVEZ 3.2 and of the FuncTAL table behind rvd_dna_specificity), Molly Megraw [cph] (Author of the PlantTFBS Java classes bundled with TALVEZ (simplescancode/)), Artemis G. Hatzigeorgiou [cph] (Author of the PlantTFBS Java classes bundled with TALVEZ (simplescancode/)) |
| Maintainer: | Sebastien Cunnac <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.99.0.9000 |
| Built: | 2026-10-09 16:33:05 UTC |
| Source: | https://github.com/scunnac/tantale |
Tools to find the TALE genes of Xanthomonas in DNA sequences, compare and group them, align their repeat arrays and predict the plant promoter sites they bind. The package website has worked examples of each step.

tell_tales() finds TALE genes with HMMER profiles of the TALE domains,
much as AnnoTALE does, and is written for noisy sequences such as draft
assemblies or long reads: it can correct frameshifts against reference
TALEs before AnnoTALE reads out the RVDs. run_annotale_predict() runs
AnnoTALE itself, and correct_tales() runs TALEcorrection.
tales_from_telltales() and tales_from_annotale() load either result
as a tales object.
A tales object holds one row per part (N-terminus, repeat or
C-terminus) of each TALE, and tales_anomalies() reports the TALEs
whose structure is not standard. A tales_msa adds the alignment of the
arrays. tale_distances and domain_distances objects hold distances
between TALEs or between their domains.
tales_compare_distal() and tales_compare_functal() reimplement the
DisTAL and FuncTAL comparisons of QueTAL. tales_group_kmedoids() and
tales_group_hclust() group TALEs from these distances, and
talomes_heatmap() compares the groups across strains. AnnoTALE's own
classes come from run_annotale_build(), and its published catalogue
from run_annotale_load_classes() and run_annotale_assign(). The
tale_annotations dataset gives 128 curated TALEs of ten
X. oryzae genomes to compare against.
tales_align() aligns the RVD or domain sequences of the arrays with
MAFFT; tales_consensus() and the plot() method summarise the
alignment.
tales_predict_targets() runs Talvez (talvez()) or PrediTALE
(preditale()) on DNA sequences such as promoters, and
plot_target_preds() draws a predicted site with the RVDs facing their
bases.
MAFFT, HMMER, mmseqs2 and the Perl that Talvez runs on come from a
conda environment the package builds for itself, so conda (or mamba, or
micromamba) is needed for most of the package. tantale_setup() called
bare reports what is present and changes nothing;
tantale_setup(install = TRUE) builds or repairs the environment
and downloads the Java tools (AnnoTALE, PrediTALE, TALEcorrection) and
the example genomes. It checks tool versions as well as presence: MAFFT
and HMMER are pinned because later MAFFT versions align TALE repeat
strings differently.
Without conda, reticulate::install_miniconda() installs one from
inside R. An existing conda, mamba or micromamba is found through
reticulate::conda_binary().
tantale runs on Linux and on Intel macOS, the platforms the pinned
conda tools exist for; it does not run on Windows. The Java tools need
Java on the PATH, which tantale_setup() checks.
Maintainer: Sebastien Cunnac [email protected] (ORCID)
Authors:
Sebastien Cunnac [email protected] (ORCID)
Bao Tram Vi [email protected] (ORCID)
Other contributors:
Alvaro L. Pérez-Quintero (Author of the bundled TALVEZ 3.2 and of the FuncTAL table behind rvd_dna_specificity) [copyright holder]
Molly Megraw (Author of the PlantTFBS Java classes bundled with TALVEZ (simplescancode/)) [copyright holder]
Artemis G. Hatzigeorgiou (Author of the PlantTFBS Java classes bundled with TALVEZ (simplescancode/)) [copyright holder]
Useful links:
Report bugs at https://github.com/scunnac/tantale/issues
Subsets rows and columns like an ordinary tibble, but the class travels
only while the result still satisfies the contract: id1/id2
(both character) and dissim (numeric) all present. Dropping any of
them leaves something that can no longer be described as a pairwise
distance table, and the result is a plain tibble, without an error.
## S3 method for class 'pairwise_distances' x[...]## S3 method for class 'pairwise_distances' x[...]
x |
A |
... |
Passed on to the tibble/data frame method. |
Squareness is not checked here (see distances_assert_square):
subsetting rows is an everyday way to end up with a non-square table.
The subset: still a pairwise_distances (or its
tale_distances/domain_distances subclass) if the contract
holds, otherwise a plain tibble.
Other 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(),
tales_tale_distances(),
validate_pairwise_distances()
d <- pairwise_distances(data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) )) is_pairwise_distances(d[1:2, ]) # row subsetting never breaks the contract class(d[, "id1"]) # dropping dissim/id2: the class steps asided <- pairwise_distances(data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) )) is_pairwise_distances(d[1:2, ]) # row subsetting never breaks the contract class(d[, "id1"]) # dropping dissim/id2: the class steps aside
Subsets rows and columns like an ordinary tibble, but the class travels
only while the result still satisfies the tales contract.
## S3 method for class 'tales' x[...]## S3 method for class 'tales' x[...]
x |
A |
... |
Passed on to the tibble/data frame method. |
Row subsetting never breaks anything: every invariant a tales
checks still holds on any subset of rows, so filtering to one array, or
to its repeats only, is still a valid tales. Column subsetting is
where it degrades: dropping array_id, or both residue columns
(rvd, dom_code) at once, leaves something that can no
longer be described as a tales, and the result is a plain tibble,
without an error. Dropping an optional column (seqnames,
aa_seq, ...) has no such consequence. A tales_msa degrades
one step at a time: losing alignment_position alone steps it back
to a plain tales.
Attributes travel with a valid subset. dom_code_namespace
describes the run the codes came from, so cutting an object down with
[ keeps its namespace unchanged.
The subset: still a tales (or tales_msa) if the
contract holds, otherwise a plain tibble.
Other tales objects:
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
x <- tales(data.frame( array_id = c("A1", "A1"), position_in_array = c(1L, 2L), rvd = c("NTERM", "HD") )) is_tales(x[1, ]) # row subsetting never breaks the contract class(x[, -1]) # dropping array_id: the class steps out of the wayx <- tales(data.frame( array_id = c("A1", "A1"), position_in_array = c(1L, 2L), rvd = c("NTERM", "HD") )) is_tales(x[1, ]) # row subsetting never breaks the contract class(x[, -1]) # dropping array_id: the class steps out of the way
Turns sep-separated TALE sequences — RVD strings, or repeat-code
strings — into a tales object, taking sequence order as
position_in_array and sequence names as array_id.
as_tales(x, ...) ## S3 method for class 'data.frame' as_tales(x, ...) ## Default S3 method: as_tales(x, sep = "-", residue_col = c("rvd", "dom_code"), ...)as_tales(x, ...) ## S3 method for class 'data.frame' as_tales(x, ...) ## Default S3 method: as_tales(x, sep = "-", residue_col = c("rvd", "dom_code"), ...)
x |
A path to a fasta file, a |
... |
Passed to methods. |
sep |
Separator between elements of a sequence. Use |
residue_col |
Which residue column the parsed elements become:
|
The result is deliberately column-poor: a bare sequence file carries no
domain types, amino acid sequences or source contigs, so only
array_id, position_in_array and the chosen residue column are
produced. That is a valid tales: seqnames and the other
columns are optional.
A tales_msa passed to as_tales() is demoted to a plain
tales: alignment_position stays as an ordinary column, and
the alignment width is dropped (tales_msa_width returns
NULL).
A validated tales object.
Other tales objects:
[.tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") as_tales(rvd_fasta, sep = "-")rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") as_tales(rvd_fasta, sep = "-")
Materialises the wide form, with ids as both row and column names, sorted.
## S3 method for class 'pairwise_distances' as.matrix(x, value = PAIRWISE_DISTANCES_VALUE_COL, ...)## S3 method for class 'pairwise_distances' as.matrix(x, value = PAIRWISE_DISTANCES_VALUE_COL, ...)
x |
A |
value |
Name of the column to fill cells with. Defaults to
|
... |
Ignored. |
x must be square (see distances_assert_square, called
here for you): every id present in both id1 and id2. A table
filtered on one id column only is not; use
distances_restrict to filter both.
A numeric matrix, square, with sorted ids as dimnames.
Other pairwise distances:
[.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(),
tales_tale_distances(),
validate_pairwise_distances()
d <- pairwise_distances(data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) )) as.matrix(d)d <- pairwise_distances(data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) )) as.matrix(d)
Materialises the rectangular form: one row per array, one column per alignment position, cells holding the requested layer. This is the only place the gapped matrix is built — the long object is the canonical storage.
## S3 method for class 'tales_msa' as.matrix(x, value = NULL, gap = NA, ...)## S3 method for class 'tales_msa' as.matrix(x, value = NULL, gap = NA, ...)
x |
A |
value |
Name of the column to fill cells with. Defaults to the first
available of |
gap |
Value to use for gaps. Defaults to |
... |
Ignored. |
A character matrix with arrays as rows and alignment positions as columns.
Other TALE alignment:
is_tales_msa(),
tales_align(),
tales_consensus(),
tales_consensus_match(),
tales_msa(),
tales_msa_params(),
tales_msa_width(),
validate_tales_msa()
aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) as.matrix(msa) # gaps as NA as.matrix(msa, gap = "-") # gaps as "-"aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) as.matrix(msa) # gaps as NA as.matrix(msa, gap = "-") # gaps as "-"
A much faster alternative to running tell_tales
in correction mode on error-prone sequences such as ONT-assembled genomes:
a wrapper around the Java TALE correction tool from this GitHub
page.
It takes an input fasta file and writes a file with corrected indels in TALE coding sequences
using an approach described in the Erkes et al. paper.
tell_tales can subsequently be run on the corrected
sequences in no correction mode.
correct_tales( uncorrected_path, corrected_path = tempfile("corrected_tales_", fileext = ".fa"), hmm_path = .tantale_tool("talecorrection_hmm"), return_corrections = FALSE, conda_bin = "auto", java_args = "" )correct_tales( uncorrected_path, corrected_path = tempfile("corrected_tales_", fileext = ".fa"), hmm_path = .tantale_tool("talecorrection_hmm"), return_corrections = FALSE, conda_bin = "auto", java_args = "" )
uncorrected_path |
Path to the input sequence file |
corrected_path |
Path of the output file. The default is a new file
under |
hmm_path |
Path to the folder containing the profile HMM files. The
default points to the ones built from Xanthomonas oryzae pv. oryzae (Xoo)
templates, in the tools |
return_corrections |
Specify |
conda_bin |
Path to your Conda binary file if you need to specify a path different from the one that is automatically searched by the reticulate package functions. |
java_args |
A single string of options for the Java virtual
machine, placed before |
A tibble if return_corrections is TRUE or the path to the
corrected sequences file.
Other TALE discovery:
tale_annotations,
tales_from_annotale(),
tales_from_telltales(),
tell_tales()
# Needs nhmmer and a Java runtime. subj <- system.file("extdata", "bai3_sample_tal_genomic_regions.fasta", package = "tantale") out_fa <- tempfile(fileext = ".fa") correct_tales(uncorrected_path = subj, corrected_path = out_fa)# Needs nhmmer and a Java runtime. subj <- system.file("extdata", "bai3_sample_tal_genomic_regions.fasta", package = "tantale") out_fa <- tempfile(fileext = ".fa") correct_tales(uncorrected_path = subj, corrected_path = out_fa)
Checks that the table holds every ordered pair of the ids it contains —
n^2 rows for n ids. Phrased over the ids present, so that a
symmetric subset stays square: filtering both id columns to the same set of
entities preserves this, while filtering one of them does not.
distances_assert_square(x, arg = "x")distances_assert_square(x, arg = "x")
x |
A |
arg |
Name of the argument being checked, for the error message. |
Squareness is a precondition of the functions that need it. The class itself does not require it, because filtering the two id columns one after the other passes through a legitimate non-square intermediate.
x, invisibly.
Other pairwise distances:
[.pairwise_distances(),
as.matrix.pairwise_distances(),
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(),
tales_tale_distances(),
validate_pairwise_distances()
d <- pairwise_distances(data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) )) distances_assert_square(d) try(distances_assert_square(d[1:3, ])) # missing the A2-A2 pair -- errorsd <- pairwise_distances(data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) )) distances_assert_square(d) try(distances_assert_square(d[1:3, ])) # missing the A2-A2 pair -- errors
Filters both id columns, which is what keeps the result square.
distances_restrict(x, ids)distances_restrict(x, ids)
x |
A |
ids |
A character vector of entity ids to keep. |
A pairwise_distances over ids only.
Other pairwise distances:
[.pairwise_distances(),
as.matrix.pairwise_distances(),
distances_assert_square(),
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(),
tales_tale_distances(),
validate_pairwise_distances()
d <- pairwise_distances(data.frame( id1 = c("A1", "A1", "A1", "A2", "A2", "A2", "A3", "A3", "A3"), id2 = c("A1", "A2", "A3", "A1", "A2", "A3", "A1", "A2", "A3"), dissim = c(0, 35, 60, 35, 0, 40, 60, 40, 0) )) distances_restrict(d, c("A1", "A2"))d <- pairwise_distances(data.frame( id1 = c("A1", "A1", "A1", "A2", "A2", "A2", "A3", "A3", "A3"), id2 = c("A1", "A2", "A3", "A1", "A2", "A3", "A1", "A2", "A3"), dissim = c(0, 35, 60, 35, 0, 40, 60, 40, 0) )) distances_restrict(d, c("A1", "A2"))
The representation print.tales emits, returned as a character
vector, so an object's description can go somewhere other than the
console: a log, an error message, a report.
It shows what the class knows and a tibble would not: the number of arrays
as distinct from the number of parts, which residue layers the object
carries, the dom_code namespace when it is stamped, and a preview of
the first and last arrays as sequences.
The preview uses dom_code when present and rvd otherwise.
Domain codes are the more discriminating of the two: two arrays can share
an RVD sequence while being built from different repeats.
This replaces the format() a tales would otherwise inherit
from tibble. Call format(tibble::as_tibble(x)) for that one.
## S3 method for class 'tales' format(x, n = 2L, ...)## S3 method for class 'tales' format(x, n = 2L, ...)
x |
A |
n |
Number of arrays to show at each end. Everything is shown when the
object holds |
... |
Unused, present for compatibility with the |
A character vector, one element per line.
Other tales objects:
[.tales(),
as_tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
parts <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "C-terminus", "N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "CTERM") ) x <- tales(parts) format(x)parts <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "C-terminus", "N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "CTERM") ) x <- tales(parts) format(x)
As format.tales, plus the alignment width, and a preview of
aligned rows: gaps are drawn and every cell padded to a common width, so
the columns line up down the page.
## S3 method for class 'tales_msa' format(x, n = 2L, gap = "-", ...)## S3 method for class 'tales_msa' format(x, n = 2L, gap = "-", ...)
x |
A |
n |
Number of arrays to show at each end. |
gap |
What to draw where an array has no residue at a position. |
... |
Unused, present for compatibility with the |
A character vector, one element per line.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) format(msa)aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) format(msa)
Is this a pairwise distance table?
is_pairwise_distances(x)is_pairwise_distances(x)
x |
An object. |
A logical scalar.
Other pairwise distances:
[.pairwise_distances(),
as.matrix.pairwise_distances(),
distances_assert_square(),
distances_restrict(),
pairwise_distances(),
rvd_dna_specificity,
tales_assign_domain_codes(),
tales_compare_distal(),
tales_compare_functal(),
tales_domain_distances(),
tales_group_hclust(),
tales_group_kmedoids(),
tales_tale_distances(),
validate_pairwise_distances()
d <- data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) ) is_pairwise_distances(d) is_pairwise_distances(pairwise_distances(d))d <- data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) ) is_pairwise_distances(d) is_pairwise_distances(pairwise_distances(d))
Is this a tales object?
is_tales(x)is_tales(x)
x |
An object. |
A logical scalar.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
parts <- data.frame( array_id = c("A1", "A1", "A1"), position_in_array = 1:3, domain_type = c("N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM") ) is_tales(parts) # a plain data frame is_tales(tales(parts))parts <- data.frame( array_id = c("A1", "A1", "A1"), position_in_array = 1:3, domain_type = c("N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM") ) is_tales(parts) # a plain data frame is_tales(tales(parts))
Is this a tales_msa object?
is_tales_msa(x)is_tales_msa(x)
x |
An object. |
A logical scalar.
Other TALE alignment:
as.matrix.tales_msa(),
tales_align(),
tales_consensus(),
tales_consensus_match(),
tales_msa(),
tales_msa_params(),
tales_msa_width(),
validate_tales_msa()
aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) is_tales_msa(msa) is_tales_msa(as_tales(msa)) # back to a plain talesaligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) is_tales_msa(msa) is_tales_msa(as_tales(msa)) # back to a plain tales
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).
pairwise_distances(x, dom_code_namespace = NULL) tale_distances(x, dom_code_namespace = NULL) domain_distances(x, dom_code_namespace = NULL)pairwise_distances(x, dom_code_namespace = NULL) tale_distances(x, dom_code_namespace = NULL) domain_distances(x, dom_code_namespace = NULL)
x |
A data frame with |
dom_code_namespace |
Optional scalar string identifying the run whose
|
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.
A validated pairwise_distances object.
Other pairwise distances:
[.pairwise_distances(),
as.matrix.pairwise_distances(),
distances_assert_square(),
distances_restrict(),
is_pairwise_distances(),
rvd_dna_specificity,
tales_assign_domain_codes(),
tales_compare_distal(),
tales_compare_functal(),
tales_domain_distances(),
tales_group_hclust(),
tales_group_kmedoids(),
tales_tale_distances(),
validate_pairwise_distances()
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)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)
This function enables visual inspection of TALE target predictions results that are located within a specified subject DNA sequence region
plot_target_preds(preds, subj_file, filter_range)plot_target_preds(preds, subj_file, filter_range)
preds |
A tibble of prediction results obtained with |
subj_file |
The fasta file of subject DNA sequences that was used to predict DNA binding elements. |
filter_range |
A length one genomic ranges in the form of a properly formatted character string (eg. "chr2:56-125") or an atomic GenomicRanges object. This argument specifies the DNA region that will be plotted together with predicted binding TALEs RVD sequences whose predicted EBE lies entirely within. |
RVDs sequences predicted to target an EBE on the sense strand of the DNA sequence are plotted on top of the double stranded DNA sequence in parallel to its cognate EBE which is highlighted on the corresponding strand of the DNA sequence. Those predicted to target an EBE on the opposite strand are displayed below.
Each RVD sits in a box whose colour says how strongly the RVD is expected to bind the base at that position, compared with the other three bases. The RVDs labelled "OO" correspond to the first non-canonical repeat also called repeat zero in TALE protein sequences.
Numeric values inside the boxes located immediately to the right of the TALE labels reflect prediction scores.
Returns a ggplot object that can be further altered using ggplot2 package functions.
Other target prediction:
preditale(),
tales_predict_targets(),
talvez()
Other TALE plots:
plot.tales(),
plot.tales_msa(),
talomes_heatmap()
# Needs a Java runtime, for preditale(). x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) rvds <- tales_rvd_strings(x) subj <- system.file("extdata", "cladeIII_sweet_promoters.fasta", package = "tantale") preds <- preditale(rvd_seqs = rvds, subj_file = subj) best <- preds[order(-preds$score), ][1, ] # The site with 10 bp on either side plot_target_preds(preds = best, subj_file = subj, filter_range = paste0(best$subj_seq_id, ":", best$start - 10, "-", best$end + 10))# Needs a Java runtime, for preditale(). x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) rvds <- tales_rvd_strings(x) subj <- system.file("extdata", "cladeIII_sweet_promoters.fasta", package = "tantale") preds <- preditale(rvd_seqs = rvds, subj_file = subj) best <- preds[order(-preds$score), ][1, ] # The site with 10 bp on either side plot_target_preds(preds = best, subj_file = subj, filter_range = paste0(best$subj_seq_id, ":", best$start - 10, "-", best$end + 10))
A compact, information-rich view of the arrays in a tales object: one
point per part, positioned by its place in the array, outlined by domain
type and filled by part type and amino-acid length. Each repeat carries
its RVD, each terminus the short name of its code (N-, -C,
or ?? for a terminus that does not match its TALE domain profile; see
tales_anchor_codes). Arrays are listed from the top in
alphabetical order of array_id.
The fill colours follow the role of each part. The canonical 34-aa repeat and the 20-aa half-repeat that ends every array get calm colours, so a repeat of any other length (an aberrant repeat, for instance) stands out. N-termini are shades of wine and C-termini shades of teal, lighter when shorter, which makes a truncated terminus visible. The legend gives the length of each colour, its keys outlined like the parts they stand for. All colours are chosen to stay distinct for colour-blind readers.
A tales_msa dispatches to plot.tales_msa
instead, being the more specific class.
## S3 method for class 'tales' plot(x, position = c("array", "alignment"), facet_by = "seqnames", ...)## S3 method for class 'tales' plot(x, position = c("array", "alignment"), facet_by = "seqnames", ...)
x |
A |
position |
Which coordinate to lay the parts out on. |
facet_by |
Names of the columns whose values split the plot into
panels, stacked in rows whose height follows the number of arrays.
Each column must hold one value per array: |
... |
Unused, present for compatibility with the |
A ggplot object. Like any ggplot, it is drawn when printed, which
happens automatically at the console; inside a loop or a function, call
print() on it.
Other TALE plots:
plot.tales_msa(),
plot_target_preds(),
talomes_heatmap()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) plot(x) plot(x, facet_by = NULL)x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) plot(x) plot(x, facet_by = NULL)
Draws the alignment as a heatmap: one row per array, one column per alignment position, with cells coloured by one layer and optionally labelled with another.
## S3 method for class 'tales_msa' plot( x, fill = NULL, label = NULL, tale_distances = NULL, domain_distances = NULL, h_cut = 10, ref_pattern = NULL, consensus = FALSE, fill_type = "domain_clust", ... )## S3 method for class 'tales_msa' plot( x, fill = NULL, label = NULL, tale_distances = NULL, domain_distances = NULL, h_cut = 10, ref_pattern = NULL, consensus = FALSE, fill_type = "domain_clust", ... )
x |
A |
fill |
Layer whose values colour the cells. Defaults to
|
label |
Layer whose values are written in the cells. Left unset it
defaults to |
tale_distances |
Pairwise distances between whole TALEs, as the
|
domain_distances |
Pairwise distances between distinct domains, as
the |
h_cut |
Height at which the domain tree is cut to define clusters. Interpreted on a distance scale, so 0 means identical. |
ref_pattern |
Regular expression matched against the array names to choose the reference TALE. Must identify exactly one. |
consensus |
Whether to add a consensus panel above the alignment. The consensus is the most frequent element in each column of the labelled layer, so it always matches what the cells say. |
fill_type |
One of |
... |
Unused, present for compatibility with the |
A tales_msa carries every layer at once (rvd,
dom_code and whatever else the object holds), so fill and
label simply name two of them.
Three settings act independently, and it helps to read the figure that way: what each cell says, what colour that text is, and what colour the block behind it is.
Cell text is whatever label names, or nothing when
label = NULL. Termini are relabelled N- and -C; an
unidentified terminus keeps its XXXXX code.
Domain codes are padded to three characters so columns line up.
Text colour always answers one question: does this element match
the consensus of its column? Black for yes, red for no, grey where the
column has no consensus (a gap, or a tie). The block fills are all pale,
so the text reads on every one of them. The consensus is the most
frequent element in the column (tales_consensus), taken over
the labelled layer, so the text colour and the text itself always describe
the same thing.
Block fill is what fill_type selects, and it is the only
part that can be unavailable:
| fill_type | shows | needs |
"domain_clust" |
which cluster the domain falls in, cut at h_cut |
domain_distances |
"domain_sim" |
protein-sequence similarity to the reference, 0-100 | domain_distances |
"rvd_sim" |
how alike the RVD's DNA-binding preference is to the reference's, -1 to 1 | a label layer
|
Every value here scores across the whole tales_msa, termini
included: domain_distances covers every distinct part sequence,
and "domain_clust"/"domain_sim" colour a terminus cell
exactly like a repeat cell.
With no domain_distances and no label, every block is flat
grey: the text still carries the consensus comparison, but there is
nothing to colour blocks by.
A cell with no value for the chosen layer keeps its text and is filled
grey. In "rvd_sim" that is the termini, which have no DNA-binding
preference and so no position on a specificity scale. The RVD similarity
table is TALVEZ's and covers 17 RVDs; a rarer RVD (NV, say) scores
1 where it is identical to the reference's RVD and is grey elsewhere.
The reference matters for both similarity fills.
ref_pattern must match exactly one array name; otherwise the
function warns and uses the default, which is the array with the most
non-gap parts, ties broken alphabetically. The reference row is marked
with a trailing _#.
Two panels may be attached. Supplying tale_distances with
more than one array adds a dendrogram panel on the left; consensus =
TRUE adds a consensus panel on top. When either is present the return
value is an aplot composition: modify the alignment through its
plotlist element, since layers added to the composition itself do
not reach it.
The alignment plot, returned invisibly after being printed as a
side effect: a ggplot normally, or, when tale_distances
and/or consensus add extra panels, an
aplot composition – see Details.
Other TALE plots:
plot.tales(),
plot_target_preds(),
talomes_heatmap()
aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) plot(msa)aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) plot(msa)
An R wrapper around the PrediTale 'PrediTALE.jar preditale' module. Takes a list of TALE RVD sequences and a fasta file of DNA sequences and runs PrediTale.
preditale( rvd_seqs, subj_file, opt_param = "", output_dir = NULL, java_args = "-Xms512M -Xmx2G", predictor_path = .tantale_tool("preditale") )preditale( rvd_seqs, subj_file, opt_param = "", output_dir = NULL, java_args = "-Xms512M -Xmx2G", predictor_path = .tantale_tool("preditale") )
rvd_seqs |
Tale RVD sequences are supplied as either a fasta file (atomic character vector) with Tale info (name) in title and sequences of RVD as a space or '-' separated string or as a Biostrings XStringSet with sequences of RVD similarly formatted. See the PrediTale man page for how to encode RVDs present on aberrant repeats. |
subj_file |
Expects a character vector specifying the path to the fasta file holding subject DNA sequence(s). |
opt_param |
A single string of options for PrediTALE, as
|
output_dir |
Expects a character vector specifying the path to an output directory. If not supplied, output files will be temporary. |
java_args |
A single string of options for the Java virtual
machine, placed before |
predictor_path |
Path to "PrediTALE.jar". The default is the copy
|
A tibble with one row per predicted EBE (effector binding
element), the columns renamed from the tool's own output so that
talvez and preditale return the same ones
in the same order: tale_id, rvds, subj_seq_id,
start, end, strand, ebe_seq and
score, followed by the tool's own column: pval, the
approximate p-value PrediTALE gives each site.
Other target prediction:
plot_target_preds(),
tales_predict_targets(),
talvez()
# Needs a Java runtime. x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) rvds <- tales_rvd_strings(x) subj <- system.file("extdata", "cladeIII_sweet_promoters.fasta", package = "tantale") preds <- preditale(rvd_seqs = rvds, subj_file = subj) head(preds)# Needs a Java runtime. x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) rvds <- tales_rvd_strings(x) subj <- system.file("extdata", "cladeIII_sweet_promoters.fasta", package = "tantale") preds <- preditale(rvd_seqs = rvds, subj_file = subj) head(preds)
Emits what format.tales builds; see there for what is shown
and why.
## S3 method for class 'tales' print(x, n = 2L, ...)## S3 method for class 'tales' print(x, n = 2L, ...)
x |
A |
n |
Number of arrays to show at each end. Everything is shown when the
object holds |
... |
Unused, present for compatibility with the |
x, invisibly.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
parts <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "C-terminus", "N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "CTERM") ) x <- tales(parts) print(x)parts <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "C-terminus", "N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "CTERM") ) x <- tales(parts) print(x)
Emits what format.tales_msa builds; see there for what is
shown and why.
## S3 method for class 'tales_msa' print(x, n = 2L, gap = "-", ...)## S3 method for class 'tales_msa' print(x, n = 2L, gap = "-", ...)
x |
A |
n |
Number of arrays to show at each end. |
gap |
What to draw where an array has no residue at a position. |
... |
Unused, present for compatibility with the |
x, invisibly.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) print(msa)aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) print(msa)
An R wrapper around the 'AnnoTALEcli.jar assign' call. AnnoTALE places
each TALE in the class of the catalogue it belongs to, and opens a new
class for any that fit none. Where
run_annotale_build groups the TALEs you hand it among
themselves, knowing nothing of what the rest of the world calls them,
this one answers "which published class is this TALE in", so its names
can be compared with the literature's.
run_annotale_assign( fasta_file, class_builder, output_dir = tempfile("annotale_assign_"), strain = NULL, accession = NULL, opt_param = "", java_args = "-Xms512M -Xmx8G", annotale_jar = .tantale_tool("annotale") )run_annotale_assign( fasta_file, class_builder, output_dir = tempfile("annotale_assign_"), strain = NULL, accession = NULL, opt_param = "", java_args = "-Xms512M -Xmx8G", annotale_jar = .tantale_tool("annotale") )
fasta_file |
Path to a FASTA file of the TALEs to assign, one record per TALE (or per TALE part), in one of these forms:
|
class_builder |
Path to the class builder XML holding the classes
to assign against, as |
output_dir |
Directory where output will be written, created if it
does not exist. The default is a new directory under |
strain |
The strain the TALEs come from. AnnoTALE uses it to build the systematic names it proposes, so without it they are unnamed. |
accession |
The genome's accession number, recorded in the report. |
opt_param |
A single string of further options, as |
java_args |
A single string of options for the Java virtual
machine, placed before |
annotale_jar |
Path to the AnnoTALE jar file. The default is the
copy |
output_dir, invisibly. It holds the per-TALE assignment
report, a table of original against proposed systematic names, a
report and figure for each class that changed or was created, and a
class builder extended with the TALEs given.
run_annotale_load_classes, which fetches the
classes; run_annotale_build, which builds classes from
scratch instead.
Other external TALE tools:
run_annotale_build(),
run_annotale_load_classes(),
run_annotale_predict()
# Needs a Java runtime and the catalogue, which takes a while to fetch. classes <- run_annotale_load_classes(output_dir = tempfile("annotale_classes_")) predicted <- run_annotale_predict(tantale_genome("MAI1")) tales <- list.files(file.path(predicted, "Predict"), pattern = "^TALE_DNA_sequences_", full.names = TRUE) run_annotale_assign(tales, class_builder = classes, strain = "MAI1")# Needs a Java runtime and the catalogue, which takes a while to fetch. classes <- run_annotale_load_classes(output_dir = tempfile("annotale_classes_")) predicted <- run_annotale_predict(tantale_genome("MAI1")) tales <- list.files(file.path(predicted, "Predict"), pattern = "^TALE_DNA_sequences_", full.names = TRUE) run_annotale_assign(tales, class_builder = classes, strain = "MAI1")
An R wrapper around the AnnoTALE 'AnnoTALE.jar build' program.
It usually takes its input from the file generated by the run_annotale_predict
function.
run_annotale_build( fasta_file, output_dir = tempfile("annotale_build_"), opt_param = "c=5 s=0.01", java_args = "-Xms512M -Xmx6G", annotale_jar = .tantale_tool("annotale") )run_annotale_build( fasta_file, output_dir = tempfile("annotale_build_"), opt_param = "c=5 s=0.01", java_args = "-Xms512M -Xmx6G", annotale_jar = .tantale_tool("annotale") )
fasta_file |
Path to a |
output_dir |
Directory where output will be written, created if it
does not exist. The default is a new directory under |
opt_param |
A single string of options for AnnoTALE build, as
|
java_args |
A single string of options for the Java virtual
machine, placed before |
annotale_jar |
Path to the AnnoTALE jar file. The default is the
copy |
output_dir, invisibly. If AnnoTALE exits with a non-zero
status, the
function stops with an error of class
tantale_error_annotale_failed.
Other external TALE tools:
run_annotale_assign(),
run_annotale_load_classes(),
run_annotale_predict()
# Needs a Java runtime and the tools tantale_setup() downloads. Chained # from run_annotale_predict()'s own output, since that is the file build # normally classifies. fasta <- tantale_genome("MAI1") predict_out <- file.path(tempdir(), "annotale_build_example", "predict") run_annotale_predict(fasta, output_dir = predict_out) predicted <- list.files(file.path(predict_out, "Predict"), pattern = "^TALE_DNA_sequences_", full.names = TRUE) build_out <- file.path(tempdir(), "annotale_build_example", "build") run_annotale_build(predicted, output_dir = build_out) list.files(build_out)# Needs a Java runtime and the tools tantale_setup() downloads. Chained # from run_annotale_predict()'s own output, since that is the file build # normally classifies. fasta <- tantale_genome("MAI1") predict_out <- file.path(tempdir(), "annotale_build_example", "predict") run_annotale_predict(fasta, output_dir = predict_out) predicted <- list.files(file.path(predict_out, "Predict"), pattern = "^TALE_DNA_sequences_", full.names = TRUE) build_out <- file.path(tempdir(), "annotale_build_example", "build") run_annotale_build(predicted, output_dir = build_out) list.files(build_out)
A TALE class groups the TALEs of different strains that are similar
enough to be considered the same effector, and carries the systematic
name the literature uses for it (TalAA, TalAB, ...).
AnnoTALE curates that catalogue and publishes it; this is an R wrapper
around its 'AnnoTALEcli.jar loadAndView' call, which downloads the
current definition. run_annotale_assign consumes what it
writes.
run_annotale_load_classes( output_dir = tempfile("annotale_classes_"), class_builder = NULL, opt_param = "", java_args = "-Xms512M -Xmx8G", annotale_jar = .tantale_tool("annotale") )run_annotale_load_classes( output_dir = tempfile("annotale_classes_"), class_builder = NULL, opt_param = "", java_args = "-Xms512M -Xmx8G", annotale_jar = .tantale_tool("annotale") )
output_dir |
Directory where the catalogue will be written, created
if it does not exist. The default is a new directory under
|
class_builder |
Path to a class builder XML to read instead of
downloading, as written by an earlier call. |
opt_param |
A single string of further options for the tool, as
|
java_args |
A single string of options for the Java virtual
machine, placed before |
annotale_jar |
Path to the AnnoTALE jar file. The default is the
copy |
The download is slow and bulky: about a quarter of an hour, and some
440 MB of output, most of it the class builder itself, which carries a
cached alignment between every pair of catalogued TALEs. The file is
therefore kept once and reused rather than fetched per call, which is
what output_dir is for: point it at a directory you keep, and
pass the returned path to run_annotale_assign as often as
you like.
Record the date along with any class you take from it. A class name is
stable, but the catalogue grows, and the index AnnoTALE appends to the
class when it names a TALE (TalAH30, the thirtieth member of
TalAH) is only true of the catalogue that produced it.
The path of the class builder XML, invisibly, so the call can be
passed straight to run_annotale_assign. Beside it,
output_dir also holds Lists_of_classes,_strains_and_TALEs/,
whose List_of_classes.txt gives every class as plain text, one
line per member with its aligned repeat-variable diresidues, strain
and systematic name. That file answers "which class is this TALE in"
without going through run_annotale_assign at all, when
the TALE is already catalogued.
run_annotale_assign, which places TALEs into
these classes.
Other external TALE tools:
run_annotale_assign(),
run_annotale_build(),
run_annotale_predict()
# Slow: downloads and rebuilds the catalogue, about 15 minutes. classes <- run_annotale_load_classes(output_dir = tempfile("annotale_classes_"))# Slow: downloads and rebuilds the catalogue, about 15 minutes. classes <- run_annotale_load_classes(output_dir = tempfile("annotale_classes_"))
An R wrapper around the
AnnoTALE 'AnnoTALE.jar
predict' and 'AnnoTALE.jar analyze' shell calls.
run_annotale_build completes the AnnoTALE workflow.
run_annotale_predict( fasta_file, output_dir = tempfile("annotale_predict_"), prefix = NULL, opt_param = "Sensitive=false", java_args = "", annotale_jar = .tantale_tool("annotale") )run_annotale_predict( fasta_file, output_dir = tempfile("annotale_predict_"), prefix = NULL, opt_param = "Sensitive=false", java_args = "", annotale_jar = .tantale_tool("annotale") )
fasta_file |
Path to a fasta file of the DNA sequences (e.g. a genome assembly) to search for TALEs. |
output_dir |
Directory where output will be written, created if it
does not exist. The default is a new directory under |
prefix |
A scalar character vector containing a prefix that will be appended to TALE names by AnnoTALE. If not supplied, the function will try to guess the prefix from the input file name. |
opt_param |
A single string of options for the predict stage, as
|
java_args |
A single string of options for the Java virtual
machine, placed before |
annotale_jar |
Path to the AnnoTALE jar file. The default is the
copy |
output_dir, invisibly, so that the call can be passed
straight to tales_from_annotale(). If either stage exits with a
non-zero status, the
function stops with an error of class
tantale_error_annotale_failed.
Other external TALE tools:
run_annotale_assign(),
run_annotale_build(),
run_annotale_load_classes()
# Needs a Java runtime, and the tools and genomes tantale_setup() downloads. fasta <- tantale_genome("MAI1") out <- file.path(tempdir(), "annotale_predict_example") run_annotale_predict(fasta, output_dir = out) list.files(file.path(out, "Predict"))# Needs a Java runtime, and the tools and genomes tantale_setup() downloads. fasta <- tantale_genome("MAI1") out <- file.path(tempdir(), "annotale_predict_example") run_annotale_predict(fasta, output_dir = out) list.files(file.path(out, "Predict"))
One row per RVD, giving its relative binding weight for each of the four
bases. This is the table tales_compare_functal stacks, one
row per repeat, to build an array's position weight matrix.
rvd_dna_specificityrvd_dna_specificity
A tibble with 404 rows and 5 columns:
The two-letter RVD code. "N*" and "H*" are
RVDs whose residue 13 is missing; "OO" is position 0, the base
just before the first repeat's target, where TALEs prefer a T;
"XX" is the flat fallback row used for an unrecognised RVD.
Relative binding weight for that base. The weights
do not sum to one: tales_compare_functal hands
them to create_motif as
raw counts (type = "PCM"), which normalises internally.
Taken verbatim from QueTAL FuncTAL's own table (Info/2014mat18 in
FuncTAL 1.1, by A. L. Pérez-Quintero, redistributed with permission): the
values are unchanged, only a header and column names added. Conceptually related to
but distinct from the internal rvdSimDf used by
tales_align's RVD scoring: that one is a derived
RVD-vs-RVD similarity (a correlation between two RVDs' base-preference
profiles, itself built from TALVEZ's much smaller 17-RVD mat1),
used to score repeat substitutions during sequence alignment. This one
is the raw, per-RVD base preference itself, one level upstream, used to
build a whole array's binding-specificity model for comparison against
another array's. The two tables serve different consumers and cannot
replace each other.
Pérez-Quintero A.L. et al. (2015). QueTAL: a suite of tools to classify and compare TAL effectors functionally and phylogenetically. Frontiers in Plant Science 6, 545. doi:10.3389/fpls.2015.00545
tales_compare_functal, its only consumer.
Other pairwise distances:
[.pairwise_distances(),
as.matrix.pairwise_distances(),
distances_assert_square(),
distances_restrict(),
is_pairwise_distances(),
pairwise_distances(),
tales_assign_domain_codes(),
tales_compare_distal(),
tales_compare_functal(),
tales_domain_distances(),
tales_group_hclust(),
tales_group_kmedoids(),
tales_tale_distances(),
validate_pairwise_distances()
rvd_dna_specificity[rvd_dna_specificity$rvd %in% c("HD", "NI", "NG", "NN"), ]rvd_dna_specificity[rvd_dna_specificity$rvd %in% c("HD", "NI", "NG", "NN"), ]
The measures worth knowing about a set of TALE arrays before doing anything
with them, and the ones too expensive for print.tales.
## S3 method for class 'tales' summary(object, ...) ## S3 method for class 'summary.tales' print(x, ...)## S3 method for class 'tales' summary(object, ...) ## S3 method for class 'summary.tales' print(x, ...)
object |
A |
... |
Unused. |
x |
A |
Distinct domains counts different dom_codes against the
number of parts, broken down by domain type. These are domains,
repeats and termini alike: a dom_code identifies any distinct part
sequence, and the two termini are parts like the repeats are. In the
example output shipped with the package (see tales_from_telltales),
47 distinct codes cover 39 repeats and 8 termini, so reading the total as a
count of distinct repeats would overstate repeat diversity.
The ratio to parts is a property of the biology: TALEs reuse repeats
heavily, within an array and between arrays. It is also what decides the
cost of tales_compare_distal, whose pairwise comparison runs
over distinct domains.
Repeats per array counts repeats only, excluding the termini, so
it is the number that determines how long a target box each TALE
recognises. Note that tell_tales()'s log reports array length as the
number of domain hits, which includes the two termini and is therefore
larger by up to two.
Complete arrays are those where both an N- and a C-terminus were identified. An incomplete one is not necessarily wrong (the array may sit at the end of a contig, or a terminus may simply not have been detected), but completeness is a precondition several downstream functions depend on.
Anomalies come from tales_anomalies. They are
worth computing but too slow to compute every time an object is printed,
which is why they appear here.
An object of class summary.tales: a list of the measures,
so they can be used as well as read.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
parts <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "C-terminus", "N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "CTERM") ) x <- tales(parts) summary(x)parts <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "C-terminus", "N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "CTERM") ) x <- tales(parts) summary(x)
What an alignment looks like, in numbers: how gappy it is, and how much the arrays actually agree.
## S3 method for class 'tales_msa' summary(object, ...) ## S3 method for class 'summary.tales_msa' print(x, ...)## S3 method for class 'tales_msa' summary(object, ...) ## S3 method for class 'summary.tales_msa' print(x, ...)
object |
A |
... |
Unused. |
x |
A |
Columns with no consensus is the measure worth having. A column
has no consensus when no element is strictly more common than the rest
(see tales_consensus), so the count says how much of the
alignment the arrays agree on.
It is reported per layer, and the two usually differ in a way that means
something. Repeats that are distinct proteins can carry the same RVD, so a
column can lack a dom_code consensus while having a clear
rvd one: the arrays disagree about the repeat and agree about the
base it binds. The reverse is rarer and more interesting.
An object of class summary.tales_msa.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) summary(msa)aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) summary(msa)
The TALEs of ten complete, published genomes, named as the literature
names them and annotated by hand. It is the reference this package's own
discovery can be checked against: three of the ten genomes, MAI1, BAI3
and PXO86, are the ones tantale_genome() installs, so a
tell_tales() run on them can be compared array by array with what is
recorded here.
tale_annotationstale_annotations
A tibble with 128 rows and 10 columns. One row is one TALE gene.
The strain, e.g. "PXO99A". Ten of them.
The TALE's name in the literature, capitalised
("Tal4a") and as written in the source publication
("tal4a"). strain and label together identify
a row: a label repeats across strains, never within one.
tal_name is missing where the source gives no name.
The AnnoTALE class the TALE belongs to
("TalAH"), from the catalogue of 2026-10-04. A class groups
TALEs similar enough to be considered the same TALE across strains,
and is how the literature refers to them. Missing for two rows, see
Details.
The RefSeq replicon and the GenBank
assembly the TALE comes from, e.g. "NC_010717" and
"GCA_000019585.2". Present for every row: this is what lets a
reader fetch the sequence.
PubMed identifier(s) of the publication(s) reporting the genome or the TALE, comma-separated where there is more than one.
TRUE for the nine truncTALEs, TALEs whose
C-terminal region is naturally shortened so that they no longer
activate transcription. See the truncTALE article for what this does
to discovery and to frameshift correction.
The repeat-variable diresidues in array order,
dash-separated ("NI-HD-NG-..."), the format of
tales_rvd_strings. tales_predict_targets
takes them as a named BStringSet:
Biostrings::BStringSet(setNames(rvd_seq, paste(strain, label))).
A lowercase RVD
("ng", "n*") marks a repeat of non-standard length,
the usual convention; 16 of the 128 arrays carry at least one, so
do not upper-case this column before comparing it with anything.
A note, for the nine arrays that carry one, on what makes the gene atypical: repeats of non-standard length, deletions, duplications, a premature stop.
The table is sparse where the sources are: tal_name is absent for
19 rows and pubmed for 19. The gaps are the state of the
curation, not placeholders to be filled by a guess.
annotale_class is missing for one row: PXO99A's Tal7b,
the five-repeat allele its own unusual_feature describes, too
short to be catalogued.
The class is stored without the member index AnnoTALE appends to it
("TalAH", not "TalAH30"). That index numbers the members
of a class as of the day it is read, and the catalogue grows: every one
of the 73 indices recorded when this table was curated in 2021 had moved
by 2026, while the class itself agreed in every case.
Identifiers that name an array within a single run are deliberately not
included: the tell_tales array id and AnnoTALE's
tempTALE name both depend on the run that produced them, so
neither would survive a rerun. Matching a row to a fresh
tell_tales result means matching on what the TALE is,
its rvd_seq, rather than on what some run called it.
No column of DisTAL groups is included. The working file carried one, but
how its values had been computed was not recorded, so they could not be
vouched for. tales_compare_distal followed by
tales_group_hclust computes such groups from
rvd_seq.
Compiled by Bao Tram Vi during the work that became this package, from
the genome records and publications cited in each row; published here for
the first time. annotale_class was taken from AnnoTALE's class
catalogue as downloaded on 2026-10-04. The genome sequences themselves are the GenBank
assemblies named in genome_id, at
https://www.ncbi.nlm.nih.gov/datasets/genome/.
talomes_heatmap, which takes a table of this
shape directly: the column names below are the ones its
group_col, strain_col, rvd_col and
trunc_tales_col arguments expect.
Other TALE discovery:
correct_tales(),
tales_from_annotale(),
tales_from_telltales(),
tell_tales()
# the TALEs of one strain subset(tale_annotations, strain == "PXO86", select = c("label", "annotale_class", "truncTALE")) # the ten strains compared class by class; truncTALEs are marked "T" grouped <- tale_annotations[!is.na(tale_annotations$annotale_class), ] talomes_heatmap(grouped, group_col = "annotale_class", strain_col = "strain", rvd_col = "rvd_seq", trunc_tales_col = "truncTALE") # the naturally truncated ones, across all ten genomes table(tale_annotations$strain, tale_annotations$truncTALE) # what makes the atypical arrays atypical subset(tale_annotations, !is.na(unusual_feature), select = c("strain", "label", "unusual_feature"))# the TALEs of one strain subset(tale_annotations, strain == "PXO86", select = c("label", "annotale_class", "truncTALE")) # the ten strains compared class by class; truncTALEs are marked "T" grouped <- tale_annotations[!is.na(tale_annotations$annotale_class), ] talomes_heatmap(grouped, group_col = "annotale_class", strain_col = "strain", rvd_col = "rvd_seq", trunc_tales_col = "truncTALE") # the naturally truncated ones, across all ten genomes table(tale_annotations$strain, tale_annotations$truncTALE) # what makes the atypical arrays atypical subset(tale_annotations, !is.na(unusual_feature), select = c("strain", "label", "unusual_feature"))
Builds a tales object from a data frame of TALE array parts: one row
per (array, slot).
tales(x, dom_code_namespace = NULL, sanitize = FALSE)tales(x, dom_code_namespace = NULL, sanitize = FALSE)
x |
A data frame with at least |
dom_code_namespace |
Optional scalar string, see
|
sanitize |
Which arrays to remove, among those
Structural corruption is an error either way. |
A validated tales object.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
parts <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "C-terminus", "N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "CTERM") ) tales(parts)parts <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "C-terminus", "N-terminus", "repeat", "C-terminus"), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "CTERM") ) tales(parts)
Aligns TALE arrays on one of their residue layers with MAFFT's text mode,
returning the alignment as a tales_msa — the input object with
an alignment_position column added, so every other layer
(rvd, dom_code, aa_seq, ...) remains available.
tales_align( x, residue_col = c("rvd", "dom_code"), domain_distances = NULL, mafft_opts = "--localpair --maxiterate 1000 --reorder --op 0 --ep 5 --thread 1", mafft_path = NULL, mafft_verbose = FALSE )tales_align( x, residue_col = c("rvd", "dom_code"), domain_distances = NULL, mafft_opts = "--localpair --maxiterate 1000 --reorder --op 0 --ep 5 --thread 1", mafft_path = NULL, mafft_verbose = FALSE )
x |
A |
residue_col |
Which layer to align on: |
domain_distances |
Scoring matrix for the residues being aligned.
|
mafft_opts |
Command-line options handed to MAFFT. The default,
|
mafft_path |
Where to find MAFFT. |
mafft_verbose |
Whether to let MAFFT write to the console. It reports
its banner, the strategy it chose and its progress through the sequences,
which is dozens of lines per alignment and rarely what you want. With
|
The mapping back from MAFFT's output is positional: the k-th non-gap cell
of an aligned row is the k-th part fed in. That is well defined only because
this function builds MAFFT's input from x itself, which is why
tales_assert_complete is enforced first.
A tales_msa object. The settings it was aligned with
(residue_col, domain_distances, mafft_opts) are
kept with it; tales_msa_params returns them.
Other TALE alignment:
as.matrix.tales_msa(),
is_tales_msa(),
tales_consensus(),
tales_consensus_match(),
tales_msa(),
tales_msa_params(),
tales_msa_width(),
validate_tales_msa()
# Needs MAFFT, resolved from the tantale conda environment on first use. rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") x <- as_tales(rvd_fasta, sep = "-") msa <- tales_align(x, residue_col = "rvd") as.matrix(msa)# Needs MAFFT, resolved from the tantale conda environment on first use. rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") x <- as_tales(rvd_fasta, sep = "-") msa <- tales_align(x, residue_col = "rvd") as.matrix(msa)
The values a rvd column takes on non-repeat parts.
tales_anchor_codes()tales_anchor_codes()
AnnoTALE reports as N-terminus whatever the ORF encodes upstream of the
first repeat, and as C-terminus whatever it encodes downstream of the last
one. tell_tales searches each of these
segments with the TALE N- or C-terminal protein profile (hmmsearch).
"NTERM" and "CTERM" mark a canonical TALE terminal domain,
one that can be expected to do its usual job: the match has an E-value of
at most terminus_max_evalue, covers at least
terminus_min_cover of the profile (0.9 by default) and reaches the
end of the profile that adjoins the repeats. "XXXXX" marks any
other segment. An array for which AnnoTALE reported no segment on one side
has no terminus part at the protein level on that side.
A terminus can fail to be canonical in several ways, which
array_report.tsv tells apart (its *_aa_* and
*_dna_* columns, see tell_tales): the segment may
be unrelated sequence where the ORF starts or ends inside a frameshifted
region, its repeat-side part may be in another reading frame, or the
terminus may have lost a large part of its domain. The truncTALEs
of Xanthomonas oryzae have lost the activation domain, and their
C-termini are coded "XXXXX". A smaller internal deletion, such as
the one in the N-terminus of TalC, a major TALE of African
X. oryzae pv. oryzae, leaves a terminus canonical.
These share the rvd column with real RVDs, so code that distinguishes
repeats from termini by value should use this function rather than spelling
the codes out.
A named character vector of the three codes.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
tales_anchor_codes()tales_anchor_codes()
Lists the arrays whose content is biologically odd:
missing sequence data,
a structure other than that of a standard TALE (an N-terminus, one or more repeats and a C-terminus, both termini canonical TALE terminal domains),
impossible domain-type arrangements,
coordinate disagreements,
an amino acid sequence paired with more than one RVD,
an attribute that varies within an array when it should not.
Structurally broken input (a duplicated key, a missing required column)
is an error in tales instead.
"Odd" arrays are accepted by tales – real TALE predictions are
messy, and refusing to load them would force cleaning outside the package and
destroy the diagnostic signal. Construction warns about them and this
function tells you which and why.
Each anomaly is of one of two kinds. "noncanonical" marks a TALE
whose structure departs from the standard one: a terminus that is not a
canonical TALE terminal domain (terminus_noncanonical), such as
the C-terminus of a truncTALE, or no terminus part on one side
(terminus_absent). Such TALEs can be real and interesting.
"integrity" marks every other anomaly: data that are inconsistent
or incomplete, or an array without repeats. tales(x, sanitize =
TRUE) removes the arrays with an anomaly of kind "integrity" and
keeps the others; tales(x, sanitize = "canonical") keeps
canonical TALEs only.
The structure checks need a domain_type column, and the terminus
profile check an rvd column; they are skipped when it is absent.
The structure checks report terminus_absent (no N- or no
C-terminus part), no_repeat (no repeat part) and
terminus_noncanonical (a terminus coded XXXXX, see
tales_anchor_codes). They apply to whole arrays: a subset
keeping only the repeats is reported as lacking its termini.
tales_anomalies(x)tales_anomalies(x)
x |
A |
A tibble of array_id, check, kind
("integrity" or "noncanonical") and detail, one
row per anomaly. Zero rows if the object is clean.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
# A2 carries two N-termini -- an impossible arrangement. odd <- data.frame( array_id = c("A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "N-terminus", "N-terminus", "repeat"), rvd = c("NTERM", "HD", "NTERM", "NTERM", "NI") ) x <- suppressWarnings(tales(odd)) tales_anomalies(x) tales(odd, sanitize = TRUE) # drops A2 instead of merely warning # B2 is a truncTALE-like array: its C-terminus is not canonical. parts <- data.frame( array_id = rep(c("B1", "B2"), each = 3), position_in_array = rep(1:3, 2), domain_type = rep(c("N-terminus", "repeat", "C-terminus"), 2), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "XXXXX") ) y <- tales(parts, sanitize = TRUE) # keeps B2, with a message tales_anomalies(y) z <- tales(parts, sanitize = "canonical") # drops B2 unique(z$array_id)# A2 carries two N-termini -- an impossible arrangement. odd <- data.frame( array_id = c("A1", "A1", "A2", "A2", "A2"), position_in_array = c(1L, 2L, 1L, 2L, 3L), domain_type = c("N-terminus", "repeat", "N-terminus", "N-terminus", "repeat"), rvd = c("NTERM", "HD", "NTERM", "NTERM", "NI") ) x <- suppressWarnings(tales(odd)) tales_anomalies(x) tales(odd, sanitize = TRUE) # drops A2 instead of merely warning # B2 is a truncTALE-like array: its C-terminus is not canonical. parts <- data.frame( array_id = rep(c("B1", "B2"), each = 3), position_in_array = rep(1:3, 2), domain_type = rep(c("N-terminus", "repeat", "C-terminus"), 2), rvd = c("NTERM", "HD", "CTERM", "NTERM", "NI", "XXXXX") ) y <- tales(parts, sanitize = TRUE) # keeps B2, with a message tales_anomalies(y) z <- tales(parts, sanitize = "canonical") # drops B2 unique(z$array_id)
Checks that every array carries all of its parts: position_in_array
running contiguously from 1, and — when domain_type and
position_in_crd are present — position_in_crd equal to
position_in_array minus the number of non-repeat parts before it.
tales_assert_complete(x, arg = "x")tales_assert_complete(x, arg = "x")
x |
A |
arg |
Name of the argument being checked, for the error message. |
Completeness is a precondition of some functions; the class itself does
not require it: filter(x, domain_type == "repeat") legitimately
produces a valid tales that is no longer complete. Alignment
requires completeness, because the mapping back from a
MAFFT alignment is positional — the k-th aligned residue is the k-th part
fed in.
x, invisibly.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") x <- as_tales(rvd_fasta, sep = "-") tales_assert_complete(x) # every array is 1..n already -- no error # Keeping only the repeats breaks completeness, which tales_align() needs. repeats_only <- x[x$position_in_array > 1, ] try(tales_assert_complete(repeats_only))rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") x <- as_tales(rvd_fasta, sep = "-") tales_assert_complete(x) # every array is 1..n already -- no error # Keeping only the repeats breaks completeness, which tales_align() needs. repeats_only <- x[x$position_in_array > 1, ] try(tales_assert_complete(repeats_only))
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.
tales_assign_domain_codes(x)tales_assign_domain_codes(x)
x |
A tales object carrying an |
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.
x with a dom_code column and a dom_code_namespace stamp.
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().
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()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) tales_namespace(xa)x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) tales_namespace(xa)
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.
tales_bind(..., on_namespace_mismatch = c("recode", "error"), sanitize = FALSE)tales_bind(..., on_namespace_mismatch = c("recode", "error"), sanitize = FALSE)
... |
One or more |
on_namespace_mismatch |
What to do when the inputs' |
sanitize |
Passed to |
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.
A validated tales object.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_names(),
tales_namespace(),
tales_requirements(),
validate_tales()
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)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)
Renders each array as a separated string of its dom_codes in part order,
where each distinct domain sequence is one "residue". tales_align() and
tales_tale_distances() work on arrays in this form.
tales_coded_strings(x, sep = " ", repeats_only = FALSE)tales_coded_strings(x, sep = " ", repeats_only = FALSE)
x |
A tales object carrying a |
sep |
Separator between codes. Defaults to |
repeats_only |
Drop the terminus parts, keeping only repeats.
|
This is the sibling of tales_rvd_strings() and takes the same two
arguments, but both defaults differ, because the two projections feed
different consumers:
tales_rvd_strings() |
tales_coded_strings() |
|
sep |
"-", the AnnoTALE convention |
" ", what MAFFT
--text splits on |
| filter | repeats_only = TRUE |
repeats_only = FALSE
|
The separator is free to choose here in a way it is not for RVDs: a
dom_code is a bare integer rendered as text, so "1 2 3" and "1-2-3"
are equally unambiguous. It defaults to a space because that is what
MAFFT's text mode expects.
The termini are kept by default, where tales_rvd_strings() drops them.
Target prediction concerns the repeat domain only, so dropping them there
is right; alignment is the consumer here, and the two termini are the most
reliable anchors an alignment of TALE arrays has. Set repeats_only = TRUE
to compare bare repeat arrays.
A Biostrings::BStringSet, named by array_id.
tales_domain_codes() for the code-to-sequence lookup,
tales_rvd_strings() for the sibling projection.
Other tales projections:
tales_domain_codes(),
tales_get_dna_seq(),
tales_get_protein_seq(),
tales_rvd_strings(),
tales_to_universalmotif()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) tales_coded_strings(xa)[1] tales_coded_strings(xa, sep = "-", repeats_only = TRUE)[1]x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) tales_coded_strings(xa)[1] tales_coded_strings(xa, sep = "-", repeats_only = TRUE)[1]
Quantifies how TALE arrays, and the individual domains they are built
from – repeats and the two termini alike – relate to one another by
aligning their domain sequences. An R re-implementation of the original
DisTAL Perl program, including the array alignment step (the ARLEM
model, see tales_tale_distances), with parallel domain
alignment, which makes it much faster (the exact speedup depends on
aln_method).
tales_compare_distal( x, ncores = 1, aln_method = "DECIPHER", conda_bin = "auto" )tales_compare_distal( x, ncores = 1, aln_method = "DECIPHER", conda_bin = "auto" )
x |
A |
ncores |
Number of cores for the pairwise alignment step. |
aln_method |
Approach for pairwise distances between part amino acid
sequences: |
conda_bin |
Path to a Conda binary, if |
The name says which comparison this is: tales_compare_functal
compares TALEs by their predicted DNA-binding specificity instead.
It returns the two expensive products (the pairwise protein alignment between distinct domains, and the alignment of the coded arrays) with the coded input; anything else is cheap to derive from these.
This is where dom_code is minted, over the whole set of parts
supplied, and where tales/domain_distances are stamped with
a namespace identifying that set — see tales_namespace.
Passing a subset later is safe; re-running on a different part set mints
different codes, and the differing namespace is what stops the two being
joined by mistake. tale_distances carries no such stamp: it is
keyed by array_id, a name that keeps its meaning across runs.
A list of three objects, all describing the same run:
tales: the input, with a dom_code column added.
domain_distances: a domain_distances between distinct
domains, keyed by dom_code.
tale_distances: a tale_distances between whole arrays,
keyed by array_id.
Pérez-Quintero A.L. et al. (2015). QueTAL: a suite of tools to classify and compare TAL effectors functionally and phylogenetically. Frontiers in Plant Science 6, 545. doi:10.3389/fpls.2015.00545
Abouelhoda M.I., Giegerich R., Behzadi B., Steyaert J.-M. (2009). Alignment of minisatellite maps based on run-length encoding scheme. Journal of Bioinformatics and Computational Biology 7(2), 287–308. doi:10.1142/S0219720009004060
tales_group_hclust/tales_group_kmedoids
to cluster arrays from the returned tale_distances;
tales_compare_functal, comparing TALEs by predicted DNA-binding
specificity instead of domain-sequence relatedness.
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_functal(),
tales_domain_distances(),
tales_group_hclust(),
tales_group_kmedoids(),
tales_tale_distances(),
validate_pairwise_distances()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) cmp <- tales_compare_distal(x) names(cmp) cmp$tale_distancesx <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) cmp <- tales_compare_distal(x) names(cmp) cmp$tale_distances
Quantifies how TALE arrays relate by the DNA sequence their repeats are
predicted to bind. (tales_compare_distal compares them by
domain sequence instead.) The function turns each array's repeats into a
position weight matrix (PWM) of the bases its RVDs prefer, and compares
the PWMs pairwise with compare_motifs.
tales_compare_functal( x, method = "PCC", tryRC = FALSE, min.overlap = 1, normalise.scores = TRUE, score.strat = "a.mean", nthreads = 1 )tales_compare_functal( x, method = "PCC", tryRC = FALSE, min.overlap = 1, normalise.scores = TRUE, score.strat = "a.mean", nthreads = 1 )
x |
A |
method |
One of |
tryRC |
Also score each pair's reverse-complement alignment and keep
the better one. |
min.overlap |
Minimum aligned width to accept, as |
normalise.scores |
Penalise alignments that leave much of either
motif unaligned. |
score.strat |
How |
nthreads |
Passed to |
This is a reimplementation of QueTAL's FuncTAL comparison on
universalmotif; the original Perl tool depends on BioPerl's
Bio::Perl module, which current BioPerl no longer provides.
Results differ from the original FuncTAL tool, by design. FuncTAL
scored two RVD arrays by flattening their entire padded, overlapping
alignment (positions and bases together) into one vector and taking a
single Pearson correlation. compare_motifs() instead correlates
matched columns individually and combines the column scores
(score.strat); the two disagree on real data.
tales_to_universalmotif builds the PWMs (see its page for
what drives them and how it treats an RVD missing from
rvd_dna_specificity). It is exported so that its output
can go to any universalmotif function.
Only a handful of compare_motifs's many
options are exposed here, chosen for what actually varies across TALE
arrays (their differing repeat counts); see ?compare_motifs for the
rest.
A tale_distances object, interchangeable with
tales_compare_distal's, so it can be handed directly to
tales_group_hclust/tales_group_kmedoids.
No tree is built here, matching tales_compare_distal()'s own
division of labour: compare here, cluster/tree there.
tales_compare_distal(), comparing by domain sequence instead;
tales_to_universalmotif(), the conversion step this uses; called
directly, it lets any other universalmotif function (
motif_tree(), view_motifs(), scan_sequences(),
merge_motifs(), ...) can be run on the same PWMs.
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_domain_distances(),
tales_group_hclust(),
tales_group_kmedoids(),
tales_tale_distances(),
validate_pairwise_distances()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) fn <- tales_compare_functal(x) fnx <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) fn <- tales_compare_functal(x) fn
Pick the most frequent element in each column of the alignment matrix.
tales_consensus(align)tales_consensus(align)
align |
A TALE alignment as a character matrix, one row per array
and one column per alignment position, with |
A column has a consensus only when one element is strictly more
common than every other. Where two or more are tied for most frequent –
as happens whenever each array carries a different repeat at that
position – the result is NA, because there is no agreement to
report. NA is likewise returned when the most common thing at a
position is a gap.
A vector of consensus elements in each column of align.
Other TALE alignment:
as.matrix.tales_msa(),
is_tales_msa(),
tales_align(),
tales_consensus_match(),
tales_msa(),
tales_msa_params(),
tales_msa_width(),
validate_tales_msa()
# column 1: HD is a clear majority. column 2: a three-way tie, no consensus. aln <- matrix(c("HD", "HD", "NI", "NG", "NI", "HD"), nrow = 3, dimnames = list(c("A1", "A2", "A3"), NULL)) aln tales_consensus(aln) # From a tales_msa, such as tales_align() returns msa <- tales_msa(data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A3", "A3", "A3"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 1L, 2L, 3L), alignment_position = c(1L, 2L, 3L, 1L, 3L, 1L, 2L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM", "NTERM", "HD", "CTERM") )) tales_consensus(as.matrix(msa))# column 1: HD is a clear majority. column 2: a three-way tie, no consensus. aln <- matrix(c("HD", "HD", "NI", "NG", "NI", "HD"), nrow = 3, dimnames = list(c("A1", "A2", "A3"), NULL)) aln tales_consensus(aln) # From a tales_msa, such as tales_align() returns msa <- tales_msa(data.frame( array_id = c("A1", "A1", "A1", "A2", "A2", "A3", "A3", "A3"), position_in_array = c(1L, 2L, 3L, 1L, 2L, 1L, 2L, 3L), alignment_position = c(1L, 2L, 3L, 1L, 3L, 1L, 2L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM", "NTERM", "HD", "CTERM") )) tales_consensus(as.matrix(msa))
Compute a logical matrix corresponding to the input align
input with TRUE where an element matches the consensus at that
position and FALSE where it does not. Columns with no consensus –
see tales_consensus – are NA throughout, since
there is nothing there to match.
tales_consensus_match(align, long = TRUE)tales_consensus_match(align, long = TRUE)
align |
A TALE alignment as a character matrix, one row per array
and one column per alignment position, with |
long |
Set to |
A multiple Tal sequences alignment in the form of a
matrix filled with logical values if long is FALSE and
a long tibble representing the original alignment otherwise (default).
Other TALE alignment:
as.matrix.tales_msa(),
is_tales_msa(),
tales_align(),
tales_consensus(),
tales_msa(),
tales_msa_params(),
tales_msa_width(),
validate_tales_msa()
aln <- matrix(c("HD", "HD", "NI", "NG", "NI", "HD"), nrow = 3, dimnames = list(c("A1", "A2", "A3"), NULL)) tales_consensus_match(aln, long = FALSE) tales_consensus_match(aln)aln <- matrix(c("HD", "HD", "NI", "NG", "NI", "HD"), nrow = 3, dimnames = list(c("A1", "A2", "A3"), NULL)) tales_consensus_match(aln, long = FALSE) tales_consensus_match(aln)
One row per distinct domain sequence: its dom_code, the amino acid
sequence it stands for, and the RVD carried by that domain.
tales_domain_codes(x)tales_domain_codes(x)
x |
A |
A tibble with dom_code and
aa_seq columns, plus rvd when x carries one, one
row per code.
Other tales projections:
tales_coded_strings(),
tales_get_dna_seq(),
tales_get_protein_seq(),
tales_rvd_strings(),
tales_to_universalmotif()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) head(tales_domain_codes(xa))x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) head(tales_domain_codes(xa))
Step 2 of tales_compare_distal(). Aligns every distinct domain sequence against
every other and returns their pairwise dissimilarity.
tales_domain_distances( x, aln_method = "DECIPHER", ncores = 1, conda_bin = "auto" )tales_domain_distances( x, aln_method = "DECIPHER", ncores = 1, conda_bin = "auto" )
x |
A tales object carrying |
aln_method |
One of |
ncores |
Number of cores for the pairwise alignment. |
conda_bin |
Passed to |
This is the expensive step, and the one worth having on its own: the domain-level distances answer questions about domain diversity without any array-level alignment.
Distances are between distinct domains, keyed by dom_code, so the
cost goes with the number of distinct sequences rather than the number of
parts. See summary() for that ratio on a given object.
dissim follows DisTAL's definition: the percentage of amino acids that
change between two domains, normalised by the longer one, with residues
one domain lacks counted as changes. A 20-residue half-repeat that is an
exact prefix of a 34-residue repeat is therefore 14/34, about 41 percent, from
it. All three backends follow this definition. They still differ slightly
pair by pair: "DECIPHER" measures distances inside one multiple
alignment of all domains, the other two align each pair separately, and
"Biostrings" also charges a cost for opening an internal gap.
A domain_distances object, stamped with x's namespace.
tales_tale_distances(), which consumes this.
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_group_hclust(),
tales_group_kmedoids(),
tales_tale_distances(),
validate_pairwise_distances()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) tales_domain_distances(xa)x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) tales_domain_distances(xa)
Reads the output of AnnoTALE's analyze stage, as written by
run_annotale_predict, and returns a validated
tales object with the same columns as
tales_from_telltales.
tales_from_annotale( annotale_dir, terminus_max_evalue = 1e-05, terminus_min_cover = 0.9, sanitize = FALSE, hmm_dir = system.file("extdata", "hmmProfile", package = "tantale", mustWork = TRUE) )tales_from_annotale( annotale_dir, terminus_max_evalue = 1e-05, terminus_min_cover = 0.9, sanitize = FALSE, hmm_dir = system.file("extdata", "hmmProfile", package = "tantale", mustWork = TRUE) )
annotale_dir |
A directory holding AnnoTALE analyze's
|
terminus_max_evalue, terminus_min_cover
|
Maximum |
sanitize |
|
hmm_dir |
Directory holding the TALE terminus protein profiles. |
AnnoTALE predict finds TALE genes in a genome; analyze splits each one into
its N-terminal region, repeats and C-terminal region, and reads the RVD of
every repeat. tell_tales runs analyze too, on ORFs it
delimits itself from nhmmer hits of the TALE DNA profiles, so the two need
not report the same set of TALEs.
As in tell_tales(), each terminal segment is searched with the TALE
N- or C-terminal protein profile (hmmsearch, from the tantale
environment; see tantale_setup). The rvd column holds
NTERM/CTERM for a segment that is a canonical terminus by
that search and XXXXX for any other (see
tales_anchor_codes).
array_id is AnnoTALE's name for the TALE (MAI1-tempTALE1),
without the location AnnoTALE appends to it. seqnames is filled
when predict's GFF3 file is found under annotale_dir.
A validated tales object.
Other TALE discovery:
correct_tales(),
tale_annotations,
tales_from_telltales(),
tell_tales()
# Needs the tantale environment for hmmsearch (see tantale_setup()). tales_from_annotale(system.file("extdata", "annotaleExampleOutput", package = "tantale"))# Needs the tantale environment for hmmsearch (see tantale_setup()). tales_from_annotale(system.file("extdata", "annotaleExampleOutput", package = "tantale"))
Reads the AnnoTALE/telltale part files of a single
tell_tales output directory and returns a
validated tales object.
tales_from_telltales(telltale_dir, sanitize = FALSE)tales_from_telltales(telltale_dir, sanitize = FALSE)
telltale_dir |
Path to a single |
sanitize |
|
One row per part: the N-terminus, each repeat and the C-terminus, as
AnnoTALE split the array's longest ORF. The rvd column holds the RVD
of a repeat, or a terminus code (see tales_anchor_codes):
NTERM/CTERM when the terminus is a canonical TALE terminal
domain by the protein profile search of tell_tales,
XXXXX when it is not. When
AnnoTALE reported no terminus on one side, the array has no part there, with
a warning. An array whose protein and DNA parts disagree is left out, with
a warning.
A candidate array with a TALE terminus DNA hit that AnnoTALE could not
split into parts is absent from the result, with a warning naming it.
tales_anomalies cannot report such an array, since it is not
in the object. After frameshift correction this usually means the array
was corrected against a distant reference; see max_comparisons in
tell_tales.
The directory must have been written by the current version of
tell_tales(), whose array_report.tsv holds the terminus
check; an older one is an error.
The result carries no dom_code: that surrogate key is minted later,
by the relatedness computation, over the whole set of parts being analysed.
A validated tales object.
Other TALE discovery:
correct_tales(),
tale_annotations,
tales_from_annotale(),
tell_tales()
tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale"))tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale"))
The DNA sibling of tales_get_protein_seq(): reassembles each array's
parts, in order, into one full-length nucleotide sequence, by pasting
dna_seq together directly. See tales_get_protein_seq()'s Details for
why position_in_array is the ordering key even for a tales_msa.
tales_get_dna_seq(x)tales_get_dna_seq(x)
x |
A tales object carrying a |
A Biostrings::DNAStringSet, named by array_id.
tales_get_protein_seq() for the protein sequence sibling.
Other tales projections:
tales_coded_strings(),
tales_domain_codes(),
tales_get_protein_seq(),
tales_rvd_strings(),
tales_to_universalmotif()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) tales_get_dna_seq(x)[1]x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) tales_get_dna_seq(x)[1]
Reassembles each array's parts (N-terminus, repeats and C-terminus, in
order) into one full-length amino acid sequence, by pasting aa_seq
together with no separator: the result is a real protein sequence, where
tales_rvd_strings() joins RVD tokens with hyphens.
tales_get_protein_seq(x)tales_get_protein_seq(x)
x |
A tales object carrying an |
Parts are ordered by position_in_array. An alignment never reorders an
array's parts, only inserts gaps between them, and a tales_msa's gaps are
never rows: a gap is a column with no row for that array. So position_in_array
gives the same part order alignment_position would, without needing to
skip anything, and works unchanged whether x is a bare tales or a
tales_msa.
An Biostrings::AAStringSet, named by array_id.
tales_get_dna_seq() for the DNA sequence sibling.
Other tales projections:
tales_coded_strings(),
tales_domain_codes(),
tales_get_dna_seq(),
tales_rvd_strings(),
tales_to_universalmotif()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) tales_get_protein_seq(x)[1]x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) tales_get_protein_seq(x)[1]
Clusters TALE arrays with hclust on their
pairwise distance, cuts the tree into exactly k groups, and returns
the tales object the distances were computed from with the
result attached as its group column.
tales_group_hclust(x, tale_distances, k = NULL, plot_tree = FALSE)tales_group_hclust(x, tale_distances, k = NULL, plot_tree = FALSE)
x |
A tales object – the one whose comparison produced |
tale_distances |
A tale_distances object, as returned by |
k |
Integer, the number of groups to cut the tree into. |
plot_tree |
Logical, whether to draw the |
The function clusters tale_distances but returns the tales object
those distances came from, with the groups added. group is a recognised tales column, validated as constant within
an array – it is an array-level property, like seqnames.
Taking x rather than returning a bare lookup table is what makes the
correspondence checkable: the array names in tale_distances must be the array
names in x, and this is the only place that can be verified. A mismatch
is an error rather than a silent NA group, because a partly-grouped
object is the kind of thing that fails much later and confusingly.
The bare mapping is still one line away if you want it:
unique(out[c("array_id", "group")]).
The tree is built directly on the distances
(stats::hclust(stats::as.dist(distMat))), matching the original
DisTAL clustering this package reimplements. The tree is cut with
stats::cutree(tree, k = k), which always succeeds, including when
a tie in merge heights would make a height-based cut ambiguous.
x with an added (or replaced) group column.
tales_group_kmedoids(), the alternative method;
tales_compare_distal(), which produces both inputs.
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_kmedoids(),
tales_tale_distances(),
validate_pairwise_distances()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) cmp <- tales_compare_distal(x) grouped <- tales_group_hclust(cmp$tales, cmp$tale_distances, k = 2) unique(grouped[c("array_id", "group")])x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) cmp <- tales_compare_distal(x) grouped <- tales_group_hclust(cmp$tales, cmp$tale_distances, k = 2) unique(grouped[c("array_id", "group")])
Clusters TALE arrays with pam for every
candidate k in k_range, then returns the tales
object the distances were computed from with the chosen clustering's
result attached as its group column.
tales_group_kmedoids( x, tale_distances, k_range = NULL, k = NULL, seed = 7, plot_silhouette = TRUE )tales_group_kmedoids( x, tale_distances, k_range = NULL, k = NULL, seed = 7, plot_silhouette = TRUE )
x |
A tales object – the one whose comparison produced |
tale_distances |
A tale_distances object, as returned by |
k_range |
Integer vector of candidate values of |
k |
See Details. |
seed |
Passed to |
plot_silhouette |
Logical, whether to draw the silhouette-vs-k plot. |
The function clusters tale_distances but returns the tales object
those distances came from, with the groups added. group is a recognised tales column, validated as constant within
an array – it is an array-level property, like seqnames.
Taking x rather than returning a bare lookup table is what makes the
correspondence checkable: the array names in tale_distances must be the array
names in x, and this is the only place that can be verified. A mismatch
is an error rather than a silent NA group, because a partly-grouped
object is the kind of thing that fails much later and confusingly.
The bare mapping is still one line away if you want it:
unique(out[c("array_id", "group")]).
Unlike a hierarchical tree, PAM has no single structure that can be cut at
an arbitrary k after the fact: k is a parameter of the clustering
itself. So one clustering is computed per candidate in k_range, and k
picks which of those to keep:
k a single number uses that candidate directly.
k = "auto" picks the elbow of the silhouette-vs-k curve, the point
after which adding groups stops improving the fit much. It uses the
first step of the Kneedle algorithm only, a practical heuristic; check
the silhouette plot when the choice matters.
k = NULL (the default) shows the silhouette plot and asks for a number
at the console, but only when interactive() is TRUE.
In a script, a test or a vignette render, k = NULL errors instead of
blocking on input that will never arrive.
x with an added (or replaced) group column.
tales_group_hclust(), the alternative method;
tales_compare_distal(), which produces both inputs.
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_tale_distances(),
validate_pairwise_distances()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) cmp <- tales_compare_distal(x) grouped <- tales_group_kmedoids(cmp$tales, cmp$tale_distances, k_range = 2:3, k = 2) unique(grouped[c("array_id", "group")])x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) cmp <- tales_compare_distal(x) grouped <- tales_group_kmedoids(cmp$tales, cmp$tale_distances, k_range = 2:3, k = 2) unique(grouped[c("array_id", "group")])
A tales object plus an alignment_position column. Gaps
are implicit: a gap is simply the absence of a row at that
(array_id, alignment_position).
tales_msa(x, alignment_width = NULL, dom_code_namespace = NULL)tales_msa(x, alignment_width = NULL, dom_code_namespace = NULL)
x |
A data frame with the |
alignment_width |
Integer alignment width; defaults to
|
dom_code_namespace |
Optional scalar string, see
|
Normally produced by tales_align rather than called directly.
A validated tales_msa object.
Other TALE alignment:
as.matrix.tales_msa(),
is_tales_msa(),
tales_align(),
tales_consensus(),
tales_consensus_match(),
tales_msa_params(),
tales_msa_width(),
validate_tales_msa()
# A hand-built alignment: A2 has a gap at position 2 relative to A1. aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) tales_msa_width(msa) as.matrix(msa)# A hand-built alignment: A2 has a gap at position 2 relative to A1. aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) msa <- tales_msa(aligned) tales_msa_width(msa) as.matrix(msa)
What tales_align aligned on and how, kept with the
alignment so that it can be reproduced or interpreted later, for example
to tell whether a tales_msa holding both rvd and
dom_code columns was aligned on its RVDs or on its domain codes.
Subsetting keeps these settings; returning to a plain tales
(as_tales) drops them.
tales_msa_params(x)tales_msa_params(x)
x |
A |
A list with residue_col, the column aligned on;
domain_distances, the scoring given to tales_align()
(NULL, "rvd", or the matrix, table or file supplied);
and mafft_opts, the options MAFFT ran with. NULL for a
tales_msa built by hand with tales_msa.
Other TALE alignment:
as.matrix.tales_msa(),
is_tales_msa(),
tales_align(),
tales_consensus(),
tales_consensus_match(),
tales_msa(),
tales_msa_width(),
validate_tales_msa()
# Needs MAFFT, resolved from the tantale conda environment on first use. rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") msa <- tales_align(as_tales(rvd_fasta, sep = "-"), residue_col = "rvd") tales_msa_params(msa)$residue_col# Needs MAFFT, resolved from the tantale conda environment on first use. rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") msa <- tales_align(as_tales(rvd_fasta, sep = "-"), residue_col = "rvd") tales_msa_params(msa)$residue_col
The number of columns in the alignment, including those that are all gaps in
the object at hand. It is stored with the object, because subsetting arrays
can empty the last column, which would silently shrink
max(alignment_position). A plain tales has no width.
tales_msa_width(x)tales_msa_width(x)
x |
A |
An integer scalar, or NULL if unset.
Other TALE alignment:
as.matrix.tales_msa(),
is_tales_msa(),
tales_align(),
tales_consensus(),
tales_consensus_match(),
tales_msa(),
tales_msa_params(),
validate_tales_msa()
# A2 has no C-terminus, so the last column holds A1's alone. aligned <- data.frame( array_id = c("A1", "A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 4L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 4L, 1L, 2L), rvd = c("NTERM", "HD", "NI", "CTERM", "NTERM", "HD") ) msa <- tales_msa(aligned) tales_msa_width(msa) # Keeping A2 alone empties columns 3 and 4; the width is still 4. a2 <- msa[msa$array_id == "A2", ] max(a2$alignment_position) tales_msa_width(a2)# A2 has no C-terminus, so the last column holds A1's alone. aligned <- data.frame( array_id = c("A1", "A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 4L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 4L, 1L, 2L), rvd = c("NTERM", "HD", "NI", "CTERM", "NTERM", "HD") ) msa <- tales_msa(aligned) tales_msa_width(msa) # Keeping A2 alone empties columns 3 and 4; the width is still 4. a2 <- msa[msa$array_id == "A2", ] max(a2$alignment_position) tales_msa_width(a2)
Each array in a tales object is one TALE, identified by its
array_id. This returns those identifiers once each, in the order
the arrays appear in x. They are also the names of the vector that
tales_rvd_strings returns. A tales_msa has the same
arrays as the tales object it was aligned from.
tales_names(x)tales_names(x)
x |
A |
names() is left to its usual meaning: a tales object is a
data frame, so names(x) returns its column names.
A character vector of array identifiers.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_namespace(),
tales_requirements(),
validate_tales()
rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") x <- as_tales(rvd_fasta, sep = "-") tales_names(x) length(tales_names(x)) # the number of TALEsrvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") x <- as_tales(rvd_fasta, sep = "-") tales_names(x) length(tales_names(x)) # the number of TALEs
Identifies the run whose dom_code values this object carries. Objects
from different runs must not be joined: dom_code is minted per run, so
the codes collide across runs and a join would silently succeed against the
wrong domains.
tales_namespace(x)tales_namespace(x)
x |
A |
A scalar string, or NULL if the object is not stamped.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_requirements(),
validate_tales()
rvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") x <- as_tales(rvd_fasta, sep = "-") tales_namespace(x) # NULL -- dom_code has not been minted yetrvd_fasta <- system.file("extdata", "TalA_RVDSeqs_AnnoTALE.fasta", package = "tantale") x <- as_tales(rvd_fasta, sep = "-") tales_namespace(x) # NULL -- dom_code has not been minted yet
Runs a TALE target (EBE) prediction tool over a set of TALE RVD sequences and a set of DNA sequences, and returns the predictions as a tibble.
tales_predict_targets(x, subj_file, method = c("talvez", "preditale"), ...)tales_predict_targets(x, subj_file, method = c("talvez", "preditale"), ...)
x |
TALE RVD sequences: a |
subj_file |
Path to a fasta file of subject DNA sequence(s). |
method |
Which backend to use, |
... |
Passed to the chosen backend. See |
talvez and preditale are independent programs, but the package
normalises their outputs to a shared set of column names, so they can serve
as interchangeable backends of one operation. This is that operation;
talvez and
preditale remain available and documented individually, and
are where each tool's own options and citation live.
A tibble of EBE predictions with the columns both backends share
(see talvez), then method, which tool produced
them, then the tool's own column (rank for Talvez, pval
for PrediTALE).
Other target prediction:
plot_target_preds(),
preditale(),
talvez()
# Needs the tantale conda environment (for talvez) and a Java runtime # (for preditale), both built on first use. x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) subj <- system.file("extdata", "cladeIII_sweet_promoters.fasta", package = "tantale") head(tales_predict_targets(x, subj_file = subj)) head(tales_predict_targets(x, subj_file = subj, method = "preditale"))# Needs the tantale conda environment (for talvez) and a Java runtime # (for preditale), both built on first use. x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) subj <- system.file("extdata", "cladeIII_sweet_promoters.fasta", package = "tantale") head(tales_predict_targets(x, subj_file = subj)) head(tales_predict_targets(x, subj_file = subj, method = "preditale"))
What each function needs of a tales object. This is distinct
from the class's own column contract, which says what makes an object
valid: a valid tales may still lack what a given operation needs.
tales_requirements()tales_requirements()
tales_compare_distal()aa_seq or dna_seq (translated)
tales_align()whichever of rvd / dom_code residue_col names
tales_rvd_strings()rvd
tales_coded_strings()dom_code
tales_domain_codes()dom_code and aa_seq; rvd included when present
plot() on a talesrvd, aa_seq, domain_type; seqnames adds a facet, alignment_position enables the aligned layout
A tibble of function, requirement kind, and columns.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
validate_tales()
tales_requirements()tales_requirements()
Renders each array as a separated string of its RVDs in part order — the form target-prediction tools consume.
tales_rvd_strings(x, sep = "-", repeats_only = TRUE)tales_rvd_strings(x, sep = "-", repeats_only = TRUE)
x |
A |
sep |
Separator between RVDs. Defaults to |
repeats_only |
Drop the terminus parts, whose |
A BStringSet, named by array_id.
Other tales projections:
tales_coded_strings(),
tales_domain_codes(),
tales_get_dna_seq(),
tales_get_protein_seq(),
tales_to_universalmotif()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) tales_rvd_strings(x)[1] tales_rvd_strings(x, repeats_only = FALSE)[1] # keeps NTERM/CTERM markersx <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) tales_rvd_strings(x)[1] tales_rvd_strings(x, repeats_only = FALSE)[1] # keeps NTERM/CTERM markers
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.
tales_tale_distances(x, domain_distances)tales_tale_distances(x, domain_distances)
x |
A tales object carrying |
domain_distances |
A domain_distances object for the same |
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.
A tale_distances object, keyed by array_id.
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.
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()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) dd <- tales_domain_distances(xa) tales_tale_distances(xa, dd)x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) xa <- tales_assign_domain_codes(x) dd <- tales_domain_distances(xa) tales_tale_distances(xa, dd)
One universalmotif position
weight matrix per array, built by looking up each repeat's RVD in
rvd_dna_specificity and stacking the rows in repeat order.
The conversion tales_compare_functal is built on, exposed on
its own so any universalmotif function (compare_motifs(),
motif_tree(), view_motifs(), scan_sequences(),
merge_motifs(), ...) can be run directly on these TALE binding
models.
tales_to_universalmotif(x)tales_to_universalmotif(x)
x |
A |
Only rvd, in repeat order, is used (via
tales_rvd_strings, which drops the two termini by default):
DNA-binding specificity is a property of the repeat region, and QueTAL's
FuncTAL, the tool this table comes from, scored repeats only. An RVD
absent from rvd_dna_specificity is given a flat,
uninformative row, so an unusual RVD lowers the specificity of the
comparison without causing an error.
A named list of universalmotif objects, one per array,
named by array_id: a plain list, which is what
compare_motifs()/motif_tree() accept.
tales_compare_functal(), the one comparison built on this;
tales_rvd_strings(), the sibling projection at the string layer.
Other tales projections:
tales_coded_strings(),
tales_domain_codes(),
tales_get_dna_seq(),
tales_get_protein_seq(),
tales_rvd_strings()
x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) motifs <- tales_to_universalmotif(x) motifs[[1]]x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) motifs <- tales_to_universalmotif(x) motifs[[1]]
Draws a talome overview: one column per TALE group, one row per strain, each cell showing which RVD sequence variant that strain carries in that group. A strain's talome is its whole complement of TALEs, so the plot shows at a glance which groups each strain has and where strains carry different variants of the same TALE.
Within a group, the cell colour gives each variant's rank by the number
of strains that carry it: the most common variant is the palest and
rarer ones are darker.
The # after each group label counts its distinct
variants. A white cell means the strain has no member in that group. A
cell can hold several colours side by side when a strain carries more
than one variant in the same group. Dendrograms order strains and groups
by the similarity of their variant profiles.
talomes_heatmap( tale_annotation, group_col = "group", strain_col, rvd_col, trunc_tales_col = NULL, extra_col = NULL, x_lab = "TALE Group", y_lab = "Strain", title = "RVD sequences variants", plot_type = "all", colors = .tantale_colours$variant_ranks, margins = NULL, sep_width = 5, sep_color = "white", inner_sep_color = "white", save_path = NULL )talomes_heatmap( tale_annotation, group_col = "group", strain_col, rvd_col, trunc_tales_col = NULL, extra_col = NULL, x_lab = "TALE Group", y_lab = "Strain", title = "RVD sequences variants", plot_type = "all", colors = .tantale_colours$variant_ranks, margins = NULL, sep_width = 5, sep_color = "white", inner_sep_color = "white", save_path = NULL )
tale_annotation |
A data frame with one row per TALE and at least a
group, a strain and an RVD-sequence column. Or a |
group_col |
Name of the |
strain_col |
Name of the column holding strain names, drawn as rows. |
rvd_col |
Name of the column holding RVD sequences (e.g. from
|
trunc_tales_col |
Optional name of a logical column marking
truncated TALEs; those are labelled "T" in their cell (with
|
extra_col |
Optional name of a column with further information about each strain (e.g. origin), drawn as a side bar on the right. |
x_lab, y_lab, title
|
Axis names and plot title. |
plot_type |
Either |
colors |
Colours from the most common variant to the rarest. They are interpolated over the ranks present, so the most common variant always gets the first colour and the rarest the last. The default runs from pale to dark wine, so a rare variant stands out. |
margins |
Space for the row dendrogram, column dendrogram, row
names and column names, in that order, counted in heatmap cells.
|
sep_width |
Width of the separator between adjacent cells. |
sep_color |
Colour of the separator between adjacent cells. |
inner_sep_color |
Colour of the separator between variants within one cell. |
save_path |
Optional file path; the image format follows the file
extension. If |
NULL, invisibly. Called for the side effect of drawing the
heatmap (or, if save_path is given, writing it to a file).
Other TALE plots:
plot.tales(),
plot.tales_msa(),
plot_target_preds()
ann <- data.frame( group = c("G1", "G1", "G1", "G2", "G2"), strain = c("S1", "S2", "S3", "S1", "S2"), rvdseq = c("NI-HD-NG", "NI-HD-NG", "NN-HD-NG", "HD-NI-NG-NG", "HD-NI-NG-NG") ) talomes_heatmap(ann, group_col = "group", strain_col = "strain", rvd_col = "rvdseq") # From a tales object: one group and one strain per array x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) x$group <- c(ROI_00001 = 1, ROI_00002 = 1, ROI_00003 = 2, ROI_00004 = 2)[x$array_id] x$strain <- c(ROI_00001 = "S1", ROI_00002 = "S2", ROI_00003 = "S1", ROI_00004 = "S2")[x$array_id] talomes_heatmap(x, strain_col = "strain")ann <- data.frame( group = c("G1", "G1", "G1", "G2", "G2"), strain = c("S1", "S2", "S3", "S1", "S2"), rvdseq = c("NI-HD-NG", "NI-HD-NG", "NN-HD-NG", "HD-NI-NG-NG", "HD-NI-NG-NG") ) talomes_heatmap(ann, group_col = "group", strain_col = "strain", rvd_col = "rvdseq") # From a tales object: one group and one strain per array x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) x$group <- c(ROI_00001 = 1, ROI_00002 = 1, ROI_00003 = 2, ROI_00004 = 2)[x$array_id] x$strain <- c(ROI_00001 = "S1", ROI_00002 = "S2", ROI_00003 = "S1", ROI_00004 = "S2")[x$array_id] talomes_heatmap(x, strain_col = "strain")
An R wrapper around the Talvez predictor Perl script. Takes a list of TALE RVD sequences and a fasta file of DNA sequences and runs Talvez.
talvez( rvd_seqs, subj_file, opt_param = "-t 0 -l 19", output_dir = NULL, talvez_dir = system.file("tools", "TALVEZ_3.2", package = "tantale", mustWork = T), conda_bin = "auto" )talvez( rvd_seqs, subj_file, opt_param = "-t 0 -l 19", output_dir = NULL, talvez_dir = system.file("tools", "TALVEZ_3.2", package = "tantale", mustWork = T), conda_bin = "auto" )
rvd_seqs |
Tale RVD sequences are supplied as either a fasta file (atomic character vector) with Tale info (name) in title and sequences of RVD as a space or '-' separated string or as a Biostrings XStringSet with sequences of RVD similarly formatted. |
subj_file |
Expects a character vector specifying the path to the fasta file holding subject DNA sequence(s). Talvez does not accept sequences wrapped at a fixed width. The function unwraps them with Biostrings, but this fails for subject sequences longer than 20 kb: unwrap such sequences beforehand. |
opt_param |
An atomic character vector specifying optional parameters for the Talvez script (eg "-t 0 -l 19"). These may not include the '-e' and '-z' options specifying the matrix files. |
output_dir |
Expects a character vector specifying the path to an output directory. If not supplied, output files will be temporary. |
talvez_dir |
If you want to use another version of Talvez than the one supplied with tantale, specify the path of the directory containing the necessary files here. |
conda_bin |
Path to your Conda binary file if you need to specify a path different from the one that is automatically searched by the reticulate package functions. |
This wrapper uses the RVD-nucleotide specificity matrices shipped with Talvez; custom matrices are not supported. The Talvez script runs in a conda environment providing its dependencies, created automatically on first use.
A tibble with one row per predicted EBE (effector binding
element), the columns renamed from the tool's own output so that
talvez and preditale return the same ones
in the same order: tale_id, rvds, subj_seq_id,
start, end, strand, ebe_seq and
score, followed by the tool's own column: rank, the
site's rank among the TALE's predictions by score.
Other target prediction:
plot_target_preds(),
preditale(),
tales_predict_targets()
# Needs the tantale conda environment, built on first use. x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) rvds <- tales_rvd_strings(x) subj <- system.file("extdata", "cladeIII_sweet_promoters.fasta", package = "tantale") preds <- talvez(rvd_seqs = rvds, subj_file = subj) head(preds)# Needs the tantale conda environment, built on first use. x <- tales_from_telltales(system.file("extdata", "tellTaleExampleOutput", package = "tantale")) rvds <- tales_rvd_strings(x) subj <- system.file("extdata", "cladeIII_sweet_promoters.fasta", package = "tantale") preds <- talvez(rvd_seqs = rvds, subj_file = subj) head(preds)
The articles and examples use four Xanthomonas oryzae pv. oryzae
genome assemblies. They are not part of the package
itself: tantale_setup() downloads them, with the Java tools, when called
with install = TRUE. This function returns where one of them is.
tantale_genome(strain = c("MAI1", "BAI3", "BAI3-1-1", "PXO86"))tantale_genome(strain = c("MAI1", "BAI3", "BAI3-1-1", "PXO86"))
strain |
Which genome. |
MAI1 (GenBank CP025609.1), BAI3 (CP025610.1) and PXO86 (RefSeq
NZ_CP007166.1) are complete genomes of African and Asian strains;
the sequences are those of the records, with shortened FASTA headers.
BAI3-1-1 is an unpublished assembly of a BAI3 derivative that carries
sequencing and assembly errors in its TALE loci. It was produced by the
authors of tantale, is available only from the package's genomes-1
release, and serves to illustrate frameshift correction.
The path of a FASTA file.
tantale_setup(), which downloads them.
# Needs the genomes downloaded by tantale_setup(install = TRUE). tantale_genome("MAI1")# Needs the genomes downloaded by tantale_setup(install = TRUE). tantale_genome("MAI1")
Reports whether the external programs tantale drives are present and at the
versions it expects, and can build or repair the conda environment that
provides most of them. It also downloads the Java programs tantale wraps
(AnnoTALE, PrediTALE, TALEcorrection) and the four example genomes of the
articles (tantale_genome()), which are too large to be part of the
package.
Called bare it changes nothing – it is a diagnostic. Pass
install = TRUE to act on what it finds.
tantale_setup( install = FALSE, conda = FALSE, conda_bin = "auto", archive_dir = NULL )tantale_setup( install = FALSE, conda = FALSE, conda_bin = "auto", archive_dir = NULL )
install |
Build the |
conda |
Install a conda distribution if none is found. |
conda_bin |
Passed to |
archive_dir |
A directory holding the archives
|
Why versions are checked as well as presence. MAFFT changed
its --text mode gap handling after 7.4x, and later versions align TALE
repeat-code strings differently, leaving the N- and C-termini unanchored.
An environment built by an older version of this package can therefore
produce different alignments from the same input, with nothing to indicate
it. The pins in tantale_conda_env.yaml exist for that reason, and this
function checks them.
Why three paths are reported. The conda binary, its default root, and
the environment actually in use are three different things, and on a
machine with any history they diverge – reticulate scans several known
locations, so two roots can each hold an environment named tantale. When
that happens, a rebuild can honestly report success while the package goes
on using the other one. Everything here therefore works with the
environment's prefix (its path), never its name.
Where the downloads go. The function checks two archives, attached
to releases of tantale's GitHub repository, against a sha256 recorded in
the package and unpacks them into tools::R_user_dir("tantale", "data")
(~/.local/share/R/tantale on Linux), in one folder per archive
version (tools-1/, genomes-1/). Set the environment variable
TANTALE_DATA_DIR to use another directory, for instance one shared by
a team. The tools take about 60 MB, the genomes 20 MB.
Java is checked too. It is a hard requirement of the AnnoTALE,
PrediTALE and TALE-correction wrappers, it comes from outside conda, and
without this check they fail deep inside a system() call.
Invisibly, a list with conda, system and archives data
frames of the checks, and prefix, so the result can be tested as well
as read.
conda is NULL and prefix is NA when no conda/mamba installation,
or no tantale environment, was found at all; system is always a
data frame, since Java is checked regardless.
conda = TRUE installs a conda distribution if none is found. It is
deliberately opt-in and separate from install: putting a package manager
on someone's machine is a larger side effect than building an environment
in one that already exists. It installs miniconda, via
reticulate::install_miniconda().
tell_tales(), tales_align(), tales_compare_distal(),
talvez() and correct_tales(), the entry points that need these
tools.
# A read-only diagnostic report; nothing is installed or changed. tantale_setup()# A read-only diagnostic report; nothing is installed or changed. tantale_setup()
tell_tales has been primarily written to report on 'corrected' TALE RVD
sequences in indels prone, noisy DNA sequences (suboptimally polished genomes
assembly, raw reads of long read sequencing technologies such as PacBio or ONT)
that may otherwise be missed by conventional tools (eg AnnoTALE).
tell_tales( subject_file, output_dir = tempfile("tell_tales_"), hmm_dir = system.file("extdata", "hmmProfile", package = "tantale", mustWork = T), nterm_min_score = 300, repeat_min_score = 20, cterm_min_score = 200, terminus_max_evalue = 1e-05, terminus_min_cover = 0.9, min_dna_hits = 4, min_array_length = 0, min_gap = 35, extremity_codes = TRUE, rvd_sep = "-", hmmer_path = NULL, extend_len = 300, correct_array = FALSE, correction_ref = system.file("extdata", "tale_correction_ref.fa.gz", package = "tantale", mustWork = T), max_comparisons = 50, frameshift = -11, ... )tell_tales( subject_file, output_dir = tempfile("tell_tales_"), hmm_dir = system.file("extdata", "hmmProfile", package = "tantale", mustWork = T), nterm_min_score = 300, repeat_min_score = 20, cterm_min_score = 200, terminus_max_evalue = 1e-05, terminus_min_cover = 0.9, min_dna_hits = 4, min_array_length = 0, min_gap = 35, extremity_codes = TRUE, rvd_sep = "-", hmmer_path = NULL, extend_len = 300, correct_array = FALSE, correction_ref = system.file("extdata", "tale_correction_ref.fa.gz", package = "tantale", mustWork = T), max_comparisons = 50, frameshift = -11, ... )
subject_file |
Fasta file with DNA sequence(s) to be searched for the presence of TALE coding sequences (CDS). |
output_dir |
Path of the output directory, created if it does not
exist. The default is a new directory under |
hmm_dir |
Folder holding the profile HMMs, if you do not want the
ones provided with tantale. It must hold files with the same names: the
three DNA profiles of the nhmmer search
( |
nterm_min_score |
Minimal nhmmer score cut_off value to consider the DNA hit as genuine |
repeat_min_score |
Minimal nhmmer score cut_off value to consider the DNA hit as genuine |
cterm_min_score |
Minimal nhmmer score cut_off value to consider the DNA hit as genuine |
terminus_max_evalue, terminus_min_cover
|
What it takes for the
segment AnnoTALE reports on either side of the repeats to be flagged as a
canonical TALE N- or C-terminus, |
min_dna_hits |
Minimum number of nhmmer hits for a subject
sequence (a contig, a chromosome) to be considered further. A cheap way
to discard whole sequences that carry nothing but stray matches, before
any expensive work is done on them. It says nothing about the length of
the TALE arrays found within a sequence that passes – see
|
min_array_length |
Minimum number of repeat units for a TALE
array to be kept. Defaults to Counting repeats rather than all hits means an array is not penalised for having had its termini missed, and matches what "array length" usually means for a TALE: the number of repeats is what determines how long a target box it recognises. Whether a short array is noise or a genuinely truncated TALE is a judgement about the biology, which is why nothing is discarded unless you ask. A pseudogene with three surviving repeats is real, and may be what you are looking for. |
min_gap |
Minimum gap in base pairs between two tale domain DNA hits for them to be considered distinct. If the length of the gap is below this value, domains are considered "contiguous" and grouped in the same array. |
extremity_codes |
Set this to |
rvd_sep |
Symbol acting as a separator in RVD sequences |
hmmer_path |
Specify the path to a directory holding the HMMER executable if you do not want to use the ones provided with tantale. |
extend_len |
number of nucleotides to extend in 3'-end at the tal ORF prediction stage. |
correct_array |
Whether to pass each array through
|
correction_ref |
Fasta of reference TALE proteins to correct
against. Two are shipped, both built by
Both keep the pseudogenes. Their frameshifts came from high-quality genomes and so are assumed real. A reference holding only intact TALEs would "repair" a genuine pseudogene into an ORF that no strain carries. |
max_comparisons |
How many reference proteins each array may be
aligned against during frameshift correction, and the main control on
how long correction takes. |
frameshift |
Frameshift penalty passed to
|
... |
Additional parameters for the
|
The approach is first to use HMMER to find and
categorize regions in the input DNA sequence that are related to the coding
sequence of canonical TALE protein domains (N-Term, repeats, C-term). It
then groups hits that are adjacent, or nearly so (see min_gap), into
"taleArrays", each a potential tal gene.
With correct_array = FALSE, tell_tales() gives
AnnoTALE the longest open
reading frame of each taleArray (extended by extend_len) to detect TALE
domains in the predicted translation product. The Results should hence be
very similar to what would be obtained with AnnoTALE, plus many additional
informative output files such as tabular reports.
With correct_array = TRUE,
CorrectFrameshifts first tries
to 'correct' potential frameshifts in the taleArray sequences. This
conveniently removes many artefactual indels but bear in mind that this may
also erroneously 'correct' genuine frame shifts which can be highly
relevant especially for truncTALEs or iTALEs. The resulting 'corrected'
taleArray open reading frames are then passed to AnnoTALE.
Note that occasionally, when a putative open reading frame does not encode a canonical TALE protein (early frame shift, incomplete ORF, etc...), the "analyze" module of AnnoTALE outputs DNA parts but no protein parts and/or RVD sequence. This should be detected and reported in the tell_tales log.
Each sequence of subject_file is treated as linear. A tal
gene that spans the junction of a circular molecule (the two ends of an
assembled chromosome or plasmid) is cut in two, and is reported, if at
all, as two partial arrays at the ends of the sequence. Rotating the
sequence so that it starts elsewhere avoids this.
Called for its side effects (writing files). If everything runs smoothly, it invisibly returns the path of the directory where output files were written.
List of output files:
all_ranges.gff: gff file of all Tal arrays detected by HMMer
array_report.tsv: one row per candidate TALE array. Columns
named *_dna_* describe the nhmmer search of the subject DNA;
columns named *_aa_* describe the protein segments AnnoTALE
extracted from the array's longest ORF.
array_id, seqnames, start, end, strand: the array's identifier and the span of its nhmmer hits on the subject sequence.
n_dna_hits: number of nhmmer hits (N-terminus, repeats and C-terminus profiles together) grouped in the array. A terminus hit usually overlaps the adjacent repeat hit by a few nucleotides, at the boundary between the two domains.
array_seq: DNA sequence of that span.
nterm_dna_hit, cterm_dna_hit: whether an nhmmer hit
of the N- (C-) terminus DNA profile is part of the array.
Only hits scoring at least nterm_min_score
(cterm_min_score) count.
rvd_string: the RVDs AnnoTALE read, separated by
rvd_sep, with the terminus codes described under
rvd_sequences.fas. Empty when AnnoTALE found no RVD.
has_aberrant_repeat: whether AnnoTALE flagged a repeat of non-canonical length (a lowercase letter in its RVD).
nterm_dna_score, cterm_dna_score,
nterm_dna_evalue, cterm_dna_evalue: bit score and
E-value of the best nhmmer hit of the N- (C-) terminus DNA profile
next to the array's repeats, whatever its score: on the same strand,
upstream of the first repeat (downstream of the last one), within
twice the profile length. NA when there is none.
nterm_dna_cover, cterm_dna_cover: fraction of
the DNA profile's positions those hits cover together; 0 when
there is none.
nterm_dna_pieces, cterm_dna_pieces: how many such hits. More than one usually means the terminus is split, often by an insertion or a deletion.
nterm_aa_evalue, cterm_aa_evalue,
nterm_aa_score, cterm_aa_score: E-value and bit score
of the hmmsearch match between the segment AnnoTALE reported
upstream (downstream) of the repeats and the TALE N- (C-) terminal
protein profile. NA when there is no segment, or no match with
an E-value up to 10.
nterm_aa_profile_gap, cterm_aa_profile_gap:
number of profile positions between the end of that match and the end
of the profile that adjoins the repeats (the last position of the
N-terminal profile, the first of the C-terminal one). 0 for a
match that reaches the repeats, NA when there is no match.
nterm_aa_far_gap, cterm_aa_far_gap: the same at the other end of the profile, the start of the N-terminal one (the end of the C-terminal one). A terminus that stops early, like the C-terminus of a truncTALE, leaves a large gap here.
nterm_aa_cover, cterm_aa_cover: fraction of the protein profile's positions the match covers. Below 1 minus the two gaps when part of the terminus is missing in between.
nterm_aa_domains, cterm_aa_domains: how many separate stretches of the profile the match consists of. More than one means the terminus is split, by a deletion or a change of reading frame.
nterm_aa_hit, cterm_aa_hit: TRUE for a
canonical terminus: E-value at most terminus_max_evalue,
cover at least terminus_min_cover, profile gap at most 10.
FALSE for any other segment, NA when AnnoTALE
reported no segment on that side.
nterm_aa_length, cterm_aa_length: length of those
segments in amino acid residues, excluding a stop codon, as in the
tales object's aa_seq.
longest_orf_length, longest_orf_seq: the longest
ORF found in the array region extended by extend_len
nucleotides at its 3' end.
orf_coverage: that ORF's length as a percentage of the extended region's length.
predicted_dels_count, predicted_ins_count (with
correct_array = TRUE): number of putative deletions/insertions
in the raw sequence that
CorrectFrameshifts
corrected.
hits_report.tsv: report of all hits detected by HMMer, with their bit score, evalue and the profile positions they cover, hmm_from to hmm_to (for hits merged into one, the best score and E-value and the span they cover together)
hits_report.gff: gff file of all hits detected by HMMer
domains_report.tsv: report of all Tal amino acid domains detected by AnnoTALE analyze
putative_tal_orf.fasta: for each array in which AnnoTALE found
RVDs, the DNA of the longest ORF of the array region extended by
extend_len nucleotides at its 3' end (after frameshift
correction with correct_array = TRUE). This is the putative
TALE coding sequence AnnoTALE analysed.
pseudo_tal_cds.fasta: for each array in which AnnoTALE found no
RVD, the DNA of the array region extended by extend_len
nucleotides at its 3' end, as found in subject_file: candidate
pseudogenes, assembly errors or false detections, kept for inspection.
rvd_sequences.fas: the RVDs (separated by rvd_sep) of each
array for which AnnoTALE found at least one. With extremity_codes
= TRUE (the default), each string is bracketed by terminus codes (see
tales_anchor_codes): NTERM (CTERM) when the
segment AnnoTALE reported upstream (downstream) of the repeats matches
the TALE N- (C-) terminal protein profile, XXXXX when it does
not, and no code when AnnoTALE reported no segment on that side.
c_terminus_aa_alignment.html: protein alignment of all C-termini (only written when at least 2 were found; skipped with a warning otherwise)
c_terminus_dna_alignment.html: DNA alignment of all C-termini (same condition)
n_terminus_aa_alignment.html: protein alignment of all N-termini (same condition)
n_terminus_dna_alignment.html: DNA alignment of all N-termini (same condition)
tale_cds_all_diagnostic_regions_hmmfile.out: HMMER profile used for tale cds search.
hmmer_search_out.txt: ignore
nhmmer_human_readable_output_of_last_run.txt: primary HMMER output file.
tell_tales.log: a log file
annotale folder: folder containing result of AnnoTALE analyze for all Tal arrays
correction_alignment_aa folder: folder containing protein alignment of Tal array detected by HMMer and corrected Tal array if correct_array = TRUE
correction_alignment_dna folder: folder containing DNA alignment of Tal array detected by HMMer and corrected Tal array if correct_array = TRUE
Other TALE discovery:
correct_tales(),
tale_annotations,
tales_from_annotale(),
tales_from_telltales()
# Needs nhmmer and AnnoTALE, resolved from the tantale conda environment # (and a Java runtime) on first use. subj <- system.file("extdata", "bai3_sample_tal_genomic_regions.fasta", package = "tantale") out <- tempfile("tell_tales_example") tell_tales(subject_file = subj, output_dir = out) tales_from_telltales(out)# Needs nhmmer and AnnoTALE, resolved from the tantale conda environment # (and a Java runtime) on first use. subj <- system.file("extdata", "bai3_sample_tal_genomic_regions.fasta", package = "tantale") out <- tempfile("tell_tales_example") tell_tales(subject_file = subj, output_dir = out) tales_from_telltales(out)
Checks the column contract, and nothing else. Squareness, the diagonal and
symmetry are preconditions of the methods that need them, checked by
distances_assert_square: a table filtered on one id column is
a legitimate intermediate step.
validate_pairwise_distances(x)validate_pairwise_distances(x)
x |
A |
x, invisibly, if valid; otherwise an error.
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(),
tales_tale_distances()
d <- data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) ) validate_pairwise_distances(pairwise_distances(d)) # Without its dissim column, a table is not a pairwise_distances try(validate_pairwise_distances(d[, c("id1", "id2")]))d <- data.frame( id1 = c("A1", "A1", "A2", "A2"), id2 = c("A1", "A2", "A1", "A2"), dissim = c(0, 35, 35, 0) ) validate_pairwise_distances(pairwise_distances(d)) # Without its dissim column, a table is not a pairwise_distances try(validate_pairwise_distances(d[, c("id1", "id2")]))
Checks the column contract and every invariant that still holds on any
subset of rows. Properties that hold only of a complete object (an array
carrying all its parts, numbered contiguously from 1) are checked by the
functions that need them, such as alignment; see
tales_assert_complete.
validate_tales(x)validate_tales(x)
x |
A |
x, invisibly, if valid; otherwise an error.
Other tales objects:
[.tales(),
as_tales(),
format.tales(),
format.tales_msa(),
is_tales(),
new_tales(),
print.tales(),
print.tales_msa(),
summary.tales(),
summary.tales_msa(),
tales(),
tales_anchor_codes(),
tales_anomalies(),
tales_assert_complete(),
tales_bind(),
tales_names(),
tales_namespace(),
tales_requirements()
parts <- data.frame( array_id = c("A1", "A1"), position_in_array = c(1L, 2L), rvd = c("NTERM", "HD") ) validate_tales(tales(parts))parts <- data.frame( array_id = c("A1", "A1"), position_in_array = c(1L, 2L), rvd = c("NTERM", "HD") ) validate_tales(tales(parts))
Checks every validate_tales invariant, then those specific to
an alignment. As for tales, only properties that still hold on any
subset of rows are checked here; grid completeness is a precondition of
the functions that need it.
validate_tales_msa(x)validate_tales_msa(x)
x |
A |
x, invisibly, if valid; otherwise an error.
Other TALE alignment:
as.matrix.tales_msa(),
is_tales_msa(),
tales_align(),
tales_consensus(),
tales_consensus_match(),
tales_msa(),
tales_msa_params(),
tales_msa_width()
aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) validate_tales_msa(tales_msa(aligned)) # Two parts of A1 placed in the same alignment column aligned$alignment_position[2] <- 1L try(tales_msa(aligned))aligned <- data.frame( array_id = c("A1", "A1", "A1", "A2", "A2"), position_in_array = c(1L, 2L, 3L, 1L, 2L), alignment_position = c(1L, 2L, 3L, 1L, 3L), rvd = c("NTERM", "HD", "CTERM", "NTERM", "CTERM") ) validate_tales_msa(tales_msa(aligned)) # Two parts of A1 placed in the same alignment column aligned$alignment_position[2] <- 1L try(tales_msa(aligned))