Skip to contents

Read multimodal MuData (.h5mu) files and convert to a Seurat object with multiple assays. This function wraps MuDataSeurat::ReadH5MU with additional support for spatial data, Seurat V5 layers, and enhanced metadata preservation.

Usage

LoadH5MU(
  file,
  modalities = NULL,
  assay.names = NULL,
  restore.spatial = TRUE,
  verbose = TRUE
)

Arguments

file

Path to .h5mu file

modalities

Character vector of modality names to load. If NULL (default), loads all modalities found in the file

assay.names

Named vector mapping modality names to desired Seurat assay names. If NULL, uses standard mapping (rna→RNA, prot→ADT, atac→ATAC, etc.)

restore.spatial

Logical; if TRUE, attempts to restore spatial data from the h5mu file structure (coordinates, images, scalefactors)

verbose

Show progress messages

Value

A Seurat object with multiple assays corresponding to each modality

Details

The h5mu format stores multimodal data where each modality is stored as a separate AnnData-like structure under /mod/{modality_name}. This function:

  • Reads each modality using MuDataSeurat functionality

  • Converts modalities to Seurat assays

  • Merges modalities into a single Seurat object

  • Preserves global cell metadata from /obs

  • Restores spatial data if present

  • Maintains Seurat V5 layer structure

Modality Mapping

By default, modality names are mapped to standard Seurat assay names:

  • rna → RNA

  • prot → ADT

  • atac → ATAC

  • spatial → Spatial

  • Other names are preserved as-is

Examples

if (FALSE) { # \dontrun{
# Load all modalities from an h5mu file
seurat_obj <- LoadH5MU("multimodal_data.h5mu")

# Load specific modalities only
seurat_obj <- LoadH5MU("multimodal_data.h5mu", modalities = c("rna", "prot"))

# Custom assay name mapping
seurat_obj <- LoadH5MU(
  "data.h5mu",
  assay.names = c(rna = "RNA", prot = "Protein")
)
} # }