knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Multimodal data format — MuData — has been introduced to address the need for cross-platform standard for sharing large-scale multimodal omics data. Importantly, it develops ideas of and is compatible with AnnData standard for storing raw and derived data for unimodal datasets.
In Bioconductor, multimodal datasets have been stored in
MultiAssayExperiment
(MAE) objects. This MuData
package provides functionality to read data from
MuData files into MAE objects as well as to save MAE objects into H5MU files.
The most recent dev build can be installed from GitHub:
library(remotes) remotes::install_github("ilia-kats/MuData")
Stable version of MuData
will be available in future bioconductor versions.
library(MuData) library(MultiAssayExperiment) library(rhdf5)
We'll use a simple MAE object from the MultiAssayExperiment
package that
we'll then save in a H5MU file.
data(miniACC)
miniACC
We will now write its contents into an H5MU file with WriteH5MU
:
writeH5MU(miniACC, "miniacc.h5mu")
We can manually check the top level of the structure of the file:
rhdf5::h5ls("miniacc.h5mu", recursive = FALSE)
Or dig deeper into the file:
h5 <- rhdf5::H5Fopen("miniacc.h5mu") h5&'mod' rhdf5::H5close()
This package provides ReadH5MU
to create an object with data from an H5MU
file. Since H5MU structure has been designed to accommodate more structured
information than MAE, only some data will be read. For instance, MAE has no
support for loading multimodal embeddings or pairwise graphs.
acc <- readH5MU("miniacc.h5mu") acc
Importantly, we recover the information from the original MAE object:
head(colData(miniACC)[,1:4]) head(colData(acc)[,1:4])
Features metadata is also recovered:
head(rowData(miniACC[["gistict"]])) head(rowData(acc[["gistict"]]))
It is possible to read H5MU files while keeping matrices (both .X
and
.layers
) on disk.
acc_b <- readH5MU("miniacc.h5mu", backed = TRUE) assay(acc_b, "RNASeq2GeneNorm")[1:5,1:3]
The data in the assay is a DelayedMatrix
object:
class(assay(acc_b, "RNASeq2GeneNorm"))
This is in contrast to the acc
object that has matrices in memory:
assay(acc, "RNASeq2GeneNorm")[1:5,1:3] class(assay(acc, "RNASeq2GeneNorm"))
mudata (Python) documentation
muon documentation and web page
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.