spacr 0.2.4__py3-none-any.whl → 0.2.8__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/__init__.py +1 -11
- spacr/core.py +277 -349
- spacr/deep_spacr.py +248 -269
- spacr/gui.py +58 -54
- spacr/gui_core.py +689 -535
- spacr/gui_elements.py +1002 -153
- spacr/gui_utils.py +452 -107
- spacr/io.py +158 -91
- spacr/measure.py +199 -151
- spacr/plot.py +159 -47
- spacr/resources/font/open_sans/OFL.txt +93 -0
- spacr/resources/font/open_sans/OpenSans-Italic-VariableFont_wdth,wght.ttf +0 -0
- spacr/resources/font/open_sans/OpenSans-VariableFont_wdth,wght.ttf +0 -0
- spacr/resources/font/open_sans/README.txt +100 -0
- spacr/resources/font/open_sans/static/OpenSans-Bold.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-BoldItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-ExtraBold.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-ExtraBoldItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-Italic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-Light.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-LightItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-Medium.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-MediumItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-Regular.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-SemiBold.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans-SemiBoldItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-Bold.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-BoldItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-ExtraBold.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-ExtraBoldItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-Italic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-Light.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-LightItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-Medium.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-MediumItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-Regular.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-SemiBold.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_Condensed-SemiBoldItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Bold.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-BoldItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-ExtraBold.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-ExtraBoldItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Italic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Light.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-LightItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Medium.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-MediumItalic.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Regular.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-SemiBold.ttf +0 -0
- spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-SemiBoldItalic.ttf +0 -0
- spacr/resources/icons/logo.pdf +2786 -6
- spacr/resources/icons/logo_spacr.png +0 -0
- spacr/resources/icons/logo_spacr_1.png +0 -0
- spacr/sequencing.py +477 -587
- spacr/settings.py +217 -144
- spacr/utils.py +46 -46
- {spacr-0.2.4.dist-info → spacr-0.2.8.dist-info}/METADATA +46 -35
- spacr-0.2.8.dist-info/RECORD +100 -0
- {spacr-0.2.4.dist-info → spacr-0.2.8.dist-info}/WHEEL +1 -1
- spacr-0.2.4.dist-info/RECORD +0 -58
- {spacr-0.2.4.dist-info → spacr-0.2.8.dist-info}/LICENSE +0 -0
- {spacr-0.2.4.dist-info → spacr-0.2.8.dist-info}/entry_points.txt +0 -0
- {spacr-0.2.4.dist-info → spacr-0.2.8.dist-info}/top_level.txt +0 -0
spacr/settings.py
CHANGED
@@ -3,8 +3,8 @@ import os, ast
|
|
3
3
|
def set_default_plot_merge_settings():
|
4
4
|
settings = {}
|
5
5
|
settings.setdefault('include_noninfected', True)
|
6
|
-
settings.setdefault('include_multiinfected',
|
7
|
-
settings.setdefault('include_multinucleated',
|
6
|
+
settings.setdefault('include_multiinfected', 10)
|
7
|
+
settings.setdefault('include_multinucleated', 1)
|
8
8
|
settings.setdefault('remove_background', False)
|
9
9
|
settings.setdefault('filter_min_max', None)
|
10
10
|
settings.setdefault('channel_dims', [0,1,2,3])
|
@@ -20,7 +20,7 @@ def set_default_plot_merge_settings():
|
|
20
20
|
settings.setdefault('normalize', True)
|
21
21
|
settings.setdefault('print_object_number', True)
|
22
22
|
settings.setdefault('nr', 1)
|
23
|
-
settings.setdefault('figuresize',
|
23
|
+
settings.setdefault('figuresize', 10)
|
24
24
|
settings.setdefault('cmap', 'inferno')
|
25
25
|
settings.setdefault('verbose', True)
|
26
26
|
return settings
|
@@ -70,7 +70,7 @@ def set_default_settings_preprocess_generate_masks(src, settings={}):
|
|
70
70
|
|
71
71
|
# Plot settings
|
72
72
|
settings.setdefault('plot', False)
|
73
|
-
settings.setdefault('figuresize',
|
73
|
+
settings.setdefault('figuresize', 10)
|
74
74
|
settings.setdefault('cmap', 'inferno')
|
75
75
|
settings.setdefault('normalize', True)
|
76
76
|
settings.setdefault('normalize_plots', True)
|
@@ -116,7 +116,7 @@ def set_default_settings_preprocess_img_data(settings):
|
|
116
116
|
skip_mode = settings.setdefault('skip_mode', False)
|
117
117
|
|
118
118
|
cmap = settings.setdefault('cmap', 'inferno')
|
119
|
-
figuresize = settings.setdefault('figuresize',
|
119
|
+
figuresize = settings.setdefault('figuresize', 10)
|
120
120
|
normalize = settings.setdefault('normalize', True)
|
121
121
|
save_dtype = settings.setdefault('save_dtype', 'uint16')
|
122
122
|
|
@@ -189,7 +189,7 @@ def set_default_umap_image_settings(settings={}):
|
|
189
189
|
settings.setdefault('remove_cluster_noise', True)
|
190
190
|
settings.setdefault('remove_highly_correlated', True)
|
191
191
|
settings.setdefault('log_data', False)
|
192
|
-
settings.setdefault('figuresize',
|
192
|
+
settings.setdefault('figuresize', 10)
|
193
193
|
settings.setdefault('black_background', True)
|
194
194
|
settings.setdefault('remove_image_canvas', False)
|
195
195
|
settings.setdefault('plot_outlines', True)
|
@@ -220,6 +220,7 @@ def get_measure_crop_settings(settings):
|
|
220
220
|
|
221
221
|
settings.setdefault('src', 'path')
|
222
222
|
settings.setdefault('verbose', False)
|
223
|
+
settings.setdefault('experiment', 'exp')
|
223
224
|
|
224
225
|
# Test mode
|
225
226
|
settings.setdefault('test_mode', False)
|
@@ -252,8 +253,6 @@ def get_measure_crop_settings(settings):
|
|
252
253
|
|
253
254
|
# Operational settings
|
254
255
|
settings.setdefault('plot',False)
|
255
|
-
settings.setdefault('plot_filtration',False)
|
256
|
-
settings.setdefault('representative_images', False)
|
257
256
|
settings.setdefault('n_jobs', os.cpu_count()-2)
|
258
257
|
|
259
258
|
# Object settings
|
@@ -268,24 +267,9 @@ def get_measure_crop_settings(settings):
|
|
268
267
|
settings.setdefault('cytoplasm_min_size',0)
|
269
268
|
settings.setdefault('merge_edge_pathogen_cells', True)
|
270
269
|
|
271
|
-
# Miscellaneous settings
|
272
|
-
settings.setdefault('experiment', 'exp')
|
273
|
-
settings.setdefault('cells', ['HeLa'])
|
274
|
-
settings.setdefault('cell_loc', None)
|
275
|
-
settings.setdefault('pathogens', ['ME49Dku80WT', 'ME49Dku80dgra8:GRA8', 'ME49Dku80dgra8', 'ME49Dku80TKO'])
|
276
|
-
settings.setdefault('pathogen_loc', [['c1', 'c2', 'c3', 'c4', 'c5', 'c6'], ['c7', 'c8', 'c9', 'c10', 'c11', 'c12'], ['c13', 'c14', 'c15', 'c16', 'c17', 'c18'], ['c19', 'c20', 'c21', 'c22', 'c23', 'c24']])
|
277
|
-
settings.setdefault('treatments', ['BR1', 'BR2', 'BR3'])
|
278
|
-
settings.setdefault('treatment_loc', [['c1', 'c2', 'c7', 'c8', 'c13', 'c14', 'c19', 'c20'], ['c3', 'c4', 'c9', 'c10', 'c15', 'c16', 'c21', 'c22'], ['c5', 'c6', 'c11', 'c12', 'c17', 'c18', 'c23', 'c24']])
|
279
|
-
settings.setdefault('channel_of_interest', 2)
|
280
|
-
settings.setdefault('compartments', ['pathogen', 'cytoplasm'])
|
281
|
-
settings.setdefault('measurement', 'mean_intensity')
|
282
|
-
settings.setdefault('nr_imgs', 32)
|
283
|
-
settings.setdefault('um_per_pixel', 0.1)
|
284
|
-
|
285
270
|
if settings['test_mode']:
|
286
271
|
settings['verbose'] = True
|
287
272
|
settings['plot'] = True
|
288
|
-
settings['plot_filtration'] = True
|
289
273
|
test_imgs = settings['test_nr']
|
290
274
|
print(f'Test mode enabled with {test_imgs} images, plotting set to True')
|
291
275
|
|
@@ -293,7 +277,7 @@ def get_measure_crop_settings(settings):
|
|
293
277
|
|
294
278
|
def set_default_analyze_screen(settings):
|
295
279
|
settings.setdefault('src', 'path')
|
296
|
-
settings.setdefault('
|
280
|
+
settings.setdefault('model_type_ml','xgboost')
|
297
281
|
settings.setdefault('heatmap_feature','predictions')
|
298
282
|
settings.setdefault('grouping','mean')
|
299
283
|
settings.setdefault('min_max','allq')
|
@@ -330,7 +314,6 @@ def set_default_train_test_model(settings):
|
|
330
314
|
settings.setdefault('batch_size',64)
|
331
315
|
settings.setdefault('epochs',100)
|
332
316
|
settings.setdefault('val_split',0.1)
|
333
|
-
settings.setdefault('train_mode','erm')
|
334
317
|
settings.setdefault('learning_rate',0.001)
|
335
318
|
settings.setdefault('weight_decay',0.00001)
|
336
319
|
settings.setdefault('dropout_rate',0.1)
|
@@ -340,14 +323,90 @@ def set_default_train_test_model(settings):
|
|
340
323
|
settings.setdefault('gradient_accumulation',True)
|
341
324
|
settings.setdefault('gradient_accumulation_steps',4)
|
342
325
|
settings.setdefault('intermedeate_save',True)
|
343
|
-
settings.setdefault('pin_memory',
|
326
|
+
settings.setdefault('pin_memory',False)
|
344
327
|
settings.setdefault('n_jobs',cores)
|
345
|
-
settings.setdefault('
|
328
|
+
settings.setdefault('train_channels',['r','g','b'])
|
346
329
|
settings.setdefault('augment',False)
|
347
330
|
settings.setdefault('verbose',False)
|
348
331
|
return settings
|
349
332
|
|
333
|
+
def set_generate_training_dataset_defaults(settings):
|
334
|
+
|
335
|
+
settings.setdefault('src','path')
|
336
|
+
settings.setdefault('dataset_mode','metadata')
|
337
|
+
settings.setdefault('annotation_column','test')
|
338
|
+
settings.setdefault('annotated_classes',[1,2])
|
339
|
+
settings.setdefault('classes',['nc','pc'])
|
340
|
+
settings.setdefault('size',224)
|
341
|
+
settings.setdefault('test_split',0.1)
|
342
|
+
settings.setdefault('class_metadata',[['c1'],['c2']])
|
343
|
+
settings.setdefault('metadata_type_by','col')
|
344
|
+
settings.setdefault('channel_of_interest',3)
|
345
|
+
settings.setdefault('custom_measurement',None)
|
346
|
+
settings.setdefault('tables',None)
|
347
|
+
settings.setdefault('png_type','cell_png')
|
348
|
+
|
349
|
+
return settings
|
350
|
+
|
351
|
+
def deep_spacr_defaults(settings):
|
352
|
+
|
353
|
+
cores = os.cpu_count()-4
|
354
|
+
|
355
|
+
settings.setdefault('src','path')
|
356
|
+
settings.setdefault('dataset_mode','metadata')
|
357
|
+
settings.setdefault('annotation_column','test')
|
358
|
+
settings.setdefault('annotated_classes',[1,2])
|
359
|
+
settings.setdefault('classes',['nc','pc'])
|
360
|
+
settings.setdefault('size',224)
|
361
|
+
settings.setdefault('test_split',0.1)
|
362
|
+
settings.setdefault('class_metadata',[['c1'],['c2']])
|
363
|
+
settings.setdefault('metadata_type_by','col')
|
364
|
+
settings.setdefault('channel_of_interest',3)
|
365
|
+
settings.setdefault('custom_measurement',None)
|
366
|
+
settings.setdefault('tables',None)
|
367
|
+
settings.setdefault('png_type','cell_png')
|
368
|
+
settings.setdefault('custom_model',False)
|
369
|
+
settings.setdefault('custom_model_path','path')
|
370
|
+
settings.setdefault('train',True)
|
371
|
+
settings.setdefault('test',False)
|
372
|
+
settings.setdefault('model_type','maxvit_t')
|
373
|
+
settings.setdefault('optimizer_type','adamw')
|
374
|
+
settings.setdefault('schedule','reduce_lr_on_plateau') #reduce_lr_on_plateau, step_lr
|
375
|
+
settings.setdefault('loss_type','focal_loss') # binary_cross_entropy_with_logits
|
376
|
+
settings.setdefault('normalize',True)
|
377
|
+
settings.setdefault('image_size',224)
|
378
|
+
settings.setdefault('batch_size',64)
|
379
|
+
settings.setdefault('epochs',100)
|
380
|
+
settings.setdefault('val_split',0.1)
|
381
|
+
settings.setdefault('learning_rate',0.001)
|
382
|
+
settings.setdefault('weight_decay',0.00001)
|
383
|
+
settings.setdefault('dropout_rate',0.1)
|
384
|
+
settings.setdefault('init_weights',True)
|
385
|
+
settings.setdefault('amsgrad',True)
|
386
|
+
settings.setdefault('use_checkpoint',True)
|
387
|
+
settings.setdefault('gradient_accumulation',True)
|
388
|
+
settings.setdefault('gradient_accumulation_steps',4)
|
389
|
+
settings.setdefault('intermedeate_save',True)
|
390
|
+
settings.setdefault('pin_memory',False)
|
391
|
+
settings.setdefault('n_jobs',cores)
|
392
|
+
settings.setdefault('train_channels',['r','g','b'])
|
393
|
+
settings.setdefault('augment',False)
|
394
|
+
settings.setdefault('preload_batches', 3)
|
395
|
+
settings.setdefault('verbose',True)
|
396
|
+
settings.setdefault('apply_model_to_dataset',True)
|
397
|
+
settings.setdefault('file_metadata',None)
|
398
|
+
settings.setdefault('sample',None)
|
399
|
+
settings.setdefault('experiment','exp.')
|
400
|
+
settings.setdefault('score_threshold',0.5)
|
401
|
+
settings.setdefault('tar_path','path')
|
402
|
+
settings.setdefault('model_path','path')
|
403
|
+
settings.setdefault('file_type','cell_png')
|
404
|
+
settings.setdefault('generate_training_dataset', True)
|
405
|
+
settings.setdefault('train_DL_model', True)
|
406
|
+
return settings
|
407
|
+
|
350
408
|
def get_analyze_recruitment_default_settings(settings):
|
409
|
+
settings.setdefault('src','path')
|
351
410
|
settings.setdefault('target','protein')
|
352
411
|
settings.setdefault('cell_types',['HeLa'])
|
353
412
|
settings.setdefault('cell_plate_metadata',None)
|
@@ -367,12 +426,10 @@ def get_analyze_recruitment_default_settings(settings):
|
|
367
426
|
settings.setdefault('plot',True)
|
368
427
|
settings.setdefault('plot_nr',10)
|
369
428
|
settings.setdefault('plot_control',True)
|
370
|
-
settings.setdefault('figuresize',
|
371
|
-
settings.setdefault('remove_background',False)
|
372
|
-
settings.setdefault('backgrounds',100)
|
429
|
+
settings.setdefault('figuresize',10)
|
373
430
|
settings.setdefault('include_noninfected',True)
|
374
|
-
settings.setdefault('include_multiinfected',
|
375
|
-
settings.setdefault('include_multinucleated',
|
431
|
+
settings.setdefault('include_multiinfected',10)
|
432
|
+
settings.setdefault('include_multinucleated',1)
|
376
433
|
settings.setdefault('cells_per_well',0)
|
377
434
|
settings.setdefault('pathogen_size_range',[0,100000])
|
378
435
|
settings.setdefault('nucleus_size_range',[0,100000])
|
@@ -384,6 +441,7 @@ def get_analyze_recruitment_default_settings(settings):
|
|
384
441
|
return settings
|
385
442
|
|
386
443
|
def get_analyze_reads_default_settings(settings):
|
444
|
+
settings.setdefault('src', 'path')
|
387
445
|
settings.setdefault('upstream', 'CTTCTGGTAAATGGGGATGTCAAGTT')
|
388
446
|
settings.setdefault('downstream', 'GTTTAAGAGCTATGCTGGAAACAGCAG') #This is the reverce compliment of the column primer starting from the end #TGCTGTTTAAGAGCTATGCTGGAAACAGCA
|
389
447
|
settings.setdefault('barecode_length_1', 8)
|
@@ -396,7 +454,7 @@ def get_map_barcodes_default_settings(settings):
|
|
396
454
|
settings.setdefault('src', 'path')
|
397
455
|
settings.setdefault('grna', '/home/carruthers/Documents/grna_barcodes.csv')
|
398
456
|
settings.setdefault('barcodes', '/home/carruthers/Documents/SCREEN_BARCODES.csv')
|
399
|
-
settings.setdefault('plate_dict', {'EO1': 'plate1', 'EO2': 'plate2', 'EO3': 'plate3', 'EO4': 'plate4', 'EO5': 'plate5', 'EO6': 'plate6', 'EO7': 'plate7', 'EO8': 'plate8'})
|
457
|
+
settings.setdefault('plate_dict', "{'EO1': 'plate1', 'EO2': 'plate2', 'EO3': 'plate3', 'EO4': 'plate4', 'EO5': 'plate5', 'EO6': 'plate6', 'EO7': 'plate7', 'EO8': 'plate8'}")
|
400
458
|
settings.setdefault('test', False)
|
401
459
|
settings.setdefault('verbose', True)
|
402
460
|
settings.setdefault('pc', 'TGGT1_220950_1')
|
@@ -522,7 +580,7 @@ expected_types = {
|
|
522
580
|
"timelapse": bool,
|
523
581
|
"timelapse_displacement": int,
|
524
582
|
"timelapse_memory": int,
|
525
|
-
"timelapse_frame_limits": list, # This can be a list of lists
|
583
|
+
"timelapse_frame_limits": (list, type(None)), # This can be a list of lists
|
526
584
|
"timelapse_remove_transient": bool,
|
527
585
|
"timelapse_mode": str,
|
528
586
|
"timelapse_objects": list,
|
@@ -549,13 +607,11 @@ expected_types = {
|
|
549
607
|
"save_png": bool,
|
550
608
|
"crop_mode": list,
|
551
609
|
"use_bounding_box": bool,
|
552
|
-
"png_size": list, # This can be a list of lists
|
610
|
+
"png_size": list, # This can be a list of lists
|
553
611
|
"normalize": bool,
|
554
612
|
"png_dims": list,
|
555
613
|
"normalize_by": str,
|
556
614
|
"save_measurements": bool,
|
557
|
-
"representative_images": bool,
|
558
|
-
"plot_filtration": bool,
|
559
615
|
"include_uninfected": bool,
|
560
616
|
"dialate_pngs": bool,
|
561
617
|
"dialate_png_ratios": list,
|
@@ -563,7 +619,7 @@ expected_types = {
|
|
563
619
|
"cells": list,
|
564
620
|
"cell_loc": list,
|
565
621
|
"pathogens": list,
|
566
|
-
"pathogen_loc": (list, list), # This can be a list of lists
|
622
|
+
"pathogen_loc": (list, list), # This can be a list of lists
|
567
623
|
"treatments": list,
|
568
624
|
"treatment_loc": (list, list), # This can be a list of lists
|
569
625
|
"channel_of_interest": int,
|
@@ -571,10 +627,9 @@ expected_types = {
|
|
571
627
|
"measurement": str,
|
572
628
|
"nr_imgs": int,
|
573
629
|
"um_per_pixel": (int, float),
|
574
|
-
# Additional settings based on provided defaults
|
575
630
|
"include_noninfected": bool,
|
576
|
-
"include_multiinfected":
|
577
|
-
"include_multinucleated":
|
631
|
+
"include_multiinfected": int,
|
632
|
+
"include_multinucleated": int,
|
578
633
|
"filter_min_max": (list, type(None)),
|
579
634
|
"channel_dims": list,
|
580
635
|
"backgrounds": list,
|
@@ -668,7 +723,6 @@ expected_types = {
|
|
668
723
|
"image_size": int,
|
669
724
|
"epochs": int,
|
670
725
|
"val_split": float,
|
671
|
-
"train_mode": str,
|
672
726
|
"learning_rate": float,
|
673
727
|
"weight_decay": float,
|
674
728
|
"dropout_rate": float,
|
@@ -683,9 +737,9 @@ expected_types = {
|
|
683
737
|
"augment": bool,
|
684
738
|
"target": str,
|
685
739
|
"cell_types": list,
|
686
|
-
"cell_plate_metadata": (list,
|
740
|
+
"cell_plate_metadata": (list, list),
|
687
741
|
"pathogen_types": list,
|
688
|
-
"pathogen_plate_metadata": (list, list), # This can be a list of lists
|
742
|
+
"pathogen_plate_metadata": (list, list), # This can be a list of lists
|
689
743
|
"treatment_plate_metadata": (list, list), # This can be a list of lists
|
690
744
|
"metadata_types": list,
|
691
745
|
"cell_chann_dim": int,
|
@@ -738,63 +792,70 @@ expected_types = {
|
|
738
792
|
"from_scratch": bool,
|
739
793
|
"width_height": list,
|
740
794
|
"resize": bool,
|
795
|
+
"compression": str,
|
796
|
+
"complevel": int,
|
741
797
|
"gene_weights_csv": str,
|
742
798
|
"fraction_threshold": float,
|
799
|
+
"barcode_mapping":dict,
|
800
|
+
"redunction_method":str,
|
801
|
+
"mix":str,
|
802
|
+
"model_type_ml":str,
|
803
|
+
"exclude_conditions":list,
|
804
|
+
"remove_highly_correlated_features":bool,
|
805
|
+
'barcode_coordinates':list, # This is a list of lists
|
806
|
+
'reverse_complement':bool,
|
807
|
+
'file_type':str,
|
808
|
+
'model_path':str,
|
809
|
+
'tar_path':str,
|
810
|
+
'score_threshold':float,
|
811
|
+
'sample':None,
|
812
|
+
'file_metadata':None,
|
813
|
+
'apply_model_to_dataset':False,
|
814
|
+
"train":bool,
|
815
|
+
"test":bool,
|
816
|
+
'train_channels':list,
|
817
|
+
"optimizer_type":str,
|
818
|
+
"dataset_mode":str,
|
819
|
+
"annotated_classes":list,
|
820
|
+
"annotation_column":str,
|
821
|
+
"apply_model_to_dataset":bool,
|
822
|
+
"metadata_type_by":str,
|
823
|
+
"custom_measurement":str,
|
824
|
+
"custom_model":bool,
|
825
|
+
"size":int,
|
826
|
+
"test_split":float,
|
827
|
+
"class_metadata":list, # This is a list of lists
|
828
|
+
"png_type":str,
|
829
|
+
"custom_model_path":str,
|
830
|
+
"generate_training_dataset":bool,
|
831
|
+
'preload_batches':int,
|
832
|
+
"train_DL_model":bool,
|
743
833
|
}
|
744
834
|
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
else:
|
768
|
-
raise ValueError("Invalid format for list or list of lists")
|
769
|
-
elif expected_type == list:
|
770
|
-
settings[key] = parse_list(value) if value else None
|
771
|
-
elif expected_type == bool:
|
772
|
-
settings[key] = value if isinstance(value, bool) else value.lower() in ['true', '1', 't', 'y', 'yes']
|
773
|
-
elif expected_type == (int, type(None)):
|
774
|
-
settings[key] = int(value) if value else None
|
775
|
-
elif expected_type == (float, type(None)):
|
776
|
-
settings[key] = float(value) if value else None
|
777
|
-
elif expected_type == (int, float):
|
778
|
-
settings[key] = float(value) if '.' in value else int(value)
|
779
|
-
elif expected_type == (str, type(None)):
|
780
|
-
settings[key] = str(value) if value else None
|
781
|
-
elif isinstance(expected_type, tuple):
|
782
|
-
for typ in expected_type:
|
783
|
-
try:
|
784
|
-
settings[key] = typ(value) if value else None
|
785
|
-
break
|
786
|
-
except (ValueError, TypeError):
|
787
|
-
continue
|
788
|
-
else:
|
789
|
-
raise ValueError
|
790
|
-
else:
|
791
|
-
settings[key] = expected_type(value) if value else None
|
792
|
-
except (ValueError, SyntaxError):
|
793
|
-
expected_type_name = ' or '.join([t.__name__ for t in expected_type]) if isinstance(expected_type, tuple) else expected_type.__name__
|
794
|
-
q.put(f"Error: Invalid format for {key}. Expected type: {expected_type_name}.")
|
795
|
-
return
|
835
|
+
categories = {"General": ["src", "metadata_type", "custom_regex", "experiment", "channels", "magnification", "channel_dims", "apply_model_to_dataset", "generate_training_dataset", "train_DL_model"],
|
836
|
+
"Cell": ["cell_intensity_range", "cell_size_range", "cell_chann_dim", "cell_channel", "cell_background", "cell_Signal_to_noise", "cell_CP_prob", "cell_FT", "remove_background_cell", "cell_min_size", "cell_mask_dim", "cytoplasm", "cytoplasm_min_size", "include_uninfected", "merge_edge_pathogen_cells", "adjust_cells"],
|
837
|
+
"Nucleus": ["nucleus_intensity_range", "nucleus_size_range", "nucleus_chann_dim", "nucleus_channel", "nucleus_background", "nucleus_Signal_to_noise", "nucleus_CP_prob", "nucleus_FT", "remove_background_nucleus", "nucleus_min_size", "nucleus_mask_dim", "nucleus_loc"],
|
838
|
+
"Pathogen": ["pathogen_intensity_range", "pathogen_size_range", "pathogen_chann_dim", "pathogen_channel", "pathogen_background", "pathogen_Signal_to_noise", "pathogen_CP_prob", "pathogen_FT", "pathogen_model", "remove_background_pathogen", "pathogen_min_size", "pathogen_mask_dim"],
|
839
|
+
"Timelapse": ["fps", "timelapse_displacement", "timelapse_memory", "timelapse_frame_limits", "timelapse_remove_transient", "timelapse_mode", "timelapse_objects", "compartments"],
|
840
|
+
"Plot": ["plot_control", "plot_nr", "examples_to_plot", "normalize_plots", "normalize", "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"],
|
841
|
+
"Measurements": ["remove_image_canvas", "remove_highly_correlated", "homogeneity", "homogeneity_distances", "radial_dist", "calculate_correlation", "manders_thresholds", "save_measurements", "tables", "image_nr", "dot_size", "filter_by", "remove_highly_correlated_features", "remove_low_variance_features", "channel_of_interest"],
|
842
|
+
"Paths":["grna", "barcodes", "custom_model_path", "tar_path","model_path"],
|
843
|
+
"Sequencing": ["upstream", "downstream", "barecode_length_1", "barecode_length_2", "chunk_size", "barcode_mapping", "reverse_complement", "barcode_coordinates", "complevel", "compression","plate_dict"],
|
844
|
+
"Embedding": ["visualize","n_neighbors","min_dist","metric","resnet_features","reduction_method","embedding_by_controls","col_to_compare","log_data"],
|
845
|
+
"Clustering": ["eps","min_samples","analyze_clusters","clustering","remove_cluster_noise"],
|
846
|
+
"Object Image": ["save_png", "dialate_pngs", "dialate_png_ratios", "png_size", "png_dims", "save_arrays", "normalize_by", "dialate_png_ratios", "crop_mode", "dialate_pngs", "normalize", "use_bounding_box"],
|
847
|
+
"Annotation": ["nc_loc", "pc_loc", "nc", "pc", "cell_plate_metadata","pathogen_types", "pathogen_plate_metadata", "treatment_plate_metadata", "metadata_types", "cell_types", "target","positive_control","negative_control", "location_column", "treatment_loc", "cells", "cell_loc", "pathogens", "pathogen_loc", "channel_of_interest", "measurement", "treatments", "um_per_pixel", "nr_imgs", "exclude", "exclude_conditions", "mix", "pos", "neg"],
|
848
|
+
"Machine Learning":[],
|
849
|
+
"Deep Learning": ["png_type","score_threshold","file_type", "train_channels", "epochs", "loss_type", "optimizer_type","image_size","val_split","learning_rate","weight_decay","dropout_rate", "init_weights", "train", "classes", "augment"],
|
850
|
+
"Generate Dataset":["preload_batches", "file_metadata","class_metadata", "annotation_column","annotated_classes", "dataset_mode", "metadata_type_by","custom_measurement", "sample", "size"],
|
851
|
+
"Cellpose":["from_scratch", "n_epochs", "width_height", "model_name", "custom_model", "resample", "rescale", "CP_prob", "flow_threshold", "percentiles", "circular", "invert", "diameter", "grayscale", "background", "Signal_to_noise", "resize", "target_height", "target_width"],
|
852
|
+
"Regression":["class_1_threshold", "plate", "other", "fraction_threshold", "alpha", "remove_row_column_effect", "regression_type", "min_cell_count", "agg_type", "transform", "dependent_variable", "gene_weights_csv"],
|
853
|
+
"Miscellaneous": ["all_to_mip", "pick_slice", "skip_mode", "upscale", "upscale_factor"],
|
854
|
+
"Test": ["test_mode", "test_images", "random_test", "test_nr", "test", "test_split"],
|
855
|
+
"Advanced": ["target_intensity_min", "cells_per_well", "include_multinucleated", "include_multiinfected", "include_noninfected", "backgrounds", "plot", "timelapse", "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", "amsgrad","use_checkpoint","gradient_accumulation","gradient_accumulation_steps","intermedeate_save","pin_memory"]
|
856
|
+
}
|
796
857
|
|
797
|
-
|
858
|
+
category_keys = list(categories.keys())
|
798
859
|
|
799
860
|
def check_settings(vars_dict, expected_types, q=None):
|
800
861
|
from .gui_utils import parse_list
|
@@ -805,9 +866,9 @@ def check_settings(vars_dict, expected_types, q=None):
|
|
805
866
|
|
806
867
|
settings = {}
|
807
868
|
|
808
|
-
for key, (label, widget, var) in vars_dict.items():
|
869
|
+
for key, (label, widget, var, _) in vars_dict.items():
|
809
870
|
if key not in expected_types:
|
810
|
-
if key not in
|
871
|
+
if key not in category_keys:
|
811
872
|
q.put(f"Key {key} not found in expected types.")
|
812
873
|
continue
|
813
874
|
|
@@ -815,13 +876,15 @@ def check_settings(vars_dict, expected_types, q=None):
|
|
815
876
|
expected_type = expected_types.get(key, str)
|
816
877
|
|
817
878
|
try:
|
818
|
-
if key in ["png_size", "pathogen_plate_metadata", "treatment_plate_metadata"]:
|
879
|
+
if key in ["cell_plate_metadata", "timelapse_frame_limits", "png_size", "pathogen_loc", "treatment_loc", "pathogen_plate_metadata", "treatment_plate_metadata", "barcode_coordinates", "class_metadata"]:
|
819
880
|
parsed_value = ast.literal_eval(value) if value else None
|
820
881
|
if isinstance(parsed_value, list):
|
821
882
|
if all(isinstance(i, list) for i in parsed_value) or all(not isinstance(i, list) for i in parsed_value):
|
822
883
|
settings[key] = parsed_value
|
823
884
|
else:
|
824
885
|
raise ValueError("Invalid format: Mixed list and list of lists")
|
886
|
+
#elif parsed_value == None:
|
887
|
+
# settings[key] = None
|
825
888
|
else:
|
826
889
|
raise ValueError("Invalid format for list or list of lists")
|
827
890
|
elif expected_type == list:
|
@@ -836,6 +899,20 @@ def check_settings(vars_dict, expected_types, q=None):
|
|
836
899
|
settings[key] = float(value) if '.' in value else int(value)
|
837
900
|
elif expected_type == (str, type(None)):
|
838
901
|
settings[key] = str(value) if value else None
|
902
|
+
elif expected_type == dict:
|
903
|
+
try:
|
904
|
+
# Ensure that the value is a string that can be converted to a dictionary
|
905
|
+
if isinstance(value, str):
|
906
|
+
settings[key] = ast.literal_eval(value)
|
907
|
+
else:
|
908
|
+
raise ValueError("Expected a string representation of a dictionary.")
|
909
|
+
|
910
|
+
# Check if the result is actually a dictionary
|
911
|
+
if not isinstance(settings[key], dict):
|
912
|
+
raise ValueError("Value is not a valid dictionary.")
|
913
|
+
except (ValueError, SyntaxError) as e:
|
914
|
+
settings[key] = {}
|
915
|
+
q.put(f"Error: Invalid format for {key}. Expected type: dict. Error: {e}")
|
839
916
|
elif isinstance(expected_type, tuple):
|
840
917
|
for typ in expected_type:
|
841
918
|
try:
|
@@ -856,7 +933,7 @@ def check_settings(vars_dict, expected_types, q=None):
|
|
856
933
|
|
857
934
|
def generate_fields(variables, scrollable_frame):
|
858
935
|
from .gui_utils import create_input_field
|
859
|
-
from .gui_elements import spacrToolTip
|
936
|
+
from .gui_elements import set_dark_style, spacrToolTip
|
860
937
|
row = 1
|
861
938
|
vars_dict = {}
|
862
939
|
tooltips = {
|
@@ -886,7 +963,7 @@ def generate_fields(variables, scrollable_frame):
|
|
886
963
|
"cell_Signal_to_noise": "(float) - The signal-to-noise ratio for the cell channel. This will be used to determine the range of intensities to normalize images to for cell segmentation.",
|
887
964
|
"cell_size_range": "(list) - Size range for cell segmentation.",
|
888
965
|
"cell_types": "(list) - Types of cells to include in the analysis.",
|
889
|
-
"cells": "(list) - The cell types to include in the analysis.",
|
966
|
+
"cells": "(list of lists) - The cell types to include in the analysis.",
|
890
967
|
"cells_per_well": "(int) - Number of cells per well.",
|
891
968
|
"channel_dims": "(list) - The dimensions of the image channels.",
|
892
969
|
"channel_of_interest": "(int) - The channel of interest to use for the analysis.",
|
@@ -936,8 +1013,8 @@ def generate_fields(variables, scrollable_frame):
|
|
936
1013
|
"image_nr": "(int) - Number of images to process.",
|
937
1014
|
"image_size": "(int) - Size of the images for training.",
|
938
1015
|
"img_zoom": "(float) - Zoom factor for the images in plots.",
|
939
|
-
"include_multinucleated": "(
|
940
|
-
"include_multiinfected": "(
|
1016
|
+
"include_multinucleated": "(int) - Whether to include multinucleated cells in the analysis.",
|
1017
|
+
"include_multiinfected": "(int) - Whether to include multi-infected cells in the analysis.",
|
941
1018
|
"include_noninfected": "(bool) - Whether to include non-infected cells in the analysis.",
|
942
1019
|
"include_uninfected": "(bool) - Whether to include uninfected cells in the analysis.",
|
943
1020
|
"init_weights": "(bool) - Whether to initialize weights for the model.",
|
@@ -955,7 +1032,7 @@ def generate_fields(variables, scrollable_frame):
|
|
955
1032
|
"metadata_type": "(str) - Type of metadata to expect in the images. This will determine how the images are processed. If 'custom' is selected, you can provide a custom regex pattern to extract metadata from the image names.",
|
956
1033
|
"metadata_types": "(list) - Types of metadata to include in the analysis.",
|
957
1034
|
"merge_edge_pathogen_cells": "(bool) - Whether to merge cells that share pathogen objects.",
|
958
|
-
"merge_pathogens": "(bool) - Whether to merge pathogen objects that share more than 75
|
1035
|
+
"merge_pathogens": "(bool) - Whether to merge pathogen objects that share more than 75 percent of their perimeter.",
|
959
1036
|
"metric": "(str) - Metric to use for UMAP.",
|
960
1037
|
"min_cell_count": "(int) - Minimum number of cells required for analysis.",
|
961
1038
|
"min_dist": "(float) - Minimum distance for UMAP.",
|
@@ -964,6 +1041,7 @@ def generate_fields(variables, scrollable_frame):
|
|
964
1041
|
"mix": "(dict) - Mixing settings for the samples.",
|
965
1042
|
"model_name": "(str) - Name of the Cellpose model.",
|
966
1043
|
"model_type": "(str) - Type of model to use for the analysis.",
|
1044
|
+
"model_type_ml": "(str) - Type of model to use for machine learning.",
|
967
1045
|
"nc": "(str) - Negative control identifier.",
|
968
1046
|
"nc_loc": "(str) - Location of the negative control in the images.",
|
969
1047
|
"negative_control": "(str) - Identifier for the negative control.",
|
@@ -994,12 +1072,7 @@ def generate_fields(variables, scrollable_frame):
|
|
994
1072
|
"pathogen_background": "(float) - The background intensity for the pathogen channel. This will be used to remove background noise.",
|
995
1073
|
"pathogen_chann_dim": "(int) - Dimension of the channel to use for pathogen segmentation.",
|
996
1074
|
"pathogen_channel": "(int) - The channel to use for the pathogen. If None, the pathogen will not be segmented.",
|
997
|
-
"pathogen_intensity_range": "(
|
998
|
-
"pathogen_loc": "(list) - The locations of the pathogen types in the images.",
|
999
|
-
"pathogen_mask_dim": "(int) - The dimension of the array the pathogen mask is saved in.",
|
1000
|
-
"pathogen_min_size": "(int) - The minimum size of pathogen objects in pixels^2.",
|
1001
|
-
"pathogen_model": "(str) - Model to use for pathogen segmentation.",
|
1002
|
-
"pathogen_plate_metadata": "(str) - Metadata for the pathogen plate.",
|
1075
|
+
"pathogen_intensity_range": "(str) - Metadata for the pathogen plate.",
|
1003
1076
|
"pathogen_Signal_to_noise": "(float) - The signal-to-noise ratio for the pathogen channel. This will be used to determine the range of intensities to normalize images to for pathogen segmentation.",
|
1004
1077
|
"pathogen_size_range": "(list) - Size range for pathogen segmentation.",
|
1005
1078
|
"pathogen_types": "(list) - Types of pathogens to include in the analysis.",
|
@@ -1014,7 +1087,6 @@ def generate_fields(variables, scrollable_frame):
|
|
1014
1087
|
"plot_by_cluster": "(bool) - Whether to plot images by clusters.",
|
1015
1088
|
"plot_cluster_grids": "(bool) - Whether to plot grids of clustered images.",
|
1016
1089
|
"plot_control": "(dict) - Control settings for plotting.",
|
1017
|
-
"plot_filtration": "(bool) - Whether to plot the filtration steps.",
|
1018
1090
|
"plot_images": "(bool) - Whether to plot images.",
|
1019
1091
|
"plot_nr": "(int) - Number of plots to generate.",
|
1020
1092
|
"plot_outlines": "(bool) - Whether to plot outlines of segmented objects.",
|
@@ -1036,7 +1108,6 @@ def generate_fields(variables, scrollable_frame):
|
|
1036
1108
|
"remove_image_canvas": "(bool) - Whether to remove the image canvas after plotting.",
|
1037
1109
|
"remove_low_variance_features": "(bool) - Whether to remove low variance features from the analysis.",
|
1038
1110
|
"remove_row_column_effect": "(bool) - Whether to remove row and column effects from the data.",
|
1039
|
-
"representative_images": "(bool) - Whether to save representative images of the segmented objects (Not working yet).",
|
1040
1111
|
"resize": "(bool) - Resize factor for the images.",
|
1041
1112
|
"resample": "(bool) - Whether to resample the images during processing.",
|
1042
1113
|
"rescale": "(float) - Rescaling factor for the images.",
|
@@ -1067,7 +1138,6 @@ def generate_fields(variables, scrollable_frame):
|
|
1067
1138
|
"treatments": "(list) - The treatments to include in the analysis.",
|
1068
1139
|
"top_features": "(int) - Top features to include in the analysis.",
|
1069
1140
|
"train": "(bool) - Whether to train the model.",
|
1070
|
-
"train_mode": "(str) - Mode to use for training the model.",
|
1071
1141
|
"transform": "(dict) - Transformation to apply to the data.",
|
1072
1142
|
"upscale": "(bool) - Whether to upscale the images.",
|
1073
1143
|
"upscale_factor": "(float) - Factor by which to upscale the images.",
|
@@ -1077,51 +1147,42 @@ def generate_fields(variables, scrollable_frame):
|
|
1077
1147
|
"verbose": "(bool) - Whether to print verbose output during processing.",
|
1078
1148
|
"weight_decay": "(float) - Weight decay for regularization.",
|
1079
1149
|
"width_height": "(tuple) - Width and height of the input images.",
|
1150
|
+
"barcode_coordinates": "(list of lists) - Coordinates of the barcodes in the sequence.",
|
1151
|
+
"barcode_mapping": "dict - names and barecode csv files",
|
1152
|
+
"compression": "str - type of compression (e.g. zlib)",
|
1153
|
+
"complevel": "int - level of compression (0-9). Higher is slower and yealds smaller files",
|
1154
|
+
"file_type": "str - type of file to process",
|
1155
|
+
"model_path": "str - path to the model",
|
1156
|
+
"tar_path": "str - path to the tar file with image dataset",
|
1157
|
+
"score_threshold": "float - threshold for classification",
|
1158
|
+
"sample": "str - number of images to sample for tar dataset (including both classes). Default: None",
|
1159
|
+
"file_metadata": "str - string that must be present in image path to be included in the dataset",
|
1160
|
+
"apply_model_to_dataset": "bool - whether to apply model to the dataset",
|
1161
|
+
"train_channels": "list - channels to use for training",
|
1162
|
+
"dataset_mode": "str - How to generate train/test dataset.",
|
1163
|
+
"annotated_classes": "list - list of numbers in annotation column.",
|
1080
1164
|
"um_per_pixel": "(float) - The micrometers per pixel for the images."
|
1081
1165
|
}
|
1082
1166
|
|
1083
|
-
|
1084
1167
|
for key, (var_type, options, default_value) in variables.items():
|
1085
|
-
label, widget, var = create_input_field(scrollable_frame.scrollable_frame, key, row, var_type, options, default_value)
|
1086
|
-
vars_dict[key] = (label, widget, var) # Store the label, widget, and variable
|
1168
|
+
label, widget, var, frame = create_input_field(scrollable_frame.scrollable_frame, key, row, var_type, options, default_value)
|
1169
|
+
vars_dict[key] = (label, widget, var, frame) # Store the label, widget, and variable
|
1087
1170
|
|
1088
1171
|
# Add tooltip to the label if it exists in the tooltips dictionary
|
1089
1172
|
if key in tooltips:
|
1090
1173
|
spacrToolTip(label, tooltips[key])
|
1174
|
+
|
1091
1175
|
row += 1
|
1176
|
+
|
1092
1177
|
return vars_dict
|
1093
1178
|
|
1094
|
-
categories = {
|
1095
|
-
"General": ["src", "metadata_type", "custom_regex", "experiment", "channels", "magnification", "channel_dims"],
|
1096
|
-
"Paths":["grna", "barcodes"],
|
1097
|
-
"Regression":["class_1_threshold", "plate", "other", "fraction_threshold", "alpha", "remove_row_column_effect", "regression_type", "min_cell_count", "agg_type", "transform", "dependent_variable", "gene_weights_csv"],
|
1098
|
-
"Cellpose":["from_scratch", "n_epochs", "width_height", "model_name", "custom_model", "resample", "rescale", "CP_prob", "flow_threshold", "percentiles", "circular", "invert", "diameter", "grayscale", "background", "Signal_to_noise", "resize", "target_height", "target_width"],
|
1099
|
-
"Nucleus": ["nucleus_intensity_range", "nucleus_size_range", "nucleus_chann_dim", "nucleus_channel", "nucleus_background", "nucleus_Signal_to_noise", "nucleus_CP_prob", "nucleus_FT", "remove_background_nucleus", "nucleus_min_size", "nucleus_mask_dim", "nucleus_loc"],
|
1100
|
-
"Cell": ["cell_intensity_range", "cell_size_range", "cell_chann_dim", "cell_channel", "cell_background", "cell_Signal_to_noise", "cell_CP_prob", "cell_FT", "remove_background_cell", "cell_min_size", "cell_mask_dim", "cytoplasm", "cytoplasm_min_size", "include_uninfected", "merge_edge_pathogen_cells", "adjust_cells"],
|
1101
|
-
"Pathogen": ["pathogen_intensity_range", "pathogen_size_range", "pathogen_chann_dim", "pathogen_channel", "pathogen_background", "pathogen_Signal_to_noise", "pathogen_CP_prob", "pathogen_FT", "pathogen_model", "remove_background_pathogen", "pathogen_min_size", "pathogen_mask_dim"],
|
1102
|
-
"Timelapse": ["fps", "timelapse_displacement", "timelapse_memory", "timelapse_frame_limits", "timelapse_remove_transient", "timelapse_mode", "timelapse_objects", "compartments"],
|
1103
|
-
"Plot": ["plot_control", "plot_nr", "plot_filtration", "examples_to_plot", "normalize_plots", "normalize", "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"],
|
1104
|
-
"Object Image": ["save_png", "dialate_pngs", "dialate_png_ratios", "png_size", "png_dims", "save_arrays", "normalize_by", "dialate_png_ratios", "crop_mode", "dialate_pngs", "normalize", "use_bounding_box"],
|
1105
|
-
"Annotate Data": ["nc_loc", "pc_loc", "nc", "pc", "cell_plate_metadata","pathogen_types", "pathogen_plate_metadata", "treatment_plate_metadata", "metadata_types", "cell_types", "target","positive_control","negative_control", "location_column", "treatment_loc", "cells", "cell_loc", "pathogens", "pathogen_loc", "channel_of_interest", "measurement", "treatments", "representative_images", "um_per_pixel", "nr_imgs", "exclude", "exclude_conditions", "mix", "pos", "neg"],
|
1106
|
-
"Measurements": ["remove_image_canvas", "remove_highly_correlated", "homogeneity", "homogeneity_distances", "radial_dist", "calculate_correlation", "manders_thresholds", "save_measurements", "tables", "image_nr", "dot_size", "filter_by", "remove_highly_correlated_features", "remove_low_variance_features", "channel_of_interest"],
|
1107
|
-
"Advanced": ["plate_dict", "target_intensity_min", "cells_per_well", "include_multinucleated", "include_multiinfected", "include_noninfected", "backgrounds", "plot", "timelapse", "schedule", "test_size","exclude","n_repeats","top_features", "model_type","minimum_cell_count","n_estimators","preprocess", "remove_background", "normalize", "lower_percentile", "merge_pathogens", "batch_size", "filter", "save", "masks", "verbose", "randomize", "n_jobs", "train_mode","amsgrad","use_checkpoint","gradient_accumulation","gradient_accumulation_steps","intermedeate_save","pin_memory","n_jobs","channels","augment"],
|
1108
|
-
"Clustering": ["eps","min_samples","analyze_clusters","clustering","remove_cluster_noise"],
|
1109
|
-
"Embedding": ["visualize","n_neighbors","min_dist","metric","resnet_features","reduction_method","embedding_by_controls","col_to_compare","log_data"],
|
1110
|
-
"Train DL Model": ["epochs", "loss_type", "optimizer_type","image_size","val_split","learning_rate","weight_decay","dropout_rate", "init_weights", "train", "classes"],
|
1111
|
-
"Miscellaneous": ["all_to_mip", "pick_slice", "skip_mode", "upscale", "upscale_factor"],
|
1112
|
-
"Test": ["test_mode", "test_images", "random_test", "test_nr", "test"],
|
1113
|
-
"Sequencing": ["upstream", "downstream", "barecode_length_1", "barecode_length_2", "chunk_size"]
|
1114
|
-
}
|
1115
|
-
|
1116
1179
|
descriptions = {
|
1117
|
-
'mask': "Generate
|
1180
|
+
'mask': "\n\nHelp:\n- Generate Cells, Nuclei, Pathogens, and Cytoplasm masks from intensity images in src.\n- To ensure that spacr is installed correctly:\n- 1. Downloade the training set (click Download).\n- 2. Import settings (click settings navigate to downloaded dataset settings folder and import preprocess_generate_masks_settings.csv).\n- 3. Run the module.\n- 4. Proceed to the Measure module (click Measure in the menue bar).\n- For further help, click the Help button in the menue bar.",
|
1118
1181
|
|
1119
1182
|
'measure': "Capture Measurements from Cells, Nuclei, Pathogens, and Cytoplasm objects. Generate single object PNG images for one or several objects. (Requires masks from the Mask module). Function: measure_crop from spacr.measure.\n\nKey Features:\n- Comprehensive Measurement Capture: Obtain detailed measurements for various cellular components, including area, perimeter, intensity, and more.\n- Image Generation: Create high-resolution PNG images of individual objects, facilitating further analysis and visualization.\n- Mask Dependency: Requires accurate masks generated by the Mask module to ensure precise measurements.",
|
1120
1183
|
|
1121
1184
|
'classify': "Train and Test any Torch Computer vision model. (Requires PNG images from the Measure module). Function: train_test_model from spacr.deep_spacr.\n\nKey Features:\n- Deep Learning Integration: Train and evaluate state-of-the-art Torch models for various classification tasks.\n- Flexible Training: Supports a wide range of Torch models, allowing customization based on specific research needs.\n- Data Requirement: Requires PNG images generated by the Measure module for training and testing.",
|
1122
1185
|
|
1123
|
-
'sequencing': "Find Barcodes and gRNA sequences in FASTQ files. (Requires paired-end FASTQ files, R1 and R2). Function: analyze_reads from spacr.sequencing.\n\nKey Features:\n- Barcode and gRNA Identification: Efficiently detect and extract barcode and gRNA sequences from raw sequencing data.\n- Paired-End Support: Specifically designed to handle paired-end FASTQ files, ensuring accurate sequence alignment and analysis.\n- High Throughput: Capable of processing large sequencing datasets quickly and accurately.",
|
1124
|
-
|
1125
1186
|
'umap': "Generate UMAP or tSNE embeddings and represent points as single cell images. (Requires measurements.db and PNG images from the Measure module). Function: generate_image_umap from spacr.core.\n\nKey Features:\n- Dimensionality Reduction: Employ UMAP or tSNE algorithms to reduce high-dimensional data into two dimensions for visualization.\n- Single Cell Representation: Visualize embedding points as single cell images, providing an intuitive understanding of data clusters.\n- Data Integration: Requires measurements and images generated by the Measure module, ensuring comprehensive data representation.",
|
1126
1187
|
|
1127
1188
|
'train_cellpose': "Train custom Cellpose models for your specific dataset. Function: train_cellpose_model from spacr.core.\n\nKey Features:\n- Custom Model Training: Train Cellpose models on your dataset to improve segmentation accuracy.\n- Data Adaptation: Tailor the model to handle specific types of biological samples more effectively.\n- Advanced Training Options: Supports various training parameters and configurations for optimized performance.",
|
@@ -1132,8 +1193,8 @@ descriptions = {
|
|
1132
1193
|
|
1133
1194
|
'cellpose_all': "Run Cellpose on all images in your dataset and obtain masks and measurements. Function: cellpose_analysis from spacr.cellpose.\n\nKey Features:\n- End-to-End Analysis: Perform both segmentation and measurement extraction in a single step.\n- Efficiency: Process entire datasets with minimal manual intervention.\n- Comprehensive Output: Obtain detailed masks and corresponding measurements for further analysis.",
|
1134
1195
|
|
1135
|
-
'map_barcodes': "Map barcodes
|
1136
|
-
|
1196
|
+
'map_barcodes': "\n\nHelp:\n- 1 .Generate consensus read fastq files from R1 and R2 files.\n- 2. Map barcodes from sequencing data for identification and tracking of samples.\n- 3. Run the module to extract and map barcodes from your FASTQ files in chunks.\n- Prepare your barcode CSV files with the appropriate 'name' and 'sequence' columns.\n- Configure the barcode settings (coordinates and reverse complement flags) according to your experimental setup.\n- For further help, click the Help button in the menu bar.",
|
1197
|
+
|
1137
1198
|
'regression': "Perform regression analysis on your data. Function: regression_tools from spacr.analysis.\n\nKey Features:\n- Statistical Analysis: Conduct various types of regression analysis to identify relationships within your data.\n- Flexible Options: Supports multiple regression models and configurations.\n- Data Insight: Gain deeper insights into your dataset through advanced regression techniques.",
|
1138
1199
|
|
1139
1200
|
'recruitment': "Analyze recruitment data to understand sample recruitment dynamics. Function: recruitment_analysis_tools from spacr.analysis.\n\nKey Features:\n- Recruitment Analysis: Investigate and analyze the recruitment of samples over time or conditions.\n- Visualization: Generate visualizations to represent recruitment trends and patterns.\n- Integration: Utilize data from various sources for a comprehensive recruitment analysis."
|
@@ -1142,7 +1203,7 @@ descriptions = {
|
|
1142
1203
|
def set_annotate_default_settings(settings):
|
1143
1204
|
settings.setdefault('src', 'path')
|
1144
1205
|
settings.setdefault('image_type', 'cell_png')
|
1145
|
-
settings.setdefault('channels',
|
1206
|
+
settings.setdefault('channels', "r,g,b")
|
1146
1207
|
settings.setdefault('img_size', 200)
|
1147
1208
|
settings.setdefault('annotation_column', 'test')
|
1148
1209
|
settings.setdefault('normalize', 'False')
|
@@ -1151,3 +1212,15 @@ def set_annotate_default_settings(settings):
|
|
1151
1212
|
settings.setdefault('threshold', '2')
|
1152
1213
|
return settings
|
1153
1214
|
|
1215
|
+
def set_default_generate_barecode_mapping(settings={}):
|
1216
|
+
settings.setdefault('src', 'path')
|
1217
|
+
settings.setdefault('chunk_size', 100000)
|
1218
|
+
|
1219
|
+
settings.setdefault('barcode_mapping', {'row': ['/home/carruthers/Documents/row_barcodes.csv',(80, 88), True],
|
1220
|
+
'grna': ['/home/carruthers/Documents/grna_barcodes.csv',(34, 55), True],
|
1221
|
+
'column': ['/home/carruthers/Documents/column_barcodes.csv',(0, 7), False]})
|
1222
|
+
|
1223
|
+
settings.setdefault('n_jobs', None)
|
1224
|
+
settings.setdefault('compression', 'zlib')
|
1225
|
+
settings.setdefault('complevel', 5)
|
1226
|
+
return settings
|