mmm4microbiome 0.1.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.
@@ -0,0 +1,16 @@
1
+ # local case studies (data + caches) -- never committed
2
+ example/
3
+
4
+ # environments and builds
5
+ .venv/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+
10
+ # caches
11
+ __pycache__/
12
+ *.py[cod]
13
+ .pytest_cache/
14
+ __marimo__/
15
+ .ipynb_checkpoints/
16
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 peiyang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.5
2
+ Name: mmm4microbiome
3
+ Version: 0.1.0
4
+ Summary: Read a StripeSankey sweep of mixed-membership models as microbiome: microbial components (MC), their taxa, and the samples behind them
5
+ Project-URL: Homepage, https://gitlab.kuleuven.be/aida-lab/public/mmm4microbiome
6
+ Project-URL: Repository, https://gitlab.kuleuven.be/aida-lab/public/mmm4microbiome.git
7
+ Author-email: Peiyang Huo <peiyang.huo@kuleuven.be>
8
+ Maintainer-email: Peiyang Huo <peiyang.huo@kuleuven.be>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2025 peiyang
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: LDA,NMF,anywidget,microbiome,mixed-membership,stripesankey,topic-modeling,visualization
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Framework :: Jupyter
34
+ Classifier: Intended Audience :: Science/Research
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.9
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
42
+ Classifier: Topic :: Scientific/Engineering :: Visualization
43
+ Requires-Python: >=3.9
44
+ Requires-Dist: anywidget>=0.9.0
45
+ Requires-Dist: numpy>=1.20.0
46
+ Requires-Dist: pandas>=1.3.0
47
+ Requires-Dist: plotly>=5.0.0
48
+ Requires-Dist: scipy>=1.7.0
49
+ Requires-Dist: stripesankey>=0.4.1
50
+ Requires-Dist: traitlets>=5.0.0
51
+ Provides-Extra: daa
52
+ Requires-Dist: scikit-bio>=0.7.0; extra == 'daa'
53
+ Requires-Dist: statsmodels>=0.14.0; extra == 'daa'
54
+ Provides-Extra: static
55
+ Requires-Dist: kaleido>=1.0.0; extra == 'static'
56
+ Description-Content-Type: text/markdown
57
+
58
+ # mmm4microbiome
59
+
60
+ mmm4microbiome is the microbiome layer on top of
61
+ [stripesankey](https://pypi.org/project/stripesankey/) (>= 0.4.1). *mmm4microbiome* reads the output of *stripesankey* and makes interpretation plots for microbiome data analysis.
62
+
63
+ ## Install
64
+
65
+ ```bash
66
+ pip install mmm4microbiome # with pip
67
+ uv add mmm4microbiome # with uv
68
+ ```
69
+
70
+ ## Input: a stripesankey base folder
71
+
72
+ Everything takes a `base` folder written by *stripesankey*:
73
+
74
+ ```python
75
+ import stripesankey as ss
76
+
77
+ ss.prepare(base, counts, feature_annotation, metadata, level="Genus")
78
+ ss.sweep(base, k_range=range(2, 11))
79
+ ```
80
+
81
+ ## Use
82
+
83
+ ```python
84
+ import mmm4microbiome as mmm
85
+
86
+ # the sweep, with captions like "MC3 · Prevotella"
87
+ mmm.stripesankey_mb(base, metadata_df=meta, hover_field="METADATA_COLUMN")
88
+ mmm.metasankey_mb(base, metadata_df=meta, hover_field="METADATA_COLUMN")
89
+
90
+ # one k, sample by sample
91
+ mmm.heatmap_sample(base, 5, metadata_df=meta, include=["METADATA_COLUMN"])
92
+ mmm.bar_sample(base, 5, metadata_df=meta, sort="METADATA_COLUMN")
93
+
94
+ # what the MCs are made of
95
+ mmm.heatmap_mc(base, 5, feature_level="Family")
96
+
97
+ # everything in one self-contained HTML page: base/visualization/onestop_app.html
98
+ mmm.onestop(base, meta)
99
+ ```
100
+
101
+ ### Taxonomic levels
102
+
103
+ The **fit level** is what `prepare(level=)` collapsed the counts to. The
104
+ **display level** (`feature_level=`) is what a figure names. By default it is
105
+ the fit level, except that an ASV (or Species) fit is shown at Genus. A coarser
106
+ level sums the probabilities of its child taxa; a level finer than the fit
107
+ cannot be recovered and falls back to the fit level with a warning.
108
+
109
+ ## License
110
+
111
+ MIT
@@ -0,0 +1,54 @@
1
+ # mmm4microbiome
2
+
3
+ mmm4microbiome is the microbiome layer on top of
4
+ [stripesankey](https://pypi.org/project/stripesankey/) (>= 0.4.1). *mmm4microbiome* reads the output of *stripesankey* and makes interpretation plots for microbiome data analysis.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ pip install mmm4microbiome # with pip
10
+ uv add mmm4microbiome # with uv
11
+ ```
12
+
13
+ ## Input: a stripesankey base folder
14
+
15
+ Everything takes a `base` folder written by *stripesankey*:
16
+
17
+ ```python
18
+ import stripesankey as ss
19
+
20
+ ss.prepare(base, counts, feature_annotation, metadata, level="Genus")
21
+ ss.sweep(base, k_range=range(2, 11))
22
+ ```
23
+
24
+ ## Use
25
+
26
+ ```python
27
+ import mmm4microbiome as mmm
28
+
29
+ # the sweep, with captions like "MC3 · Prevotella"
30
+ mmm.stripesankey_mb(base, metadata_df=meta, hover_field="METADATA_COLUMN")
31
+ mmm.metasankey_mb(base, metadata_df=meta, hover_field="METADATA_COLUMN")
32
+
33
+ # one k, sample by sample
34
+ mmm.heatmap_sample(base, 5, metadata_df=meta, include=["METADATA_COLUMN"])
35
+ mmm.bar_sample(base, 5, metadata_df=meta, sort="METADATA_COLUMN")
36
+
37
+ # what the MCs are made of
38
+ mmm.heatmap_mc(base, 5, feature_level="Family")
39
+
40
+ # everything in one self-contained HTML page: base/visualization/onestop_app.html
41
+ mmm.onestop(base, meta)
42
+ ```
43
+
44
+ ### Taxonomic levels
45
+
46
+ The **fit level** is what `prepare(level=)` collapsed the counts to. The
47
+ **display level** (`feature_level=`) is what a figure names. By default it is
48
+ the fit level, except that an ASV (or Species) fit is shown at Genus. A coarser
49
+ level sums the probabilities of its child taxa; a level finer than the fit
50
+ cannot be recovered and falls back to the fit level with a warning.
51
+
52
+ ## License
53
+
54
+ MIT
@@ -0,0 +1,90 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "mmm4microbiome"
7
+ dynamic = ["version"]
8
+ description = "Read a StripeSankey sweep of mixed-membership models as microbiome: microbial components (MC), their taxa, and the samples behind them"
9
+ readme = "README.md"
10
+ license = {file = "LICENSE"}
11
+ authors = [
12
+ {name = "Peiyang Huo", email = "peiyang.huo@kuleuven.be"}
13
+ ]
14
+ maintainers = [
15
+ {name = "Peiyang Huo", email = "peiyang.huo@kuleuven.be"}
16
+ ]
17
+ keywords = [
18
+ "microbiome",
19
+ "mixed-membership",
20
+ "topic-modeling",
21
+ "LDA",
22
+ "NMF",
23
+ "stripesankey",
24
+ "anywidget",
25
+ "visualization",
26
+ ]
27
+ classifiers = [
28
+ "Development Status :: 3 - Alpha",
29
+ "Intended Audience :: Science/Research",
30
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
31
+ "Topic :: Scientific/Engineering :: Visualization",
32
+ "Framework :: Jupyter",
33
+ "License :: OSI Approved :: MIT License",
34
+ "Programming Language :: Python :: 3",
35
+ "Programming Language :: Python :: 3.9",
36
+ "Programming Language :: Python :: 3.10",
37
+ "Programming Language :: Python :: 3.11",
38
+ "Programming Language :: Python :: 3.12",
39
+ ]
40
+ requires-python = ">=3.9"
41
+ dependencies = [
42
+ # the upstream: prepare / sweep / consensus write the base folder this
43
+ # package reads, and its widget draws the Sankey (>= 0.4.1 for the
44
+ # per-component annotation interface).
45
+ "stripesankey>=0.4.1",
46
+ "numpy>=1.20.0",
47
+ "pandas>=1.3.0",
48
+ "scipy>=1.7.0",
49
+ "anywidget>=0.9.0",
50
+ "traitlets>=5.0.0",
51
+ "plotly>=5.0.0",
52
+ ]
53
+
54
+ [project.optional-dependencies]
55
+ # compare_groups(): differential abundance (ANCOM-BC, Dirichlet-multinomial,
56
+ # Wilcoxon on CLR) and PERMANOVA. Imported only when compare_groups runs.
57
+ daa = [
58
+ "scikit-bio>=0.7.0",
59
+ "statsmodels>=0.14.0",
60
+ ]
61
+ # .svg / .png output of the plotly figures (heatmap_mc, mc_profile, da_barplot).
62
+ static = [
63
+ "kaleido>=1.0.0",
64
+ ]
65
+
66
+ [dependency-groups]
67
+ dev = [
68
+ "pytest>=7.0",
69
+ ]
70
+
71
+ [project.urls]
72
+ Homepage = "https://gitlab.kuleuven.be/aida-lab/public/mmm4microbiome"
73
+ Repository = "https://gitlab.kuleuven.be/aida-lab/public/mmm4microbiome.git"
74
+
75
+ [tool.hatch.version]
76
+ path = "src/mmm4microbiome/__init__.py"
77
+
78
+ [tool.hatch.build.targets.sdist]
79
+ include = [
80
+ "src/mmm4microbiome",
81
+ "tests",
82
+ "README.md",
83
+ "LICENSE",
84
+ ]
85
+
86
+ [tool.hatch.build.targets.wheel]
87
+ packages = ["src/mmm4microbiome"]
88
+
89
+ [tool.pytest.ini_options]
90
+ testpaths = ["tests"]
@@ -0,0 +1,47 @@
1
+ """
2
+ mmm4microbiome: read a mixed-membership sweep as microbiome.
3
+
4
+ Downstream of ``stripesankey`` (>= 0.4.1): ``stripesankey.prepare`` and
5
+ ``stripesankey.sweep`` write a base folder, and everything here reads it. A
6
+ component is called **MC** (microbial component), and its H row is mapped to
7
+ taxa through ``feature_annotation.csv``. Fitting, consensus and the Sankey
8
+ widget itself stay in stripesankey::
9
+
10
+ import stripesankey as ss
11
+ import mmm4microbiome as mmm
12
+
13
+ ss.prepare(base, counts, feature_annotation, metadata, level="Genus")
14
+ ss.sweep(base, k_range=range(2, 11))
15
+
16
+ mmm.stripesankey_mb(base, metadata_df=meta, hover_field="Country")
17
+ mmm.heatmap_mc(base, 5)
18
+ mmm.compare_groups(base, "K5MC2", "K5MC0")
19
+ mmm.onestop(base, meta)
20
+ """
21
+
22
+ __version__ = "0.1.0"
23
+
24
+ from ._base import (dominant_samples, fit_level, k_values, load_clusters, load_counts,
25
+ load_mc, mc_feature_table, parse_mc, taxonomy_for_features)
26
+ from .sankey import stripesankey_mb, metasankey_mb
27
+ from .sample import SampleHeatmapInline, heatmap_sample, bar_sample
28
+ from .features import heatmap_mc, mc_profile
29
+ from .da_barplot import da_barplot
30
+ from .compare import compare_groups, CompareReport, DAA_METHODS
31
+ from .onestop import onestop
32
+
33
+ __all__ = [
34
+ # the base folder
35
+ "k_values", "fit_level", "load_mc", "load_clusters", "load_counts",
36
+ "mc_feature_table", "taxonomy_for_features", "parse_mc", "dominant_samples",
37
+ # the sweep
38
+ "stripesankey_mb", "metasankey_mb",
39
+ # one k, sample by sample
40
+ "SampleHeatmapInline", "heatmap_sample", "bar_sample",
41
+ # what the MCs are made of
42
+ "heatmap_mc", "mc_profile",
43
+ # two groups compared
44
+ "compare_groups", "CompareReport", "DAA_METHODS", "da_barplot",
45
+ # everything in one page
46
+ "onestop",
47
+ ]