mudata 0.2.3__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mudata-0.3.0/.codecov.yml +17 -0
- mudata-0.3.0/.editorconfig +12 -0
- mudata-0.3.0/.gitignore +134 -0
- mudata-0.3.0/.pre-commit-config.yaml +6 -0
- mudata-0.3.0/.readthedocs.yaml +19 -0
- mudata-0.3.0/CITATION.cff +30 -0
- mudata-0.3.0/CONTRIBUTING.md +23 -0
- mudata-0.3.0/DESIGN.md +36 -0
- mudata-0.3.0/LICENSE +29 -0
- mudata-0.3.0/MANIFEST.in +1 -0
- mudata-0.3.0/PKG-INFO +147 -0
- mudata-0.3.0/README.md +114 -0
- mudata-0.3.0/pyproject.toml +102 -0
- mudata-0.3.0/src/mudata/__init__.py +55 -0
- {mudata-0.2.3 → mudata-0.3.0/src}/mudata/_core/config.py +1 -0
- {mudata-0.2.3 → mudata-0.3.0/src}/mudata/_core/file_backing.py +10 -12
- {mudata-0.2.3 → mudata-0.3.0/src}/mudata/_core/io.py +189 -90
- mudata-0.3.0/src/mudata/_core/merge.py +292 -0
- {mudata-0.2.3 → mudata-0.3.0/src}/mudata/_core/mudata.py +1171 -119
- {mudata-0.2.3 → mudata-0.3.0/src}/mudata/_core/repr.py +91 -92
- mudata-0.3.0/src/mudata/_core/to_.py +73 -0
- mudata-0.3.0/src/mudata/_core/utils.py +212 -0
- mudata-0.3.0/src/mudata/_core/views.py +37 -0
- mudata-0.3.0/src/mudata/_version.py +16 -0
- mudata-0.3.0/tests/__init__.py +0 -0
- mudata-0.3.0/tests/conftest.py +26 -0
- mudata-0.3.0/tests/test_axis_-1.py +27 -0
- mudata-0.3.0/tests/test_io.py +77 -0
- mudata-0.3.0/tests/test_mod_order.py +55 -0
- mudata-0.3.0/tests/test_nullable.py +40 -0
- mudata-0.3.0/tests/test_obs_var.py +53 -0
- mudata-0.3.0/tests/test_pull_push.py +310 -0
- mudata-0.3.0/tests/test_repr.py +44 -0
- mudata-0.3.0/tests/test_to_.py +48 -0
- mudata-0.3.0/tests/test_update.py +236 -0
- mudata-0.3.0/tests/test_update_axis_1.py +222 -0
- mudata-0.3.0/tests/test_view_copy.py +83 -0
- mudata-0.2.3/PKG-INFO +0 -128
- mudata-0.2.3/README.md +0 -97
- mudata-0.2.3/mudata/__init__.py +0 -10
- mudata-0.2.3/mudata/_core/utils.py +0 -37
- mudata-0.2.3/pyproject.toml +0 -49
- {mudata-0.2.3 → mudata-0.3.0/src}/mudata/_core/__init__.py +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Based on pydata/xarray, anndata
|
|
2
|
+
codecov:
|
|
3
|
+
require_ci_to_pass: no
|
|
4
|
+
|
|
5
|
+
coverage:
|
|
6
|
+
status:
|
|
7
|
+
project:
|
|
8
|
+
default:
|
|
9
|
+
# Require 1% coverage, i.e., always succeed
|
|
10
|
+
target: 1
|
|
11
|
+
patch: false
|
|
12
|
+
changes: false
|
|
13
|
+
|
|
14
|
+
comment:
|
|
15
|
+
layout: "diff, flags, files"
|
|
16
|
+
behavior: once
|
|
17
|
+
require_base: no
|
mudata-0.3.0/.gitignore
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
src/mudata/_version.py
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
.python-version
|
|
87
|
+
|
|
88
|
+
# pipenv
|
|
89
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
90
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
91
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
92
|
+
# install all needed dependencies.
|
|
93
|
+
#Pipfile.lock
|
|
94
|
+
|
|
95
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
96
|
+
__pypackages__/
|
|
97
|
+
|
|
98
|
+
# Celery stuff
|
|
99
|
+
celerybeat-schedule
|
|
100
|
+
celerybeat.pid
|
|
101
|
+
|
|
102
|
+
# SageMath parsed files
|
|
103
|
+
*.sage.py
|
|
104
|
+
|
|
105
|
+
# Environments
|
|
106
|
+
.env
|
|
107
|
+
.venv
|
|
108
|
+
env/
|
|
109
|
+
venv/
|
|
110
|
+
ENV/
|
|
111
|
+
env.bak/
|
|
112
|
+
venv.bak/
|
|
113
|
+
|
|
114
|
+
# Spyder project settings
|
|
115
|
+
.spyderproject
|
|
116
|
+
.spyproject
|
|
117
|
+
|
|
118
|
+
# Rope project settings
|
|
119
|
+
.ropeproject
|
|
120
|
+
|
|
121
|
+
# KDevelop project settings
|
|
122
|
+
*.kdev4
|
|
123
|
+
.kdev4/
|
|
124
|
+
|
|
125
|
+
# mkdocs documentation
|
|
126
|
+
/site
|
|
127
|
+
|
|
128
|
+
# mypy
|
|
129
|
+
.mypy_cache/
|
|
130
|
+
.dmypy.json
|
|
131
|
+
dmypy.json
|
|
132
|
+
|
|
133
|
+
# Pyre type checker
|
|
134
|
+
.pyre/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
# Set the OS, Python version and other tools you might need
|
|
4
|
+
build:
|
|
5
|
+
os: ubuntu-22.04
|
|
6
|
+
tools:
|
|
7
|
+
python: "3.11"
|
|
8
|
+
|
|
9
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
10
|
+
sphinx:
|
|
11
|
+
configuration: docs/source/conf.py
|
|
12
|
+
|
|
13
|
+
# Explicitly set the version of Python and its requirements
|
|
14
|
+
python:
|
|
15
|
+
install:
|
|
16
|
+
- method: pip
|
|
17
|
+
path: .
|
|
18
|
+
extra_requirements:
|
|
19
|
+
- docs
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this software, please cite it as below."
|
|
3
|
+
authors:
|
|
4
|
+
- family-names: "Bredikhin"
|
|
5
|
+
given-names: "Danila"
|
|
6
|
+
orcid: "https://orcid.org/0000-0001-8089-6983"
|
|
7
|
+
- family-names: "Kats"
|
|
8
|
+
given-names: "Ilia"
|
|
9
|
+
orcid: "https://orcid.org/0000-0001-5220-5671"
|
|
10
|
+
title: "muon"
|
|
11
|
+
version: 1.0.0
|
|
12
|
+
date-released: 2021-06-01
|
|
13
|
+
url: "https://github.com/scverse/muon"
|
|
14
|
+
preferred-citation:
|
|
15
|
+
type: article
|
|
16
|
+
authors:
|
|
17
|
+
- family-names: "Bredikhin"
|
|
18
|
+
given-names: "Danila"
|
|
19
|
+
orcid: "https://orcid.org/0000-0001-8089-6983"
|
|
20
|
+
- family-names: "Kats"
|
|
21
|
+
given-names: "Ilia"
|
|
22
|
+
orcid: "https://orcid.org/0000-0001-5220-5671"
|
|
23
|
+
- family-names: "Stegle"
|
|
24
|
+
given-names: "Oliver"
|
|
25
|
+
orcid: "https://orcid.org/0000-0002-8818-7193"
|
|
26
|
+
doi: "10.1186/s13059-021-02577-8"
|
|
27
|
+
journal: "Genome Biology"
|
|
28
|
+
month: 2
|
|
29
|
+
title: "MUON: multimodal omics analysis framework"
|
|
30
|
+
year: 2022
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
This document describes details about contributing to `MuData`.
|
|
4
|
+
|
|
5
|
+
The main entry point for a contribution is an issue. Please use issues to discuss the change you wish to make or the funcionality you want to add to `MuData`. For a more in-depth discussion you can also use [discussions](https://github.com/scverse/mudata/discussions) or contact `MuData` authors or maintainers via other communication methods such as email.
|
|
6
|
+
|
|
7
|
+
## Issues
|
|
8
|
+
|
|
9
|
+
Please consider opening an issue if you've encountered a bug, a performance issue, a documentation issue or have a feature request in mind. For convenience, we provide issue templates that you are very welcome to use.
|
|
10
|
+
|
|
11
|
+
When creating an issue about a problem that you've encountered (e.g. an error), please include the minimal amount of source code to reproduce it. When including tracebacks, please paste the full traceback text.
|
|
12
|
+
|
|
13
|
+
## Pull requests
|
|
14
|
+
|
|
15
|
+
The code that is suggested to be merged into `MuData` is expected to follow reasonable Python code styleguides such as the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html). Below there are a few ideas that may help to improve the code quality.
|
|
16
|
+
|
|
17
|
+
- Format the code with [black](https://github.com/psf/black).
|
|
18
|
+
- Make sure debugging code (e.g. `pdb.set_trace()`) is removed as well as respective dependencies (`import pdb`).
|
|
19
|
+
- Use tools like `pylint` and `flake8` to check proposed code changes.
|
|
20
|
+
- Make sure documentation is changed to reflect the changes. That includes docstrings as well as external files such as the ones in `docs/` or respective `README.md` files.
|
|
21
|
+
- Consider increasing the version number in `setup.py`. Please stick to [semantic versioning](https://semver.org/).
|
|
22
|
+
- Pull requests can be merged when the LGTM (_looks good to me_) has been received from reviewers, probably after a few rounds of reviews.
|
|
23
|
+
|
mudata-0.3.0/DESIGN.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Designing `MuData`
|
|
2
|
+
|
|
3
|
+
This document outlines design considerations and some technical details about `MuData` implementation.
|
|
4
|
+
|
|
5
|
+
## Multimodal data containers
|
|
6
|
+
|
|
7
|
+
`MuData` provides an implementation of the data type for storing multimodal measurements. It is embodied in the `MuData` class and represents a particular way of thinking about multimodal objects as _containers_. That means the unimodal measurements are stored in fully functional objects that can be operated independently — those are `AnnData` instances in the case of `MuData`. These containers can also store information that only makes sense when all of its insides are considered together, e.g. embeddings or cell annotation generated on all modalities en masse.
|
|
8
|
+
|
|
9
|
+
Such design is transparent, builds on existing software, which has been widely adopted by some communities (e.g. `scanpy` for single-cell data analysis), as well as data formats (HDF5-based files), and also has potential to grow gaining container-level features without disrupting current code. The latter being particularly important when contrasting it to an alternative approach of extending existing data formats such as `AnnData`. See e.g. [this anndata-related discussion](https://github.com/theislab/anndata/issues/237) where multiple challenges has been raised such as [how to have](https://github.com/theislab/anndata/issues/237#issuecomment-562505701) both modality-specific and cross-modality APIs (e.g. to create and to store respective embeddings).
|
|
10
|
+
|
|
11
|
+
One of the great side effects of this _container_ approach is that AnnData objects can be directly read from and written to HDF5 files with multimodal data:
|
|
12
|
+
|
|
13
|
+
```py
|
|
14
|
+
import mudata
|
|
15
|
+
|
|
16
|
+
# Read from inside the .h5mu file
|
|
17
|
+
adata = mudata.read("pbmc_10k.h5mu/rna")
|
|
18
|
+
|
|
19
|
+
# Write insides the .h5mu file
|
|
20
|
+
mudata.write("pbmc_10k.h5mu/rna", adata)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
One can verify in their terminal it's stored in the HDF5 file as expected:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
h5ls pbmc_10k.h5mu/mod/rna
|
|
27
|
+
# X Group
|
|
28
|
+
# obs Group
|
|
29
|
+
# var Group
|
|
30
|
+
# ...
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Operating on MuData objects
|
|
35
|
+
|
|
36
|
+
To handle `MuData` objects with multi-omics data, a [multimodal omics analysis framework (`muon`)](https://github.com/PmBio/muon) has been built. More implementation details can be found [in the respective `DESIGN.md` file](https://github.com/scverse/muon/blob/master/DESIGN.md).
|
mudata-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020, Danila Bredikhin
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
mudata-0.3.0/MANIFEST.in
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-exclude tests *
|
mudata-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: mudata
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Multimodal data
|
|
5
|
+
Project-URL: Documentation, https://muon.readthedocs.io/en/latest/
|
|
6
|
+
Project-URL: Source, https://github.com/scverse/mudata
|
|
7
|
+
Project-URL: Home-page, https://muon.scverse.org/
|
|
8
|
+
Author: Danila Bredikhin
|
|
9
|
+
Maintainer-email: Danila Bredikhin <danila@stanford.edu>
|
|
10
|
+
License-Expression: BSD-3-Clause
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: anndata>=0.10.8
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: setuptools-scm; extra == 'dev'
|
|
22
|
+
Provides-Extra: docs
|
|
23
|
+
Requires-Dist: nbsphinx; extra == 'docs'
|
|
24
|
+
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
|
|
25
|
+
Requires-Dist: readthedocs-sphinx-search; extra == 'docs'
|
|
26
|
+
Requires-Dist: recommonmark; extra == 'docs'
|
|
27
|
+
Requires-Dist: sphinx; extra == 'docs'
|
|
28
|
+
Requires-Dist: sphinx-automodapi; extra == 'docs'
|
|
29
|
+
Requires-Dist: sphinx-book-theme; extra == 'docs'
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: zarr; extra == 'test'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
[](http://mudata.readthedocs.io/)
|
|
37
|
+
[](https://pypi.org/project/mudata)
|
|
38
|
+
[](https://scverse.org)
|
|
39
|
+
[](https://numfocus.org)
|
|
40
|
+
|
|
41
|
+
# MuData – multimodal data
|
|
42
|
+
|
|
43
|
+
[Documentation](https://mudata.readthedocs.io/) | [Publication](https://genomebiology.biomedcentral.com/articles/10.1186/s13059-021-02577-8)
|
|
44
|
+
|
|
45
|
+
For using `MuData` in multimodal omics applications see [`muon`](https://github.com/scverse/muon).
|
|
46
|
+
|
|
47
|
+
## Data structure
|
|
48
|
+
|
|
49
|
+
In the same vein as [AnnData](https://github.com/theislab/anndata) is designed to represent unimodal annotated datasets in Python, `MuData` is designed to provide functionality to load, process, and store multimodal omics data.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
MuData
|
|
54
|
+
.obs -- annotation of observations (cells, samples)
|
|
55
|
+
.var -- annotation of features (genes, genomic loci, etc.)
|
|
56
|
+
.obsm -- multidimensional cell annotation,
|
|
57
|
+
incl. a boolean for each modality
|
|
58
|
+
that links .obs to the cells of that modality
|
|
59
|
+
.varm -- multidimensional feature annotation,
|
|
60
|
+
incl. a boolean vector for each modality
|
|
61
|
+
that links .var to the features of that modality
|
|
62
|
+
.mod
|
|
63
|
+
AnnData
|
|
64
|
+
.X -- data matrix (cells x features)
|
|
65
|
+
.obs -- cell metadata (assay-specific)
|
|
66
|
+
.var -- annotation of features (genes, peaks, genomic sites)
|
|
67
|
+
.obsm
|
|
68
|
+
.varm
|
|
69
|
+
.uns
|
|
70
|
+
.uns
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Overview
|
|
74
|
+
|
|
75
|
+
### Input
|
|
76
|
+
|
|
77
|
+
`MuData` can be thought of as a multimodal container, in which every modality is an AnnData object:
|
|
78
|
+
|
|
79
|
+
```py
|
|
80
|
+
from mudata import MuData
|
|
81
|
+
|
|
82
|
+
mdata = MuData({'rna': adata_rna, 'atac': adata_atac})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
If multimodal data from 10X Genomics is to be read, convenient readers are provided by [`muon`](https://github.com/scverse/muon) that return a `MuData` object with AnnData objects inside, each corresponding to its own modality:
|
|
86
|
+
|
|
87
|
+
```py
|
|
88
|
+
import muon as mu
|
|
89
|
+
|
|
90
|
+
mu.read_10x_h5("filtered_feature_bc_matrix.h5")
|
|
91
|
+
# MuData object with n_obs × n_vars = 10000 × 80000
|
|
92
|
+
# 2 modalities
|
|
93
|
+
# rna: 10000 x 30000
|
|
94
|
+
# var: 'gene_ids', 'feature_types', 'genome', 'interval'
|
|
95
|
+
# atac: 10000 x 50000
|
|
96
|
+
# var: 'gene_ids', 'feature_types', 'genome', 'interval'
|
|
97
|
+
# uns: 'atac', 'files'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### I/O with `.h5mu` files
|
|
101
|
+
|
|
102
|
+
`MuData` objects represent 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.
|
|
103
|
+
|
|
104
|
+
```py
|
|
105
|
+
import mudata as md
|
|
106
|
+
|
|
107
|
+
mdata_pbmc.write("pbmc_10k.h5mu")
|
|
108
|
+
mdata = md.read("pbmc_10k.h5mu")
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
It allows to effectively use the hierarchical nature of HDF5 files and to read/write AnnData object directly from/to `.h5mu` files:
|
|
112
|
+
|
|
113
|
+
```py
|
|
114
|
+
adata = md.read("pbmc_10k.h5mu/rna")
|
|
115
|
+
md.write("pbmc_10k.h5mu/rna", adata)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Citation
|
|
119
|
+
|
|
120
|
+
If you use `mudata` in your work, please cite the publication as follows:
|
|
121
|
+
|
|
122
|
+
> **MUON: multimodal omics analysis framework**
|
|
123
|
+
>
|
|
124
|
+
> Danila Bredikhin, Ilia Kats, Oliver Stegle
|
|
125
|
+
>
|
|
126
|
+
> _Genome Biology_ 2022 Feb 01. doi: [10.1186/s13059-021-02577-8](https://doi.org/10.1186/s13059-021-02577-8).
|
|
127
|
+
|
|
128
|
+
You can cite the scverse publication as follows:
|
|
129
|
+
|
|
130
|
+
> **The scverse project provides a computational ecosystem for single-cell omics data analysis**
|
|
131
|
+
>
|
|
132
|
+
> 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
|
|
133
|
+
>
|
|
134
|
+
> _Nat Biotechnol._ 2023 Apr 10. doi: [10.1038/s41587-023-01733-8](https://doi.org/10.1038/s41587-023-01733-8).
|
|
135
|
+
|
|
136
|
+
[//]: # "numfocus-fiscal-sponsor-attribution"
|
|
137
|
+
|
|
138
|
+
`mudata` 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/).
|
|
139
|
+
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.
|
|
140
|
+
|
|
141
|
+
<a href="https://numfocus.org/project/scverse">
|
|
142
|
+
<img
|
|
143
|
+
src="https://raw.githubusercontent.com/numfocus/templates/master/images/numfocus-logo.png"
|
|
144
|
+
width="200"
|
|
145
|
+
>
|
|
146
|
+
</a>
|
|
147
|
+
|
mudata-0.3.0/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
[](http://mudata.readthedocs.io/)
|
|
4
|
+
[](https://pypi.org/project/mudata)
|
|
5
|
+
[](https://scverse.org)
|
|
6
|
+
[](https://numfocus.org)
|
|
7
|
+
|
|
8
|
+
# MuData – multimodal data
|
|
9
|
+
|
|
10
|
+
[Documentation](https://mudata.readthedocs.io/) | [Publication](https://genomebiology.biomedcentral.com/articles/10.1186/s13059-021-02577-8)
|
|
11
|
+
|
|
12
|
+
For using `MuData` in multimodal omics applications see [`muon`](https://github.com/scverse/muon).
|
|
13
|
+
|
|
14
|
+
## Data structure
|
|
15
|
+
|
|
16
|
+
In the same vein as [AnnData](https://github.com/theislab/anndata) is designed to represent unimodal annotated datasets in Python, `MuData` is designed to provide functionality to load, process, and store multimodal omics data.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
MuData
|
|
21
|
+
.obs -- annotation of observations (cells, samples)
|
|
22
|
+
.var -- annotation of features (genes, genomic loci, etc.)
|
|
23
|
+
.obsm -- multidimensional cell annotation,
|
|
24
|
+
incl. a boolean for each modality
|
|
25
|
+
that links .obs to the cells of that modality
|
|
26
|
+
.varm -- multidimensional feature annotation,
|
|
27
|
+
incl. a boolean vector for each modality
|
|
28
|
+
that links .var to the features of that modality
|
|
29
|
+
.mod
|
|
30
|
+
AnnData
|
|
31
|
+
.X -- data matrix (cells x features)
|
|
32
|
+
.obs -- cell metadata (assay-specific)
|
|
33
|
+
.var -- annotation of features (genes, peaks, genomic sites)
|
|
34
|
+
.obsm
|
|
35
|
+
.varm
|
|
36
|
+
.uns
|
|
37
|
+
.uns
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Overview
|
|
41
|
+
|
|
42
|
+
### Input
|
|
43
|
+
|
|
44
|
+
`MuData` can be thought of as a multimodal container, in which every modality is an AnnData object:
|
|
45
|
+
|
|
46
|
+
```py
|
|
47
|
+
from mudata import MuData
|
|
48
|
+
|
|
49
|
+
mdata = MuData({'rna': adata_rna, 'atac': adata_atac})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
If multimodal data from 10X Genomics is to be read, convenient readers are provided by [`muon`](https://github.com/scverse/muon) that return a `MuData` object with AnnData objects inside, each corresponding to its own modality:
|
|
53
|
+
|
|
54
|
+
```py
|
|
55
|
+
import muon as mu
|
|
56
|
+
|
|
57
|
+
mu.read_10x_h5("filtered_feature_bc_matrix.h5")
|
|
58
|
+
# MuData object with n_obs × n_vars = 10000 × 80000
|
|
59
|
+
# 2 modalities
|
|
60
|
+
# rna: 10000 x 30000
|
|
61
|
+
# var: 'gene_ids', 'feature_types', 'genome', 'interval'
|
|
62
|
+
# atac: 10000 x 50000
|
|
63
|
+
# var: 'gene_ids', 'feature_types', 'genome', 'interval'
|
|
64
|
+
# uns: 'atac', 'files'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### I/O with `.h5mu` files
|
|
68
|
+
|
|
69
|
+
`MuData` objects represent 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.
|
|
70
|
+
|
|
71
|
+
```py
|
|
72
|
+
import mudata as md
|
|
73
|
+
|
|
74
|
+
mdata_pbmc.write("pbmc_10k.h5mu")
|
|
75
|
+
mdata = md.read("pbmc_10k.h5mu")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
It allows to effectively use the hierarchical nature of HDF5 files and to read/write AnnData object directly from/to `.h5mu` files:
|
|
79
|
+
|
|
80
|
+
```py
|
|
81
|
+
adata = md.read("pbmc_10k.h5mu/rna")
|
|
82
|
+
md.write("pbmc_10k.h5mu/rna", adata)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Citation
|
|
86
|
+
|
|
87
|
+
If you use `mudata` in your work, please cite the publication as follows:
|
|
88
|
+
|
|
89
|
+
> **MUON: multimodal omics analysis framework**
|
|
90
|
+
>
|
|
91
|
+
> Danila Bredikhin, Ilia Kats, Oliver Stegle
|
|
92
|
+
>
|
|
93
|
+
> _Genome Biology_ 2022 Feb 01. doi: [10.1186/s13059-021-02577-8](https://doi.org/10.1186/s13059-021-02577-8).
|
|
94
|
+
|
|
95
|
+
You can cite the scverse publication as follows:
|
|
96
|
+
|
|
97
|
+
> **The scverse project provides a computational ecosystem for single-cell omics data analysis**
|
|
98
|
+
>
|
|
99
|
+
> 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
|
|
100
|
+
>
|
|
101
|
+
> _Nat Biotechnol._ 2023 Apr 10. doi: [10.1038/s41587-023-01733-8](https://doi.org/10.1038/s41587-023-01733-8).
|
|
102
|
+
|
|
103
|
+
[//]: # "numfocus-fiscal-sponsor-attribution"
|
|
104
|
+
|
|
105
|
+
`mudata` 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/).
|
|
106
|
+
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.
|
|
107
|
+
|
|
108
|
+
<a href="https://numfocus.org/project/scverse">
|
|
109
|
+
<img
|
|
110
|
+
src="https://raw.githubusercontent.com/numfocus/templates/master/images/numfocus-logo.png"
|
|
111
|
+
width="200"
|
|
112
|
+
>
|
|
113
|
+
</a>
|
|
114
|
+
|