Load gene expression data from Loom files (HDF5-based file format for storing annotated matrices) into a Seurat object. Loom files are commonly created by Python-based analysis tools and offer an alternative to H5AD format for storing single-cell data.
Usage
LoadLoom(
file,
assay = NULL,
cells = "CellID",
features = "Gene",
normalized = NULL,
scaled = NULL,
filter = c("cells", "features", "all", "none"),
verbose = TRUE,
...
)
# S3 method for class 'character'
LoadLoom(file, ...)
# S3 method for class 'H5File'
LoadLoom(file, ...)
# S3 method for class 'loom'
LoadLoom(file, ...)
# S3 method for class 'loom'
as.Seurat(
x,
assay = NULL,
cells = "CellID",
features = "Gene",
normalized = NULL,
scaled = NULL,
filter = c("cells", "features", "all", "none"),
verbose = TRUE,
...
)Arguments
- file, x
Name of Loom file (character path) or a
loomobject connection to load data from- assay
Name of assay to store expression data as. If
NULL, will search for an HDF5 attribute namedSEURAT_ASSAYor dataset at/attrs/SEURAT_ASSAYfor the assay name. Defaults to"RNA"if not found.- cells
Name of dataset in
/col_attrscontaining cell/sample names. If not found, uses column indices as cell names.- features
Name of dataset in
/row_attrscontaining feature/gene names. If not found, uses row indices as feature names.- normalized
Name of layer in
/layersto load as normalized expression data; special value"/matrix"loads the main matrix as normalized data instead of counts- scaled
Name of layer in
/layersto load as scaled data- filter
Logical; if
TRUE, keep only cells and features marked as valid using/col_attrs/Validand/row_attrs/Validattributes- verbose
Logical; if
TRUE(default), show progress updates- ...
Arguments passed to other methods
Details
The Loom format stores data in a specific HDF5 structure:
/matrix: Main expression matrix (features x cells)/row_attrs: Feature-level metadata (gene names, coordinates, etc.)/col_attrs: Cell/sample-level metadata/layers: Additional expression layers (normalized, scaled, etc.)
Loom 3.0.0 Loading
For loom files version 3.0.0 and higher, LoadLoom3.0 provides
comprehensive loading with support for filtering, dimensional reductions,
and cell graphs.
See also
SaveLoom to save Seurat objects to Loom format
LoadH5Seurat to load h5Seurat files
LoadH5AD to load h5ad files
Loom documentation
Loom file conventions
Examples
if (FALSE) { # \dontrun{
library(SeuratDisk)
# Load a basic Loom file
seurat_obj <- LoadLoom("data.loom")
# Load with specific assay name
seurat_obj <- LoadLoom("data.loom", assay = "RNA")
# Load and filter to valid cells/features only
seurat_obj <- LoadLoom("data.loom", filter = TRUE)
# Load specific layers
seurat_obj <- LoadLoom(
"data.loom",
normalized = "normalized",
scaled = "scaled"
)
} # }