Returns number of elements in each sequence in given sq object.

get_sq_lengths(x)

Arguments

x

[sq]
An object this function is applied to.

Value

A numeric vector, where each element gives length of corresponding sequence from sq object.

Details

Due to storage implementation, using lengths method returns length of stored raw vectors instead of real sequence lengths. This function accesses original_length attribute of each sequence, which attribute stores information about how many elements are there in given sequence.

See also

Functions from utility module: ==.sq(), is.sq(), sqconcatenate, sqextract

Examples

# Creating objects to work on:
sq_ami <- sq(c("MIAANYTWIL","TIAALGNIIYRAIE", "NYERTGHLI", "MAYXXXIALN"),
             alphabet = "ami_ext")
sq_dna <- sq(c("ATGCAGGA", "GACCGAACGAN", "TGACGAGCTTA", "ACTNNAGCN"),
             alphabet = "dna_ext")

# Counting number of elements in sq object:
get_sq_lengths(sq_dna)
#> [1]  8 11 11  9
get_sq_lengths(sq_ami)
#> [1] 10 14  9 10