XStringSetList-class {Biostrings}R Documentation

XStringSetList objects

Description

The XStringSetList class is a virtual container for storing a list of XStringSet objects.

Usage

## Constructors:
DNAStringSetList(..., use.names=TRUE)

Arguments

...

Character vector(s) (with no NAs), or XStringSet object(s), or XStringViews object(s) to be concatenated into a XStringSetList.

use.names

TRUE or FALSE. Should names be preserved?

Details

Concrete flavors of the XStringSetList container are the BStringSetList, DNAStringSetList, RNAStringSetList and AAStringSetList containers for storing a list of BStringSet, DNAStringSet, RNAStringSet and AAStringSet objects, respectively. These four containers are direct subclasses of XStringSetList with no additional slots.

Currently DNAStringSetList() is the only XStringSetList constructor. The XStringSetList class itself is virtual and has no constructor.

Accessor-like methods

In the code snippets below, x is an XStringSetList object.

length(x): The number of list elements in x.

PartitioningByEnd(x): A PartitioningByEnd object describing the grouping of the inner elements in x within each top-level list element.

elementLengths(x): An integer vector of the length of each list element of x.

names(x): NULL or a character vector of the same length as x containing a short user-provided description or comment for each element in x. These are the only data in an XStringSetList object that can safely be changed by the user. All the other data are immutable! As a general recommendation, the user should never try to modify an object by accessing its slots directly.

Subsetting and appending

In the code snippets below, x and values are XStringSet objects, and i should be an index specifying the elements to extract.

x[[i]]: Extract the i-th XStringSet object from x.

append(x, values, after=length(x)): Add sequences in values to x.

Author(s)

H. Pages

See Also

XStringSet-class, Grouping-class, Vector-class

Examples

## ------------------------------------------------------------------------
## A. THE XStringSetList CONSTRUCTORS
## ------------------------------------------------------------------------
## Currently DNAStringSetList() is the only constructor. Others will 
## be developed when the use case arises.

dna1 <- DNAStringSet(c("AAA", "AC", "", "T", "GGATA"))
dna2 <- DNAStringSet(c("G", "TT", "C"))
x <- DNAStringSetList(dna1, dna2)
x

y <- DNAStringSetList(c("AAA", "AC", "", "T", "GGATA"), c("G", "TT", "C"))
stopifnot(identical(x, y))

## ---------------------------------------------------------------------
## B. UNLISTING AN XStringSetList OBJECT
## ---------------------------------------------------------------------
length(x)
elementLengths(x)
unlist(x)
x[[1]]
x[[2]]
as.list(x)

names(x) <- LETTERS[1:length(x)]
x[["A"]]
x[["B"]]
as.list(x)  # named list

## ---------------------------------------------------------------------
## B. USING THE GROUPING CORE API ON 'PartitioningByEnd(x)'
## ---------------------------------------------------------------------
PartitioningByEnd(x)
length(PartitioningByEnd(x))
nobj(PartitioningByEnd(x))
grouplength(PartitioningByEnd(x))  # same as 'unname(sapply(x, length))'

## ---------------------------------------------------------------------
## C. USING THE RANGES CORE API ON 'PartitioningByEnd(x)'
## ---------------------------------------------------------------------
start(PartitioningByEnd(x))
end(PartitioningByEnd(x))
width(PartitioningByEnd(x))  # same as 'grouplength(PartitioningByEnd(x))'

[Package Biostrings version 2.28.0 Index]