Skip to main content

Multimodal omics analysis framework

Project description

muon is a multimodal omics Python framework.

Documentation Status

Data structure

In the same vein as scanpy and AnnData are designed to work with scRNA-seq data in Python, muon and MuData are designed to provide functionality to load, process, and store multimodal omics data.

MuData
  .obs     -- annotation of observations (cells, samples)
  .var     -- annotation of features (genes, genomic loci, etc.)
  .obsm    -- multidimensional cell annotation, 
              incl. a boolean for each modality
              that links .obs to the cells of that modality
  .varm    -- multidimensional feature annotation, 
              incl. a boolean vector for each modality
              that links .var to the features of that modality
  .mod
    AnnData
      .X    -- data matrix (cells x features)
      .obs  -- cells metadata (assay-specific)
      .var  -- annotation of features (genes, peaks, genomic sites)
      .obsm
      .varm
      .uns
  .uns

By design, muon can incorporate disjoint multimodal experiments, i.e. the ones with different cells having different modalities measured. No redundant empty measurements are stored due to the distinct feature sets per assay as well as distinct cell sets mapped to a global set of observations.

Input

For reading multimodal omics data, muon relies on the functionality available in scanpy. muon comes with MuData — a multimodal container, in which every modality is an AnnData object:

from muon import MuData

mdata = MuData({'rna': adata_rna, 'atac': adata_atac})

If multimodal data from 10X Genomics is to be read, muon provides a reader that returns a MuData object with AnnData objects inside, each corresponding to its own modality:

import muon as mu

mu.read_10x_h5("filtered_feature_bc_matrix.h5")
# MuData object with n_obs × n_vars = 10000 × 80000 
# 2 modalities
#   rna:	10000 x 30000
#     var:	'gene_ids', 'feature_types', 'genome', 'interval'
#   atac:	10000 x 50000
#     var:	'gene_ids', 'feature_types', 'genome', 'interval'
#     uns:	'atac', 'files'

I/O with .h5mu files

muon operates on multimodal data (MuData) that represents modalities as collections of AnnData objects. These collections can be saved to disk and retrieved using HDF5-based .h5mu files, which design is based on .h5ad file structure.

mdata.write("pbmc_10k.h5mu")
mdata = mu.read("pbmc_10k.h5mu")

It allows to effectively use the hierarchical nature of HDF5 files and to read/write AnnData object directly from/to .h5mu files:

adata = mu.read("pbmc_10k.h5mu/rna")
mu.write("pbmc_10k.h5mu/rna", adata)

Multimodal omics analysis

muon incorporates a set of methods for multimodal omics analysis. These methods address the challenge of taking multimodal data as their input. For instance, while for a unimodal analysis one would use principal components analysis, muon comes with a method to run multi-omics factor analysis:

# Unimodal
import scanpy as sc
sc.tl.pca(adata)

# Multimodal
import muon as mu
mu.tl.mofa(mdata)

Individual assays

Individual assays are stored as AnnData object, which enables the use of all the default scanpy functionality per assay:

import scanpy as sc

sc.tl.umap(mdata.mod["rna"])

Typically, a modality inside a container can be referred to with a variable to make the code more concise:

rna = mdata.mod["rna"]
sc.pl.umap(rna)

Modules in muon

muon comes with a set of modules that can be used hand in hand with scanpy's API. These modules are named after respective sequencing protocols and comprise special functions that might come in handy. It is also handy to import them as two letter abbreviations:

# ATAC module:
from muon import atac as ac

# Protein (epitope) module:
from muon import prot as pt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

muon-0.1.0-py3.8.egg (366.3 kB view details)

Uploaded Source

muon-0.1.0-py3-none-any.whl (304.7 kB view details)

Uploaded Python 3

File details

Details for the file muon-0.1.0-py3.8.egg.

File metadata

  • Download URL: muon-0.1.0-py3.8.egg
  • Upload date:
  • Size: 366.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6

File hashes

Hashes for muon-0.1.0-py3.8.egg
Algorithm Hash digest
SHA256 c7efff41991dbb2fe6db185cd0e3ad0b56a180a246bd1ebf343801e2bdabdc23
MD5 ffc4e0f994d278dbf7fa1292f28c4ac5
BLAKE2b-256 aef0d746972f4fc79130163fe8f9cce796169e207fff3894aa17874e2b75dac8

See more details on using hashes here.

File details

Details for the file muon-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: muon-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 304.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6

File hashes

Hashes for muon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4c5fb251faf8a30199b9b768cc96a8365357a08f401c39aaba61c8adaa6cf10
MD5 bf64b25a1f002f67d26e8bd720198668
BLAKE2b-256 480e80828bd193561694d6f71d063e077d8ab4c67ab69fa9ec9973c1c9a74f21

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page