sqprint {tidysq} | R Documentation |
Print sq object
Description
Prints input sq
object in a
human-friendly form.
Arguments
x |
[ |
max_sequences |
[ |
use_color |
[ |
letters_sep |
[ |
NA_letter |
[ |
... |
further arguments to be passed from or to other methods. |
Details
print
method is often called implicitly by calling variable name.
Only explicit calling of this method allows its parameters to be changed.
Printed information consists of three parts:
First line is always a header that contains info about the type of sequences contained.
The next part is the content. Each sequence has its own line, but not all sequences are printed. The number of printed sequences is limited by parameter
max_sequences
, defaulting to 10. These sequences are printed with:left-aligned index of sequence in square brackets (e.g.
[3]
),left-aligned sequence data (more about it in paragraph below),
right-aligned sequence length in angle brackets (e.g.
<27>
).
Finally, if number of sequences is greater than
max_sequences
, then a footer is displayed with how many sequences are there and how many were printed.
Each sequence data is printed as letters. If sequence is too long to fit in
one line, then only a subsequence is displayed - a subsequence that begins
from the first letter. Sequence printing is controlled by letters_sep
and NA_letter
parameters. The first one specifies a string that should
be inserted between any two letters. By default it's empty when all letters
are one character in length; and a space otherwise. NA_letter
dictates
how NA
values are displayed, by default it's an exclamation mark
("!
").
Most consoles support color printing, but when any of these do not, then the
user might use use_color
parameter set to FALSE
- or better
yet, change related option value, where said option is called
"tidysq_print_use_color"
.
Value
An object that was passed as the first argument to the function.
It is returned invisibly (equivalent of invisible(x)
)
See Also
Functions that display sequence info:
get_tidysq_options()
Examples
# Creating objects to work on:
sq_ami <- sq(c("MIAANYTWIL","TIAALGNIIYRAIE", "NYERTGHLI", "MAYXXXIALN"),
alphabet = "ami_ext")
sq_dna <- sq(c("ATGCAGGA", "GACCGNBAACGAN", "TGACGAGCTTA"),
alphabet = "dna_bsc")
sq_unt <- sq(c("ATGCAGGA?", "TGACGAGCTTA", "", "TIAALGNIIYRAIE"))
# Printing without explicit function calling with default parameters:
sq_ami
sq_dna
sq_unt
# Printing with explicit function calling and specific parameters:
print(sq_ami)
print(sq_dna, max_sequences = 1, use_color = FALSE)
print(sq_unt, letters_sep = ":")