collapse {tidysq} | R Documentation |
Collapse multiple sequences into one
Description
Joins sequences from a vector into a single sequence. Sequence type remains unchanged.
Usage
collapse(x, ...)
## S3 method for class 'sq'
collapse(x, ..., NA_letter = getOption("tidysq_NA_letter"))
Arguments
x |
[ |
... |
further arguments to be passed from or to other methods. |
NA_letter |
[ |
Details
collapse()
joins sequences from supplied sq
object in the same
order as they appear in said vector. That is, if there are three sequences
AGGCT, ATCCGT and GAACGT, then resulting sequence will be AGGCTATCCGTGAACGT.
This operation does not alter the type of the input object nor its alphabet.
Value
sq
object of the same type as input but with
exactly one sequence.
See Also
Functions that affect order of elements:
bite()
,
paste()
,
reverse()
Examples
# Creating objects to work on:
sq_ami <- sq(c("MIAANYTWIL","TIAALGNIIYRAIE", "NYERTGHLI", "MAYXXXIALN"),
alphabet = "ami_ext")
sq_dna <- sq(c("ATGCAGGA", "GACCGAACGAN", ""), alphabet = "dna_ext")
sq_unt <- sq(c("ATGCAGGA?", "TGACGAGCTTA", "", "TIAALGNIIYRAIE"))
# Collapsing sequences:
collapse(sq_ami)
collapse(sq_dna)
collapse(sq_unt)
# Empty sq objects are collapsed as well (into empty string - ""):
sq_empty <- sq(character(), alphabet = "rna_bsc")
collapse(sq_empty)
[Package tidysq version 1.1.3 Index]