spacr 0.0.1__tar.gz → 0.0.6__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 (75) hide show
  1. spacr-0.0.6/MANIFEST.in +1 -0
  2. spacr-0.0.6/PKG-INFO +118 -0
  3. spacr-0.0.6/README.md +70 -0
  4. spacr-0.0.6/setup.py +91 -0
  5. {spacr-0.0.1 → spacr-0.0.6}/spacr/__init__.py +6 -2
  6. {spacr-0.0.1 → spacr-0.0.6}/spacr/__main__.py +0 -2
  7. spacr-0.0.6/spacr/alpha.py +807 -0
  8. {spacr-0.0.1 → spacr-0.0.6}/spacr/annotate_app.py +118 -120
  9. spacr-0.0.6/spacr/chris.py +50 -0
  10. spacr-0.0.6/spacr/cli.py +41 -0
  11. {spacr-0.0.1 → spacr-0.0.6}/spacr/core.py +1611 -389
  12. spacr-0.0.1/spacr/train.py → spacr-0.0.6/spacr/deep_spacr.py +226 -24
  13. spacr-0.0.6/spacr/foldseek.py +779 -0
  14. spacr-0.0.6/spacr/get_alfafold_structures.py +72 -0
  15. spacr-0.0.6/spacr/graph_learning.py +320 -0
  16. spacr-0.0.6/spacr/gui.py +145 -0
  17. spacr-0.0.6/spacr/gui_2.py +90 -0
  18. spacr-0.0.6/spacr/gui_classify_app.py +187 -0
  19. spacr-0.0.6/spacr/gui_mask_app.py +222 -0
  20. spacr-0.0.6/spacr/gui_measure_app.py +221 -0
  21. spacr-0.0.6/spacr/gui_utils.py +1028 -0
  22. {spacr-0.0.1 → spacr-0.0.6}/spacr/io.py +620 -469
  23. {spacr-0.0.1 → spacr-0.0.6}/spacr/mask_app.py +116 -9
  24. {spacr-0.0.1 → spacr-0.0.6}/spacr/measure.py +178 -84
  25. spacr-0.0.6/spacr/models/cp/toxo_pv_lumen.CP_model +0 -0
  26. spacr-0.0.6/spacr/old_code.py +358 -0
  27. {spacr-0.0.1 → spacr-0.0.6}/spacr/plot.py +263 -100
  28. spacr-0.0.6/spacr/sequencing.py +1130 -0
  29. {spacr-0.0.1 → spacr-0.0.6}/spacr/sim.py +634 -122
  30. {spacr-0.0.1 → spacr-0.0.6}/spacr/timelapse.py +343 -53
  31. {spacr-0.0.1 → spacr-0.0.6}/spacr/utils.py +1530 -188
  32. spacr-0.0.6/spacr.egg-info/PKG-INFO +118 -0
  33. {spacr-0.0.1 → spacr-0.0.6}/spacr.egg-info/SOURCES.txt +24 -3
  34. spacr-0.0.6/spacr.egg-info/entry_points.txt +9 -0
  35. spacr-0.0.6/spacr.egg-info/requires.txt +39 -0
  36. spacr-0.0.6/tests/test_annotate_app.py +58 -0
  37. spacr-0.0.6/tests/test_core.py +65 -0
  38. spacr-0.0.6/tests/test_gui_classify_app.py +28 -0
  39. spacr-0.0.6/tests/test_gui_mask_app.py +28 -0
  40. spacr-0.0.6/tests/test_gui_measure_app.py +28 -0
  41. spacr-0.0.6/tests/test_gui_sim_app.py +28 -0
  42. spacr-0.0.6/tests/test_gui_utils.py +90 -0
  43. spacr-0.0.6/tests/test_io.py +52 -0
  44. spacr-0.0.6/tests/test_mask_app.py +75 -0
  45. spacr-0.0.6/tests/test_measure.py +58 -0
  46. spacr-0.0.6/tests/test_plot.py +43 -0
  47. spacr-0.0.6/tests/test_sim.py +35 -0
  48. spacr-0.0.6/tests/test_timelapse.py +41 -0
  49. spacr-0.0.6/tests/test_train.py +39 -0
  50. spacr-0.0.6/tests/test_umap.py +43 -0
  51. spacr-0.0.6/tests/test_utils.py +33 -0
  52. spacr-0.0.1/PKG-INFO +0 -64
  53. spacr-0.0.1/README.md +0 -25
  54. spacr-0.0.1/setup.py +0 -56
  55. spacr-0.0.1/spacr/cli.py +0 -203
  56. spacr-0.0.1/spacr/gui_mask_app.py +0 -247
  57. spacr-0.0.1/spacr/gui_measure_app.py +0 -214
  58. spacr-0.0.1/spacr/gui_utils.py +0 -488
  59. spacr-0.0.1/spacr/old_code.py +0 -104
  60. spacr-0.0.1/spacr/umap.py +0 -689
  61. spacr-0.0.1/spacr.egg-info/PKG-INFO +0 -64
  62. spacr-0.0.1/spacr.egg-info/entry_points.txt +0 -5
  63. spacr-0.0.1/spacr.egg-info/requires.txt +0 -30
  64. spacr-0.0.1/tests/test_io.py +0 -0
  65. spacr-0.0.1/tests/test_measure.py +0 -0
  66. spacr-0.0.1/tests/test_plot.py +0 -0
  67. spacr-0.0.1/tests/test_timelapse.py +0 -0
  68. spacr-0.0.1/tests/test_util.py +0 -0
  69. {spacr-0.0.1 → spacr-0.0.6}/LICENSE +0 -0
  70. {spacr-0.0.1 → spacr-0.0.6}/setup.cfg +0 -0
  71. /spacr-0.0.1/tests/test_core.py → /spacr-0.0.6/spacr/gui_sim_app.py +0 -0
  72. {spacr-0.0.1 → spacr-0.0.6}/spacr/logger.py +0 -0
  73. {spacr-0.0.1 → spacr-0.0.6}/spacr/version.py +0 -0
  74. {spacr-0.0.1 → spacr-0.0.6}/spacr.egg-info/dependency_links.txt +0 -0
  75. {spacr-0.0.1 → spacr-0.0.6}/spacr.egg-info/top_level.txt +0 -0
@@ -0,0 +1 @@
1
+ include spacr/models/cp/*
spacr-0.0.6/PKG-INFO ADDED
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.1
2
+ Name: spacr
3
+ Version: 0.0.6
4
+ Summary: Spatial phenotype analysis of crisp screens (SpaCr)
5
+ Home-page: https://github.com/EinarOlafsson/spacr
6
+ Author: Einar Birnir Olafsson
7
+ Author-email: olafsson@med.umich.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ License-File: LICENSE
12
+ Requires-Dist: dgl
13
+ Requires-Dist: torch>=2.2.1
14
+ Requires-Dist: torchvision>=0.17.1
15
+ Requires-Dist: torch-geometric>=2.5.1
16
+ Requires-Dist: numpy>=1.26.4
17
+ Requires-Dist: pandas>=2.2.1
18
+ Requires-Dist: statsmodels>=0.14.1
19
+ Requires-Dist: scikit-image>=0.22.0
20
+ Requires-Dist: scikit-learn>=1.4.1
21
+ Requires-Dist: seaborn>=0.13.2
22
+ Requires-Dist: matplotlib>=3.8.3
23
+ Requires-Dist: shap>=0.45.0
24
+ Requires-Dist: pillow>=10.2.0
25
+ Requires-Dist: imageio>=2.34.0
26
+ Requires-Dist: scipy>=1.12.0
27
+ Requires-Dist: ipywidgets>=8.1.2
28
+ Requires-Dist: mahotas>=1.4.13
29
+ Requires-Dist: btrack>=0.6.5
30
+ Requires-Dist: trackpy>=0.6.2
31
+ Requires-Dist: cellpose>=3.0.6
32
+ Requires-Dist: IPython>=8.18.1
33
+ Requires-Dist: opencv-python-headless>=4.9.0.80
34
+ Requires-Dist: umap-learn>=0.5.6
35
+ Requires-Dist: ttkthemes>=3.2.2
36
+ Requires-Dist: xgboost>=2.0.3
37
+ Requires-Dist: PyWavelets>=1.6.0
38
+ Requires-Dist: torchcam>=0.4.0
39
+ Requires-Dist: ttf_opensans>=2020.10.30
40
+ Requires-Dist: customtkinter>=5.2.2
41
+ Requires-Dist: lxml>=5.1.0
42
+ Provides-Extra: dev
43
+ Requires-Dist: pytest>=3.9; extra == "dev"
44
+ Provides-Extra: headless
45
+ Requires-Dist: opencv-python-headless; extra == "headless"
46
+ Provides-Extra: full
47
+ Requires-Dist: opencv-python; extra == "full"
48
+
49
+ [![PyPI version](https://badge.fury.io/py/spacr.svg)](https://badge.fury.io/py/spacr)
50
+ [![Python version](https://img.shields.io/pypi/pyversions/spacr)](https://pypistats.org/packages/spacr)
51
+ [![Licence: GPL v3](https://img.shields.io/github/license/EinarOlafsson/spacr)](https://github.com/EinarOlafsson/spacr/blob/master/LICENSE)
52
+ [![repo size](https://img.shields.io/github/repo-size/EinarOlafsson/spacr)](https://github.com/EinarOlafsson/spacr/)
53
+
54
+ # SpaCr
55
+ <table>
56
+ <tr>
57
+ <td>
58
+
59
+ Spatial phenotype analysis of CRISPR-Cas9 screens (SpaCr). The spatial organization of organelles and proteins within cells constitutes a key level of functional regulation. In the context of infectious disease, the spatial relationships between host cell structures and intracellular pathogens are critical to understand host clearance mechanisms and how pathogens evade them. Spacr is a Python-based software package for generating single cell image data for deep-learning sub-cellular/cellular phenotypic classification from pooled genetic CRISPR-Cas9 screens. Spacr provides a flexible toolset to extract single cell images and measurements from high content cell painting experiments, train deep-learning models to classify cellular/ subcellular phenotypes, simulate and analyze pooled CRISPR-Cas9 imaging screens.
60
+
61
+ </td>
62
+ <td>
63
+
64
+ <img src="spacr/logo_spacr.png" alt="SPACR Logo" title="SPACR Logo" width="600"/>
65
+
66
+ </td>
67
+ </tr>
68
+ </table>
69
+
70
+ ## Features
71
+
72
+ - **Generate Masks:** Generate cellpose masks of cell, nuclei and pathogen objects.
73
+
74
+ - **Object Measurements:** Measurements for each object including scikit-image-regionprops, intensity percentiles, shannon-entropy, pearsons and manders correlations, homogenicity and radial distribution. Measurements are saved to a sql database in object level tables.
75
+
76
+ - **Crop Images:** Objects (e.g. cells) can be saved as PNGs from the object area or bounding box area of each object. Object paths are saved in an sql database that can be annotated and used to train CNNs/Transformer models for classefication tasks.
77
+
78
+ - **Train CNNs or Transformers:** Train Torch Convolutional Neural Networks (CNNs) or Transformers to classify single object images. Train Torch models with IRM/ERM, checkpointing.
79
+
80
+ - **Manual Annotation:** Supports manual annotation of single cell images and segmentation to refine training datasets for training CNNs/Transformers or cellpose, respectively.
81
+
82
+ - **Finetune Cellpose Models:** Adjust pre-existing Cellpose models to your specific dataset for improved performance.
83
+
84
+ - **Timelapse Data Support:** Track objects in timelapse image data.
85
+
86
+ - **Simulations:** Simulate spatial phenotype screens.
87
+
88
+ - **Sequencing:** Map FASTQ reads to barecode and gRNA barecode metadata.
89
+
90
+ - **Misc:** Analyze Ca oscillation, recruitment, infection rate, plaque size/count.
91
+
92
+ ## Installation
93
+
94
+ Requires Tkinter for graphical user interface features.
95
+
96
+ ### Ubuntu
97
+
98
+ Before installing spacr, ensure Tkinter is installed:
99
+
100
+ (Tkinter is included with the standard Python installation on macOS, and Windows)
101
+
102
+ On Linux:
103
+
104
+ ```
105
+ sudo apt-get install python3-tk
106
+ ```
107
+
108
+ install spacr with pip
109
+
110
+ ```
111
+ pip install spacr
112
+ ```
113
+
114
+ Run spacr GUI:
115
+
116
+ ```
117
+ gui
118
+ ```
spacr-0.0.6/README.md ADDED
@@ -0,0 +1,70 @@
1
+ [![PyPI version](https://badge.fury.io/py/spacr.svg)](https://badge.fury.io/py/spacr)
2
+ [![Python version](https://img.shields.io/pypi/pyversions/spacr)](https://pypistats.org/packages/spacr)
3
+ [![Licence: GPL v3](https://img.shields.io/github/license/EinarOlafsson/spacr)](https://github.com/EinarOlafsson/spacr/blob/master/LICENSE)
4
+ [![repo size](https://img.shields.io/github/repo-size/EinarOlafsson/spacr)](https://github.com/EinarOlafsson/spacr/)
5
+
6
+ # SpaCr
7
+ <table>
8
+ <tr>
9
+ <td>
10
+
11
+ Spatial phenotype analysis of CRISPR-Cas9 screens (SpaCr). The spatial organization of organelles and proteins within cells constitutes a key level of functional regulation. In the context of infectious disease, the spatial relationships between host cell structures and intracellular pathogens are critical to understand host clearance mechanisms and how pathogens evade them. Spacr is a Python-based software package for generating single cell image data for deep-learning sub-cellular/cellular phenotypic classification from pooled genetic CRISPR-Cas9 screens. Spacr provides a flexible toolset to extract single cell images and measurements from high content cell painting experiments, train deep-learning models to classify cellular/ subcellular phenotypes, simulate and analyze pooled CRISPR-Cas9 imaging screens.
12
+
13
+ </td>
14
+ <td>
15
+
16
+ <img src="spacr/logo_spacr.png" alt="SPACR Logo" title="SPACR Logo" width="600"/>
17
+
18
+ </td>
19
+ </tr>
20
+ </table>
21
+
22
+ ## Features
23
+
24
+ - **Generate Masks:** Generate cellpose masks of cell, nuclei and pathogen objects.
25
+
26
+ - **Object Measurements:** Measurements for each object including scikit-image-regionprops, intensity percentiles, shannon-entropy, pearsons and manders correlations, homogenicity and radial distribution. Measurements are saved to a sql database in object level tables.
27
+
28
+ - **Crop Images:** Objects (e.g. cells) can be saved as PNGs from the object area or bounding box area of each object. Object paths are saved in an sql database that can be annotated and used to train CNNs/Transformer models for classefication tasks.
29
+
30
+ - **Train CNNs or Transformers:** Train Torch Convolutional Neural Networks (CNNs) or Transformers to classify single object images. Train Torch models with IRM/ERM, checkpointing.
31
+
32
+ - **Manual Annotation:** Supports manual annotation of single cell images and segmentation to refine training datasets for training CNNs/Transformers or cellpose, respectively.
33
+
34
+ - **Finetune Cellpose Models:** Adjust pre-existing Cellpose models to your specific dataset for improved performance.
35
+
36
+ - **Timelapse Data Support:** Track objects in timelapse image data.
37
+
38
+ - **Simulations:** Simulate spatial phenotype screens.
39
+
40
+ - **Sequencing:** Map FASTQ reads to barecode and gRNA barecode metadata.
41
+
42
+ - **Misc:** Analyze Ca oscillation, recruitment, infection rate, plaque size/count.
43
+
44
+ ## Installation
45
+
46
+ Requires Tkinter for graphical user interface features.
47
+
48
+ ### Ubuntu
49
+
50
+ Before installing spacr, ensure Tkinter is installed:
51
+
52
+ (Tkinter is included with the standard Python installation on macOS, and Windows)
53
+
54
+ On Linux:
55
+
56
+ ```
57
+ sudo apt-get install python3-tk
58
+ ```
59
+
60
+ install spacr with pip
61
+
62
+ ```
63
+ pip install spacr
64
+ ```
65
+
66
+ Run spacr GUI:
67
+
68
+ ```
69
+ gui
70
+ ```
spacr-0.0.6/setup.py ADDED
@@ -0,0 +1,91 @@
1
+ from setuptools import setup, find_packages
2
+ import subprocess
3
+
4
+ # Function to determine the CUDA version
5
+ def get_cuda_version():
6
+ try:
7
+ output = subprocess.check_output(['nvcc', '--version'], stderr=subprocess.STDOUT).decode('utf-8')
8
+ if 'release' in output:
9
+ return output.split('release ')[1].split(',')[0].replace('.', '')
10
+ except (subprocess.CalledProcessError, FileNotFoundError):
11
+ return None
12
+
13
+ cuda_version = get_cuda_version()
14
+
15
+ if cuda_version:
16
+ dgl_dependency = f'dgl-cu{cuda_version}'
17
+ else:
18
+ dgl_dependency = 'dgl' # Fallback to CPU version if no CUDA is detected
19
+
20
+ # Ensure you have read the README.md content into a variable, e.g., `long_description`
21
+ with open("README.md", "r", encoding="utf-8") as fh:
22
+ long_description = fh.read()
23
+
24
+ dependencies = [
25
+ dgl_dependency,
26
+ 'torch>=2.2.1',
27
+ 'torchvision>=0.17.1',
28
+ 'torch-geometric>=2.5.1',
29
+ 'numpy>=1.26.4',
30
+ 'pandas>=2.2.1',
31
+ 'statsmodels>=0.14.1',
32
+ 'scikit-image>=0.22.0',
33
+ 'scikit-learn>=1.4.1',
34
+ 'seaborn>=0.13.2',
35
+ 'matplotlib>=3.8.3',
36
+ 'shap>=0.45.0',
37
+ 'pillow>=10.2.0',
38
+ 'imageio>=2.34.0',
39
+ 'scipy>=1.12.0',
40
+ 'ipywidgets>=8.1.2',
41
+ 'mahotas>=1.4.13',
42
+ 'btrack>=0.6.5',
43
+ 'trackpy>=0.6.2',
44
+ 'cellpose>=3.0.6',
45
+ 'IPython>=8.18.1',
46
+ 'opencv-python-headless>=4.9.0.80',
47
+ 'umap-learn>=0.5.6',
48
+ 'ttkthemes>=3.2.2',
49
+ 'xgboost>=2.0.3',
50
+ 'PyWavelets>=1.6.0',
51
+ 'torchcam>=0.4.0',
52
+ 'ttf_opensans>=2020.10.30',
53
+ 'customtkinter>=5.2.2',
54
+ 'lxml>=5.1.0'
55
+ ]
56
+
57
+ setup(
58
+ name="spacr",
59
+ version="0.0.6",
60
+ author="Einar Birnir Olafsson",
61
+ author_email="olafsson@med.umich.com",
62
+ description="Spatial phenotype analysis of crisp screens (SpaCr)",
63
+ long_description=long_description,
64
+ url="https://github.com/EinarOlafsson/spacr",
65
+ packages=find_packages(exclude=["tests.*", "tests"]),
66
+ include_package_data=True,
67
+ package_data={'spacr': ['models/cp/*'],},
68
+ install_requires=dependencies,
69
+ entry_points={
70
+ 'console_scripts': [
71
+ 'mask=spacr.gui_mask_app:gui_mask',
72
+ 'measure=spacr.gui_measure_app:gui_measure',
73
+ 'make_masks=spacr.mask_app:gui_make_masks',
74
+ 'annotate=spacr.annotate_app:gui_annotation',
75
+ 'classify=spacr.gui_classify_app:gui_classify',
76
+ 'sim=spacr.gui_sim_app:gui_sim',
77
+ 'gui=spacr.gui:gui_app',
78
+ 'gui2=spacr.gui_2:gui_app',
79
+ ],
80
+ },
81
+ extras_require={
82
+ 'dev': ['pytest>=3.9'],
83
+ 'headless': ['opencv-python-headless'],
84
+ 'full': ['opencv-python'],
85
+ },
86
+ classifiers=[
87
+ "Programming Language :: Python :: 3",
88
+ "License :: OSI Approved :: MIT License",
89
+ "Operating System :: OS Independent",
90
+ ]
91
+ )
@@ -8,12 +8,14 @@ from . import plot
8
8
  from . import measure
9
9
  from . import sim
10
10
  from . import timelapse
11
- from . import train
11
+ from . import deep_spacr
12
12
  from . import mask_app
13
13
  from . import annotate_app
14
+ from . import graph_learning
14
15
  from . import gui_utils
15
16
  from . import gui_mask_app
16
17
  from . import gui_measure_app
18
+ from . import gui_classify_app
17
19
  from . import logger
18
20
 
19
21
  __all__ = [
@@ -24,12 +26,14 @@ __all__ = [
24
26
  "measure",
25
27
  "sim",
26
28
  "timelapse",
27
- "train",
29
+ "deep_spacr",
28
30
  "annotate_app",
31
+ "graph_learning",
29
32
  "gui_utils",
30
33
  "mask_app",
31
34
  "gui_mask_app",
32
35
  "gui_measure_app",
36
+ "gui_classify_app",
33
37
  "logger"
34
38
  ]
35
39
 
@@ -9,7 +9,5 @@ from tqdm import tqdm
9
9
  #from spacr import utils, io, version, timelapse, plot, core, mask_app, annotate_app
10
10
  import logging
11
11
 
12
-
13
-
14
12
  if __name__ == "__main__":
15
13
  main()