This function subsets a liger object with
character feature index and any valid cell index. For datasets based on HDF5,
the filenames of subset H5 files could only be automatically generated for
now. Feature subsetting is based on the intersection of available features
from datasets involved by cellIdx
, while featureIdx = NULL
does
not take the intersection (i.e. nothing done on the feature axis).
a ligerDataset object is also allowed for now and meanwhile,
setting filename
is supported.
Usage
subsetLiger(
object,
featureIdx = NULL,
cellIdx = NULL,
useSlot = NULL,
chunkSize = 1000,
verbose = getOption("ligerVerbose", TRUE),
newH5 = TRUE,
returnObject = TRUE,
...
)
Arguments
- object
A liger or ligerDataset object.
- featureIdx
Character vector. Missing or
NULL
for all features.- cellIdx
Character, logical or numeric index that can subscribe cells. Missing or
NULL
for all cells.- useSlot
The slot(s) to only consider. Choose one or more from
"rawData"
,"normData"
and"scaleData"
. DefaultNULL
subsets the whole object including analysis result matrices.- 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")
orTRUE
if users have not set.- newH5
Whether to create new H5 files on disk for the subset datasets if involved datasets in the
object
is HDF5 based.TRUE
writes a new ones,FALSE
returns in memory data.- returnObject
Logical, whether to return a liger object for result. Default
TRUE
.FALSE
returns a list containing requested values.- ...
Arguments passed to
subsetLigerDataset
Examples
pbmc.small <- subsetLiger(pbmc, cellIdx = pbmc$nUMI > 200)
#> ℹ Subsetting dataset: "ctrl"
#> ℹ Subsetting dataset: "stim"
#> ✔ Subsetting dataset: "stim" ... done
#>
#> ℹ Subsetting dataset: "ctrl"
#> ✔ Subsetting dataset: "ctrl" ... done
#>
pbmc.small <- pbmc[, pbmc$nGene > 50]
#> ℹ Subsetting dataset: "ctrl"
#> ℹ Subsetting dataset: "stim"
#> ✔ Subsetting dataset: "stim" ... done
#>
#> ℹ Subsetting dataset: "ctrl"
#> ✔ Subsetting dataset: "ctrl" ... done
#>