spacr 0.3.1__py3-none-any.whl → 0.3.2__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 +19 -3
- spacr/cellpose.py +311 -0
- spacr/core.py +140 -2493
- spacr/deep_spacr.py +151 -29
- spacr/gui.py +1 -0
- spacr/gui_core.py +74 -63
- spacr/gui_elements.py +110 -5
- spacr/gui_utils.py +346 -6
- spacr/io.py +624 -44
- spacr/logger.py +28 -9
- spacr/measure.py +107 -95
- spacr/mediar.py +0 -3
- spacr/ml.py +964 -0
- spacr/openai.py +37 -0
- spacr/plot.py +280 -15
- spacr/resources/data/lopit.csv +3833 -0
- spacr/resources/data/toxoplasma_metadata.csv +8843 -0
- spacr/resources/icons/convert.png +0 -0
- spacr/resources/{models/cp/toxo_plaque_cyto_e25000_X1120_Y1120.CP_model → icons/dna_matrix.mp4} +0 -0
- spacr/sequencing.py +241 -1311
- spacr/settings.py +129 -43
- spacr/sim.py +0 -2
- spacr/submodules.py +348 -0
- spacr/timelapse.py +0 -2
- spacr/toxo.py +233 -0
- spacr/utils.py +271 -171
- {spacr-0.3.1.dist-info → spacr-0.3.2.dist-info}/METADATA +7 -1
- {spacr-0.3.1.dist-info → spacr-0.3.2.dist-info}/RECORD +32 -33
- spacr/chris.py +0 -50
- spacr/graph_learning.py +0 -340
- spacr/resources/MEDIAR/.git +0 -1
- spacr/resources/MEDIAR_weights/.DS_Store +0 -0
- spacr/resources/icons/.DS_Store +0 -0
- spacr/resources/icons/spacr_logo_rotation.gif +0 -0
- spacr/resources/models/cp/toxo_plaque_cyto_e25000_X1120_Y1120.CP_model_settings.csv +0 -23
- spacr/resources/models/cp/toxo_pv_lumen.CP_model +0 -0
- spacr/sim_app.py +0 -0
- {spacr-0.3.1.dist-info → spacr-0.3.2.dist-info}/LICENSE +0 -0
- {spacr-0.3.1.dist-info → spacr-0.3.2.dist-info}/WHEEL +0 -0
- {spacr-0.3.1.dist-info → spacr-0.3.2.dist-info}/entry_points.txt +0 -0
- {spacr-0.3.1.dist-info → spacr-0.3.2.dist-info}/top_level.txt +0 -0
spacr/settings.py
CHANGED
@@ -2,9 +2,9 @@ import os, ast
|
|
2
2
|
|
3
3
|
def set_default_plot_merge_settings():
|
4
4
|
settings = {}
|
5
|
-
settings.setdefault('
|
6
|
-
settings.setdefault('
|
7
|
-
settings.setdefault('
|
5
|
+
settings.setdefault('uninfected', True)
|
6
|
+
settings.setdefault('pathogen_limit', 10)
|
7
|
+
settings.setdefault('nuclei_limit', 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])
|
@@ -217,7 +217,7 @@ def set_default_umap_image_settings(settings={}):
|
|
217
217
|
settings.setdefault('verbose',True)
|
218
218
|
return settings
|
219
219
|
|
220
|
-
def get_measure_crop_settings(settings):
|
220
|
+
def get_measure_crop_settings(settings={}):
|
221
221
|
|
222
222
|
settings.setdefault('src', 'path')
|
223
223
|
settings.setdefault('verbose', False)
|
@@ -246,7 +246,7 @@ def get_measure_crop_settings(settings):
|
|
246
246
|
settings.setdefault('normalize_by','png')
|
247
247
|
settings.setdefault('crop_mode',['cell'])
|
248
248
|
settings.setdefault('dialate_pngs', False)
|
249
|
-
settings.setdefault('dialate_png_ratios', [0.2])
|
249
|
+
settings.setdefault('dialate_png_ratios', [0.2, 0,2])
|
250
250
|
|
251
251
|
# Timelapsed settings
|
252
252
|
settings.setdefault('timelapse', False)
|
@@ -291,6 +291,9 @@ def set_default_analyze_screen(settings):
|
|
291
291
|
settings.setdefault('positive_control','c2')
|
292
292
|
settings.setdefault('negative_control','c1')
|
293
293
|
settings.setdefault('exclude',None)
|
294
|
+
settings.setdefault('nuclei_limit',True)
|
295
|
+
settings.setdefault('pathogen_limit',3)
|
296
|
+
settings.setdefault('uninfected',True)
|
294
297
|
settings.setdefault('n_repeats',10)
|
295
298
|
settings.setdefault('top_features',30)
|
296
299
|
settings.setdefault('remove_low_variance_features',True)
|
@@ -345,6 +348,9 @@ def set_generate_training_dataset_defaults(settings):
|
|
345
348
|
settings.setdefault('channel_of_interest',3)
|
346
349
|
settings.setdefault('custom_measurement',None)
|
347
350
|
settings.setdefault('tables',None)
|
351
|
+
settings.setdefault('nuclei_limit',True)
|
352
|
+
settings.setdefault('pathogen_limit',True)
|
353
|
+
settings.setdefault('uninfected',True)
|
348
354
|
settings.setdefault('png_type','cell_png')
|
349
355
|
|
350
356
|
return settings
|
@@ -392,7 +398,6 @@ def deep_spacr_defaults(settings):
|
|
392
398
|
settings.setdefault('n_jobs',cores)
|
393
399
|
settings.setdefault('train_channels',['r','g','b'])
|
394
400
|
settings.setdefault('augment',False)
|
395
|
-
settings.setdefault('preload_batches', 3)
|
396
401
|
settings.setdefault('verbose',True)
|
397
402
|
settings.setdefault('apply_model_to_dataset',True)
|
398
403
|
settings.setdefault('file_metadata',None)
|
@@ -406,6 +411,37 @@ def deep_spacr_defaults(settings):
|
|
406
411
|
settings.setdefault('train_DL_model', True)
|
407
412
|
return settings
|
408
413
|
|
414
|
+
def get_train_test_model_settings(settings):
|
415
|
+
settings.setdefault('src', 'path')
|
416
|
+
settings.setdefault('train', True)
|
417
|
+
settings.setdefault('test', False)
|
418
|
+
settings.setdefault('custom_model', False)
|
419
|
+
settings.setdefault('classes', ['nc','pc'])
|
420
|
+
settings.setdefault('train_channels', ['r','g','b'])
|
421
|
+
settings.setdefault('model_type', 'maxvit_t')
|
422
|
+
settings.setdefault('optimizer_type', 'adamw')
|
423
|
+
settings.setdefault('schedule', 'reduce_lr_on_plateau')
|
424
|
+
settings.setdefault('loss_type', 'focal_loss')
|
425
|
+
settings.setdefault('normalize', True)
|
426
|
+
settings.setdefault('image_size', 224)
|
427
|
+
settings.setdefault('batch_size', 64)
|
428
|
+
settings.setdefault('epochs', 100)
|
429
|
+
settings.setdefault('val_split', 0.1)
|
430
|
+
settings.setdefault('learning_rate', 0.0001)
|
431
|
+
settings.setdefault('weight_decay', 0.00001)
|
432
|
+
settings.setdefault('dropout_rate', 0.1)
|
433
|
+
settings.setdefault('init_weights', True)
|
434
|
+
settings.setdefault('amsgrad', True)
|
435
|
+
settings.setdefault('use_checkpoint', True)
|
436
|
+
settings.setdefault('gradient_accumulation', True)
|
437
|
+
settings.setdefault('gradient_accumulation_steps', 4)
|
438
|
+
settings.setdefault('intermedeate_save',True)
|
439
|
+
settings.setdefault('pin_memory', True)
|
440
|
+
settings.setdefault('n_jobs', 30)
|
441
|
+
settings.setdefault('augment', True)
|
442
|
+
settings.setdefault('verbose', True)
|
443
|
+
return settings
|
444
|
+
|
409
445
|
def get_analyze_recruitment_default_settings(settings):
|
410
446
|
settings.setdefault('src','path')
|
411
447
|
settings.setdefault('target','protein')
|
@@ -428,9 +464,9 @@ def get_analyze_recruitment_default_settings(settings):
|
|
428
464
|
settings.setdefault('plot_nr',10)
|
429
465
|
settings.setdefault('plot_control',True)
|
430
466
|
settings.setdefault('figuresize',10)
|
431
|
-
settings.setdefault('
|
432
|
-
settings.setdefault('
|
433
|
-
settings.setdefault('
|
467
|
+
settings.setdefault('uninfected',True)
|
468
|
+
settings.setdefault('pathogen_limit',10)
|
469
|
+
settings.setdefault('nuclei_limit',1)
|
434
470
|
settings.setdefault('cells_per_well',0)
|
435
471
|
settings.setdefault('pathogen_size_range',[0,100000])
|
436
472
|
settings.setdefault('nucleus_size_range',[0,100000])
|
@@ -481,14 +517,21 @@ def get_train_cellpose_default_settings(settings):
|
|
481
517
|
settings.setdefault('verbose',True)
|
482
518
|
return settings
|
483
519
|
|
520
|
+
def set_generate_dataset_defaults(settings):
|
521
|
+
settings.setdefault('src','path')
|
522
|
+
settings.setdefault('file_metadata',None)
|
523
|
+
settings.setdefault('experiment','experiment_1')
|
524
|
+
settings.setdefault('sample',None)
|
525
|
+
return settings
|
526
|
+
|
484
527
|
def get_perform_regression_default_settings(settings):
|
485
|
-
settings.setdefault('
|
528
|
+
settings.setdefault('highlight','239740')
|
486
529
|
settings.setdefault('dependent_variable','predictions')
|
487
530
|
settings.setdefault('transform',None)
|
488
531
|
settings.setdefault('agg_type','mean')
|
489
532
|
settings.setdefault('min_cell_count',25)
|
490
533
|
settings.setdefault('regression_type','ols')
|
491
|
-
settings.setdefault('
|
534
|
+
settings.setdefault('random_row_column_effects',False)
|
492
535
|
settings.setdefault('alpha',1)
|
493
536
|
settings.setdefault('fraction_threshold',0.1)
|
494
537
|
settings.setdefault('nc','c1')
|
@@ -496,6 +539,10 @@ def get_perform_regression_default_settings(settings):
|
|
496
539
|
settings.setdefault('other','c3')
|
497
540
|
settings.setdefault('plate','plate1')
|
498
541
|
settings.setdefault('class_1_threshold',None)
|
542
|
+
settings.setdefault('cov_type',None)
|
543
|
+
settings.setdefault('metadata_files',['/home/carruthers/Documents/TGME49_Summary.csv','/home/carruthers/Documents/TGGT1_Summary.csv'])
|
544
|
+
settings.setdefault('toxo', True)
|
545
|
+
|
499
546
|
|
500
547
|
if settings['regression_type'] == 'quantile':
|
501
548
|
print(f"Using alpha as quantile for quantile regression, alpha: {settings['alpha']}")
|
@@ -552,9 +599,10 @@ def get_identify_masks_finetune_default_settings(settings):
|
|
552
599
|
|
553
600
|
q = None
|
554
601
|
expected_types = {
|
555
|
-
"src": str,
|
602
|
+
"src": (str, list),
|
556
603
|
"metadata_type": str,
|
557
604
|
"custom_regex": (str, type(None)),
|
605
|
+
"cov_type": (str, type(None)),
|
558
606
|
"experiment": str,
|
559
607
|
"channels": list,
|
560
608
|
"magnification": int,
|
@@ -628,9 +676,9 @@ expected_types = {
|
|
628
676
|
"measurement": str,
|
629
677
|
"nr_imgs": int,
|
630
678
|
"um_per_pixel": (int, float),
|
631
|
-
"
|
632
|
-
"
|
633
|
-
"
|
679
|
+
"uninfected": bool,
|
680
|
+
"pathogen_limit": int,
|
681
|
+
"nuclei_limit": int,
|
634
682
|
"filter_min_max": (list, type(None)),
|
635
683
|
"channel_dims": list,
|
636
684
|
"backgrounds": list,
|
@@ -767,7 +815,7 @@ expected_types = {
|
|
767
815
|
"agg_type": str,
|
768
816
|
"min_cell_count": int,
|
769
817
|
"regression_type": str,
|
770
|
-
"
|
818
|
+
"random_row_column_effects": bool,
|
771
819
|
"alpha": float,
|
772
820
|
"fraction_threshold": float,
|
773
821
|
"class_1_threshold": (float, type(None)),
|
@@ -829,34 +877,33 @@ expected_types = {
|
|
829
877
|
"png_type":str,
|
830
878
|
"custom_model_path":str,
|
831
879
|
"generate_training_dataset":bool,
|
832
|
-
'preload_batches':int,
|
833
880
|
"segmentation_mode":str,
|
834
881
|
"train_DL_model":bool,
|
835
882
|
}
|
836
883
|
|
837
|
-
categories = {"
|
838
|
-
"
|
884
|
+
categories = {"Paths":[ "src", "grna", "barcodes", "custom_model_path", "tar_path","model_path","grna_csv","row_csv","column_csv"],
|
885
|
+
"General": ["metadata_type", "custom_regex", "experiment", "channels", "magnification", "channel_dims", "apply_model_to_dataset", "generate_training_dataset", "train_DL_model", "segmentation_mode"],
|
886
|
+
"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"],
|
887
|
+
"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", "cells", "cell_loc"],
|
839
888
|
"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"],
|
840
|
-
"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"],
|
841
|
-
"Timelapse": ["fps", "timelapse_displacement", "timelapse_memory", "timelapse_frame_limits", "timelapse_remove_transient", "timelapse_mode", "timelapse_objects", "compartments"],
|
842
|
-
"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"],
|
889
|
+
"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", "pathogens", "pathogen_loc", "pathogen_types", "pathogen_plate_metadata", ],
|
843
890
|
"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"],
|
844
|
-
"Paths":["grna", "barcodes", "custom_model_path", "tar_path","model_path"],
|
845
|
-
"Sequencing": ["upstream", "downstream", "barecode_length_1", "barecode_length_2", "chunk_size", "barcode_mapping", "reverse_complement", "barcode_coordinates", "complevel", "compression","plate_dict"],
|
846
|
-
"Embedding": ["visualize","n_neighbors","min_dist","metric","resnet_features","reduction_method","embedding_by_controls","col_to_compare","log_data"],
|
847
|
-
"Clustering": ["eps","min_samples","analyze_clusters","clustering","remove_cluster_noise"],
|
848
891
|
"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"],
|
849
|
-
"
|
850
|
-
"
|
851
|
-
"
|
852
|
-
"
|
853
|
-
"
|
854
|
-
"Regression":["class_1_threshold", "plate", "other", "fraction_threshold", "alpha", "
|
855
|
-
"
|
892
|
+
"Sequencing": ["signal_direction","mode","comp_level","comp_type","save_h5","expected_end","offset","target_sequence","regex", "highlight"],
|
893
|
+
"Generate Dataset":["file_metadata","class_metadata", "annotation_column","annotated_classes", "dataset_mode", "metadata_type_by","custom_measurement", "sample", "size"],
|
894
|
+
"Hyperparamiters (Training)": ["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", "amsgrad","use_checkpoint","gradient_accumulation","gradient_accumulation_steps","intermedeate_save","pin_memory"],
|
895
|
+
"Hyperparamiters (Embedding)": ["visualize","n_neighbors","min_dist","metric","resnet_features","reduction_method","embedding_by_controls","col_to_compare","log_data"],
|
896
|
+
"Hyperparamiters (Clustering)": ["eps","min_samples","analyze_clusters","clustering","remove_cluster_noise"],
|
897
|
+
"Hyperparamiters (Regression)":["cov_type", "class_1_threshold", "plate", "other", "fraction_threshold", "alpha", "random_row_column_effects", "regression_type", "min_cell_count", "agg_type", "transform", "dependent_variable"],
|
898
|
+
"Annotation": ["nc_loc", "pc_loc", "nc", "pc", "cell_plate_metadata","treatment_plate_metadata", "metadata_types", "cell_types", "target","positive_control","negative_control", "location_column", "treatment_loc", "channel_of_interest", "measurement", "treatments", "um_per_pixel", "nr_imgs", "exclude", "exclude_conditions", "mix", "pos", "neg"],
|
899
|
+
"Plot": ["plot", "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"],
|
856
900
|
"Test": ["test_mode", "test_images", "random_test", "test_nr", "test", "test_split"],
|
857
|
-
"
|
901
|
+
"Timelapse": ["timelapse", "fps", "timelapse_displacement", "timelapse_memory", "timelapse_frame_limits", "timelapse_remove_transient", "timelapse_mode", "timelapse_objects", "compartments"],
|
902
|
+
"Advanced": ["target_intensity_min", "cells_per_well", "nuclei_limit", "pathogen_limit", "uninfected", "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"],
|
903
|
+
"Miscellaneous": ["all_to_mip", "pick_slice", "skip_mode", "upscale", "upscale_factor"]
|
858
904
|
}
|
859
905
|
|
906
|
+
|
860
907
|
category_keys = list(categories.keys())
|
861
908
|
|
862
909
|
def check_settings(vars_dict, expected_types, q=None):
|
@@ -935,7 +982,7 @@ def check_settings(vars_dict, expected_types, q=None):
|
|
935
982
|
|
936
983
|
def generate_fields(variables, scrollable_frame):
|
937
984
|
from .gui_utils import create_input_field
|
938
|
-
from .gui_elements import
|
985
|
+
from .gui_elements import spacrToolTip
|
939
986
|
row = 1
|
940
987
|
vars_dict = {}
|
941
988
|
tooltips = {
|
@@ -1015,9 +1062,9 @@ def generate_fields(variables, scrollable_frame):
|
|
1015
1062
|
"image_nr": "(int) - Number of images to process.",
|
1016
1063
|
"image_size": "(int) - Size of the images for training.",
|
1017
1064
|
"img_zoom": "(float) - Zoom factor for the images in plots.",
|
1018
|
-
"
|
1019
|
-
"
|
1020
|
-
"
|
1065
|
+
"nuclei_limit": "(int) - Whether to include multinucleated cells in the analysis.",
|
1066
|
+
"pathogen_limit": "(int) - Whether to include multi-infected cells in the analysis.",
|
1067
|
+
"uninfected": "(bool) - Whether to include non-infected cells in the analysis.",
|
1021
1068
|
"include_uninfected": "(bool) - Whether to include uninfected cells in the analysis.",
|
1022
1069
|
"init_weights": "(bool) - Whether to initialize weights for the model.",
|
1023
1070
|
"src": "(str) - Path to the folder containing the images.",
|
@@ -1109,7 +1156,7 @@ def generate_fields(variables, scrollable_frame):
|
|
1109
1156
|
"remove_highly_correlated_features": "(bool) - Whether to remove highly correlated features from the analysis.",
|
1110
1157
|
"remove_image_canvas": "(bool) - Whether to remove the image canvas after plotting.",
|
1111
1158
|
"remove_low_variance_features": "(bool) - Whether to remove low variance features from the analysis.",
|
1112
|
-
"
|
1159
|
+
"random_row_column_effects": "(bool) - Whether to remove row and column effects from the data.",
|
1113
1160
|
"resize": "(bool) - Resize factor for the images.",
|
1114
1161
|
"resample": "(bool) - Whether to resample the images during processing.",
|
1115
1162
|
"rescale": "(float) - Rescaling factor for the images.",
|
@@ -1163,9 +1210,44 @@ def generate_fields(variables, scrollable_frame):
|
|
1163
1210
|
"train_channels": "list - channels to use for training",
|
1164
1211
|
"dataset_mode": "str - How to generate train/test dataset.",
|
1165
1212
|
"annotated_classes": "list - list of numbers in annotation column.",
|
1166
|
-
"um_per_pixel": "(float) - The micrometers per pixel for the images."
|
1213
|
+
"um_per_pixel": "(float) - The micrometers per pixel for the images.",
|
1214
|
+
"segmentation_model": "(str) - The segmentation model to use, either cellpose or mediar.",
|
1215
|
+
"pathogen_model": "(str) - use a custom cellpose model to detect pathogen objects.",
|
1216
|
+
"timelapse_displacement": "(int) - Displacement for timelapse tracking.",
|
1217
|
+
"timelapse_memory": "(int) - Memory for timelapse tracking.",
|
1218
|
+
"timelapse_mode": "(str) - Mode for timelapse tracking, trackpy or btrack.",
|
1219
|
+
"timelapse_frame_limits": "(list) - Frame limits for timelapse tracking [start,end].",
|
1220
|
+
"timelapse_objects": "(list) - Objects to track in the timelapse, cells, nuclei, or pathogens.",
|
1221
|
+
"timelapse_remove_transient": "(bool) - Whether to remove transient objects in the timelapse.",
|
1222
|
+
"masks": "(bool) - Whether to generate masks for the segmented objects.",
|
1223
|
+
"timelapse": "(bool) - Whether to analyze images as a timelapse.",
|
1224
|
+
"pathogen_min_size": "(int) - The minimum size of pathogen objects in pixels^2.",
|
1225
|
+
"pathogen_mask_dim": "(int) - The dimension of the array the pathogen mask is saved in.",
|
1226
|
+
"use_bounding_box": "(bool) - Whether to use the bounding box for cropping the images.",
|
1227
|
+
"plot_points": "(bool) - Whether to plot scatterplot points.",
|
1228
|
+
"embedding_by_controls": "(bool) - Use the controlls to greate the embedding, then apply this embedding to all of the data.",
|
1229
|
+
"pos": "(str) - Positive control identifier.",
|
1230
|
+
"neg": "(str) - Negative control identifier.",
|
1231
|
+
"minimum_cell_count": "(int) - Minimum number of cells/well. if number of cells < minimum_cell_count, the well is excluded from the analysis.",
|
1232
|
+
"circular": "(bool) - If a circle is to be drawn and corners excluded (e.g. square images of round wells).",
|
1233
|
+
"highlight": "(str) - highlight genes/grnas containing this string.",
|
1234
|
+
"pathogen_plate_metadata": "(str) - Metadata for the pathogen plate.",
|
1235
|
+
"treatment_plate_metadata": "(str) - Metadata for the treatment plate.",
|
1236
|
+
"regex": "(str) - Regular expression to use.",
|
1237
|
+
"target_sequence": "(str) - The DNA sequence to look for that the consensus sequence will start with directly downstream of the first barcode.",
|
1238
|
+
"offset": "(int) - The offset to use for the consensus sequence, e.g. -8 if the barecode is 8 bases before target_sequence.",
|
1239
|
+
"expected_end": "(int) - The expected length of the sequence from the start of the first barcode to the end of the last.",
|
1240
|
+
"column_csv": "(path) - path to the csv file containing column barcodes.",
|
1241
|
+
"row_csv": "(path) - path to the csv file containing row barcodes.",
|
1242
|
+
"grna_csv": "(path) - path to the csv file containing gRNA sequences.",
|
1243
|
+
"save_h5": "(bool) - Whether to save the results to an HDF5 file. (this generates a large file, if compression is used this can be very time consuming)",
|
1244
|
+
"comp_type": "(str) - Compression type for the HDF5 file (e.g. zlib).",
|
1245
|
+
"comp_level": "(int) - Compression level for the HDF5 file (0-9). Higher is slower and yields smaller files.",
|
1246
|
+
"mode": "(str) - Mode to use for sequence analysis (either single for R1 or R2 fastq files or paired for the combination of R1 and R2).",
|
1247
|
+
"signal_direction": "(str) - Direction of fastq file (R1 or R2). only relevent when mode is single.",
|
1248
|
+
"custom_model_path": "(str) - Path to the custom model to finetune.",
|
1167
1249
|
}
|
1168
|
-
|
1250
|
+
|
1169
1251
|
for key, (var_type, options, default_value) in variables.items():
|
1170
1252
|
label, widget, var, frame = create_input_field(scrollable_frame.scrollable_frame, key, row, var_type, options, default_value)
|
1171
1253
|
vars_dict[key] = (label, widget, var, frame) # Store the label, widget, and variable
|
@@ -1210,12 +1292,13 @@ def set_annotate_default_settings(settings):
|
|
1210
1292
|
settings.setdefault('annotation_column', 'test')
|
1211
1293
|
settings.setdefault('normalize', 'False')
|
1212
1294
|
settings.setdefault('percentiles', [2, 98])
|
1213
|
-
settings.setdefault('measurement', 'cytoplasm_channel_3_mean_intensity,pathogen_channel_3_mean_intensity')
|
1214
|
-
settings.setdefault('threshold', '2')
|
1295
|
+
settings.setdefault('measurement', '')#'cytoplasm_channel_3_mean_intensity,pathogen_channel_3_mean_intensity')
|
1296
|
+
settings.setdefault('threshold', '')#'2')
|
1215
1297
|
return settings
|
1216
1298
|
|
1217
1299
|
def set_default_generate_barecode_mapping(settings={}):
|
1218
1300
|
settings.setdefault('src', 'path')
|
1301
|
+
settings.setdefault('regex', '^(?P<column>.{8})TGCTG.*TAAAC(?P<grna>.{20,21})AACTT.*AGAAG(?P<row>.{8}).*'),
|
1219
1302
|
settings.setdefault('target_sequence', 'TGCTGTTTCCAGCATAGCTCTTAAAC')
|
1220
1303
|
settings.setdefault('offset_start', -8)
|
1221
1304
|
settings.setdefault('expected_end', 89)
|
@@ -1227,4 +1310,7 @@ def set_default_generate_barecode_mapping(settings={}):
|
|
1227
1310
|
settings.setdefault('comp_level', 5)
|
1228
1311
|
settings.setdefault('chunk_size', 100000)
|
1229
1312
|
settings.setdefault('n_jobs', None)
|
1313
|
+
settings.setdefault('mode', 'paired')
|
1314
|
+
settings.setdefault('single_direction', 'R1')
|
1315
|
+
settings.setdefault('test', False)
|
1230
1316
|
return settings
|
spacr/sim.py
CHANGED
@@ -15,8 +15,6 @@ import statsmodels.api as sm
|
|
15
15
|
from multiprocessing import cpu_count, Pool, Manager
|
16
16
|
from copy import deepcopy
|
17
17
|
|
18
|
-
from .logger import log_function_call
|
19
|
-
|
20
18
|
warnings.filterwarnings("ignore")
|
21
19
|
warnings.filterwarnings("ignore", category=RuntimeWarning) # Ignore RuntimeWarning
|
22
20
|
|