spacr 0.0.2__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 (65) hide show
  1. spacr-0.0.6/MANIFEST.in +1 -0
  2. {spacr-0.0.2/spacr.egg-info → spacr-0.0.6}/PKG-INFO +17 -29
  3. {spacr-0.0.2 → spacr-0.0.6}/README.md +8 -27
  4. {spacr-0.0.2 → spacr-0.0.6}/setup.py +36 -8
  5. {spacr-0.0.2 → spacr-0.0.6}/spacr/__init__.py +2 -2
  6. {spacr-0.0.2 → spacr-0.0.6}/spacr/__main__.py +0 -2
  7. spacr-0.0.6/spacr/alpha.py +807 -0
  8. {spacr-0.0.2 → spacr-0.0.6}/spacr/annotate_app.py +118 -120
  9. spacr-0.0.6/spacr/chris.py +50 -0
  10. {spacr-0.0.2 → spacr-0.0.6}/spacr/core.py +1544 -533
  11. spacr-0.0.2/spacr/train.py → spacr-0.0.6/spacr/deep_spacr.py +219 -23
  12. spacr-0.0.6/spacr/foldseek.py +779 -0
  13. spacr-0.0.6/spacr/get_alfafold_structures.py +72 -0
  14. spacr-0.0.6/spacr/graph_learning.py +320 -0
  15. spacr-0.0.6/spacr/gui.py +145 -0
  16. spacr-0.0.6/spacr/gui_2.py +90 -0
  17. {spacr-0.0.2 → spacr-0.0.6}/spacr/gui_classify_app.py +70 -80
  18. spacr-0.0.6/spacr/gui_mask_app.py +222 -0
  19. spacr-0.0.6/spacr/gui_measure_app.py +221 -0
  20. {spacr-0.0.2 → spacr-0.0.6}/spacr/gui_utils.py +376 -32
  21. {spacr-0.0.2 → spacr-0.0.6}/spacr/io.py +441 -438
  22. {spacr-0.0.2 → spacr-0.0.6}/spacr/mask_app.py +116 -9
  23. {spacr-0.0.2 → spacr-0.0.6}/spacr/measure.py +169 -69
  24. spacr-0.0.6/spacr/models/cp/toxo_pv_lumen.CP_model +0 -0
  25. {spacr-0.0.2 → spacr-0.0.6}/spacr/old_code.py +70 -2
  26. {spacr-0.0.2 → spacr-0.0.6}/spacr/plot.py +173 -17
  27. spacr-0.0.6/spacr/sequencing.py +1130 -0
  28. {spacr-0.0.2 → spacr-0.0.6}/spacr/sim.py +630 -125
  29. {spacr-0.0.2 → spacr-0.0.6}/spacr/timelapse.py +139 -10
  30. {spacr-0.0.2 → spacr-0.0.6}/spacr/utils.py +1360 -119
  31. {spacr-0.0.2 → spacr-0.0.6/spacr.egg-info}/PKG-INFO +17 -29
  32. {spacr-0.0.2 → spacr-0.0.6}/spacr.egg-info/SOURCES.txt +9 -3
  33. spacr-0.0.6/spacr.egg-info/entry_points.txt +9 -0
  34. {spacr-0.0.2 → spacr-0.0.6}/spacr.egg-info/requires.txt +8 -1
  35. {spacr-0.0.2 → spacr-0.0.6}/tests/test_train.py +1 -1
  36. spacr-0.0.2/spacr/alpha.py +0 -18
  37. spacr-0.0.2/spacr/graph_learning.py +0 -276
  38. spacr-0.0.2/spacr/graph_learning_lap.py +0 -84
  39. spacr-0.0.2/spacr/gui_mask_app.py +0 -199
  40. spacr-0.0.2/spacr/gui_measure_app.py +0 -200
  41. spacr-0.0.2/spacr/umap.py +0 -689
  42. spacr-0.0.2/spacr.egg-info/entry_points.txt +0 -7
  43. {spacr-0.0.2 → spacr-0.0.6}/LICENSE +0 -0
  44. {spacr-0.0.2 → spacr-0.0.6}/setup.cfg +0 -0
  45. {spacr-0.0.2 → spacr-0.0.6}/spacr/cli.py +0 -0
  46. {spacr-0.0.2 → spacr-0.0.6}/spacr/gui_sim_app.py +0 -0
  47. {spacr-0.0.2 → spacr-0.0.6}/spacr/logger.py +0 -0
  48. {spacr-0.0.2 → spacr-0.0.6}/spacr/version.py +0 -0
  49. {spacr-0.0.2 → spacr-0.0.6}/spacr.egg-info/dependency_links.txt +0 -0
  50. {spacr-0.0.2 → spacr-0.0.6}/spacr.egg-info/top_level.txt +0 -0
  51. {spacr-0.0.2 → spacr-0.0.6}/tests/test_annotate_app.py +0 -0
  52. {spacr-0.0.2 → spacr-0.0.6}/tests/test_core.py +0 -0
  53. {spacr-0.0.2 → spacr-0.0.6}/tests/test_gui_classify_app.py +0 -0
  54. {spacr-0.0.2 → spacr-0.0.6}/tests/test_gui_mask_app.py +0 -0
  55. {spacr-0.0.2 → spacr-0.0.6}/tests/test_gui_measure_app.py +0 -0
  56. {spacr-0.0.2 → spacr-0.0.6}/tests/test_gui_sim_app.py +0 -0
  57. {spacr-0.0.2 → spacr-0.0.6}/tests/test_gui_utils.py +0 -0
  58. {spacr-0.0.2 → spacr-0.0.6}/tests/test_io.py +0 -0
  59. {spacr-0.0.2 → spacr-0.0.6}/tests/test_mask_app.py +0 -0
  60. {spacr-0.0.2 → spacr-0.0.6}/tests/test_measure.py +0 -0
  61. {spacr-0.0.2 → spacr-0.0.6}/tests/test_plot.py +0 -0
  62. {spacr-0.0.2 → spacr-0.0.6}/tests/test_sim.py +0 -0
  63. {spacr-0.0.2 → spacr-0.0.6}/tests/test_timelapse.py +0 -0
  64. {spacr-0.0.2 → spacr-0.0.6}/tests/test_umap.py +0 -0
  65. {spacr-0.0.2 → spacr-0.0.6}/tests/test_utils.py +0 -0
@@ -0,0 +1 @@
1
+ include spacr/models/cp/*
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spacr
3
- Version: 0.0.2
3
+ Version: 0.0.6
4
4
  Summary: Spatial phenotype analysis of crisp screens (SpaCr)
5
5
  Home-page: https://github.com/EinarOlafsson/spacr
6
6
  Author: Einar Birnir Olafsson
@@ -9,6 +9,7 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
11
  License-File: LICENSE
12
+ Requires-Dist: dgl
12
13
  Requires-Dist: torch>=2.2.1
13
14
  Requires-Dist: torchvision>=0.17.1
14
15
  Requires-Dist: torch-geometric>=2.5.1
@@ -19,6 +20,7 @@ Requires-Dist: scikit-image>=0.22.0
19
20
  Requires-Dist: scikit-learn>=1.4.1
20
21
  Requires-Dist: seaborn>=0.13.2
21
22
  Requires-Dist: matplotlib>=3.8.3
23
+ Requires-Dist: shap>=0.45.0
22
24
  Requires-Dist: pillow>=10.2.0
23
25
  Requires-Dist: imageio>=2.34.0
24
26
  Requires-Dist: scipy>=1.12.0
@@ -29,8 +31,13 @@ Requires-Dist: trackpy>=0.6.2
29
31
  Requires-Dist: cellpose>=3.0.6
30
32
  Requires-Dist: IPython>=8.18.1
31
33
  Requires-Dist: opencv-python-headless>=4.9.0.80
32
- Requires-Dist: umap>=0.1.1
34
+ Requires-Dist: umap-learn>=0.5.6
33
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
34
41
  Requires-Dist: lxml>=5.1.0
35
42
  Provides-Extra: dev
36
43
  Requires-Dist: pytest>=3.9; extra == "dev"
@@ -49,7 +56,7 @@ Requires-Dist: opencv-python; extra == "full"
49
56
  <tr>
50
57
  <td>
51
58
 
52
- Spatial phenotype analysis of crisp screens (SpaCr). A collection of functions for generating cellpose masks -> single object images and measurements -> annotation and classification of single object images. Spacr uses batch normalization to facilitate accurate segmentation of objects with low foreground representation.
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.
53
60
 
54
61
  </td>
55
62
  <td>
@@ -62,9 +69,9 @@ Spatial phenotype analysis of crisp screens (SpaCr). A collection of functions f
62
69
 
63
70
  ## Features
64
71
 
65
- - **Generate Masks:** Generate cellpose masks for cells, nuclei and pathogen images.
72
+ - **Generate Masks:** Generate cellpose masks of cell, nuclei and pathogen objects.
66
73
 
67
- - **Object Measurements:** Measurements for each object including scikit-image-regionprops, intensity quantiles, shannon-entropy, pearsons and manders correlation, homogenicity and radial distribution. Measurements are saved to a sql database in object level tables.
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.
68
75
 
69
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.
70
77
 
@@ -78,11 +85,13 @@ Spatial phenotype analysis of crisp screens (SpaCr). A collection of functions f
78
85
 
79
86
  - **Simulations:** Simulate spatial phenotype screens.
80
87
 
88
+ - **Sequencing:** Map FASTQ reads to barecode and gRNA barecode metadata.
89
+
81
90
  - **Misc:** Analyze Ca oscillation, recruitment, infection rate, plaque size/count.
82
91
 
83
92
  ## Installation
84
93
 
85
- spacr requires Tkinter for its graphical user interface features.
94
+ Requires Tkinter for graphical user interface features.
86
95
 
87
96
  ### Ubuntu
88
97
 
@@ -102,29 +111,8 @@ install spacr with pip
102
111
  pip install spacr
103
112
  ```
104
113
 
105
- To run spacr GUIs after installing spacr:
114
+ Run spacr GUI:
106
115
 
107
- To generate masks:
108
- ```
109
- gui_mask
110
- ```
111
- To generate measurements and cropped images:
112
- ```
113
- gui_measure
114
- ```
115
- To curate masks for finetuning cellpose models:
116
- ```
117
- gui_make_masks
118
- ```
119
- To annotate paths to images in sql database created in gui_measure:
120
- ```
121
- gui_annotate
122
- ```
123
- Train torch CNNs/Transformers to classify single object images.
124
- ```
125
- gui_classify
126
- ```
127
- Simulate spatial phenotype screens.
128
116
  ```
129
- gui_sim
117
+ gui
130
118
  ```
@@ -8,7 +8,7 @@
8
8
  <tr>
9
9
  <td>
10
10
 
11
- Spatial phenotype analysis of crisp screens (SpaCr). A collection of functions for generating cellpose masks -> single object images and measurements -> annotation and classification of single object images. Spacr uses batch normalization to facilitate accurate segmentation of objects with low foreground representation.
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
12
 
13
13
  </td>
14
14
  <td>
@@ -21,9 +21,9 @@ Spatial phenotype analysis of crisp screens (SpaCr). A collection of functions f
21
21
 
22
22
  ## Features
23
23
 
24
- - **Generate Masks:** Generate cellpose masks for cells, nuclei and pathogen images.
24
+ - **Generate Masks:** Generate cellpose masks of cell, nuclei and pathogen objects.
25
25
 
26
- - **Object Measurements:** Measurements for each object including scikit-image-regionprops, intensity quantiles, shannon-entropy, pearsons and manders correlation, homogenicity and radial distribution. Measurements are saved to a sql database in object level tables.
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
27
 
28
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
29
 
@@ -37,11 +37,13 @@ Spatial phenotype analysis of crisp screens (SpaCr). A collection of functions f
37
37
 
38
38
  - **Simulations:** Simulate spatial phenotype screens.
39
39
 
40
+ - **Sequencing:** Map FASTQ reads to barecode and gRNA barecode metadata.
41
+
40
42
  - **Misc:** Analyze Ca oscillation, recruitment, infection rate, plaque size/count.
41
43
 
42
44
  ## Installation
43
45
 
44
- spacr requires Tkinter for its graphical user interface features.
46
+ Requires Tkinter for graphical user interface features.
45
47
 
46
48
  ### Ubuntu
47
49
 
@@ -61,29 +63,8 @@ install spacr with pip
61
63
  pip install spacr
62
64
  ```
63
65
 
64
- To run spacr GUIs after installing spacr:
66
+ Run spacr GUI:
65
67
 
66
- To generate masks:
67
- ```
68
- gui_mask
69
- ```
70
- To generate measurements and cropped images:
71
- ```
72
- gui_measure
73
- ```
74
- To curate masks for finetuning cellpose models:
75
- ```
76
- gui_make_masks
77
- ```
78
- To annotate paths to images in sql database created in gui_measure:
79
- ```
80
- gui_annotate
81
- ```
82
- Train torch CNNs/Transformers to classify single object images.
83
- ```
84
- gui_classify
85
- ```
86
- Simulate spatial phenotype screens.
87
68
  ```
88
- gui_sim
69
+ gui
89
70
  ```
@@ -1,10 +1,28 @@
1
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
2
19
 
3
20
  # Ensure you have read the README.md content into a variable, e.g., `long_description`
4
21
  with open("README.md", "r", encoding="utf-8") as fh:
5
22
  long_description = fh.read()
6
23
 
7
24
  dependencies = [
25
+ dgl_dependency,
8
26
  'torch>=2.2.1',
9
27
  'torchvision>=0.17.1',
10
28
  'torch-geometric>=2.5.1',
@@ -15,6 +33,7 @@ dependencies = [
15
33
  'scikit-learn>=1.4.1',
16
34
  'seaborn>=0.13.2',
17
35
  'matplotlib>=3.8.3',
36
+ 'shap>=0.45.0',
18
37
  'pillow>=10.2.0',
19
38
  'imageio>=2.34.0',
20
39
  'scipy>=1.12.0',
@@ -25,29 +44,38 @@ dependencies = [
25
44
  'cellpose>=3.0.6',
26
45
  'IPython>=8.18.1',
27
46
  'opencv-python-headless>=4.9.0.80',
28
- 'umap>=0.1.1',
47
+ 'umap-learn>=0.5.6',
29
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',
30
54
  'lxml>=5.1.0'
31
55
  ]
32
56
 
33
57
  setup(
34
58
  name="spacr",
35
- version="0.0.2",
59
+ version="0.0.6",
36
60
  author="Einar Birnir Olafsson",
37
61
  author_email="olafsson@med.umich.com",
38
62
  description="Spatial phenotype analysis of crisp screens (SpaCr)",
39
63
  long_description=long_description,
40
64
  url="https://github.com/EinarOlafsson/spacr",
41
65
  packages=find_packages(exclude=["tests.*", "tests"]),
66
+ include_package_data=True,
67
+ package_data={'spacr': ['models/cp/*'],},
42
68
  install_requires=dependencies,
43
69
  entry_points={
44
70
  'console_scripts': [
45
- 'gui_mask=spacr.gui_mask_app:gui_mask',
46
- 'gui_measure=spacr.gui_measure_app:gui_measure',
47
- 'gui_make_masks=spacr.mask_app:gui_make_masks',
48
- 'gui_annotation=spacr.annotate_app:gui_annotation',
49
- 'gui_classify=spacr.gui_classify_app:gui_classify',
50
- 'gui_sim=spacr.gui_sim_app:gui_sim',
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',
51
79
  ],
52
80
  },
53
81
  extras_require={
@@ -8,7 +8,7 @@ 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
14
  from . import graph_learning
@@ -26,7 +26,7 @@ __all__ = [
26
26
  "measure",
27
27
  "sim",
28
28
  "timelapse",
29
- "train",
29
+ "deep_spacr",
30
30
  "annotate_app",
31
31
  "graph_learning",
32
32
  "gui_utils",
@@ -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()