| AtomicList {IRanges} | R Documentation |
An extension of List that holds
only atomic vectors in either a natural or run-length encoded form.
The lists of atomic vectors are LogicalList, IntegerList,
NumericList, ComplexList, CharacterList, and
RawList. There is also an RleList class for
run-length encoded versions of these atomic vector types.
Each of the above mentioned classes is virtual with Compressed* and Simple* non-virtual representations.
LogicalList(..., compress = TRUE): Concatenates the
logical vectors in ... into a new LogicalList.
If compress, the internal storage of the data is compressed.
IntegerList(..., compress = TRUE): Concatenates the
integer vectors in ... into a new IntegerList.
If compress, the internal storage of the data is compressed.
NumericList(..., compress = TRUE): Concatenates the
numeric vectors in ... into a new NumericList.
If compress, the internal storage of the data is compressed.
ComplexList(..., compress = TRUE): Concatenates the
complex vectors in ... into a new ComplexList.
If compress, the internal storage of the data is compressed.
CharacterList(..., compress = TRUE): Concatenates the
character vectors in ... into a new CharacterList.
If compress, the internal storage of the data is compressed.
RawList(..., compress = TRUE): Concatenates the
raw vectors in ... into a new RawList.
If compress, the internal storage of the data is compressed.
RleList(..., compress = FALSE): Concatenates the
run-length encoded atomic vectors in ... into a new
RleList.
If compress, the internal storage of the data is compressed.
as(from, "CompressedSplitDataFrameList"),
as(from, "SimpleSplitDataFrameList"): Creates a
CompressedSplitDataFrameList/SimpleSplitDataFrameList
instance from an AtomicList instance.
as(from, "IRangesList"), as(from, "CompressedIRangesList"),
as(from, "SimpleIRangesList"): Creates a
CompressedIRangesList/SimpleIRangesList
instance from a LogicalList or logical RleList instance. Note that the
elements of this instance are guaranteed to be normal.
as(from, "NormalIRangesList"),
as(from, "CompressedNormalIRangesList"),
as(from, "SimpleNormalIRangesList"): Creates a
CompressedNormalIRangesList/SimpleNormalIRangesList
instance from a LogicalList or logical RleList instance.
as(from, "AtomicList"): If from is a vector,
converts it to an AtomicList of the appropriate type.
AtomicList objects have support for S4 group generic functionality to operate within elements across objects:
Arith"+", "-", "*", "^",
"%%", "%/%", "/"
Compare"==", ">", "<", "!=",
"<=", ">="
Logic"&", "|"
Ops"Arith", "Compare", "Logic"
Math"abs", "sign", "sqrt",
"ceiling", "floor", "trunc", "cummax",
"cummin", "cumprod", "cumsum", "log",
"log10", "log2", "log1p", "acos",
"acosh", "asin", "asinh", "atan",
"atanh", "exp", "expm1", "cos",
"cosh", "sin", "sinh", "tan", "tanh",
"gamma", "lgamma", "digamma", "trigamma"
Note the behavior of the 'cum' methods has changed in IRanges >= 1.11.19. Previously cumsum, cumprod, cummax and cummin did not operate within elements across objects as stated above. A warning is now issued to alert users of the changed behavior; this is temporary and will be removed in BioC 2.10. To avoid the warning wrap the call to the 'cum' methods in suppressWarnings().
Math2"round", "signif"
Summary"max", "min", "range",
"prod", "sum", "any", "all"
Complex"Arg", "Conj", "Im",
"Mod", "Re"
See S4groupGeneric for more details.
The AtomicList objects also support a large number of basic methods. Like the group generics above, these methods perform the corresponding operation on each element of the list separately. The methods are:
%in%, is.na, match, sort,
table, unique
!, which, which.max, which.min
diff,
pmax, pmax.int, pmin, pmin.int,
mean, var, cov, cor, sd,
median, quantile, mad, IQR
smoothEnds, runmed. runmean,
runsum, runwtsum, runq
nchar, chartr, tolower,
toupper, sub, gsub
RleList has a number of methods that are not shared by other AtomicList derivatives.
runLength(x): Gets the run lengths of each element of the
list, as an IntegerList.
runValue(x): Gets the run values of each element of the
list, as an AtomicList.
P. Aboyoun
List for the applicable methods.
int1 <- c(1L,2L,3L,5L,2L,8L)
int2 <- c(15L,45L,20L,1L,15L,100L,80L,5L)
collection <- IntegerList(int1, int2)
## names
names(collection) <- c("one", "two")
names(collection)
names(collection) <- NULL # clear names
names(collection)
names(collection) <- "one"
names(collection) # c("one", NA)
## extraction
collection[[1]] # range1
collection[["1"]] # NULL, does not exist
collection[["one"]] # range1
collection[[NA_integer_]] # NULL
## subsetting
collection[numeric()] # empty
collection[NULL] # empty
collection[] # identity
collection[c(TRUE, FALSE)] # first element
collection[2] # second element
collection[c(2,1)] # reversed
collection[-1] # drop first
collection$one
## replacement
collection$one <- int2
collection[[2]] <- int1
## combining
col1 <- IntegerList(one = int1, int2)
col2 <- IntegerList(two = int2, one = int1)
col3 <- IntegerList(int2)
append(col1, col2)
append(col1, col2, 0)
c(col1, col2, col3)
## group generics
2 * col1
col1 + col1
col1 > 2
log(col1)
sum(col1)
## get the mean for each element
sapply(col1, mean)