cc-mapping 0.2.6__tar.gz → 0.2.7__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 (25) hide show
  1. cc_mapping-0.2.7/PKG-INFO +229 -0
  2. cc_mapping-0.2.7/README.md +192 -0
  3. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/pyproject.toml +1 -1
  4. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/__init__.py +1 -1
  5. cc_mapping-0.2.6/PKG-INFO +0 -234
  6. cc_mapping-0.2.6/README.md +0 -197
  7. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/LICENSE +0 -0
  8. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/core.py +0 -0
  9. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/feature_selection/__init__.py +0 -0
  10. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/feature_selection/_base.py +0 -0
  11. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/feature_selection/_persistence.py +0 -0
  12. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/feature_selection/_plotting.py +0 -0
  13. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/feature_selection/_preprocessing.py +0 -0
  14. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/feature_selection/_random_forest.py +0 -0
  15. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/feature_selection/_training.py +0 -0
  16. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/manifold.py +0 -0
  17. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/plot.py +0 -0
  18. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/preprocess.py +0 -0
  19. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/pseudotime.py +0 -0
  20. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/thresholding/__init__.py +0 -0
  21. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/thresholding/base.py +0 -0
  22. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/thresholding/sequential.py +0 -0
  23. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/thresholding/single.py +0 -0
  24. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/utils.py +0 -0
  25. {cc_mapping-0.2.6 → cc_mapping-0.2.7}/src/cc_mapping/utils_v0.py +0 -0
@@ -0,0 +1,229 @@
1
+ Metadata-Version: 2.1
2
+ Name: cc-mapping
3
+ Version: 0.2.7
4
+ Summary: Gaussian Mixture Model-based thresholding for single-cell gene expression analysis
5
+ Home-page: https://github.com/StallaertLab/cc_mapping
6
+ License: BSD-3-Clause
7
+ Keywords: single-cell,gaussian-mixture-model,thresholding,gene-expression,cell-cycle,anndata,bioinformatics,computational-biology
8
+ Author: ddpoe
9
+ Author-email: dap182@pitt.edu
10
+ Requires-Python: >=3.10,<4.0
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
+ Provides-Extra: manifold
20
+ Provides-Extra: persistence
21
+ Requires-Dist: anndata (>=0.10.0,<0.11.0)
22
+ Requires-Dist: kneed (>=0.8.5,<0.9.0)
23
+ Requires-Dist: matplotlib (>=3.7.0,<4.0.0)
24
+ Requires-Dist: mpl-scatter-density (>=0.8,<0.9)
25
+ Requires-Dist: numpy (>=1.24.0)
26
+ Requires-Dist: pandas (>=2.0.0,<3.0.0)
27
+ Requires-Dist: phate (>=1.0.0,<3.0.0) ; extra == "manifold"
28
+ Requires-Dist: pydantic (>=2.10.0,<3.0.0)
29
+ Requires-Dist: scikit-learn (>=1.3.0,<2.0.0)
30
+ Requires-Dist: scipy (>=1.11.0,<2.0.0)
31
+ Requires-Dist: skops (>=0.13.0,<0.14.0) ; extra == "persistence"
32
+ Requires-Dist: tqdm (>=4.67.1,<5.0.0)
33
+ Project-URL: Documentation, https://cc-mapping.readthedocs.io
34
+ Project-URL: Repository, https://github.com/StallaertLab/cc_mapping
35
+ Description-Content-Type: text/markdown
36
+
37
+ # cc_mapping
38
+
39
+ [![PyPI version](https://img.shields.io/pypi/v/cc-mapping.svg)](https://pypi.org/project/cc-mapping/)
40
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
41
+ [![Documentation](https://readthedocs.org/projects/cc-mapping/badge/?version=latest)](https://cc-mapping.readthedocs.io)
42
+ [![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://github.com/StallaertLab/cc_mapping/blob/main/LICENSE)
43
+
44
+ **Gaussian Mixture Model-based thresholding and cell cycle mapping for single-cell data**
45
+
46
+ `cc_mapping` categorizes cells by fitting Gaussian Mixture Models (GMMs) to
47
+ single-cell feature measurements stored in an [AnnData](https://anndata.readthedocs.io)
48
+ object. It was developed for cell cycle analysis, and it works for any
49
+ single-cell feature you want to split into populations (for example, low and high).
50
+
51
+ ## Features
52
+
53
+ - **Single-feature thresholding**: fit a GMM to one feature and label each cell from the fitted decision boundaries
54
+ - **Sequential thresholding**: refine one label at a time with further features, like a gating strategy
55
+ - **Manual overrides**: set thresholds by hand when you need to
56
+ - **Plots**: histograms and strip plots with the fitted components and decision boundaries
57
+ - **Feature selection**: random forest selectors that find the features that best separate your labels
58
+ - **Cell cycle maps**: PHATE embeddings of the selected features (optional dependency)
59
+ - **AnnData throughout**: labels go to `adata.obs`, and the fitted models and thresholds go to `adata.uns`
60
+
61
+ ## Installation
62
+
63
+ ```bash
64
+ pip install cc-mapping
65
+ ```
66
+
67
+ Optional extras:
68
+
69
+ ```bash
70
+ pip install "cc-mapping[manifold]" # PHATE, for cell cycle maps
71
+ pip install "cc-mapping[persistence]" # skops, to save and load fitted feature selectors
72
+ ```
73
+
74
+ To install from source:
75
+
76
+ ```bash
77
+ git clone https://github.com/StallaertLab/cc_mapping.git
78
+ cd cc_mapping
79
+ pip install -e .
80
+ ```
81
+
82
+ ## Quick start
83
+
84
+ ```python
85
+ import anndata as ad
86
+ from cc_mapping import GMMThresholding
87
+
88
+ adata = ad.read_h5ad("your_data.h5ad")
89
+
90
+ # Threshold one feature (a name in adata.var_names)
91
+ gmm = GMMThresholding(
92
+ adata=adata,
93
+ feature="PCNA",
94
+ label_obs_save_str="PCNA_category",
95
+ )
96
+
97
+ # Fit a two-component GMM and label the cells
98
+ gmm.fit(n_components=2)
99
+ gmm.categorize_samples(ordered_labels=["Low", "High"])
100
+
101
+ # Plot the histogram with the fitted components and the decision boundary
102
+ gmm.plot_hist_distribution_with_boundaries(save_path="pcna_thresholding.png")
103
+
104
+ # Get a copy of the AnnData with the labels in adata.obs["PCNA_category"]
105
+ adata = gmm.return_adata()
106
+ ```
107
+
108
+ `GMMThresholding` works on a copy of your AnnData, so call `return_adata()`
109
+ to get the labelled result.
110
+
111
+ To set the threshold yourself, pass `manual_thresholds`. No fit is needed:
112
+
113
+ ```python
114
+ gmm.categorize_samples(ordered_labels=["Low", "High"], manual_thresholds=[0.05])
115
+ ```
116
+
117
+ ## Sequential thresholding
118
+
119
+ `SequentialGMM` thresholds the whole dataset once, then refines one label at
120
+ a time using other features. Each step has a name and is recorded in `adata.uns`.
121
+
122
+ ```python
123
+ from cc_mapping import SequentialGMM
124
+
125
+ seq_gmm = SequentialGMM(adata=adata)
126
+
127
+ # Step 1: split every cell on DNA content
128
+ seq_gmm.threshold_entire_dataset(
129
+ feature="DNA_content",
130
+ label_obs_save_str="cell_cycle",
131
+ n_components=2,
132
+ ordered_labels=["2N", "4N"],
133
+ operation_name="DNA_threshold",
134
+ )
135
+
136
+ # Step 2: split only the 2N cells on pRB
137
+ seq_gmm.refine_labels_with_gmm(
138
+ feature="pRB",
139
+ obs_label="cell_cycle",
140
+ value_to_refine="2N",
141
+ n_components=2,
142
+ ordered_labels=["G0", "G1"],
143
+ operation_name="pRB_refinement",
144
+ )
145
+
146
+ adata = seq_gmm.return_adata()
147
+ ```
148
+
149
+ Use `refine_labels_with_manual_thresholds` to refine a label with thresholds
150
+ you choose.
151
+
152
+ ## Combining labels
153
+
154
+ `create_boolean_label_combination` combines two categorical `adata.obs`
155
+ columns with boolean logic:
156
+
157
+ ```python
158
+ from cc_mapping import create_boolean_label_combination
159
+
160
+ adata = create_boolean_label_combination(
161
+ adata=adata,
162
+ obs_key_1="treatment",
163
+ match_values_1=["control"],
164
+ obs_key_2="cell_cycle",
165
+ match_values_2=["G0"],
166
+ operator="AND",
167
+ output_obs_key="control_G0",
168
+ true_label="control_G0",
169
+ false_label="other",
170
+ )
171
+ ```
172
+
173
+ ## Feature selection and cell cycle maps
174
+
175
+ `cc_mapping.feature_selection` selects the features that best separate a set
176
+ of labels, and `cc_mapping.manifold` embeds the cells on those features with PHATE:
177
+
178
+ ```python
179
+ from cc_mapping.feature_selection import RFMinMaxSelector
180
+ from cc_mapping.manifold import run_phate
181
+
182
+ # Find the smallest feature set that keeps classification accuracy high
183
+ selector = RFMinMaxSelector(threshold=0.05, stable_iterations=5)
184
+ selector.fit_adata(adata, adata.var_names, "cell_cycle")
185
+ selector.transform_adata(adata, var_key="selected_features")
186
+
187
+ # Embed the cells with PHATE (needs the "manifold" extra)
188
+ adata = run_phate(adata, feature_set="selected_features", layer="z_score")
189
+ # coordinates are in adata.obsm["X_phate"]
190
+ ```
191
+
192
+ `run_phate` reads from `adata.layers`, so `layer` must name a layer in your AnnData.
193
+
194
+ ## Documentation
195
+
196
+ The full documentation, tutorials and API reference are at
197
+ [cc-mapping.readthedocs.io](https://cc-mapping.readthedocs.io).
198
+
199
+ Example notebooks are in [`notebooks/`](https://github.com/StallaertLab/cc_mapping/tree/main/notebooks):
200
+
201
+ - [Single thresholding](https://github.com/StallaertLab/cc_mapping/blob/main/notebooks/Single_Thresholding_Workflow.ipynb)
202
+ - [Sequential thresholding](https://github.com/StallaertLab/cc_mapping/blob/main/notebooks/Sequential_Thresholding_Workflow.ipynb)
203
+ - [CSV to AnnData](https://github.com/StallaertLab/cc_mapping/blob/main/notebooks/CSV_to_Anndata.ipynb)
204
+ - [Cell cycle maps](https://github.com/StallaertLab/cc_mapping/blob/main/notebooks/Cell_Cycle_Map_Workflow.ipynb) (random forest feature selection and PHATE)
205
+
206
+ ## Requirements
207
+
208
+ Python 3.10 or later. `pip` installs the dependencies: numpy, pandas, scipy,
209
+ scikit-learn, matplotlib, anndata, pydantic, kneed, mpl-scatter-density and tqdm.
210
+
211
+ ## Citation
212
+
213
+ If you use `cc_mapping` in your research, please cite this repository:
214
+ <https://github.com/StallaertLab/cc_mapping>
215
+
216
+ ## Contributing
217
+
218
+ Contributions are welcome. Please open an issue or submit a pull request.
219
+
220
+ ## License
221
+
222
+ `cc_mapping` is released under the BSD 3-Clause License. See
223
+ [LICENSE](https://github.com/StallaertLab/cc_mapping/blob/main/LICENSE).
224
+
225
+ ## Support
226
+
227
+ - **Bug reports and questions**: [GitHub Issues](https://github.com/StallaertLab/cc_mapping/issues)
228
+ - **Email**: dap182@pitt.edu
229
+
@@ -0,0 +1,192 @@
1
+ # cc_mapping
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/cc-mapping.svg)](https://pypi.org/project/cc-mapping/)
4
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
5
+ [![Documentation](https://readthedocs.org/projects/cc-mapping/badge/?version=latest)](https://cc-mapping.readthedocs.io)
6
+ [![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://github.com/StallaertLab/cc_mapping/blob/main/LICENSE)
7
+
8
+ **Gaussian Mixture Model-based thresholding and cell cycle mapping for single-cell data**
9
+
10
+ `cc_mapping` categorizes cells by fitting Gaussian Mixture Models (GMMs) to
11
+ single-cell feature measurements stored in an [AnnData](https://anndata.readthedocs.io)
12
+ object. It was developed for cell cycle analysis, and it works for any
13
+ single-cell feature you want to split into populations (for example, low and high).
14
+
15
+ ## Features
16
+
17
+ - **Single-feature thresholding**: fit a GMM to one feature and label each cell from the fitted decision boundaries
18
+ - **Sequential thresholding**: refine one label at a time with further features, like a gating strategy
19
+ - **Manual overrides**: set thresholds by hand when you need to
20
+ - **Plots**: histograms and strip plots with the fitted components and decision boundaries
21
+ - **Feature selection**: random forest selectors that find the features that best separate your labels
22
+ - **Cell cycle maps**: PHATE embeddings of the selected features (optional dependency)
23
+ - **AnnData throughout**: labels go to `adata.obs`, and the fitted models and thresholds go to `adata.uns`
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install cc-mapping
29
+ ```
30
+
31
+ Optional extras:
32
+
33
+ ```bash
34
+ pip install "cc-mapping[manifold]" # PHATE, for cell cycle maps
35
+ pip install "cc-mapping[persistence]" # skops, to save and load fitted feature selectors
36
+ ```
37
+
38
+ To install from source:
39
+
40
+ ```bash
41
+ git clone https://github.com/StallaertLab/cc_mapping.git
42
+ cd cc_mapping
43
+ pip install -e .
44
+ ```
45
+
46
+ ## Quick start
47
+
48
+ ```python
49
+ import anndata as ad
50
+ from cc_mapping import GMMThresholding
51
+
52
+ adata = ad.read_h5ad("your_data.h5ad")
53
+
54
+ # Threshold one feature (a name in adata.var_names)
55
+ gmm = GMMThresholding(
56
+ adata=adata,
57
+ feature="PCNA",
58
+ label_obs_save_str="PCNA_category",
59
+ )
60
+
61
+ # Fit a two-component GMM and label the cells
62
+ gmm.fit(n_components=2)
63
+ gmm.categorize_samples(ordered_labels=["Low", "High"])
64
+
65
+ # Plot the histogram with the fitted components and the decision boundary
66
+ gmm.plot_hist_distribution_with_boundaries(save_path="pcna_thresholding.png")
67
+
68
+ # Get a copy of the AnnData with the labels in adata.obs["PCNA_category"]
69
+ adata = gmm.return_adata()
70
+ ```
71
+
72
+ `GMMThresholding` works on a copy of your AnnData, so call `return_adata()`
73
+ to get the labelled result.
74
+
75
+ To set the threshold yourself, pass `manual_thresholds`. No fit is needed:
76
+
77
+ ```python
78
+ gmm.categorize_samples(ordered_labels=["Low", "High"], manual_thresholds=[0.05])
79
+ ```
80
+
81
+ ## Sequential thresholding
82
+
83
+ `SequentialGMM` thresholds the whole dataset once, then refines one label at
84
+ a time using other features. Each step has a name and is recorded in `adata.uns`.
85
+
86
+ ```python
87
+ from cc_mapping import SequentialGMM
88
+
89
+ seq_gmm = SequentialGMM(adata=adata)
90
+
91
+ # Step 1: split every cell on DNA content
92
+ seq_gmm.threshold_entire_dataset(
93
+ feature="DNA_content",
94
+ label_obs_save_str="cell_cycle",
95
+ n_components=2,
96
+ ordered_labels=["2N", "4N"],
97
+ operation_name="DNA_threshold",
98
+ )
99
+
100
+ # Step 2: split only the 2N cells on pRB
101
+ seq_gmm.refine_labels_with_gmm(
102
+ feature="pRB",
103
+ obs_label="cell_cycle",
104
+ value_to_refine="2N",
105
+ n_components=2,
106
+ ordered_labels=["G0", "G1"],
107
+ operation_name="pRB_refinement",
108
+ )
109
+
110
+ adata = seq_gmm.return_adata()
111
+ ```
112
+
113
+ Use `refine_labels_with_manual_thresholds` to refine a label with thresholds
114
+ you choose.
115
+
116
+ ## Combining labels
117
+
118
+ `create_boolean_label_combination` combines two categorical `adata.obs`
119
+ columns with boolean logic:
120
+
121
+ ```python
122
+ from cc_mapping import create_boolean_label_combination
123
+
124
+ adata = create_boolean_label_combination(
125
+ adata=adata,
126
+ obs_key_1="treatment",
127
+ match_values_1=["control"],
128
+ obs_key_2="cell_cycle",
129
+ match_values_2=["G0"],
130
+ operator="AND",
131
+ output_obs_key="control_G0",
132
+ true_label="control_G0",
133
+ false_label="other",
134
+ )
135
+ ```
136
+
137
+ ## Feature selection and cell cycle maps
138
+
139
+ `cc_mapping.feature_selection` selects the features that best separate a set
140
+ of labels, and `cc_mapping.manifold` embeds the cells on those features with PHATE:
141
+
142
+ ```python
143
+ from cc_mapping.feature_selection import RFMinMaxSelector
144
+ from cc_mapping.manifold import run_phate
145
+
146
+ # Find the smallest feature set that keeps classification accuracy high
147
+ selector = RFMinMaxSelector(threshold=0.05, stable_iterations=5)
148
+ selector.fit_adata(adata, adata.var_names, "cell_cycle")
149
+ selector.transform_adata(adata, var_key="selected_features")
150
+
151
+ # Embed the cells with PHATE (needs the "manifold" extra)
152
+ adata = run_phate(adata, feature_set="selected_features", layer="z_score")
153
+ # coordinates are in adata.obsm["X_phate"]
154
+ ```
155
+
156
+ `run_phate` reads from `adata.layers`, so `layer` must name a layer in your AnnData.
157
+
158
+ ## Documentation
159
+
160
+ The full documentation, tutorials and API reference are at
161
+ [cc-mapping.readthedocs.io](https://cc-mapping.readthedocs.io).
162
+
163
+ Example notebooks are in [`notebooks/`](https://github.com/StallaertLab/cc_mapping/tree/main/notebooks):
164
+
165
+ - [Single thresholding](https://github.com/StallaertLab/cc_mapping/blob/main/notebooks/Single_Thresholding_Workflow.ipynb)
166
+ - [Sequential thresholding](https://github.com/StallaertLab/cc_mapping/blob/main/notebooks/Sequential_Thresholding_Workflow.ipynb)
167
+ - [CSV to AnnData](https://github.com/StallaertLab/cc_mapping/blob/main/notebooks/CSV_to_Anndata.ipynb)
168
+ - [Cell cycle maps](https://github.com/StallaertLab/cc_mapping/blob/main/notebooks/Cell_Cycle_Map_Workflow.ipynb) (random forest feature selection and PHATE)
169
+
170
+ ## Requirements
171
+
172
+ Python 3.10 or later. `pip` installs the dependencies: numpy, pandas, scipy,
173
+ scikit-learn, matplotlib, anndata, pydantic, kneed, mpl-scatter-density and tqdm.
174
+
175
+ ## Citation
176
+
177
+ If you use `cc_mapping` in your research, please cite this repository:
178
+ <https://github.com/StallaertLab/cc_mapping>
179
+
180
+ ## Contributing
181
+
182
+ Contributions are welcome. Please open an issue or submit a pull request.
183
+
184
+ ## License
185
+
186
+ `cc_mapping` is released under the BSD 3-Clause License. See
187
+ [LICENSE](https://github.com/StallaertLab/cc_mapping/blob/main/LICENSE).
188
+
189
+ ## Support
190
+
191
+ - **Bug reports and questions**: [GitHub Issues](https://github.com/StallaertLab/cc_mapping/issues)
192
+ - **Email**: dap182@pitt.edu
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cc-mapping"
3
- version = "0.2.6"
3
+ version = "0.2.7"
4
4
  description = "Gaussian Mixture Model-based thresholding for single-cell gene expression analysis"
5
5
  authors = ["ddpoe <dap182@pitt.edu>"]
6
6
  readme = "README.md"
@@ -20,4 +20,4 @@ __all__ = [
20
20
  "create_boolean_label_combination",
21
21
  ]
22
22
 
23
- __version__ = "0.2.6"
23
+ __version__ = "0.2.7"
cc_mapping-0.2.6/PKG-INFO DELETED
@@ -1,234 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: cc-mapping
3
- Version: 0.2.6
4
- Summary: Gaussian Mixture Model-based thresholding for single-cell gene expression analysis
5
- Home-page: https://github.com/StallaertLab/cc_mapping
6
- License: BSD-3-Clause
7
- Keywords: single-cell,gaussian-mixture-model,thresholding,gene-expression,cell-cycle,anndata,bioinformatics,computational-biology
8
- Author: ddpoe
9
- Author-email: dap182@pitt.edu
10
- Requires-Python: >=3.10,<4.0
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Intended Audience :: Science/Research
13
- Classifier: License :: OSI Approved :: BSD License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
- Provides-Extra: manifold
20
- Provides-Extra: persistence
21
- Requires-Dist: anndata (>=0.10.0,<0.11.0)
22
- Requires-Dist: kneed (>=0.8.5,<0.9.0)
23
- Requires-Dist: matplotlib (>=3.7.0,<4.0.0)
24
- Requires-Dist: mpl-scatter-density (>=0.8,<0.9)
25
- Requires-Dist: numpy (>=1.24.0)
26
- Requires-Dist: pandas (>=2.0.0,<3.0.0)
27
- Requires-Dist: phate (>=1.0.0,<3.0.0) ; extra == "manifold"
28
- Requires-Dist: pydantic (>=2.10.0,<3.0.0)
29
- Requires-Dist: scikit-learn (>=1.3.0,<2.0.0)
30
- Requires-Dist: scipy (>=1.11.0,<2.0.0)
31
- Requires-Dist: skops (>=0.13.0,<0.14.0) ; extra == "persistence"
32
- Requires-Dist: tqdm (>=4.67.1,<5.0.0)
33
- Project-URL: Documentation, https://cc-mapping.readthedocs.io
34
- Project-URL: Repository, https://github.com/StallaertLab/cc_mapping
35
- Description-Content-Type: text/markdown
36
-
37
- # cc_mapping# Cell Cycle Mapping Package
38
-
39
-
40
-
41
- [![PyPI version](https://badge.fury.io/py/cc-mapping.svg)](https://badge.fury.io/py/cc-mapping)## Step 1: Install Environment
42
-
43
- [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
44
-
45
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)From the root directory of this repository:
46
-
47
-
48
-
49
- **Gaussian Mixture Model-based thresholding for single-cell gene expression analysis**```
50
-
51
- conda env create -f .\environments\cc_mapping.yml
52
-
53
- `cc_mapping` provides robust statistical methods for categorizing cells based on gene expression levels using Gaussian Mixture Models (GMMs). Originally developed for cell cycle analysis, it's applicable to any single-cell RNA-seq thresholding task.```
54
-
55
-
56
-
57
- ## Features## Step 2: Update Global Variables
58
-
59
-
60
-
61
- - 🎯 **Automatic thresholding** using GMM-based statistical inferenceDue to the fact this is not an actual package, whenever you want to use it, you will have to tell your computer where to look. You will need to update these two files:
62
-
63
- - 📊 **Single & sequential thresholding** for simple or complex categorization schemes
64
-
65
- - 🔄 **Sequential refinement** to progressively narrow down cell populations* cc_mapping\GLOBAL_VARIABLES\GLOBAL_VARIABLES.py
66
-
67
- - 📈 **Built-in visualization** with density plots and QC metrics* notebooks\GLOBAL_VARIABLES\GLOBAL_VARIABLES.py
68
-
69
- - 🧪 **AnnData integration** for seamless single-cell workflow compatibility
70
-
71
- - ⚙️ **Flexible configuration** with manual threshold overrides when neededReplace the variable 'cc_mapping_package_dir' with the path to the root directory for the cc_mapping repository.
72
-
73
-
74
-
75
- ## InstallationThis means that if you want to use the cc_mapping package in another folder, you should copy this GLOBAL VARIABLES folder into that directory and add this to the imports of your python scripts
76
-
77
-
78
-
79
- Install from PyPI using pip:```
80
-
81
- import sys
82
-
83
- ```bashsys.path.append(os.getcwd())
84
-
85
- pip install cc-mapping
86
-
87
- ```from GLOBAL_VARIABLES.GLOBAL_VARIABLES import cc_mapping_package_dir
88
-
89
- sys.path.append(cc_mapping_package_dir)
90
-
91
- Or using Poetry:```
92
-
93
-
94
-
95
- ```bash## Step 3: Use the cc_mapping package!
96
-
97
- poetry add cc-mapping
98
-
99
- ```There is a test notebook in the notebooks directory of this repository that can be used as an example.
100
-
101
- ## Quick Start
102
-
103
- ```python
104
- import anndata as ad
105
- from cc_mapping import GMMThresholding
106
-
107
- # Load your AnnData object
108
- adata = ad.read_h5ad('your_data.h5ad')
109
-
110
- # Initialize thresholding for a gene
111
- gmm = GMMThresholding(
112
- adata=adata,
113
- feature='PCNA', # Gene name
114
- label_obs_save_str='PCNA_categories'
115
- )
116
-
117
- # Fit GMM with automatic component selection
118
- gmm.fit(n_components=2)
119
-
120
- # Categorize cells
121
- gmm.categorize_samples(ordered_labels=['Low', 'High'])
122
-
123
- # Get updated AnnData with new categories
124
- adata = gmm.return_adata()
125
-
126
- # Visualize results
127
- fig = gmm.plot_density()
128
- fig.savefig('pcna_thresholding.png')
129
- ```
130
-
131
- ## Sequential Thresholding
132
-
133
- For more complex categorization schemes (e.g., cell cycle phases):
134
-
135
- ```python
136
- from cc_mapping import SequentialGMM
137
-
138
- # Initialize sequential thresholding
139
- seq_gmm = SequentialGMM(
140
- adata=adata,
141
- features=['PCNA', 'CDK1'],
142
- parent_labels=['All'],
143
- ordered_labels_list=[
144
- ['PCNA-', 'PCNA+'],
145
- ['CDK1-', 'CDK1+']
146
- ]
147
- )
148
-
149
- # Run sequential refinement
150
- seq_gmm.fit_all(n_components_list=[2, 2])
151
- adata = seq_gmm.return_adata()
152
-
153
- # Collapse labels to final categories
154
- seq_gmm.collapse_labels(
155
- final_labels=['G0', 'G1', 'S', 'G2M'],
156
- collapse_map={
157
- 'PCNA-_CDK1-': 'G0',
158
- 'PCNA+_CDK1-': 'G1',
159
- 'PCNA+_CDK1+': ['S', 'G2M']
160
- }
161
- )
162
- ```
163
-
164
- ## Boolean Label Operations
165
-
166
- Combine categorical observations with boolean logic:
167
-
168
- ```python
169
- from cc_mapping import create_boolean_label_combination
170
-
171
- adata = create_boolean_label_combination(
172
- adata=adata,
173
- obs_key_1='treatment',
174
- match_values_1=['control'],
175
- obs_key_2='cell_cycle',
176
- match_values_2=['G0'],
177
- operator='AND',
178
- output_obs_key='control_G0',
179
- true_label='control_G0',
180
- false_label='other'
181
- )
182
- ```
183
-
184
- ## Documentation
185
-
186
- For detailed documentation, tutorials, and API reference, visit [our documentation](https://github.com/StallaertLab/cc_mapping).
187
-
188
- ### Examples
189
-
190
- - **Single thresholding**: See `notebooks/Single_Thresholding_Workflow.ipynb`
191
- - **Sequential thresholding**: See `notebooks/Sequential_Thresholding_Workflow.ipynb`
192
- - **CSV to AnnData**: See `notebooks/CSV_to_Anndata.ipynb`
193
- - **Cell cycle maps** (random forest feature selection + PHATE): See `notebooks/Cell_Cycle_Map_Workflow.ipynb`
194
-
195
- ## Requirements
196
-
197
- - Python ≥ 3.10
198
- - AnnData ≥ 0.10.0
199
- - NumPy < 2.0.0
200
- - scikit-learn ≥ 1.3.0
201
- - pandas ≥ 2.0.0
202
- - matplotlib ≥ 3.7.0
203
- - scipy ≥ 1.11.0
204
- - pydantic ≥ 2.10.0
205
- - phate (optional, for cell cycle maps): `pip install "cc-mapping[manifold]"`
206
- - skops (optional, to save and load fitted feature selectors): `pip install "cc-mapping[persistence]"`
207
-
208
- ## Citation
209
-
210
- If you use `cc_mapping` in your research, please cite:
211
-
212
- ```bibtex
213
- @software{cc_mapping,
214
- author = {Your Name},
215
- title = {cc_mapping: GMM-based thresholding for single-cell analysis},
216
- year = {2025},
217
- url = {https://github.com/StallaertLab/cc_mapping}
218
- }
219
- ```
220
-
221
- ## Contributing
222
-
223
- Contributions are welcome! Please feel free to submit a Pull Request.
224
-
225
- ## License
226
-
227
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
228
-
229
- ## Support
230
-
231
- - 🐛 **Bug reports**: [GitHub Issues](https://github.com/StallaertLab/cc_mapping/issues)
232
- - 💬 **Questions**: [GitHub Discussions](https://github.com/StallaertLab/cc_mapping/discussions)
233
- - 📧 **Email**: dap182@pitt.edu
234
-
@@ -1,197 +0,0 @@
1
- # cc_mapping# Cell Cycle Mapping Package
2
-
3
-
4
-
5
- [![PyPI version](https://badge.fury.io/py/cc-mapping.svg)](https://badge.fury.io/py/cc-mapping)## Step 1: Install Environment
6
-
7
- [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
8
-
9
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)From the root directory of this repository:
10
-
11
-
12
-
13
- **Gaussian Mixture Model-based thresholding for single-cell gene expression analysis**```
14
-
15
- conda env create -f .\environments\cc_mapping.yml
16
-
17
- `cc_mapping` provides robust statistical methods for categorizing cells based on gene expression levels using Gaussian Mixture Models (GMMs). Originally developed for cell cycle analysis, it's applicable to any single-cell RNA-seq thresholding task.```
18
-
19
-
20
-
21
- ## Features## Step 2: Update Global Variables
22
-
23
-
24
-
25
- - 🎯 **Automatic thresholding** using GMM-based statistical inferenceDue to the fact this is not an actual package, whenever you want to use it, you will have to tell your computer where to look. You will need to update these two files:
26
-
27
- - 📊 **Single & sequential thresholding** for simple or complex categorization schemes
28
-
29
- - 🔄 **Sequential refinement** to progressively narrow down cell populations* cc_mapping\GLOBAL_VARIABLES\GLOBAL_VARIABLES.py
30
-
31
- - 📈 **Built-in visualization** with density plots and QC metrics* notebooks\GLOBAL_VARIABLES\GLOBAL_VARIABLES.py
32
-
33
- - 🧪 **AnnData integration** for seamless single-cell workflow compatibility
34
-
35
- - ⚙️ **Flexible configuration** with manual threshold overrides when neededReplace the variable 'cc_mapping_package_dir' with the path to the root directory for the cc_mapping repository.
36
-
37
-
38
-
39
- ## InstallationThis means that if you want to use the cc_mapping package in another folder, you should copy this GLOBAL VARIABLES folder into that directory and add this to the imports of your python scripts
40
-
41
-
42
-
43
- Install from PyPI using pip:```
44
-
45
- import sys
46
-
47
- ```bashsys.path.append(os.getcwd())
48
-
49
- pip install cc-mapping
50
-
51
- ```from GLOBAL_VARIABLES.GLOBAL_VARIABLES import cc_mapping_package_dir
52
-
53
- sys.path.append(cc_mapping_package_dir)
54
-
55
- Or using Poetry:```
56
-
57
-
58
-
59
- ```bash## Step 3: Use the cc_mapping package!
60
-
61
- poetry add cc-mapping
62
-
63
- ```There is a test notebook in the notebooks directory of this repository that can be used as an example.
64
-
65
- ## Quick Start
66
-
67
- ```python
68
- import anndata as ad
69
- from cc_mapping import GMMThresholding
70
-
71
- # Load your AnnData object
72
- adata = ad.read_h5ad('your_data.h5ad')
73
-
74
- # Initialize thresholding for a gene
75
- gmm = GMMThresholding(
76
- adata=adata,
77
- feature='PCNA', # Gene name
78
- label_obs_save_str='PCNA_categories'
79
- )
80
-
81
- # Fit GMM with automatic component selection
82
- gmm.fit(n_components=2)
83
-
84
- # Categorize cells
85
- gmm.categorize_samples(ordered_labels=['Low', 'High'])
86
-
87
- # Get updated AnnData with new categories
88
- adata = gmm.return_adata()
89
-
90
- # Visualize results
91
- fig = gmm.plot_density()
92
- fig.savefig('pcna_thresholding.png')
93
- ```
94
-
95
- ## Sequential Thresholding
96
-
97
- For more complex categorization schemes (e.g., cell cycle phases):
98
-
99
- ```python
100
- from cc_mapping import SequentialGMM
101
-
102
- # Initialize sequential thresholding
103
- seq_gmm = SequentialGMM(
104
- adata=adata,
105
- features=['PCNA', 'CDK1'],
106
- parent_labels=['All'],
107
- ordered_labels_list=[
108
- ['PCNA-', 'PCNA+'],
109
- ['CDK1-', 'CDK1+']
110
- ]
111
- )
112
-
113
- # Run sequential refinement
114
- seq_gmm.fit_all(n_components_list=[2, 2])
115
- adata = seq_gmm.return_adata()
116
-
117
- # Collapse labels to final categories
118
- seq_gmm.collapse_labels(
119
- final_labels=['G0', 'G1', 'S', 'G2M'],
120
- collapse_map={
121
- 'PCNA-_CDK1-': 'G0',
122
- 'PCNA+_CDK1-': 'G1',
123
- 'PCNA+_CDK1+': ['S', 'G2M']
124
- }
125
- )
126
- ```
127
-
128
- ## Boolean Label Operations
129
-
130
- Combine categorical observations with boolean logic:
131
-
132
- ```python
133
- from cc_mapping import create_boolean_label_combination
134
-
135
- adata = create_boolean_label_combination(
136
- adata=adata,
137
- obs_key_1='treatment',
138
- match_values_1=['control'],
139
- obs_key_2='cell_cycle',
140
- match_values_2=['G0'],
141
- operator='AND',
142
- output_obs_key='control_G0',
143
- true_label='control_G0',
144
- false_label='other'
145
- )
146
- ```
147
-
148
- ## Documentation
149
-
150
- For detailed documentation, tutorials, and API reference, visit [our documentation](https://github.com/StallaertLab/cc_mapping).
151
-
152
- ### Examples
153
-
154
- - **Single thresholding**: See `notebooks/Single_Thresholding_Workflow.ipynb`
155
- - **Sequential thresholding**: See `notebooks/Sequential_Thresholding_Workflow.ipynb`
156
- - **CSV to AnnData**: See `notebooks/CSV_to_Anndata.ipynb`
157
- - **Cell cycle maps** (random forest feature selection + PHATE): See `notebooks/Cell_Cycle_Map_Workflow.ipynb`
158
-
159
- ## Requirements
160
-
161
- - Python ≥ 3.10
162
- - AnnData ≥ 0.10.0
163
- - NumPy < 2.0.0
164
- - scikit-learn ≥ 1.3.0
165
- - pandas ≥ 2.0.0
166
- - matplotlib ≥ 3.7.0
167
- - scipy ≥ 1.11.0
168
- - pydantic ≥ 2.10.0
169
- - phate (optional, for cell cycle maps): `pip install "cc-mapping[manifold]"`
170
- - skops (optional, to save and load fitted feature selectors): `pip install "cc-mapping[persistence]"`
171
-
172
- ## Citation
173
-
174
- If you use `cc_mapping` in your research, please cite:
175
-
176
- ```bibtex
177
- @software{cc_mapping,
178
- author = {Your Name},
179
- title = {cc_mapping: GMM-based thresholding for single-cell analysis},
180
- year = {2025},
181
- url = {https://github.com/StallaertLab/cc_mapping}
182
- }
183
- ```
184
-
185
- ## Contributing
186
-
187
- Contributions are welcome! Please feel free to submit a Pull Request.
188
-
189
- ## License
190
-
191
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
192
-
193
- ## Support
194
-
195
- - 🐛 **Bug reports**: [GitHub Issues](https://github.com/StallaertLab/cc_mapping/issues)
196
- - 💬 **Questions**: [GitHub Discussions](https://github.com/StallaertLab/cc_mapping/discussions)
197
- - 📧 **Email**: dap182@pitt.edu
File without changes