collapse | R Documentation |
Joins sequences from a vector into a single sequence. Sequence type remains unchanged.
collapse(x, ...)
## S3 method for class 'sq'
collapse(x, ..., NA_letter = getOption("tidysq_NA_letter"))
x |
[ |
... |
further arguments to be passed from or to other methods. |
NA_letter |
[ |
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.
sq
object of the same type as input but with
exactly one sequence.
Functions that affect order of elements:
bite()
,
paste()
,
reverse()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.