ligerDataset-class {rliger} | R Documentation |
ligerDataset class
Description
Object for storing dastaset specific information. Will be embedded within a higher level liger object
Usage
rawData(x, dataset = NULL)
rawData(x, dataset = NULL, check = TRUE) <- value
normData(x, dataset = NULL)
normData(x, dataset = NULL, check = TRUE) <- value
scaleData(x, dataset = NULL)
scaleData(x, dataset = NULL, check = TRUE) <- value
scaleUnsharedData(x, dataset = NULL)
scaleUnsharedData(x, dataset = NULL, check = TRUE) <- value
getMatrix(x, slot = "rawData", dataset = NULL, returnList = FALSE)
h5fileInfo(x, info = NULL)
h5fileInfo(x, info = NULL, check = TRUE) <- value
getH5File(x, dataset = NULL)
## S4 method for signature 'ligerDataset,missing'
getH5File(x, dataset = NULL)
featureMeta(x, check = NULL)
featureMeta(x, check = TRUE) <- value
## S4 method for signature 'ligerDataset'
show(object)
## S4 method for signature 'ligerDataset'
dim(x)
## S4 method for signature 'ligerDataset'
dimnames(x)
## S4 replacement method for signature 'ligerDataset,list'
dimnames(x) <- value
## S4 method for signature 'ligerDataset'
rawData(x, dataset = NULL)
## S4 replacement method for signature 'ligerDataset,ANY,ANY,matrixLike_OR_NULL'
rawData(x, dataset = NULL, check = TRUE) <- value
## S4 replacement method for signature 'ligerDataset,ANY,ANY,H5D'
rawData(x, dataset = NULL, check = TRUE) <- value
## S4 method for signature 'ligerDataset'
normData(x, dataset = NULL)
## S4 replacement method for signature 'ligerDataset,ANY,ANY,matrixLike_OR_NULL'
normData(x, dataset = NULL, check = TRUE) <- value
## S4 replacement method for signature 'ligerDataset,ANY,ANY,H5D'
normData(x, dataset = NULL, check = TRUE) <- value
## S4 method for signature 'ligerDataset,missing'
scaleData(x, dataset = NULL)
## S4 replacement method for signature 'ligerDataset,ANY,ANY,matrixLike_OR_NULL'
scaleData(x, dataset = NULL, check = TRUE) <- value
## S4 replacement method for signature 'ligerDataset,ANY,ANY,H5D'
scaleData(x, dataset = NULL, check = TRUE) <- value
## S4 replacement method for signature 'ligerDataset,ANY,ANY,H5Group'
scaleData(x, dataset = NULL, check = TRUE) <- value
## S4 method for signature 'ligerDataset,missing'
scaleUnsharedData(x, dataset = NULL)
## S4 replacement method for signature 'ligerDataset,missing,ANY,matrixLike_OR_NULL'
scaleUnsharedData(x, check = TRUE) <- value
## S4 replacement method for signature 'ligerDataset,missing,ANY,H5D'
scaleUnsharedData(x, check = TRUE) <- value
## S4 replacement method for signature 'ligerDataset,missing,ANY,H5Group'
scaleUnsharedData(x, check = TRUE) <- value
## S4 method for signature 'ligerDataset,ANY,missing,missing'
getMatrix(
x,
slot = c("rawData", "normData", "scaleData", "scaleUnsharedData", "H", "V", "U", "A",
"B"),
dataset = NULL
)
## S4 method for signature 'ligerDataset'
h5fileInfo(x, info = NULL)
## S4 replacement method for signature 'ligerDataset'
h5fileInfo(x, info = NULL, check = TRUE) <- value
## S4 method for signature 'ligerDataset'
featureMeta(x, check = NULL)
## S4 replacement method for signature 'ligerDataset'
featureMeta(x, check = TRUE) <- value
## S3 method for class 'ligerDataset'
cbind(x, ..., deparse.level = 1)
Arguments
x , object |
A |
dataset |
Not applicable for |
check |
Whether to perform object validity check on setting new value. |
value |
See detail sections for requirements |
slot |
The slot name when using |
returnList |
Not applicable for |
info |
Name of the entry in |
... |
See detailed sections for explanation. |
deparse.level |
Not used here. |
Slots
rawData
Raw data.
normData
Normalized data
scaleData
Scaled data, usually with subset variable features
scaleUnsharedData
Scaled data of features not shared with other datasets
varUnsharedFeatures
Variable features not shared with other datasets
V
matrix
A
matrix
B
matrix
H
matrix
U
matrix
h5fileInfo
list
featureMeta
Feature metadata, DataFrame
colnames
character
rownames
character
Matrix access
For ligerDataset
object, rawData()
, normData
,
scaleData()
and scaleUnsharedData()
methods are exported for
users to access the corresponding feature expression matrix. Replacement
methods are also available to modify the slots.
For other matrices, such as the H
and V
, which are dataset
specific, please use getMatrix()
method with specifying slot name.
Directly accessing slot with @
is generally not recommended.
H5 file and information access
A ligerDataset
object has a slot called h5fileInfo
, which is a
list object. The first element is called $H5File
, which is an
H5File
class object and is the connection to the input file. The
second element is $filename
which stores the absolute path of the H5
file in the current machine. The third element $formatType
stores the
name of preset being used, if applicable. The other following keys pair with
paths in the H5 file that point to specific data for constructing a feature
expression matrix.
h5fileInfo()
method access the list described above and simply
retrieves the corresponding value. When info = NULL
, returns the whole
list. When length(info) == 1
, returns the requested list value. When
more info requested, returns a subset list.
The replacement method modifies the list elements and corresponding slot
value (if applicable) at the same time. For example, running
h5fileInfo(obj, "rawData") <- newPath
not only updates the list, but
also updates the rawData
slot with the H5D
class data at
"newPath" in the H5File
object.
getH5File()
is a wrapper and is equivalent to
h5fileInfo(obj, "H5File")
.
Feature metadata access
A slot featureMeta
is included for each ligerDataset
object.
This slot requires a DataFrame-class
object, which
is the same as cellMeta
slot of a liger object. However,
the associated S4 methods only include access to the whole table for now.
Internal information access follows the same way as data.frame operation.
For example, featureMeta(ligerD)$nCell
or
featureMeta(ligerD)[varFeatures(ligerObj), "gene_var"]
.
Dimensionality
For a ligerDataset
object, the column orientation is assigned for
cells and rows are for features. Therefore, for ligerDataset
objects,
dim()
returns a numeric vector of two numbers which are number of
features and number of cells. dimnames()
returns a list of two
character vectors, which are the feature names and the cell barcodes.
For direct call of dimnames<-
method, value
should be a list
with a character vector of feature names as the first element and cell
identifiers as the second element. For colnames<-
method, the
character vector of cell identifiers. For rownames<-
method, the
character vector of feature names.
Subsetting
For more detail of subsetting a liger
object or a
ligerDataset object, please check out subsetLiger
and subsetLigerDataset
. Here, we set the S3 method
"single-bracket" [
as a quick wrapper to subset a ligerDataset
object. i
and j
serves as feature and cell subscriptor,
respectively, which can be any valid index refering the available features
and cells in a dataset. ...
arugments are passed to
subsetLigerDataset
so that advanced options are allowed.
Concatenate ligerDataset
cbind()
method is implemented for concatenating ligerDataset
objects by cells. When applying, all feature expression matrix will be merged
with taking a union of all features for the rows.
Examples
ctrl <- dataset(pbmc, "ctrl")
# Methods for base generics
ctrl
print(ctrl)
dim(ctrl)
ncol(ctrl)
nrow(ctrl)
colnames(ctrl)[1:5]
rownames(ctrl)[1:5]
ctrl[1:5, 1:5]
# rliger generics
## raw data
m <- rawData(ctrl)
class(m)
dim(m)
## normalized data
pbmc <- normalize(pbmc)
ctrl <- dataset(pbmc, "ctrl")
m <- normData(ctrl)
class(m)
dim(m)
## scaled data
pbmc <- selectGenes(pbmc)
pbmc <- scaleNotCenter(pbmc)
ctrl <- dataset(pbmc, "ctrl")
m <- scaleData(ctrl)
class(m)
dim(m)
n <- scaleData(pbmc, "ctrl")
identical(m, n)
## Any other matrices
if (requireNamespace("RcppPlanc", quietly = TRUE)) {
pbmc <- runOnlineINMF(pbmc, k = 20, minibatchSize = 100)
ctrl <- dataset(pbmc, "ctrl")
V <- getMatrix(ctrl, "V")
V[1:5, 1:5]
Vs <- getMatrix(pbmc, "V")
length(Vs)
names(Vs)
identical(Vs$ctrl, V)
}