spacr 0.9.1__py3-none-any.whl → 0.9.21__py3-none-any.whl
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.
- spacr/measure.py +219 -7
- spacr/resources/icons/flow_chart_v2.png +0 -0
- spacr/settings.py +6 -3
- spacr/utils.py +10 -1
- spacr-0.9.21.dist-info/METADATA +194 -0
- {spacr-0.9.1.dist-info → spacr-0.9.21.dist-info}/RECORD +10 -9
- spacr-0.9.1.dist-info/METADATA +0 -144
- {spacr-0.9.1.dist-info → spacr-0.9.21.dist-info}/LICENSE +0 -0
- {spacr-0.9.1.dist-info → spacr-0.9.21.dist-info}/WHEEL +0 -0
- {spacr-0.9.1.dist-info → spacr-0.9.21.dist-info}/entry_points.txt +0 -0
- {spacr-0.9.1.dist-info → spacr-0.9.21.dist-info}/top_level.txt +0 -0
spacr/measure.py
CHANGED
@@ -2,12 +2,11 @@ import os, cv2, time, sqlite3, traceback, shutil
|
|
2
2
|
import numpy as np
|
3
3
|
import pandas as pd
|
4
4
|
from collections import defaultdict
|
5
|
-
from scipy.stats import pearsonr
|
5
|
+
from scipy.stats import pearsonr, skew, kurtosis, mode
|
6
6
|
import multiprocessing as mp
|
7
|
-
from scipy.ndimage import distance_transform_edt, generate_binary_structure
|
7
|
+
from scipy.ndimage import distance_transform_edt, generate_binary_structure, binary_dilation, gaussian_filter, center_of_mass
|
8
8
|
from skimage.measure import regionprops, regionprops_table, shannon_entropy
|
9
9
|
from skimage.exposure import rescale_intensity
|
10
|
-
from scipy.ndimage import binary_dilation
|
11
10
|
from skimage.segmentation import find_boundaries
|
12
11
|
from skimage.feature import graycomatrix, graycoprops
|
13
12
|
from mahotas.features import zernike_moments
|
@@ -16,7 +15,6 @@ from skimage.util import img_as_bool
|
|
16
15
|
import matplotlib.pyplot as plt
|
17
16
|
from math import ceil, sqrt
|
18
17
|
|
19
|
-
|
20
18
|
def get_components(cell_mask, nucleus_mask, pathogen_mask):
|
21
19
|
"""
|
22
20
|
Get the components (nucleus and pathogens) for each cell in the given masks.
|
@@ -250,6 +248,148 @@ def _create_dataframe(radial_distributions, object_type):
|
|
250
248
|
return df
|
251
249
|
|
252
250
|
def _extended_regionprops_table(labels, image, intensity_props):
|
251
|
+
"""
|
252
|
+
Calculate extended region properties table, adding a suite of advanced quantitative features.
|
253
|
+
"""
|
254
|
+
|
255
|
+
def _gini(array):
|
256
|
+
# Compute Gini coefficient (nan safe)
|
257
|
+
array = np.abs(array[~np.isnan(array)])
|
258
|
+
n = array.size
|
259
|
+
if n == 0:
|
260
|
+
return np.nan
|
261
|
+
array = np.sort(array)
|
262
|
+
index = np.arange(1, n + 1)
|
263
|
+
return (np.sum((2 * index - n - 1) * array)) / (n * np.sum(array)) if np.sum(array) else np.nan
|
264
|
+
|
265
|
+
props = regionprops_table(labels, image, properties=intensity_props)
|
266
|
+
df = pd.DataFrame(props)
|
267
|
+
|
268
|
+
regions = regionprops(labels, intensity_image=image)
|
269
|
+
integrated_intensity = []
|
270
|
+
std_intensity = []
|
271
|
+
median_intensity = []
|
272
|
+
skew_intensity = []
|
273
|
+
kurtosis_intensity = []
|
274
|
+
mode_intensity = []
|
275
|
+
range_intensity = []
|
276
|
+
iqr_intensity = []
|
277
|
+
cv_intensity = []
|
278
|
+
gini_intensity = []
|
279
|
+
frac_high90 = []
|
280
|
+
frac_low10 = []
|
281
|
+
entropy_intensity = []
|
282
|
+
|
283
|
+
for region in regions:
|
284
|
+
intens = region.intensity_image[region.image]
|
285
|
+
intens = intens[~np.isnan(intens)]
|
286
|
+
if intens.size == 0:
|
287
|
+
integrated_intensity.append(np.nan)
|
288
|
+
std_intensity.append(np.nan)
|
289
|
+
median_intensity.append(np.nan)
|
290
|
+
skew_intensity.append(np.nan)
|
291
|
+
kurtosis_intensity.append(np.nan)
|
292
|
+
mode_intensity.append(np.nan)
|
293
|
+
range_intensity.append(np.nan)
|
294
|
+
iqr_intensity.append(np.nan)
|
295
|
+
cv_intensity.append(np.nan)
|
296
|
+
gini_intensity.append(np.nan)
|
297
|
+
frac_high90.append(np.nan)
|
298
|
+
frac_low10.append(np.nan)
|
299
|
+
entropy_intensity.append(np.nan)
|
300
|
+
else:
|
301
|
+
integrated_intensity.append(np.sum(intens))
|
302
|
+
std_intensity.append(np.std(intens))
|
303
|
+
median_intensity.append(np.median(intens))
|
304
|
+
skew_intensity.append(skew(intens) if intens.size > 2 else np.nan)
|
305
|
+
kurtosis_intensity.append(kurtosis(intens) if intens.size > 3 else np.nan)
|
306
|
+
# Mode (use first mode value if multimodal)
|
307
|
+
try:
|
308
|
+
mode_val = mode(intens, nan_policy='omit').mode
|
309
|
+
mode_intensity.append(mode_val[0] if len(mode_val) > 0 else np.nan)
|
310
|
+
except Exception:
|
311
|
+
mode_intensity.append(np.nan)
|
312
|
+
range_intensity.append(np.ptp(intens))
|
313
|
+
iqr_intensity.append(np.percentile(intens, 75) - np.percentile(intens, 25))
|
314
|
+
cv_intensity.append(np.std(intens) / np.mean(intens) if np.mean(intens) != 0 else np.nan)
|
315
|
+
gini_intensity.append(_gini(intens))
|
316
|
+
frac_high90.append(np.mean(intens > np.percentile(intens, 90)))
|
317
|
+
frac_low10.append(np.mean(intens < np.percentile(intens, 10)))
|
318
|
+
entropy_intensity.append(shannon_entropy(intens) if intens.size > 1 else 0.0)
|
319
|
+
|
320
|
+
df['integrated_intensity'] = integrated_intensity
|
321
|
+
df['std_intensity'] = std_intensity
|
322
|
+
df['median_intensity'] = median_intensity
|
323
|
+
df['skew_intensity'] = skew_intensity
|
324
|
+
df['kurtosis_intensity'] = kurtosis_intensity
|
325
|
+
df['mode_intensity'] = mode_intensity
|
326
|
+
df['range_intensity'] = range_intensity
|
327
|
+
df['iqr_intensity'] = iqr_intensity
|
328
|
+
df['cv_intensity'] = cv_intensity
|
329
|
+
df['gini_intensity'] = gini_intensity
|
330
|
+
df['frac_high90'] = frac_high90
|
331
|
+
df['frac_low10'] = frac_low10
|
332
|
+
df['entropy_intensity'] = entropy_intensity
|
333
|
+
|
334
|
+
percentiles = [5, 10, 25, 50, 75, 85, 95]
|
335
|
+
for p in percentiles:
|
336
|
+
df[f'percentile_{p}'] = [
|
337
|
+
np.percentile(region.intensity_image[region.image], p)
|
338
|
+
for region in regions
|
339
|
+
]
|
340
|
+
return df
|
341
|
+
|
342
|
+
def _extended_regionprops_table_v2(labels, image, intensity_props):
|
343
|
+
"""
|
344
|
+
Calculate extended region properties table, adding integrated intensity,
|
345
|
+
skewness, kurtosis, std, and median intensity per region.
|
346
|
+
"""
|
347
|
+
# regionprops_table gives you vectorized props, but not everything you want
|
348
|
+
props = regionprops_table(labels, image, properties=intensity_props)
|
349
|
+
df = pd.DataFrame(props)
|
350
|
+
|
351
|
+
# Compute extra features region-by-region
|
352
|
+
regions = regionprops(labels, intensity_image=image)
|
353
|
+
integrated_intensity = []
|
354
|
+
std_intensity = []
|
355
|
+
median_intensity = []
|
356
|
+
skew_intensity = []
|
357
|
+
kurtosis_intensity = []
|
358
|
+
for region in regions:
|
359
|
+
intens = region.intensity_image[region.image]
|
360
|
+
# Handle empty region edge-case (shouldn't happen)
|
361
|
+
if intens.size == 0:
|
362
|
+
integrated_intensity.append(np.nan)
|
363
|
+
std_intensity.append(np.nan)
|
364
|
+
median_intensity.append(np.nan)
|
365
|
+
skew_intensity.append(np.nan)
|
366
|
+
kurtosis_intensity.append(np.nan)
|
367
|
+
else:
|
368
|
+
integrated_intensity.append(np.sum(intens))
|
369
|
+
std_intensity.append(np.std(intens))
|
370
|
+
median_intensity.append(np.median(intens))
|
371
|
+
# Only valid for >2 pixels
|
372
|
+
skew_intensity.append(skew(intens) if intens.size > 2 else np.nan)
|
373
|
+
kurtosis_intensity.append(kurtosis(intens) if intens.size > 3 else np.nan)
|
374
|
+
|
375
|
+
df['integrated_intensity'] = integrated_intensity
|
376
|
+
df['std_intensity'] = std_intensity
|
377
|
+
df['median_intensity'] = median_intensity
|
378
|
+
df['skew_intensity'] = skew_intensity
|
379
|
+
df['kurtosis_intensity'] = kurtosis_intensity
|
380
|
+
|
381
|
+
# You can add other features here if desired
|
382
|
+
|
383
|
+
# Percentiles (your existing code—optional if you want to keep)
|
384
|
+
percentiles = [5, 10, 25, 50, 75, 85, 95]
|
385
|
+
for p in percentiles:
|
386
|
+
df[f'percentile_{p}'] = [
|
387
|
+
np.percentile(region.intensity_image[region.image], p)
|
388
|
+
for region in regions
|
389
|
+
]
|
390
|
+
return df
|
391
|
+
|
392
|
+
def _extended_regionprops_table_v1(labels, image, intensity_props):
|
253
393
|
"""
|
254
394
|
Calculate extended region properties table.
|
255
395
|
|
@@ -495,8 +635,75 @@ def _estimate_blur(image):
|
|
495
635
|
# Compute and return the variance of the Laplacian
|
496
636
|
return lap.var()
|
497
637
|
|
638
|
+
def _measure_intensity_distance(cell_mask, nucleus_mask, pathogen_mask, channel_arrays, settings):
|
639
|
+
"""
|
640
|
+
Compute Gaussian-smoothed intensity-weighted centroid distances for each cell object.
|
641
|
+
"""
|
642
|
+
|
643
|
+
sigma = settings.get('distance_gaussian_sigma', 1.0)
|
644
|
+
cell_labels = np.unique(cell_mask)
|
645
|
+
cell_labels = cell_labels[cell_labels > 0]
|
646
|
+
|
647
|
+
dfs = []
|
648
|
+
nucleus_dt = distance_transform_edt(nucleus_mask == 0)
|
649
|
+
pathogen_dt = distance_transform_edt(pathogen_mask == 0)
|
650
|
+
|
651
|
+
for ch in range(channel_arrays.shape[-1]):
|
652
|
+
channel_img = channel_arrays[:, :, ch]
|
653
|
+
blurred_img = gaussian_filter(channel_img, sigma=sigma)
|
654
|
+
|
655
|
+
data = []
|
656
|
+
for label in cell_labels:
|
657
|
+
cell_coords = np.argwhere(cell_mask == label)
|
658
|
+
if cell_coords.size == 0:
|
659
|
+
data.append([label, np.nan, np.nan])
|
660
|
+
continue
|
661
|
+
|
662
|
+
minr, minc = np.min(cell_coords, axis=0)
|
663
|
+
maxr, maxc = np.max(cell_coords, axis=0) + 1
|
664
|
+
|
665
|
+
cell_submask = (cell_mask[minr:maxr, minc:maxc] == label)
|
666
|
+
blurred_subimg = blurred_img[minr:maxr, minc:maxc]
|
667
|
+
|
668
|
+
if np.sum(cell_submask) == 0:
|
669
|
+
data.append([label, np.nan, np.nan])
|
670
|
+
continue
|
671
|
+
|
672
|
+
masked_intensity = blurred_subimg * cell_submask
|
673
|
+
com_local = center_of_mass(masked_intensity)
|
674
|
+
if np.isnan(com_local[0]):
|
675
|
+
data.append([label, np.nan, np.nan])
|
676
|
+
continue
|
677
|
+
|
678
|
+
com_global = (com_local[0] + minr, com_local[1] + minc)
|
679
|
+
com_global_int = tuple(np.round(com_global).astype(int))
|
680
|
+
|
681
|
+
x, y = com_global_int
|
682
|
+
if not (0 <= x < cell_mask.shape[0] and 0 <= y < cell_mask.shape[1]):
|
683
|
+
data.append([label, np.nan, np.nan])
|
684
|
+
continue
|
685
|
+
|
686
|
+
nucleus_dist = nucleus_dt[x, y]
|
687
|
+
pathogen_dist = pathogen_dt[x, y]
|
688
|
+
|
689
|
+
data.append([label, nucleus_dist, pathogen_dist])
|
690
|
+
|
691
|
+
df = pd.DataFrame(data, columns=['label',
|
692
|
+
f'cell_channel_{ch}_distance_to_nucleus',
|
693
|
+
f'cell_channel_{ch}_distance_to_pathogen'])
|
694
|
+
dfs.append(df)
|
695
|
+
|
696
|
+
# Merge all channel dataframes on label
|
697
|
+
merged_df = dfs[0]
|
698
|
+
for df in dfs[1:]:
|
699
|
+
merged_df = merged_df.merge(df, on='label', how='outer')
|
700
|
+
|
701
|
+
return merged_df
|
702
|
+
|
703
|
+
|
498
704
|
#@log_function_call
|
499
705
|
def _intensity_measurements(cell_mask, nucleus_mask, pathogen_mask, cytoplasm_mask, channel_arrays, settings, sizes=[3, 6, 12, 24], periphery=True, outside=True):
|
706
|
+
|
500
707
|
"""
|
501
708
|
Calculate various intensity measurements for different regions in the image.
|
502
709
|
|
@@ -536,8 +743,8 @@ def _intensity_measurements(cell_mask, nucleus_mask, pathogen_mask, cytoplasm_ma
|
|
536
743
|
df.append(empty_df)
|
537
744
|
continue
|
538
745
|
|
539
|
-
mask_intensity_df = _extended_regionprops_table(label, channel, intensity_props)
|
540
|
-
mask_intensity_df['shannon_entropy'] = shannon_entropy(channel, base=2)
|
746
|
+
mask_intensity_df = _extended_regionprops_table(label, channel, intensity_props)
|
747
|
+
#mask_intensity_df['shannon_entropy'] = shannon_entropy(channel, base=2)
|
541
748
|
|
542
749
|
if homogeneity:
|
543
750
|
homogeneity_df = _calculate_homogeneity(label, channel, distances)
|
@@ -558,6 +765,10 @@ def _intensity_measurements(cell_mask, nucleus_mask, pathogen_mask, cytoplasm_ma
|
|
558
765
|
|
559
766
|
mask_intensity_df.columns = [f'{ls[j]}_channel_{i}_{col}' if col != 'label' else col for col in mask_intensity_df.columns]
|
560
767
|
df.append(mask_intensity_df)
|
768
|
+
|
769
|
+
if isinstance(settings['distance_gaussian_sigma'], int):
|
770
|
+
intensity_distance_df = _measure_intensity_distance(cell_mask, nucleus_mask, pathogen_mask, channel_arrays, settings)
|
771
|
+
cell_dfs.append(intensity_distance_df)
|
561
772
|
|
562
773
|
if radial_dist:
|
563
774
|
if np.max(nucleus_mask) != 0:
|
@@ -565,7 +776,7 @@ def _intensity_measurements(cell_mask, nucleus_mask, pathogen_mask, cytoplasm_ma
|
|
565
776
|
nucleus_df = _create_dataframe(nucleus_radial_distributions, 'nucleus')
|
566
777
|
dfs[1].append(nucleus_df)
|
567
778
|
|
568
|
-
if np.max(
|
779
|
+
if np.max(pathogen_mask) != 0:
|
569
780
|
pathogen_radial_distributions = _calculate_radial_distribution(cell_mask, pathogen_mask, channel_arrays, num_bins=6)
|
570
781
|
pathogen_df = _create_dataframe(pathogen_radial_distributions, 'pathogen')
|
571
782
|
dfs[2].append(pathogen_df)
|
@@ -785,6 +996,7 @@ def _measure_crop_core(index, time_ls, file, settings):
|
|
785
996
|
#merge skeleton_df with cell_df here
|
786
997
|
|
787
998
|
cell_intensity_df, nucleus_intensity_df, pathogen_intensity_df, cytoplasm_intensity_df = _intensity_measurements(cell_mask, nucleus_mask, pathogen_mask, cytoplasm_mask, channel_arrays, settings, sizes=[1, 2, 3, 4, 5], periphery=True, outside=True)
|
999
|
+
|
788
1000
|
if settings['cell_mask_dim'] is not None:
|
789
1001
|
cell_merged_df = _merge_and_save_to_database(cell_df, cell_intensity_df, 'cell', source_folder, file_name, settings['experiment'], settings['timelapse'])
|
790
1002
|
if settings['nucleus_mask_dim'] is not None:
|
Binary file
|
spacr/settings.py
CHANGED
@@ -313,7 +313,9 @@ def get_measure_crop_settings(settings={}):
|
|
313
313
|
settings.setdefault('pathogen_min_size',0)
|
314
314
|
settings.setdefault('cytoplasm_min_size',0)
|
315
315
|
settings.setdefault('merge_edge_pathogen_cells', True)
|
316
|
-
|
316
|
+
|
317
|
+
settings.setdefault('distance_gaussian_sigma', 1)
|
318
|
+
|
317
319
|
if settings['test_mode']:
|
318
320
|
settings['verbose'] = True
|
319
321
|
settings['plot'] = True
|
@@ -1000,7 +1002,8 @@ expected_types = {
|
|
1000
1002
|
"cell_diamiter":int,
|
1001
1003
|
"nucleus_diamiter":int,
|
1002
1004
|
"pathogen_diamiter":int,
|
1003
|
-
"consolidate":bool
|
1005
|
+
"consolidate":bool,
|
1006
|
+
"distance_gaussian_sigma":int
|
1004
1007
|
}
|
1005
1008
|
|
1006
1009
|
categories = {"Paths":[ "src", "grna", "barcodes", "custom_model_path", "dataset","model_path","grna_csv","row_csv","column_csv", "metadata_files", "score_data","count_data"],
|
@@ -1022,7 +1025,7 @@ categories = {"Paths":[ "src", "grna", "barcodes", "custom_model_path", "dataset
|
|
1022
1025
|
"Plot": ["split_axis_lims", "x_lim","log_x","log_y", "plot_control", "plot_nr", "examples_to_plot", "normalize_plots", "cmap", "figuresize", "plot_cluster_grids", "img_zoom", "row_limit", "color_by", "plot_images", "smooth_lines", "plot_points", "plot_outlines", "black_background", "plot_by_cluster", "heatmap_feature","grouping","min_max","cmap","save_figure"],
|
1023
1026
|
"Timelapse": ["timelapse", "fps", "timelapse_displacement", "timelapse_memory", "timelapse_frame_limits", "timelapse_remove_transient", "timelapse_mode", "timelapse_objects", "compartments"],
|
1024
1027
|
"Advanced": ["merge_edge_pathogen_cells", "test_images", "random_test", "test_nr", "test", "test_split", "normalize", "target_unique_count","threshold_multiplier", "threshold_method", "min_n","shuffle", "target_intensity_min", "cells_per_well", "nuclei_limit", "pathogen_limit", "background", "backgrounds", "schedule", "test_size","exclude","n_repeats","top_features", "model_type_ml", "model_type","minimum_cell_count","n_estimators","preprocess", "remove_background", "normalize", "lower_percentile", "merge_pathogens", "batch_size", "filter", "save", "masks", "verbose", "randomize", "n_jobs"],
|
1025
|
-
"Beta": ["all_to_mip", "upscale", "upscale_factor", "consolidate"]
|
1028
|
+
"Beta": ["all_to_mip", "upscale", "upscale_factor", "consolidate", "distance_gaussian_sigma"]
|
1026
1029
|
}
|
1027
1030
|
|
1028
1031
|
|
spacr/utils.py
CHANGED
@@ -4602,7 +4602,10 @@ def adjust_cell_masks(parasite_folder, cell_folder, nuclei_folder, overlap_thres
|
|
4602
4602
|
raise ValueError("The number of files in the folders do not match.")
|
4603
4603
|
|
4604
4604
|
# Match files by name
|
4605
|
-
|
4605
|
+
time_ls = []
|
4606
|
+
files_to_process = len(parasite_files)
|
4607
|
+
for files_processed, file_name in enumerate(parasite_files):
|
4608
|
+
start = time.time()
|
4606
4609
|
parasite_path = os.path.join(parasite_folder, file_name)
|
4607
4610
|
cell_path = os.path.join(cell_folder, file_name)
|
4608
4611
|
nuclei_path = os.path.join(nuclei_folder, file_name)
|
@@ -4621,6 +4624,12 @@ def adjust_cell_masks(parasite_folder, cell_folder, nuclei_folder, overlap_thres
|
|
4621
4624
|
|
4622
4625
|
# Overwrite the original cell mask file with the merged result
|
4623
4626
|
np.save(cell_path, merged_cell_mask)
|
4627
|
+
|
4628
|
+
stop = time.time()
|
4629
|
+
duration = (stop - start)
|
4630
|
+
time_ls.append(duration)
|
4631
|
+
files_processed += 1
|
4632
|
+
print_progress(files_processed, files_to_process, n_jobs=1, time_ls=time_ls, batch_size=None, operation_type=f'adjust_cell_masks')
|
4624
4633
|
|
4625
4634
|
def process_masks(mask_folder, image_folder, channel, batch_size=50, n_clusters=2, plot=False):
|
4626
4635
|
|
@@ -0,0 +1,194 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: spacr
|
3
|
+
Version: 0.9.21
|
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
|
+
Description-Content-Type: text/x-rst
|
12
|
+
License-File: LICENSE
|
13
|
+
Requires-Dist: numpy <2.0,>=1.26.4
|
14
|
+
Requires-Dist: pandas <3.0,>=2.2.1
|
15
|
+
Requires-Dist: scipy <2.0,>=1.12.0
|
16
|
+
Requires-Dist: cellpose <4.0,>=3.0.6
|
17
|
+
Requires-Dist: scikit-image <1.0,>=0.22.0
|
18
|
+
Requires-Dist: scikit-learn <2.0,>=1.4.1
|
19
|
+
Requires-Dist: scikit-posthocs <0.20,>=0.10.0
|
20
|
+
Requires-Dist: mahotas <2.0,>=1.4.13
|
21
|
+
Requires-Dist: btrack <1.0,>=0.6.5
|
22
|
+
Requires-Dist: trackpy <1.0,>=0.6.2
|
23
|
+
Requires-Dist: statsmodels <1.0,>=0.14.1
|
24
|
+
Requires-Dist: shap <1.0,>=0.45.0
|
25
|
+
Requires-Dist: torch <3.0,>=2.0
|
26
|
+
Requires-Dist: torchvision <1.0,>=0.1
|
27
|
+
Requires-Dist: torch-geometric <3.0,>=2.5
|
28
|
+
Requires-Dist: torchcam <1.0,>=0.4.0
|
29
|
+
Requires-Dist: transformers <5.0,>=4.45.2
|
30
|
+
Requires-Dist: segmentation-models-pytorch >=0.3.3
|
31
|
+
Requires-Dist: monai >=1.3.0
|
32
|
+
Requires-Dist: captum <1.0,>=0.7.0
|
33
|
+
Requires-Dist: seaborn <1.0,>=0.13.2
|
34
|
+
Requires-Dist: matplotlib <4.0,>=3.8.3
|
35
|
+
Requires-Dist: matplotlib-venn <2.0,>=1.1
|
36
|
+
Requires-Dist: adjustText <2.0,>=1.2.0
|
37
|
+
Requires-Dist: bottleneck <2.0,>=1.3.6
|
38
|
+
Requires-Dist: numexpr <3.0,>=2.8.4
|
39
|
+
Requires-Dist: opencv-python-headless <5.0,>=4.9.0.80
|
40
|
+
Requires-Dist: pillow <11.0,>=10.2.0
|
41
|
+
Requires-Dist: tifffile >=2023.4.12
|
42
|
+
Requires-Dist: nd2reader <4.0,>=3.3.0
|
43
|
+
Requires-Dist: czifile
|
44
|
+
Requires-Dist: pylibCZIrw <6.0,>=5.0.0
|
45
|
+
Requires-Dist: aicspylibczi
|
46
|
+
Requires-Dist: readlif
|
47
|
+
Requires-Dist: imageio <3.0,>=2.34.0
|
48
|
+
Requires-Dist: pingouin <1.0,>=0.5.5
|
49
|
+
Requires-Dist: umap-learn <1.0,>=0.5.6
|
50
|
+
Requires-Dist: ttkthemes <4.0,>=3.2.2
|
51
|
+
Requires-Dist: xgboost <3.0,>=2.0.3
|
52
|
+
Requires-Dist: PyWavelets <2.0,>=1.6.0
|
53
|
+
Requires-Dist: ttf-opensans >=2020.10.30
|
54
|
+
Requires-Dist: customtkinter <6.0,>=5.2.2
|
55
|
+
Requires-Dist: biopython <2.0,>=1.80
|
56
|
+
Requires-Dist: lxml <6.0,>=5.1.0
|
57
|
+
Requires-Dist: psutil <6.0,>=5.9.8
|
58
|
+
Requires-Dist: gputil <2.0,>=1.4.0
|
59
|
+
Requires-Dist: gpustat <2.0,>=1.1.1
|
60
|
+
Requires-Dist: pyautogui <1.0,>=0.9.54
|
61
|
+
Requires-Dist: tables <4.0,>=3.8.0
|
62
|
+
Requires-Dist: rapidfuzz <4.0,>=3.9
|
63
|
+
Requires-Dist: keyring <16.0,>=15.1
|
64
|
+
Requires-Dist: screeninfo <1.0,>=0.8.1
|
65
|
+
Requires-Dist: fastremap >=1.14.1
|
66
|
+
Requires-Dist: pytz >=2023.3.post1
|
67
|
+
Requires-Dist: tqdm >=4.65.0
|
68
|
+
Requires-Dist: wandb >=0.16.2
|
69
|
+
Requires-Dist: openai <2.0,>=1.50.2
|
70
|
+
Requires-Dist: gdown
|
71
|
+
Requires-Dist: IPython <9.0,>=8.18.1
|
72
|
+
Requires-Dist: ipykernel
|
73
|
+
Requires-Dist: ipywidgets <9.0,>=8.1.2
|
74
|
+
Requires-Dist: brokenaxes <1.0,>=0.6.2
|
75
|
+
Requires-Dist: huggingface-hub <0.25,>=0.24.0
|
76
|
+
Provides-Extra: dev
|
77
|
+
Requires-Dist: pytest <3.11,>=3.9 ; extra == 'dev'
|
78
|
+
Provides-Extra: full
|
79
|
+
Requires-Dist: opencv-python ; extra == 'full'
|
80
|
+
Provides-Extra: headless
|
81
|
+
Requires-Dist: opencv-python-headless ; extra == 'headless'
|
82
|
+
|
83
|
+
.. |Docs| image:: https://github.com/EinarOlafsson/spacr/actions/workflows/pages/pages-build-deployment/badge.svg
|
84
|
+
:target: https://einarolafsson.github.io/spacr/index.html
|
85
|
+
.. |PyPI version| image:: https://badge.fury.io/py/spacr.svg
|
86
|
+
:target: https://badge.fury.io/py/spacr
|
87
|
+
.. |Python version| image:: https://img.shields.io/pypi/pyversions/spacr
|
88
|
+
:target: https://pypistats.org/packages/spacr
|
89
|
+
.. |Licence: GPL v3| image:: https://img.shields.io/github/license/EinarOlafsson/spacr
|
90
|
+
:target: https://github.com/EinarOlafsson/spacr/blob/master/LICENSE
|
91
|
+
.. |repo size| image:: https://img.shields.io/github/repo-size/EinarOlafsson/spacr
|
92
|
+
:target: https://github.com/EinarOlafsson/spacr/
|
93
|
+
|
94
|
+
.. _docs: https://einarolafsson.github.io/spacr/index.html
|
95
|
+
|
96
|
+
Badges
|
97
|
+
------
|
98
|
+
|Docs| |PyPI version| |Python version| |Licence: GPL v3| |repo size|
|
99
|
+
|
100
|
+
SpaCr
|
101
|
+
=====
|
102
|
+
|
103
|
+
**Spatial phenotype analysis of CRISPR-Cas9 screens (SpaCr).**
|
104
|
+
|
105
|
+
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 understanding 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.
|
106
|
+
|
107
|
+
Features
|
108
|
+
--------
|
109
|
+
|
110
|
+
- **Generate Masks:** Generate cellpose masks of cell, nuclei, and pathogen objects.
|
111
|
+
- **Object Measurements:** Measurements for each object including scikit-image regionprops, intensity percentiles, shannon-entropy, Pearson’s and Manders’ correlations, homogeneity, and radial distribution. Measurements are saved to a SQL database in object-level tables.
|
112
|
+
- **Crop Images:** Save objects (cells, nuclei, pathogen, cytoplasm) as images. Object image paths are saved in a SQL database.
|
113
|
+
- **Train CNNs or Transformers:** Train Torch models to classify single object images.
|
114
|
+
- **Manual Annotation:** Supports manual annotation of single-cell images and segmentation to refine training datasets for training CNNs/Transformers or cellpose, respectively.
|
115
|
+
- **Finetune Cellpose Models:** Adjust pre-existing Cellpose models to your specific dataset for improved performance.
|
116
|
+
- **Timelapse Data Support:** Track objects in timelapse image data.
|
117
|
+
- **Simulations:** Simulate spatial phenotype screens.
|
118
|
+
- **Sequencing:** Map FASTQ reads to barcode and gRNA barcode metadata.
|
119
|
+
- **Misc:** Analyze Ca oscillation, recruitment, infection rate, plaque size/count.
|
120
|
+
|
121
|
+
.. image:: https://github.com/EinarOlafsson/spacr/raw/main/spacr/resources/icons/flow_chart_v2.png
|
122
|
+
:alt: SpaCr workflow
|
123
|
+
:align: center
|
124
|
+
|
125
|
+
|
126
|
+
**Overview and data organization of spaCR.**
|
127
|
+
|
128
|
+
**a.** Schematic workflow of the spaCR pipeline for pooled image-based CRISPR screens. Microscopy images (TIFF, LIF, CZI, NDI) and sequencing reads (FASTQ) are used as inputs (black). The main modules (teal) are: (1) Mask: generates object masks for cells, nuclei, pathogens, and cytoplasm; (2) Measure: extracts object-level features and crops object images, storing quantitative data in an SQL database; (3) Classify—applies machine learning (ML, e.g., XGBoost) or deep learning (DL, e.g., PyTorch) models to classify objects, summarizing results as well-level classification scores; (4) Map Barcodes: extracts and maps row, column, and gRNA barcodes from sequencing data to corresponding wells; (5) Regression: estimates gRNA effect sizes and gene scores via multiple linear regression using well-level summary statistics.
|
129
|
+
**b.** Downstream submodules available for extended analyses at each stage.
|
130
|
+
**c.** Output folder structure for each module, including locations for raw and processed images, masks, object-level measurements, datasets, and results.
|
131
|
+
**d.** List of all spaCR package modules.
|
132
|
+
|
133
|
+
Installation
|
134
|
+
------------
|
135
|
+
|
136
|
+
**Linux recommended.**
|
137
|
+
If using Windows, switch to Linux—it's free, open-source, and better.
|
138
|
+
|
139
|
+
**macOS prerequisites (before install):**
|
140
|
+
|
141
|
+
::
|
142
|
+
|
143
|
+
brew install libomp
|
144
|
+
brew install hdf5
|
145
|
+
|
146
|
+
**Linux GUI requirement:**
|
147
|
+
SpaCr GUI requires Tkinter.
|
148
|
+
|
149
|
+
::
|
150
|
+
|
151
|
+
sudo apt-get install python3-tk
|
152
|
+
|
153
|
+
**Installation:**
|
154
|
+
|
155
|
+
::
|
156
|
+
|
157
|
+
pip install spacr
|
158
|
+
|
159
|
+
**Run SpaCr GUI:**
|
160
|
+
|
161
|
+
::
|
162
|
+
|
163
|
+
spacr
|
164
|
+
|
165
|
+
Data Availability
|
166
|
+
-----------------
|
167
|
+
|
168
|
+
- **Raw sequencing data** are available from NCBI BioProject `PRJNA1261935 <https://www.ncbi.nlm.nih.gov/bioproject/PRJNA1261935>`_ and SRA accessions: `SRR33531217 <https://www.ncbi.nlm.nih.gov/sra/SRR33531217>`_, `SRR33531218 <https://www.ncbi.nlm.nih.gov/sra/SRR33531218>`_, `SRR33531219 <https://www.ncbi.nlm.nih.gov/sra/SRR33531219>`_, `SRR33531220 <https://www.ncbi.nlm.nih.gov/sra/SRR33531220>`_
|
169
|
+
|
170
|
+
- **Image data** is deposited at EBI BioStudies under accession: `S-BIAD2076 <https://www.ebi.ac.uk/biostudies/studies/S-BIAD2076>`_
|
171
|
+
|
172
|
+
Example Notebooks
|
173
|
+
-----------------
|
174
|
+
|
175
|
+
The following example Jupyter notebooks illustrate common workflows using spaCR.
|
176
|
+
|
177
|
+
- `Generate masks <https://github.com/EinarOlafsson/spacr/blob/main/Notebooks/1_spacr_generate_masks.ipynb>`_
|
178
|
+
*Generate cell, nuclei, and pathogen segmentation masks from microscopy images using Cellpose.*
|
179
|
+
|
180
|
+
- `Capture single cell images and measurements <https://github.com/EinarOlafsson/spacr/blob/main/Notebooks/2_spacr_generate_mesurments_crop_images.ipynb>`_
|
181
|
+
*Extract object-level measurements and crop single-cell images for downstream analysis.*
|
182
|
+
|
183
|
+
- `Machine learning based object classification <https://github.com/EinarOlafsson/spacr/blob/main/Notebooks/3a_spacr_machine_learning.ipynb>`_
|
184
|
+
*Train traditional machine learning models (e.g., XGBoost) to classify cell phenotypes based on extracted features.*
|
185
|
+
|
186
|
+
- `Computer vision based object classification <https://github.com/EinarOlafsson/spacr/blob/main/Notebooks/3b_spacr_computer_vision.ipynb>`_
|
187
|
+
*Train and evaluate deep learning models (PyTorch CNNs/Transformers) on cropped object images.*
|
188
|
+
|
189
|
+
- `Map sequencing barcodes <https://github.com/EinarOlafsson/spacr/blob/main/Notebooks/4_spacr_map_barecodes.ipynb>`_
|
190
|
+
*Map sequencing reads to row, column, and gRNA barcodes for CRISPR screen genotype-phenotype mapping.*
|
191
|
+
|
192
|
+
- `Finetune cellpose models <https://github.com/EinarOlafsson/spacr/blob/main/Notebooks/5_spacr_train_cellpose.ipynb>`_
|
193
|
+
*Finetune Cellpose models using your own annotated training data for improved segmentation accuracy.*
|
194
|
+
|
@@ -16,20 +16,20 @@ spacr/gui_elements.py,sha256=5a3BOpctBPklsT1NungqS72h1Bg1FArUndE0OfvWD8Y,152646
|
|
16
16
|
spacr/gui_utils.py,sha256=vv_uBOA0n-04KCCicYHhNt3sRbm0IPLM5r8QX5EkJ1Q,40867
|
17
17
|
spacr/io.py,sha256=SYLhupKnOJJscNSGE4N67E32-ywhwrjRccIfZrL38Uk,157966
|
18
18
|
spacr/logger.py,sha256=lJhTqt-_wfAunCPl93xE65Wr9Y1oIHJWaZMjunHUeIw,1538
|
19
|
-
spacr/measure.py,sha256=
|
19
|
+
spacr/measure.py,sha256=XmOCKriS-kuRy-EPhQ_z7CRNg6DukyTpwQCiuSPNd_c,63414
|
20
20
|
spacr/mediar.py,sha256=p0F515eFbm6_rePSnChsgqrgH-H5Sr_3zWrghtOnAUg,14863
|
21
21
|
spacr/ml.py,sha256=XCRZeX7UkbMctQICIoskeWVx8CCmmCoHNauUOAkfFq0,91692
|
22
22
|
spacr/openai.py,sha256=5vBZ3Jl2llYcW3oaTEXgdyCB2aJujMUIO5K038z7w_A,1246
|
23
23
|
spacr/plot.py,sha256=M2w9ytR8iMFtsVPhmQ5tzIWTQDmbtCzs1-7hALUIQtg,167339
|
24
24
|
spacr/sequencing.py,sha256=EY12RdW5QRKpHDRQCw1QoAlxCq8FK2v6WoVa5uuDBXQ,26745
|
25
|
-
spacr/settings.py,sha256=
|
25
|
+
spacr/settings.py,sha256=tEFKYqMYQoObrNuKL3XdinRebQxJcuA3Gn9wK44vqhs,87505
|
26
26
|
spacr/sim.py,sha256=1xKhXimNU3ukzIw-3l9cF3Znc_brW8h20yv8fSTzvss,71173
|
27
27
|
spacr/sp_stats.py,sha256=mbhwsyIqt5upsSD346qGjdCw7CFBa0tIS7zHU9e0jNI,9536
|
28
28
|
spacr/spacr_cellpose.py,sha256=RBHMs2vwXcfkj0xqAULpALyzJYXddSRycgZSzmwI7v0,14755
|
29
29
|
spacr/submodules.py,sha256=Z2i4kv_rWdxqoXsOKCF7BaSXtvaCZB69Ow8_FQBnZsY,83093
|
30
30
|
spacr/timelapse.py,sha256=-5ZupTsCCpbenIQ2zsUmnwXh45B82fO-gPrSXOxu2s8,42980
|
31
31
|
spacr/toxo.py,sha256=GoNfgyH-NJx3WOzNQPgzODir7Jp65fs7UM46XpzcrUo,26056
|
32
|
-
spacr/utils.py,sha256=
|
32
|
+
spacr/utils.py,sha256=cw5zM6zpFWWUZQKwtYvXc_rNfBMW2ldbnlw8s6f6bFQ,234397
|
33
33
|
spacr/version.py,sha256=axH5tnGwtgSnJHb5IDhiu4Zjk5GhLyAEDRe-rnaoFOA,409
|
34
34
|
spacr/resources/data/lopit.csv,sha256=ERI5f9W8RdJGiSx_khoaylD374f8kmvLia1xjhD_mII,4421709
|
35
35
|
spacr/resources/data/toxoplasma_metadata.csv,sha256=9TXx0VlClDHAxQmaLhoklE8NuETduXaGHZjhR_6lZfs,2969409
|
@@ -82,6 +82,7 @@ spacr/resources/icons/convert.png,sha256=vLyTkQeUZ9q-pirhtZeXDq3-DzfjoPMjLlgKl5W
|
|
82
82
|
spacr/resources/icons/default.png,sha256=KoNhaSHukO4wDyivyYEgSbb5mGj-sAxmhKikLLtNpWs,20341
|
83
83
|
spacr/resources/icons/dna_matrix.mp4,sha256=NegOQkn4q4kHhFgqcIX2dd58wVytBtnkmbgg0ZegL8U,23462876
|
84
84
|
spacr/resources/icons/download.png,sha256=1nUoWRaTc4vIsK6gompdeqk0cIv2GdH-gCNHaEBX6Mc,20467
|
85
|
+
spacr/resources/icons/flow_chart_v2.png,sha256=4U4uzJlyQ8L-exWIXIhyqtkoO-KIiubO23kA7eLZYYE,640609
|
85
86
|
spacr/resources/icons/logo.pdf,sha256=VB4cS41V3VV_QxD7l6CwdQKQiYLErugLBxWoCoxjQU0,377925
|
86
87
|
spacr/resources/icons/logo_spacr.png,sha256=qG3e3bdrAefhl1281rfo0R2XP0qA-c-oaBCXjxMGXkw,42587
|
87
88
|
spacr/resources/icons/logo_spacr_1.png,sha256=g9y2ZmnV3hab8r1idDfytm8AaHbBiQdu_93Jd7YKzwA,610892
|
@@ -101,9 +102,9 @@ spacr/resources/icons/umap.png,sha256=dOLF3DeLYy9k0nkUybiZMe1wzHQwLJFRmgccppw-8b
|
|
101
102
|
spacr/resources/images/plate1_E01_T0001F001L01A01Z01C02.tif,sha256=Tl0ZUfZ_AYAbu0up_nO0tPRtF1BxXhWQ3T3pURBCCRo,7958528
|
102
103
|
spacr/resources/images/plate1_E01_T0001F001L01A02Z01C01.tif,sha256=m8N-V71rA1TT4dFlENNg8s0Q0YEXXs8slIn7yObmZJQ,7958528
|
103
104
|
spacr/resources/images/plate1_E01_T0001F001L01A03Z01C03.tif,sha256=Pbhk7xn-KUP6RSIhJsxQcrHFImBm3GEpLkzx7WOc-5M,7958528
|
104
|
-
spacr-0.9.
|
105
|
-
spacr-0.9.
|
106
|
-
spacr-0.9.
|
107
|
-
spacr-0.9.
|
108
|
-
spacr-0.9.
|
109
|
-
spacr-0.9.
|
105
|
+
spacr-0.9.21.dist-info/LICENSE,sha256=SR-2MeGc6SCM1UORJYyarSWY_A-JaOMFDj7ReSs9tRM,1083
|
106
|
+
spacr-0.9.21.dist-info/METADATA,sha256=YqQuqZf-_FromxA3MZdQVVujyS2xRwOoZ_AHqCcvv_I,9636
|
107
|
+
spacr-0.9.21.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
108
|
+
spacr-0.9.21.dist-info/entry_points.txt,sha256=BMC0ql9aNNpv8lUZ8sgDLQMsqaVnX5L535gEhKUP5ho,296
|
109
|
+
spacr-0.9.21.dist-info/top_level.txt,sha256=GJPU8FgwRXGzKeut6JopsSRY2R8T3i9lDgya42tLInY,6
|
110
|
+
spacr-0.9.21.dist-info/RECORD,,
|
spacr-0.9.1.dist-info/METADATA
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: spacr
|
3
|
-
Version: 0.9.1
|
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
|
-
Description-Content-Type: text/x-rst
|
12
|
-
License-File: LICENSE
|
13
|
-
Requires-Dist: numpy <2.0,>=1.26.4
|
14
|
-
Requires-Dist: pandas <3.0,>=2.2.1
|
15
|
-
Requires-Dist: scipy <2.0,>=1.12.0
|
16
|
-
Requires-Dist: cellpose <4.0,>=3.0.6
|
17
|
-
Requires-Dist: scikit-image <1.0,>=0.22.0
|
18
|
-
Requires-Dist: scikit-learn <2.0,>=1.4.1
|
19
|
-
Requires-Dist: scikit-posthocs <0.20,>=0.10.0
|
20
|
-
Requires-Dist: mahotas <2.0,>=1.4.13
|
21
|
-
Requires-Dist: btrack <1.0,>=0.6.5
|
22
|
-
Requires-Dist: trackpy <1.0,>=0.6.2
|
23
|
-
Requires-Dist: statsmodels <1.0,>=0.14.1
|
24
|
-
Requires-Dist: shap <1.0,>=0.45.0
|
25
|
-
Requires-Dist: torch <3.0,>=2.0
|
26
|
-
Requires-Dist: torchvision <1.0,>=0.1
|
27
|
-
Requires-Dist: torch-geometric <3.0,>=2.5
|
28
|
-
Requires-Dist: torchcam <1.0,>=0.4.0
|
29
|
-
Requires-Dist: transformers <5.0,>=4.45.2
|
30
|
-
Requires-Dist: segmentation-models-pytorch >=0.3.3
|
31
|
-
Requires-Dist: monai >=1.3.0
|
32
|
-
Requires-Dist: captum <1.0,>=0.7.0
|
33
|
-
Requires-Dist: seaborn <1.0,>=0.13.2
|
34
|
-
Requires-Dist: matplotlib <4.0,>=3.8.3
|
35
|
-
Requires-Dist: matplotlib-venn <2.0,>=1.1
|
36
|
-
Requires-Dist: adjustText <2.0,>=1.2.0
|
37
|
-
Requires-Dist: bottleneck <2.0,>=1.3.6
|
38
|
-
Requires-Dist: numexpr <3.0,>=2.8.4
|
39
|
-
Requires-Dist: opencv-python-headless <5.0,>=4.9.0.80
|
40
|
-
Requires-Dist: pillow <11.0,>=10.2.0
|
41
|
-
Requires-Dist: tifffile >=2023.4.12
|
42
|
-
Requires-Dist: nd2reader <4.0,>=3.3.0
|
43
|
-
Requires-Dist: czifile
|
44
|
-
Requires-Dist: pylibCZIrw <6.0,>=5.0.0
|
45
|
-
Requires-Dist: aicspylibczi
|
46
|
-
Requires-Dist: readlif
|
47
|
-
Requires-Dist: imageio <3.0,>=2.34.0
|
48
|
-
Requires-Dist: pingouin <1.0,>=0.5.5
|
49
|
-
Requires-Dist: umap-learn <1.0,>=0.5.6
|
50
|
-
Requires-Dist: ttkthemes <4.0,>=3.2.2
|
51
|
-
Requires-Dist: xgboost <3.0,>=2.0.3
|
52
|
-
Requires-Dist: PyWavelets <2.0,>=1.6.0
|
53
|
-
Requires-Dist: ttf-opensans >=2020.10.30
|
54
|
-
Requires-Dist: customtkinter <6.0,>=5.2.2
|
55
|
-
Requires-Dist: biopython <2.0,>=1.80
|
56
|
-
Requires-Dist: lxml <6.0,>=5.1.0
|
57
|
-
Requires-Dist: psutil <6.0,>=5.9.8
|
58
|
-
Requires-Dist: gputil <2.0,>=1.4.0
|
59
|
-
Requires-Dist: gpustat <2.0,>=1.1.1
|
60
|
-
Requires-Dist: pyautogui <1.0,>=0.9.54
|
61
|
-
Requires-Dist: tables <4.0,>=3.8.0
|
62
|
-
Requires-Dist: rapidfuzz <4.0,>=3.9
|
63
|
-
Requires-Dist: keyring <16.0,>=15.1
|
64
|
-
Requires-Dist: screeninfo <1.0,>=0.8.1
|
65
|
-
Requires-Dist: fastremap >=1.14.1
|
66
|
-
Requires-Dist: pytz >=2023.3.post1
|
67
|
-
Requires-Dist: tqdm >=4.65.0
|
68
|
-
Requires-Dist: wandb >=0.16.2
|
69
|
-
Requires-Dist: openai <2.0,>=1.50.2
|
70
|
-
Requires-Dist: gdown
|
71
|
-
Requires-Dist: IPython <9.0,>=8.18.1
|
72
|
-
Requires-Dist: ipykernel
|
73
|
-
Requires-Dist: ipywidgets <9.0,>=8.1.2
|
74
|
-
Requires-Dist: brokenaxes <1.0,>=0.6.2
|
75
|
-
Requires-Dist: huggingface-hub <0.25,>=0.24.0
|
76
|
-
Provides-Extra: dev
|
77
|
-
Requires-Dist: pytest <3.11,>=3.9 ; extra == 'dev'
|
78
|
-
Provides-Extra: full
|
79
|
-
Requires-Dist: opencv-python ; extra == 'full'
|
80
|
-
Provides-Extra: headless
|
81
|
-
Requires-Dist: opencv-python-headless ; extra == 'headless'
|
82
|
-
|
83
|
-
.. |Documentation Status| image:: https://readthedocs.org/projects/spacr/badge/?version=latest
|
84
|
-
:target: https://einarolafsson.github.io/spacr
|
85
|
-
.. |PyPI version| image:: https://badge.fury.io/py/spacr.svg
|
86
|
-
:target: https://badge.fury.io/py/spacr
|
87
|
-
.. |Python version| image:: https://img.shields.io/pypi/pyversions/spacr
|
88
|
-
:target: https://pypistats.org/packages/spacr
|
89
|
-
.. |Licence: GPL v3| image:: https://img.shields.io/github/license/EinarOlafsson/spacr
|
90
|
-
:target: https://github.com/EinarOlafsson/spacr/blob/master/LICENSE
|
91
|
-
.. |repo size| image:: https://img.shields.io/github/repo-size/EinarOlafsson/spacr
|
92
|
-
:target: https://github.com/EinarOlafsson/spacr/
|
93
|
-
|
94
|
-
|Documentation Status| |PyPI version| |Python version| |Licence: GPL v3| |repo size|
|
95
|
-
|
96
|
-
SpaCr
|
97
|
-
=====
|
98
|
-
|
99
|
-
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 understanding 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.
|
100
|
-
|
101
|
-
Features
|
102
|
-
--------
|
103
|
-
|
104
|
-
- **Generate Masks:** Generate cellpose masks of cell, nuclei, and pathogen objects.
|
105
|
-
|
106
|
-
- **Object Measurements:** Measurements for each object including scikit-image-regionprops, intensity percentiles, shannon-entropy, pearsons and manders correlations, homogeneity, and radial distribution. Measurements are saved to a SQL database in object-level tables.
|
107
|
-
|
108
|
-
- **Crop Images:** Save objects (cells, nuclei, pathogen, cytoplasm) as images. Object image paths are saved in a SQL database.
|
109
|
-
|
110
|
-
- **Train CNNs or Transformers:** Train Torch models to classify single object images.
|
111
|
-
|
112
|
-
- **Manual Annotation:** Supports manual annotation of single-cell images and segmentation to refine training datasets for training CNNs/Transformers or cellpose, respectively.
|
113
|
-
|
114
|
-
- **Finetune Cellpose Models:** Adjust pre-existing Cellpose models to your specific dataset for improved performance.
|
115
|
-
|
116
|
-
- **Timelapse Data Support:** Track objects in timelapse image data.
|
117
|
-
|
118
|
-
- **Simulations:** Simulate spatial phenotype screens.
|
119
|
-
|
120
|
-
- **Sequencing:** Map FASTQ reads to barcode and gRNA barcode metadata.
|
121
|
-
|
122
|
-
- **Misc:** Analyze Ca oscillation, recruitment, infection rate, plaque size/count.
|
123
|
-
|
124
|
-
Installation
|
125
|
-
------------
|
126
|
-
|
127
|
-
If using Windows, switch to Linux—it's free, open-source, and better.
|
128
|
-
|
129
|
-
Before installing SpaCr on OSX ensure OpenMP is installed::
|
130
|
-
|
131
|
-
brew install libomp
|
132
|
-
brew install hdf5
|
133
|
-
|
134
|
-
SpaCr GUI requires Tkinter. On Linux, ensure Tkinter is installed. (Tkinter is included with the standard Python installation on macOS and Windows)::
|
135
|
-
|
136
|
-
sudo apt-get install python3-tk
|
137
|
-
|
138
|
-
Install SpaCr with pip::
|
139
|
-
|
140
|
-
pip install spacr
|
141
|
-
|
142
|
-
Run SpaCr GUI::
|
143
|
-
|
144
|
-
spacr
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|