Skip to contents

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.

Usage

# S3 method for class 'tales'
format(x, n = 2L, ...)

Arguments

x

A tales object.

n

Number of arrays to show at each end. Everything is shown when the object holds 2 * n arrays or fewer.

...

Unused, present for compatibility with the format generic.

Value

A character vector, one element per line.

Examples

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)
#> [1] "\033[34m<tales>\033[39m 2 arrays, 6 parts"
#> [2] "  layers: rvd   |   1 other column"       
#> [3] "      rvd"                                
#> [4] "  A1  NTERM HD CTERM"                     
#> [5] "  A2  NTERM NI CTERM"