This function subsets a ligerDataset object with valid feature and cell indices. For HDF5 based object, options are available for subsetting data into memory or a new on-disk H5 file. Feature and cell subscription is always based on the size of rawData. Therefore, the feature subsetting on scaled data, which usually contains already a subset of features, will select the intersection between the wanted features and the set available from scaled data.
Usage
subsetLigerDataset(
object,
featureIdx = NULL,
cellIdx = NULL,
useSlot = NULL,
newH5 = TRUE,
filename = NULL,
filenameSuffix = NULL,
chunkSize = 1000,
verbose = getOption("ligerVerbose", TRUE),
returnObject = TRUE,
...
)
subsetH5LigerDataset(
object,
featureIdx = NULL,
cellIdx = NULL,
useSlot = NULL,
newH5 = TRUE,
filename = NULL,
filenameSuffix = NULL,
chunkSize = 1000,
verbose = getOption("ligerVerbose", TRUE),
returnObject = TRUE
)
subsetMemLigerDataset(
object,
featureIdx = NULL,
cellIdx = NULL,
useSlot = NULL,
returnObject = TRUE
)Arguments
- object
ligerDataset object. HDF5 based object if using
subsetH5LigerDataset, in-memory data forsubsetMemLigerDataset.- featureIdx
Character, logical or numeric index that can subscribe features. Missing or
NULLfor all features.- cellIdx
Character, logical or numeric index that can subscribe cells. Missing or
NULLfor all cells.- useSlot
The slot(s) to only consider. Choose one or more from
"rawData","normData"and"scaleData". DefaultNULLsubsets the whole object including analysis result matrices.- newH5
Whether to create a new H5 file on disk for the subset dataset if
objectis HDF5 based.TRUEwrites a new one,FALSEreturns in memory data.- filename
Filename of the new H5 file if being created. Default
NULLadds suffix".subset_{yymmdd_HHMMSS}.h5"to the original name.- filenameSuffix
Instead of specifying the exact filename, set a suffix for the new files so the new filename looks like
original.h5.[suffix].h5. DefaultNULL.- chunkSize
Integer. Number of maximum number of cells in each chunk, Default
1000.- verbose
Logical. Whether to show information of the progress. Default
getOption("ligerVerbose")orTRUEif users have not set.- returnObject
Logical, whether to return a ligerDataset object for result. Default
TRUE.FALSEreturns a list containing requested values.- ...
Arguments passed to
subsetH5LigerDataset
Examples
ctrl <- dataset(pbmc, "ctrl")
ctrl.small <- subsetLigerDataset(ctrl, cellIdx = 1:5)
ctrl.tiny <- ctrl[1:5, 1:5]