<img src="./docs/img/muon_header.png" data-canonical-src="./docs/img/muon_header.png" width="700"/>
`muon` is a multimodal omics Python framework.
[Documentation](https://muon.readthedocs.io/) | [Tutorials](https://muon-tutorials.readthedocs.io/) | [Publication](https://genomebiology.biomedcentral.com/articles/10.1186/s13059-021-02577-8)
[![Documentation Status](https://readthedocs.org/projects/muon/badge/?version=latest)](http://muon.readthedocs.io/?badge=latest)
[![PyPi version](https://img.shields.io/pypi/v/muon)](https://pypi.org/project/muon)
[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org)
## Data structure
`muon` is designed around `MuData` (multimodal data) objects — in the same vein as [scanpy](https://github.com/theislab/scanpy) and [AnnData](https://github.com/theislab/anndata) are designed to work primarily with scRNA-seq data in Python. Individual modalities in `MuData` are naturally represented with `AnnData` objects.
`MuData` class and `.h5mu` files I/O operations are part of [the standalone mudata library](https://github.com/scverse/mudata).
### Input
`MuData` class is implemented in the [mudata](https://github.com/scverse/mudata) library and is exposed in `muon`:
```py
from muon import MuData
mdata = MuData({'rna': adata_rna, 'atac': adata_atac})
```
If [multimodal data from 10X Genomics](https://support.10xgenomics.com/single-cell-multiome-atac-gex/software/pipelines/latest/output/overview) is to be read, `muon` provides a reader that returns a `MuData` object with AnnData objects inside, each corresponding to its own modality:
```py
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
Basic `.h5mu` files I/O functionality is implemented in [mudata](https://github.com/scverse/mudata) and is exposed in `muon`. A `MuData` object represents modalities as collections of `AnnData` objects, and these collections can be saved on disk and retrieved using HDF5-based `.h5mu` files, which design is based on `.h5ad` file structure.
```py
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:
```py
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](https://github.com/bioFAM/MOFA2):
```py
# 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:
```py
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:
```py
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:
```py
# ATAC module:
from muon import atac as ac
# Protein (epitope) module:
from muon import prot as pt
```
---
Some implementation details are noted in [DESIGN.md](./DESIGN.md).
[Contributions](./CONTRIBUTING.md) in the form of [issues](https://github.com/scverse/muon/issues), [pull requests](https://github.com/scverse/muon/pulls) or [discussions](https://github.com/scverse/muon/discussions) are welcome.
## Citation
If you use `muon` in your work, please cite the `muon` publication as follows:
> **MUON: multimodal omics analysis framework**
>
> Danila Bredikhin, Ilia Kats, Oliver Stegle
>
> _Genome Biology_ 2022 Feb 01. doi: [10.1186/s13059-021-02577-8](https://doi.org/10.1186/s13059-021-02577-8).
You can cite the scverse publication as follows:
> **The scverse project provides a computational ecosystem for single-cell omics data analysis**
>
> Isaac Virshup, Danila Bredikhin, Lukas Heumos, Giovanni Palla, Gregor Sturm, Adam Gayoso, Ilia Kats, Mikaela Koutrouli, Scverse Community, Bonnie Berger, Dana Pe’er, Aviv Regev, Sarah A. Teichmann, Francesca Finotello, F. Alexander Wolf, Nir Yosef, Oliver Stegle & Fabian J. Theis
>
> _Nat Biotechnol._ 2023 Apr 10. doi: [10.1038/s41587-023-01733-8](https://doi.org/10.1038/s41587-023-01733-8).
[//]: # "numfocus-fiscal-sponsor-attribution"
`muon` is part of the scverse project ([website](https://scverse.org), [governance](https://scverse.org/about/roles)) and is fiscally sponsored by [NumFOCUS](https://numfocus.org/).
Please consider making a tax-deductible [donation](https://numfocus.org/donate-to-scverse) to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.
<a href="https://numfocus.org/project/scverse">
<img
src="https://raw.githubusercontent.com/numfocus/templates/master/images/numfocus-logo.png"
width="200"
>
</a>
Raw data
{
"_id": null,
"home_page": "https://github.com/scverse/muon",
"name": "muon",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Danila Bredikhin",
"author_email": "danila.bredikhin@embl.de",
"download_url": "https://files.pythonhosted.org/packages/69/82/c85efa0df83275172feefc76751fd2a7fb524faafc0ba6b86048708332e4/muon-0.1.7.tar.gz",
"platform": null,
"description": "<img src=\"./docs/img/muon_header.png\" data-canonical-src=\"./docs/img/muon_header.png\" width=\"700\"/>\n\n`muon` is a multimodal omics Python framework. \n\n[Documentation](https://muon.readthedocs.io/) | [Tutorials](https://muon-tutorials.readthedocs.io/) | [Publication](https://genomebiology.biomedcentral.com/articles/10.1186/s13059-021-02577-8)\n\n[![Documentation Status](https://readthedocs.org/projects/muon/badge/?version=latest)](http://muon.readthedocs.io/?badge=latest)\n[![PyPi version](https://img.shields.io/pypi/v/muon)](https://pypi.org/project/muon)\n[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org)\n\n## Data structure\n\n`muon` is designed around `MuData` (multimodal data) objects \u2014 in the same vein as [scanpy](https://github.com/theislab/scanpy) and [AnnData](https://github.com/theislab/anndata) are designed to work primarily with scRNA-seq data in Python. Individual modalities in `MuData` are naturally represented with `AnnData` objects.\n\n`MuData` class and `.h5mu` files I/O operations are part of [the standalone mudata library](https://github.com/scverse/mudata).\n\n### Input\n\n`MuData` class is implemented in the [mudata](https://github.com/scverse/mudata) library and is exposed in `muon`:\n\n```py\nfrom muon import MuData\n\nmdata = MuData({'rna': adata_rna, 'atac': adata_atac})\n```\n\nIf [multimodal data from 10X Genomics](https://support.10xgenomics.com/single-cell-multiome-atac-gex/software/pipelines/latest/output/overview) is to be read, `muon` provides a reader that returns a `MuData` object with AnnData objects inside, each corresponding to its own modality:\n\n```py\nimport muon as mu\n\nmu.read_10x_h5(\"filtered_feature_bc_matrix.h5\")\n# MuData object with n_obs \u00d7 n_vars = 10000 \u00d7 80000 \n# 2 modalities\n# rna:\t10000 x 30000\n# var:\t'gene_ids', 'feature_types', 'genome', 'interval'\n# atac:\t10000 x 50000\n# var:\t'gene_ids', 'feature_types', 'genome', 'interval'\n# uns:\t'atac', 'files'\n```\n\n### I/O with `.h5mu` files\n\nBasic `.h5mu` files I/O functionality is implemented in [mudata](https://github.com/scverse/mudata) and is exposed in `muon`. A `MuData` object represents modalities as collections of `AnnData` objects, and these collections can be saved on disk and retrieved using HDF5-based `.h5mu` files, which design is based on `.h5ad` file structure.\n\n```py\nmdata.write(\"pbmc_10k.h5mu\")\nmdata = mu.read(\"pbmc_10k.h5mu\")\n```\n\nIt allows to effectively use the hierarchical nature of HDF5 files and to read/write AnnData object directly from/to `.h5mu` files:\n\n```py\nadata = mu.read(\"pbmc_10k.h5mu/rna\")\nmu.write(\"pbmc_10k.h5mu/rna\", adata)\n```\n\n## Multimodal omics analysis\n\n`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](https://github.com/bioFAM/MOFA2):\n\n```py\n# Unimodal\nimport scanpy as sc\nsc.tl.pca(adata)\n\n# Multimodal\nimport muon as mu\nmu.tl.mofa(mdata)\n``` \n\n## Individual assays\n\nIndividual assays are stored as AnnData object, which enables the use of all the default `scanpy` functionality per assay:\n\n```py\nimport scanpy as sc\n\nsc.tl.umap(mdata.mod[\"rna\"])\n```\n\nTypically, a modality inside a container can be referred to with a variable to make the code more concise:\n\n```py\nrna = mdata.mod[\"rna\"]\nsc.pl.umap(rna)\n```\n\n### Modules in `muon`\n\n`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:\n\n```py\n# ATAC module:\nfrom muon import atac as ac\n\n# Protein (epitope) module:\nfrom muon import prot as pt\n```\n\n---\n\nSome implementation details are noted in [DESIGN.md](./DESIGN.md). \n\n[Contributions](./CONTRIBUTING.md) in the form of [issues](https://github.com/scverse/muon/issues), [pull requests](https://github.com/scverse/muon/pulls) or [discussions](https://github.com/scverse/muon/discussions) are welcome.\n\n## Citation\n\nIf you use `muon` in your work, please cite the `muon` publication as follows:\n\n> **MUON: multimodal omics analysis framework**\n> \n> Danila Bredikhin, Ilia Kats, Oliver Stegle\n>\n> _Genome Biology_ 2022 Feb 01. doi: [10.1186/s13059-021-02577-8](https://doi.org/10.1186/s13059-021-02577-8).\n\nYou can cite the scverse publication as follows:\n\n> **The scverse project provides a computational ecosystem for single-cell omics data analysis**\n>\n> Isaac Virshup, Danila Bredikhin, Lukas Heumos, Giovanni Palla, Gregor Sturm, Adam Gayoso, Ilia Kats, Mikaela Koutrouli, Scverse Community, Bonnie Berger, Dana Pe\u2019er, Aviv Regev, Sarah A. Teichmann, Francesca Finotello, F. Alexander Wolf, Nir Yosef, Oliver Stegle & Fabian J. Theis\n>\n> _Nat Biotechnol._ 2023 Apr 10. doi: [10.1038/s41587-023-01733-8](https://doi.org/10.1038/s41587-023-01733-8).\n\n\n[//]: # \"numfocus-fiscal-sponsor-attribution\"\n\n`muon` is part of the scverse project ([website](https://scverse.org), [governance](https://scverse.org/about/roles)) and is fiscally sponsored by [NumFOCUS](https://numfocus.org/).\nPlease consider making a tax-deductible [donation](https://numfocus.org/donate-to-scverse) to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.\n\n<a href=\"https://numfocus.org/project/scverse\">\n <img\n src=\"https://raw.githubusercontent.com/numfocus/templates/master/images/numfocus-logo.png\"\n width=\"200\"\n >\n</a>\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Multimodal omics analysis framework",
"version": "0.1.7",
"project_urls": {
"Documentation": "https://muon.readthedocs.io/en/latest/",
"Homepage": "https://github.com/scverse/muon"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c05306e32c4a6431efd4df0ff4465777c635809f5811e78de8d5f5f4b931f50c",
"md5": "46d5e961800705d5b0dd167a457e9f63",
"sha256": "e14387714478a6ddd4ce8584262078c469d7c90683c9e0c90ee4a4ba9484a007"
},
"downloads": -1,
"filename": "muon-0.1.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "46d5e961800705d5b0dd167a457e9f63",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 293732,
"upload_time": "2024-10-30T10:02:20",
"upload_time_iso_8601": "2024-10-30T10:02:20.316693Z",
"url": "https://files.pythonhosted.org/packages/c0/53/06e32c4a6431efd4df0ff4465777c635809f5811e78de8d5f5f4b931f50c/muon-0.1.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6982c85efa0df83275172feefc76751fd2a7fb524faafc0ba6b86048708332e4",
"md5": "b28ebcd820c59c48e44a2e6f8689f950",
"sha256": "6bd7cb15e3bee700517ef1dec0197bc77590acb4ccef96c7d0939c6ca50f400a"
},
"downloads": -1,
"filename": "muon-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "b28ebcd820c59c48e44a2e6f8689f950",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 164020,
"upload_time": "2024-10-30T10:02:22",
"upload_time_iso_8601": "2024-10-30T10:02:22.308125Z",
"url": "https://files.pythonhosted.org/packages/69/82/c85efa0df83275172feefc76751fd2a7fb524faafc0ba6b86048708332e4/muon-0.1.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-30 10:02:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "scverse",
"github_project": "muon",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "muon"
}