mudata 0.2.4__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.
Files changed (41) hide show
  1. mudata-0.3.0/.codecov.yml +17 -0
  2. mudata-0.3.0/.editorconfig +12 -0
  3. mudata-0.3.0/.gitignore +134 -0
  4. mudata-0.3.0/.pre-commit-config.yaml +6 -0
  5. mudata-0.3.0/.readthedocs.yaml +19 -0
  6. mudata-0.3.0/CITATION.cff +30 -0
  7. mudata-0.3.0/CONTRIBUTING.md +23 -0
  8. mudata-0.3.0/DESIGN.md +36 -0
  9. mudata-0.3.0/LICENSE +29 -0
  10. mudata-0.3.0/MANIFEST.in +1 -0
  11. {mudata-0.2.4 → mudata-0.3.0}/PKG-INFO +29 -27
  12. {mudata-0.2.4 → mudata-0.3.0}/README.md +4 -3
  13. mudata-0.3.0/pyproject.toml +102 -0
  14. mudata-0.3.0/src/mudata/__init__.py +55 -0
  15. {mudata-0.2.4 → mudata-0.3.0/src}/mudata/_core/config.py +1 -0
  16. {mudata-0.2.4 → mudata-0.3.0/src}/mudata/_core/file_backing.py +10 -12
  17. {mudata-0.2.4 → mudata-0.3.0/src}/mudata/_core/io.py +188 -75
  18. mudata-0.3.0/src/mudata/_core/merge.py +292 -0
  19. {mudata-0.2.4 → mudata-0.3.0/src}/mudata/_core/mudata.py +1167 -113
  20. {mudata-0.2.4 → mudata-0.3.0/src}/mudata/_core/repr.py +86 -89
  21. mudata-0.3.0/src/mudata/_core/to_.py +73 -0
  22. mudata-0.3.0/src/mudata/_core/utils.py +212 -0
  23. mudata-0.3.0/src/mudata/_core/views.py +37 -0
  24. mudata-0.3.0/src/mudata/_version.py +16 -0
  25. mudata-0.3.0/tests/__init__.py +0 -0
  26. mudata-0.3.0/tests/conftest.py +26 -0
  27. mudata-0.3.0/tests/test_axis_-1.py +27 -0
  28. mudata-0.3.0/tests/test_io.py +77 -0
  29. mudata-0.3.0/tests/test_mod_order.py +55 -0
  30. mudata-0.3.0/tests/test_nullable.py +40 -0
  31. mudata-0.3.0/tests/test_obs_var.py +53 -0
  32. mudata-0.3.0/tests/test_pull_push.py +310 -0
  33. mudata-0.3.0/tests/test_repr.py +44 -0
  34. mudata-0.3.0/tests/test_to_.py +48 -0
  35. mudata-0.3.0/tests/test_update.py +236 -0
  36. mudata-0.3.0/tests/test_update_axis_1.py +222 -0
  37. mudata-0.3.0/tests/test_view_copy.py +83 -0
  38. mudata-0.2.4/mudata/__init__.py +0 -10
  39. mudata-0.2.4/mudata/_core/utils.py +0 -37
  40. mudata-0.2.4/pyproject.toml +0 -50
  41. {mudata-0.2.4 → 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
@@ -0,0 +1,12 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+ max_line_length = 100
9
+
10
+ [*.py]
11
+ indent_size = 4
12
+ indent_style = space
@@ -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,6 @@
1
+ repos:
2
+ - repo: https://github.com/psf/black
3
+ rev: 20.8b1 # Replace by any tag/version: https://github.com/psf/black/tags
4
+ hooks:
5
+ - id: black
6
+ language_version: python3
@@ -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.
@@ -0,0 +1 @@
1
+ recursive-exclude tests *
@@ -1,38 +1,41 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: mudata
3
- Version: 0.2.4
4
- Summary: Multimodal omics analysis framework
5
- Home-page: https://github.com/scverse/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/
6
8
  Author: Danila Bredikhin
7
- Author-email: danila.bredikhin@embl.de
8
- Requires-Python: >= 3.9
9
- Description-Content-Type: text/markdown
10
- Classifier: Programming Language :: Python :: 3
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
11
14
  Classifier: License :: OSI Approved :: BSD License
12
15
  Classifier: Operating System :: OS Independent
13
- Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Programming Language :: Python :: 3
14
17
  Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
15
- Classifier: Intended Audience :: Science/Research
16
- Requires-Dist: numpy
17
- Requires-Dist: pandas
18
- Requires-Dist: h5py
19
- Requires-Dist: anndata >= 0.10.8
20
- Requires-Dist: sphinx ; extra == "docs"
21
- Requires-Dist: sphinx-book-theme ; extra == "docs"
22
- Requires-Dist: pydata-sphinx-theme ; extra == "docs"
23
- Requires-Dist: readthedocs-sphinx-search ; extra == "docs"
24
- Requires-Dist: nbsphinx ; extra == "docs"
25
- Requires-Dist: sphinx_automodapi ; extra == "docs"
26
- Requires-Dist: recommonmark ; extra == "docs"
27
- Requires-Dist: zarr ; extra == "test"
28
- Project-URL: Documentation, https://muon.readthedocs.io/en/latest/
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: anndata>=0.10.8
20
+ Provides-Extra: dev
21
+ Requires-Dist: setuptools-scm; extra == 'dev'
29
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
30
  Provides-Extra: test
31
+ Requires-Dist: zarr; extra == 'test'
32
+ Description-Content-Type: text/markdown
31
33
 
32
- <img src="./docs/img/mudata.svg" data-canonical-src="./docs/img/mudata.svg" width="700"/>
34
+ ![mudata header](./docs/img/mudata.svg)
33
35
 
34
36
  [![Documentation Status](https://readthedocs.org/projects/mudata/badge/?version=latest)](http://mudata.readthedocs.io/)
35
37
  [![PyPi version](https://img.shields.io/pypi/v/mudata)](https://pypi.org/project/mudata)
38
+ [![](https://img.shields.io/badge/scverse-core-black.svg?labelColor=white&logo=data:image/svg%2bxml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AgICAgICAgICAgPHBhdGggZD0iTTM4LjcsOS44YzcuOSw2LjMgMTIuNCw5LjggMjAsOC41YzUuNywtMSA0LjksLTcuOSAtNCwtMTMuNmMtNC40LC0yLjggLTkuNCwtNC4yIC0xNS43LC00LjJjLTcuNSwtMCAtMTYuMywzLjkgLTIwLjYsNi40YzQsLTIuMyAxMS45LC0zLjggMjAuMywyLjlaIiBzdHlsZT0iZmlsbDojZmZmO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTojMDAwO3N0cm9rZS13aWR0aDoxcHg7Ii8+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=)](https://scverse.org)
36
39
  [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org)
37
40
 
38
41
  # MuData – multimodal data
@@ -59,7 +62,7 @@ MuData
59
62
  .mod
60
63
  AnnData
61
64
  .X -- data matrix (cells x features)
62
- .obs -- cells metadata (assay-specific)
65
+ .obs -- cell metadata (assay-specific)
63
66
  .var -- annotation of features (genes, peaks, genomic sites)
64
67
  .obsm
65
68
  .varm
@@ -132,7 +135,7 @@ You can cite the scverse publication as follows:
132
135
 
133
136
  [//]: # "numfocus-fiscal-sponsor-attribution"
134
137
 
135
- 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/).
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/).
136
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.
137
140
 
138
141
  <a href="https://numfocus.org/project/scverse">
@@ -142,4 +145,3 @@ Please consider making a tax-deductible [donation](https://numfocus.org/donate-t
142
145
  >
143
146
  </a>
144
147
 
145
-
@@ -1,7 +1,8 @@
1
- <img src="./docs/img/mudata.svg" data-canonical-src="./docs/img/mudata.svg" width="700"/>
1
+ ![mudata header](./docs/img/mudata.svg)
2
2
 
3
3
  [![Documentation Status](https://readthedocs.org/projects/mudata/badge/?version=latest)](http://mudata.readthedocs.io/)
4
4
  [![PyPi version](https://img.shields.io/pypi/v/mudata)](https://pypi.org/project/mudata)
5
+ [![](https://img.shields.io/badge/scverse-core-black.svg?labelColor=white&logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgOTEgOTEiIHZlcnNpb249IjEuMSIKICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3BhY2U9InByZXNlcnZlIgogICAgeG1sbnM6c2VyaWY9Imh0dHA6Ly93d3cuc2VyaWYuY29tLyIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoyOyI+CiAgICA8ZyBpZD0iRWJlbmVfMyI+CiAgICAgICAgPGc+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0zNSw4OS42Yy0yMi4zLC0zLjQgLTMwLjYsLTE5LjggLTMwLjYsLTE5LjhjMTAuOCwxNi45IDQzLDkuMSA1Mi45LDIuNWMxMi40LC04LjMgOCwtMTUuMyA2LjgsLTE4LjFjNS40LDcuMiA1LjMsMjM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TUuOCwxNyAtMS42LDI0LjNjNC41LDcuOCAxMy4yLDE1LjQgMjQuMywyMi44YzUuMSwzLjQgMTUuNiw4LjQgMTkuMywxNmMxMS43LC04LjEgNy42LC0xNC45IDYuMywtMTcuNloiIHN0eWxlPSJmaWxsOiNiNGI0YjQ7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOiMwMDA7c3Ryb2tlLXdpZHRoOjFweDsiLz4KICAgICAgICAgICAgPHBhdGggZD0iTTM4LjcsOS44YzcuOSw2LjMgMTIuNCw5LjggMjAsOC41YzUuNywtMSA0LjksLTcuOSAtNCwtMTMuNmMtNC40LC0yLjggLTkuNCwtNC4yIC0xNS43LC00LjJjLTcuNSwtMCAtMTYuMywzLjkgLTIwLjYsNi40YzQsLTIuMyAxMS45LC0zLjggMjAuMywyLjlaIiBzdHlsZT0iZmlsbDojZmZmO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTojMDAwO3N0cm9rZS13aWR0aDoxcHg7Ii8+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=)](https://scverse.org)
5
6
  [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org)
6
7
 
7
8
  # MuData – multimodal data
@@ -28,7 +29,7 @@ MuData
28
29
  .mod
29
30
  AnnData
30
31
  .X -- data matrix (cells x features)
31
- .obs -- cells metadata (assay-specific)
32
+ .obs -- cell metadata (assay-specific)
32
33
  .var -- annotation of features (genes, peaks, genomic sites)
33
34
  .obsm
34
35
  .varm
@@ -101,7 +102,7 @@ You can cite the scverse publication as follows:
101
102
 
102
103
  [//]: # "numfocus-fiscal-sponsor-attribution"
103
104
 
104
- 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/).
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/).
105
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.
106
107
 
107
108
  <a href="https://numfocus.org/project/scverse">
@@ -0,0 +1,102 @@
1
+ [build-system]
2
+ build-backend = "hatchling.build"
3
+ requires = ["hatchling", "hatch-vcs"]
4
+
5
+ [project]
6
+ name = "mudata"
7
+ description = "Multimodal data"
8
+ requires-python = ">= 3.10"
9
+ license = "BSD-3-Clause"
10
+ authors = [
11
+ { name = "Danila Bredikhin" },
12
+ ]
13
+ maintainers = [
14
+ { name = "Danila Bredikhin", email = "danila@stanford.edu" },
15
+ ]
16
+ readme = "README.md"
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: BSD License",
20
+ "Operating System :: OS Independent",
21
+ "Development Status :: 3 - Alpha",
22
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
23
+ "Intended Audience :: Science/Research"
24
+ ]
25
+ dependencies = [
26
+ "anndata >= 0.10.8",
27
+ ]
28
+ dynamic = ["version"]
29
+
30
+ [project.urls]
31
+ Documentation = "https://muon.readthedocs.io/en/latest/"
32
+ Source = "https://github.com/scverse/mudata"
33
+ Home-page = "https://muon.scverse.org/"
34
+
35
+ [project.optional-dependencies]
36
+ dev = [
37
+ "setuptools_scm",
38
+ ]
39
+ docs = [
40
+ "sphinx",
41
+ "sphinx-book-theme",
42
+ "pydata-sphinx-theme",
43
+ "readthedocs-sphinx-search",
44
+ "nbsphinx",
45
+ "sphinx_automodapi",
46
+ "recommonmark"
47
+ ]
48
+ test = [
49
+ "zarr"
50
+ ]
51
+
52
+ [tool.pytest.ini_options]
53
+ python_files = "test_*.py"
54
+ testpaths = [
55
+ "./tests", # unit tests
56
+ ]
57
+
58
+ [tool.black]
59
+ line-length = 100
60
+ target-version = ['py39']
61
+
62
+ [tool.hatch.version]
63
+ source = "vcs"
64
+
65
+ [tool.hatch.build.hooks.vcs]
66
+ version-file = "src/mudata/_version.py"
67
+
68
+ [tool.hatch.build.targets.wheel]
69
+ packages = ["src/mudata"]
70
+
71
+ [tool.hatch.build.targets.sdist]
72
+ exclude = [
73
+ "/.github",
74
+ "/docs",
75
+ ]
76
+
77
+ [tool.ruff]
78
+ src = ["src"]
79
+
80
+ [tool.ruff.format]
81
+ docstring-code-format = true
82
+
83
+ [tool.ruff.lint]
84
+ select = [
85
+ "E", # Error detected by Pycodestyle
86
+ "F", # Errors detected by Pyflakes
87
+ "W", # Warning detected by Pycodestyle
88
+ "UP", # pyupgrade
89
+ "I", # isort
90
+ "TCH", # manage type checking blocks
91
+ "ICN", # Follow import conventions
92
+ "PTH", # Pathlib instead of os.path
93
+ "PT", # Pytest conventions
94
+ ]
95
+ ignore = [
96
+ # line too long -> we accept long comment lines; formatter gets rid of long code lines
97
+ "E501",
98
+ # Do not assign a lambda expression, use a def -> AnnData allows lambda expression assignments,
99
+ "E731",
100
+ # allow I, O, l as variable names -> I is the identity matrix, i, j, k, l is reasonable indexing notation
101
+ "E741",
102
+ ]
@@ -0,0 +1,55 @@
1
+ """Multimodal datasets"""
2
+
3
+ try: # See https://github.com/maresb/hatch-vcs-footgun-example
4
+ from setuptools_scm import get_version
5
+
6
+ __version__ = get_version(root="../..", relative_to=__file__)
7
+ except (ImportError, LookupError):
8
+ try:
9
+ from ._version import __version__
10
+ except ModuleNotFoundError:
11
+ raise RuntimeError("mudata is not correctly installed. Please install it, e.g. with pip.")
12
+
13
+ from anndata import AnnData
14
+
15
+ from ._core import utils
16
+ from ._core.config import set_options
17
+ from ._core.io import (
18
+ read,
19
+ read_anndata,
20
+ read_h5ad,
21
+ read_h5mu,
22
+ read_zarr,
23
+ write,
24
+ write_anndata,
25
+ write_h5ad,
26
+ write_h5mu,
27
+ write_zarr,
28
+ )
29
+ from ._core.merge import concat
30
+ from ._core.mudata import MuData
31
+ from ._core.to_ import to_anndata, to_mudata
32
+
33
+ __anndataversion__ = "0.1.0"
34
+ __mudataversion__ = "0.1.0"
35
+
36
+ __all__ = [
37
+ "__version__",
38
+ "MuData",
39
+ "AnnData",
40
+ "utils",
41
+ "set_options",
42
+ "to_anndata",
43
+ "to_mudata",
44
+ "concat",
45
+ "read",
46
+ "read_h5ad",
47
+ "read_anndata",
48
+ "read_h5mu",
49
+ "read_zarr",
50
+ "write",
51
+ "write_h5ad",
52
+ "write_anndata",
53
+ "write_h5mu",
54
+ "write_zarr",
55
+ ]
@@ -3,6 +3,7 @@ import logging as log
3
3
  OPTIONS = {
4
4
  "display_style": "text",
5
5
  "display_html_expand": 0b010,
6
+ "pull_on_update": None,
6
7
  }
7
8
 
8
9
  _VALID_OPTIONS = {
@@ -1,20 +1,18 @@
1
- from pathlib import Path
2
1
  from os import PathLike
3
- from os.path import abspath
4
- from typing import Optional, Iterator, Literal
5
- from collections import defaultdict
2
+ from pathlib import Path
3
+ from typing import Literal
6
4
  from weakref import WeakSet
7
5
 
8
6
  import anndata as ad
9
- from anndata._core.file_backing import AnnDataFileManager
10
7
  import h5py
8
+ from anndata._core.file_backing import AnnDataFileManager
11
9
 
12
10
 
13
11
  class MuDataFileManager(AnnDataFileManager):
14
12
  def __init__(
15
13
  self,
16
- filename: Optional[PathLike] = None,
17
- filemode: Optional[Literal["r", "r+"]] = None,
14
+ filename: PathLike | None = None,
15
+ filemode: Literal["r", "r+"] | None = None,
18
16
  ):
19
17
  self._counter = 0
20
18
  self._children = WeakSet()
@@ -24,8 +22,8 @@ class MuDataFileManager(AnnDataFileManager):
24
22
 
25
23
  def open(
26
24
  self,
27
- filename: Optional[PathLike] = None,
28
- filemode: Optional[Literal["r", "r+"]] = None,
25
+ filename: PathLike | None = None,
26
+ filemode: Literal["r", "r+"] | None = None,
29
27
  add_ref=False,
30
28
  ) -> bool:
31
29
  if self.is_open and (
@@ -75,7 +73,7 @@ class MuDataFileManager(AnnDataFileManager):
75
73
  return (self._file is not None) and bool(self._file.id)
76
74
 
77
75
  @AnnDataFileManager.filename.setter
78
- def filename(self, filename: Optional[PathLike]):
76
+ def filename(self, filename: PathLike | None):
79
77
  self._filename = None if filename is None else filename
80
78
 
81
79
 
@@ -98,8 +96,8 @@ class AnnDataFileManager(ad._core.file_backing.AnnDataFileManager):
98
96
 
99
97
  def open(
100
98
  self,
101
- filename: Optional[PathLike] = None,
102
- filemode: Optional[Literal["r", "r+"]] = None,
99
+ filename: PathLike | None = None,
100
+ filemode: Literal["r", "r+"] | None = None,
103
101
  ):
104
102
  if not self._parent.open(filename, filemode, add_ref=True):
105
103
  self._set_file()