get_sq_lengths: Get lengths of sequences in sq object

View source: R/util-methods.R

get_sq_lengthsR Documentation

Get lengths of sequences in sq object

Description

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

Usage

get_sq_lengths(x)

Arguments

x

[sq]
An object this function is applied to.

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.

Value

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

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)
get_sq_lengths(sq_ami)


michbur/tidysq documentation built on April 1, 2022, 5:18 p.m.