cc-mapping 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,19 @@
1
+ Copyright (c) 2018 The Python Packaging Authority
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,226 @@
1
+ Metadata-Version: 2.1
2
+ Name: cc-mapping
3
+ Version: 0.1.0
4
+ Summary: Gaussian Mixture Model-based thresholding for single-cell gene expression analysis
5
+ Home-page: https://github.com/StallaertLab/cc_mapping
6
+ License: MIT
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 :: MIT 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
+ Requires-Dist: anndata (>=0.10.0,<0.11.0)
20
+ Requires-Dist: kneed (>=0.8.5,<0.9.0)
21
+ Requires-Dist: matplotlib (>=3.7.0,<4.0.0)
22
+ Requires-Dist: mpl-scatter-density (>=0.8,<0.9)
23
+ Requires-Dist: numpy (>=1.24.0)
24
+ Requires-Dist: pandas (>=2.0.0,<3.0.0)
25
+ Requires-Dist: pydantic (>=2.10.0,<3.0.0)
26
+ Requires-Dist: scikit-learn (>=1.3.0,<2.0.0)
27
+ Requires-Dist: scipy (>=1.11.0,<2.0.0)
28
+ Project-URL: Documentation, https://cc-mapping.readthedocs.io
29
+ Project-URL: Repository, https://github.com/StallaertLab/cc_mapping
30
+ Description-Content-Type: text/markdown
31
+
32
+ # cc_mapping# Cell Cycle Mapping Package
33
+
34
+
35
+
36
+ [![PyPI version](https://badge.fury.io/py/cc-mapping.svg)](https://badge.fury.io/py/cc-mapping)## Step 1: Install Environment
37
+
38
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
39
+
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)From the root directory of this repository:
41
+
42
+
43
+
44
+ **Gaussian Mixture Model-based thresholding for single-cell gene expression analysis**```
45
+
46
+ conda env create -f .\environments\cc_mapping.yml
47
+
48
+ `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.```
49
+
50
+
51
+
52
+ ## Features## Step 2: Update Global Variables
53
+
54
+
55
+
56
+ - ๐ŸŽฏ **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:
57
+
58
+ - ๐Ÿ“Š **Single & sequential thresholding** for simple or complex categorization schemes
59
+
60
+ - ๐Ÿ”„ **Sequential refinement** to progressively narrow down cell populations* cc_mapping\GLOBAL_VARIABLES\GLOBAL_VARIABLES.py
61
+
62
+ - ๐Ÿ“ˆ **Built-in visualization** with density plots and QC metrics* notebooks\GLOBAL_VARIABLES\GLOBAL_VARIABLES.py
63
+
64
+ - ๐Ÿงช **AnnData integration** for seamless single-cell workflow compatibility
65
+
66
+ - โš™๏ธ **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.
67
+
68
+
69
+
70
+ ## 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
71
+
72
+
73
+
74
+ Install from PyPI using pip:```
75
+
76
+ import sys
77
+
78
+ ```bashsys.path.append(os.getcwd())
79
+
80
+ pip install cc-mapping
81
+
82
+ ```from GLOBAL_VARIABLES.GLOBAL_VARIABLES import cc_mapping_package_dir
83
+
84
+ sys.path.append(cc_mapping_package_dir)
85
+
86
+ Or using Poetry:```
87
+
88
+
89
+
90
+ ```bash## Step 3: Use the cc_mapping package!
91
+
92
+ poetry add cc-mapping
93
+
94
+ ```There is a test notebook in the notebooks directory of this repository that can be used as an example.
95
+
96
+ ## Quick Start
97
+
98
+ ```python
99
+ import anndata as ad
100
+ from cc_mapping import GMMThresholding
101
+
102
+ # Load your AnnData object
103
+ adata = ad.read_h5ad('your_data.h5ad')
104
+
105
+ # Initialize thresholding for a gene
106
+ gmm = GMMThresholding(
107
+ adata=adata,
108
+ feature='PCNA', # Gene name
109
+ label_obs_save_str='PCNA_categories'
110
+ )
111
+
112
+ # Fit GMM with automatic component selection
113
+ gmm.fit(n_components=2)
114
+
115
+ # Categorize cells
116
+ gmm.categorize_samples(ordered_labels=['Low', 'High'])
117
+
118
+ # Get updated AnnData with new categories
119
+ adata = gmm.return_adata()
120
+
121
+ # Visualize results
122
+ fig = gmm.plot_density()
123
+ fig.savefig('pcna_thresholding.png')
124
+ ```
125
+
126
+ ## Sequential Thresholding
127
+
128
+ For more complex categorization schemes (e.g., cell cycle phases):
129
+
130
+ ```python
131
+ from cc_mapping import SequentialGMM
132
+
133
+ # Initialize sequential thresholding
134
+ seq_gmm = SequentialGMM(
135
+ adata=adata,
136
+ features=['PCNA', 'CDK1'],
137
+ parent_labels=['All'],
138
+ ordered_labels_list=[
139
+ ['PCNA-', 'PCNA+'],
140
+ ['CDK1-', 'CDK1+']
141
+ ]
142
+ )
143
+
144
+ # Run sequential refinement
145
+ seq_gmm.fit_all(n_components_list=[2, 2])
146
+ adata = seq_gmm.return_adata()
147
+
148
+ # Collapse labels to final categories
149
+ seq_gmm.collapse_labels(
150
+ final_labels=['G0', 'G1', 'S', 'G2M'],
151
+ collapse_map={
152
+ 'PCNA-_CDK1-': 'G0',
153
+ 'PCNA+_CDK1-': 'G1',
154
+ 'PCNA+_CDK1+': ['S', 'G2M']
155
+ }
156
+ )
157
+ ```
158
+
159
+ ## Boolean Label Operations
160
+
161
+ Combine categorical observations with boolean logic:
162
+
163
+ ```python
164
+ from cc_mapping import create_boolean_label_combination
165
+
166
+ adata = create_boolean_label_combination(
167
+ adata=adata,
168
+ obs_key_1='treatment',
169
+ match_values_1=['control'],
170
+ obs_key_2='cell_cycle',
171
+ match_values_2=['G0'],
172
+ operator='AND',
173
+ output_obs_key='control_G0',
174
+ true_label='control_G0',
175
+ false_label='other'
176
+ )
177
+ ```
178
+
179
+ ## Documentation
180
+
181
+ For detailed documentation, tutorials, and API reference, visit [our documentation](https://github.com/StallaertLab/cc_mapping).
182
+
183
+ ### Examples
184
+
185
+ - **Single thresholding**: See `notebooks/Single_Thresholding_Workflow.ipynb`
186
+ - **Sequential thresholding**: See `notebooks/Sequential_Thresholding_Workflow.ipynb`
187
+ - **CSV to AnnData**: See `notebooks/CSV_to_Anndata.ipynb`
188
+
189
+ ## Requirements
190
+
191
+ - Python โ‰ฅ 3.10
192
+ - AnnData โ‰ฅ 0.10.0
193
+ - NumPy < 2.0.0
194
+ - scikit-learn โ‰ฅ 1.3.0
195
+ - pandas โ‰ฅ 2.0.0
196
+ - matplotlib โ‰ฅ 3.7.0
197
+ - scipy โ‰ฅ 1.11.0
198
+ - pydantic โ‰ฅ 2.10.0
199
+
200
+ ## Citation
201
+
202
+ If you use `cc_mapping` in your research, please cite:
203
+
204
+ ```bibtex
205
+ @software{cc_mapping,
206
+ author = {Your Name},
207
+ title = {cc_mapping: GMM-based thresholding for single-cell analysis},
208
+ year = {2025},
209
+ url = {https://github.com/StallaertLab/cc_mapping}
210
+ }
211
+ ```
212
+
213
+ ## Contributing
214
+
215
+ Contributions are welcome! Please feel free to submit a Pull Request.
216
+
217
+ ## License
218
+
219
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
220
+
221
+ ## Support
222
+
223
+ - ๐Ÿ› **Bug reports**: [GitHub Issues](https://github.com/StallaertLab/cc_mapping/issues)
224
+ - ๐Ÿ’ฌ **Questions**: [GitHub Discussions](https://github.com/StallaertLab/cc_mapping/discussions)
225
+ - ๐Ÿ“ง **Email**: dap182@pitt.edu
226
+
@@ -0,0 +1,194 @@
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
+
158
+ ## Requirements
159
+
160
+ - Python โ‰ฅ 3.10
161
+ - AnnData โ‰ฅ 0.10.0
162
+ - NumPy < 2.0.0
163
+ - scikit-learn โ‰ฅ 1.3.0
164
+ - pandas โ‰ฅ 2.0.0
165
+ - matplotlib โ‰ฅ 3.7.0
166
+ - scipy โ‰ฅ 1.11.0
167
+ - pydantic โ‰ฅ 2.10.0
168
+
169
+ ## Citation
170
+
171
+ If you use `cc_mapping` in your research, please cite:
172
+
173
+ ```bibtex
174
+ @software{cc_mapping,
175
+ author = {Your Name},
176
+ title = {cc_mapping: GMM-based thresholding for single-cell analysis},
177
+ year = {2025},
178
+ url = {https://github.com/StallaertLab/cc_mapping}
179
+ }
180
+ ```
181
+
182
+ ## Contributing
183
+
184
+ Contributions are welcome! Please feel free to submit a Pull Request.
185
+
186
+ ## License
187
+
188
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
189
+
190
+ ## Support
191
+
192
+ - ๐Ÿ› **Bug reports**: [GitHub Issues](https://github.com/StallaertLab/cc_mapping/issues)
193
+ - ๐Ÿ’ฌ **Questions**: [GitHub Discussions](https://github.com/StallaertLab/cc_mapping/discussions)
194
+ - ๐Ÿ“ง **Email**: dap182@pitt.edu
@@ -0,0 +1,71 @@
1
+ [tool.poetry]
2
+ name = "cc-mapping"
3
+ version = "0.1.0"
4
+ description = "Gaussian Mixture Model-based thresholding for single-cell gene expression analysis"
5
+ authors = ["ddpoe <dap182@pitt.edu>"]
6
+ readme = "README.md"
7
+ packages = [{include = "cc_mapping", from = "src"}]
8
+ license = "MIT"
9
+ homepage = "https://github.com/StallaertLab/cc_mapping"
10
+ repository = "https://github.com/StallaertLab/cc_mapping"
11
+ documentation = "https://cc-mapping.readthedocs.io"
12
+ keywords = [
13
+ "single-cell",
14
+ "gaussian-mixture-model",
15
+ "thresholding",
16
+ "gene-expression",
17
+ "cell-cycle",
18
+ "anndata",
19
+ "bioinformatics",
20
+ "computational-biology"
21
+ ]
22
+ classifiers = [
23
+ "Development Status :: 4 - Beta",
24
+ "Intended Audience :: Science/Research",
25
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ ]
32
+
33
+ [tool.poetry.dependencies]
34
+ python = "^3.10"
35
+ numpy = ">=1.24.0"
36
+ pandas = "^2.0.0"
37
+ scipy = "^1.11.0"
38
+ scikit-learn = "^1.3.0"
39
+ matplotlib = "^3.7.0"
40
+ anndata = "^0.10.0"
41
+ pydantic = "^2.10.0"
42
+ kneed = "^0.8.5"
43
+ mpl-scatter-density = "^0.8"
44
+
45
+ [tool.poetry.group.test.dependencies]
46
+ pytest = "^8.3.5"
47
+ jupyter = "^1.1.1"
48
+
49
+ [tool.poetry.group.docs]
50
+ optional = true
51
+
52
+ [tool.poetry.group.docs.dependencies]
53
+ sphinx = "^8.0.0"
54
+ myst-parser = "^4.0.0"
55
+ sphinx-autodoc-typehints = "^2.0.0"
56
+ sphinx-copybutton = "^0.5.0"
57
+ nbsphinx = "^0.9.0"
58
+ ipykernel = "^6.29.0"
59
+ scanpydoc = "^0.13.0"
60
+ sphinx-book-theme = "^1.0.0"
61
+ pypandoc = "^1.13"
62
+ pydata-sphinx-theme = "^0.16.1"
63
+ numpydoc = "^1.9.0"
64
+ myst-nb = "^1.3.0"
65
+
66
+ [tool.pytest.ini_options]
67
+ testpaths = ["tests"]
68
+
69
+ [build-system]
70
+ requires = ["poetry-core"]
71
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,23 @@
1
+ """
2
+ cc_mapping: GMM-based thresholding for single-cell analysis.
3
+
4
+ This package provides Gaussian Mixture Model (GMM) based thresholding
5
+ for gene expression data within AnnData objects. It supports both
6
+ single-feature thresholding and sequential refinement operations.
7
+
8
+ Main functionality:
9
+ - GMMThresholding: Single-feature GMM thresholding
10
+ - SequentialGMM: Sequential refinement across multiple features
11
+ - create_boolean_label_combination: Boolean operations on categorical labels
12
+ """
13
+
14
+ from .thresholding import GMMThresholding, SequentialGMM
15
+ from .utils import create_boolean_label_combination
16
+
17
+ __all__ = [
18
+ "GMMThresholding",
19
+ "SequentialGMM",
20
+ "create_boolean_label_combination",
21
+ ]
22
+
23
+ __version__ = "0.1.0"