celldetective 1.1.1.post3__py3-none-any.whl → 1.2.0__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.
- celldetective/__init__.py +2 -1
- celldetective/__main__.py +17 -0
- celldetective/extra_properties.py +62 -34
- celldetective/gui/__init__.py +1 -0
- celldetective/gui/analyze_block.py +2 -1
- celldetective/gui/classifier_widget.py +18 -10
- celldetective/gui/control_panel.py +57 -6
- celldetective/gui/layouts.py +14 -11
- celldetective/gui/neighborhood_options.py +21 -13
- celldetective/gui/plot_signals_ui.py +39 -11
- celldetective/gui/process_block.py +413 -95
- celldetective/gui/retrain_segmentation_model_options.py +17 -4
- celldetective/gui/retrain_signal_model_options.py +106 -6
- celldetective/gui/signal_annotator.py +110 -30
- celldetective/gui/signal_annotator2.py +2708 -0
- celldetective/gui/signal_annotator_options.py +3 -1
- celldetective/gui/survival_ui.py +15 -6
- celldetective/gui/tableUI.py +248 -43
- celldetective/io.py +598 -416
- celldetective/measure.py +919 -969
- celldetective/models/pair_signal_detection/blank +0 -0
- celldetective/neighborhood.py +482 -340
- celldetective/preprocessing.py +81 -61
- celldetective/relative_measurements.py +648 -0
- celldetective/scripts/analyze_signals.py +1 -1
- celldetective/scripts/measure_cells.py +28 -8
- celldetective/scripts/measure_relative.py +103 -0
- celldetective/scripts/segment_cells.py +5 -5
- celldetective/scripts/track_cells.py +4 -1
- celldetective/scripts/train_segmentation_model.py +23 -18
- celldetective/scripts/train_signal_model.py +33 -0
- celldetective/segmentation.py +67 -29
- celldetective/signals.py +402 -8
- celldetective/tracking.py +8 -2
- celldetective/utils.py +144 -12
- {celldetective-1.1.1.post3.dist-info → celldetective-1.2.0.dist-info}/METADATA +8 -8
- {celldetective-1.1.1.post3.dist-info → celldetective-1.2.0.dist-info}/RECORD +42 -38
- {celldetective-1.1.1.post3.dist-info → celldetective-1.2.0.dist-info}/WHEEL +1 -1
- tests/test_segmentation.py +1 -1
- {celldetective-1.1.1.post3.dist-info → celldetective-1.2.0.dist-info}/LICENSE +0 -0
- {celldetective-1.1.1.post3.dist-info → celldetective-1.2.0.dist-info}/entry_points.txt +0 -0
- {celldetective-1.1.1.post3.dist-info → celldetective-1.2.0.dist-info}/top_level.txt +0 -0
|
@@ -6,7 +6,7 @@ from PyQt5.QtGui import QIcon, QDoubleValidator
|
|
|
6
6
|
from sklearn.preprocessing import MinMaxScaler
|
|
7
7
|
|
|
8
8
|
from celldetective.gui.gui_utils import center_window, FeatureChoice, ListWidget, QHSeperationLine, FigureCanvas, GeometryChoice, OperationChoice
|
|
9
|
-
from superqt import QLabeledSlider
|
|
9
|
+
from superqt import QLabeledSlider, QColormapComboBox
|
|
10
10
|
from superqt.fonticon import icon
|
|
11
11
|
from fonticon_mdi6 import MDI6
|
|
12
12
|
from celldetective.utils import extract_experiment_channels, get_software_location, _extract_labels_from_config
|
|
@@ -33,6 +33,7 @@ from matplotlib.cm import viridis, tab10
|
|
|
33
33
|
import math
|
|
34
34
|
from celldetective.gui import Styles
|
|
35
35
|
from matplotlib import colormaps
|
|
36
|
+
import matplotlib.cm as mcm
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
|
|
@@ -117,9 +118,11 @@ class ConfigSignalPlot(QWidget, Styles):
|
|
|
117
118
|
""")
|
|
118
119
|
main_layout.addWidget(panel_title, alignment=Qt.AlignCenter)
|
|
119
120
|
|
|
120
|
-
labels = [QLabel('population: '), QLabel('class: '), QLabel('time of\ninterest: ')]
|
|
121
|
-
self.cb_options = [['targets','effectors'],['class'], ['t0']]
|
|
121
|
+
labels = [QLabel('population: '), QLabel('class: '), QLabel('time of\ninterest: '), QLabel('cmap: ')]
|
|
122
|
+
self.cb_options = [['targets','effectors'],['class'], ['t0'], list(plt.colormaps())]
|
|
122
123
|
self.cbs = [QComboBox() for i in range(len(labels))]
|
|
124
|
+
self.cbs[-1] = QColormapComboBox()
|
|
125
|
+
|
|
123
126
|
self.cbs[0].currentIndexChanged.connect(self.set_classes_and_times)
|
|
124
127
|
|
|
125
128
|
choice_layout = QVBoxLayout()
|
|
@@ -128,9 +131,15 @@ class ConfigSignalPlot(QWidget, Styles):
|
|
|
128
131
|
hbox = QHBoxLayout()
|
|
129
132
|
hbox.addWidget(labels[i], 33)
|
|
130
133
|
hbox.addWidget(self.cbs[i],66)
|
|
131
|
-
|
|
134
|
+
if i < len(labels)-1:
|
|
135
|
+
self.cbs[i].addItems(self.cb_options[i])
|
|
132
136
|
choice_layout.addLayout(hbox)
|
|
133
|
-
|
|
137
|
+
|
|
138
|
+
for cm in list(colormaps):
|
|
139
|
+
try:
|
|
140
|
+
self.cbs[-1].addColormap(cm)
|
|
141
|
+
except:
|
|
142
|
+
pass
|
|
134
143
|
|
|
135
144
|
self.cbs[0].setCurrentIndex(1)
|
|
136
145
|
self.cbs[0].setCurrentIndex(0)
|
|
@@ -150,6 +159,11 @@ class ConfigSignalPlot(QWidget, Styles):
|
|
|
150
159
|
|
|
151
160
|
self.abs_time_checkbox.stateChanged.connect(self.switch_ref_time_mode)
|
|
152
161
|
|
|
162
|
+
select_layout = QHBoxLayout()
|
|
163
|
+
select_layout.addWidget(QLabel('select cells\nwith query: '), 33)
|
|
164
|
+
self.query_le = QLineEdit()
|
|
165
|
+
select_layout.addWidget(self.query_le, 66)
|
|
166
|
+
main_layout.addLayout(select_layout)
|
|
153
167
|
|
|
154
168
|
time_calib_layout = QHBoxLayout()
|
|
155
169
|
time_calib_layout.setContentsMargins(20,20,20,20)
|
|
@@ -266,9 +280,18 @@ class ConfigSignalPlot(QWidget, Styles):
|
|
|
266
280
|
self.feature_two_cb.setEnabled(True)
|
|
267
281
|
else:
|
|
268
282
|
self.feature_two_cb.setEnabled(False)
|
|
283
|
+
|
|
269
284
|
def compute_signals(self):
|
|
270
285
|
|
|
271
286
|
if self.df is not None:
|
|
287
|
+
|
|
288
|
+
try:
|
|
289
|
+
query_text = self.query_le.text()
|
|
290
|
+
if query_text != '':
|
|
291
|
+
self.df = self.df.query(query_text)
|
|
292
|
+
except Exception as e:
|
|
293
|
+
print(e, ' The query is misunderstood and will not be applied...')
|
|
294
|
+
|
|
272
295
|
self.feature_selected = self.feature_cb.currentText()
|
|
273
296
|
if self.checkBox_feature.isChecked():
|
|
274
297
|
self.second_feature_selected=self.feature_two_cb.currentText()
|
|
@@ -334,6 +357,10 @@ class ConfigSignalPlot(QWidget, Styles):
|
|
|
334
357
|
self.initialize_axis()
|
|
335
358
|
plt.tight_layout()
|
|
336
359
|
|
|
360
|
+
cmap_lbl = self.cbs[-1].currentText()
|
|
361
|
+
self.cmap = getattr(mcm, cmap_lbl)
|
|
362
|
+
self.ax.set_prop_cycle('color',[self.cmap(i) for i in np.linspace(0, 1, len(self.well_indices))])
|
|
363
|
+
|
|
337
364
|
|
|
338
365
|
self.fig.set_facecolor('none') # or 'None'
|
|
339
366
|
self.fig.canvas.setStyleSheet("background-color: transparent;")
|
|
@@ -353,7 +380,6 @@ class ConfigSignalPlot(QWidget, Styles):
|
|
|
353
380
|
radio_hbox.addWidget(self.plot_options[i], 33, alignment=Qt.AlignCenter)
|
|
354
381
|
self.plot_btn_group.buttonClicked[int].connect(self.plot_survivals)
|
|
355
382
|
|
|
356
|
-
print(self.well_indices, self.position_indices)
|
|
357
383
|
if self.position_indices is not None:
|
|
358
384
|
if len(self.well_indices)>1 and len(self.position_indices)==1:
|
|
359
385
|
self.plot_btn_group.buttons()[0].click()
|
|
@@ -725,10 +751,10 @@ class ConfigSignalPlot(QWidget, Styles):
|
|
|
725
751
|
second_matrix='second_matrix_no_event'
|
|
726
752
|
|
|
727
753
|
|
|
728
|
-
colors = np.array([
|
|
754
|
+
colors = np.array([self.cmap(i / len(self.df_pos_info)) for i in range(len(self.df_pos_info))])
|
|
729
755
|
if self.checkBox_feature.isChecked():
|
|
730
|
-
second_colors =
|
|
731
|
-
well_color = [
|
|
756
|
+
second_colors = self.cmap(np.linspace(0.5, 1.5, len(self.df_pos_info)))
|
|
757
|
+
well_color = [self.cmap(i / len(self.df_well_info)) for i in range(len(self.df_well_info))]
|
|
732
758
|
|
|
733
759
|
if self.plot_mode=='pos':
|
|
734
760
|
self.initialize_axis()
|
|
@@ -801,6 +827,8 @@ class ConfigSignalPlot(QWidget, Styles):
|
|
|
801
827
|
self.survival_window.canvas.draw()
|
|
802
828
|
|
|
803
829
|
def plot_line(self, line, color, label, mean_signal, ci_option=True, cell_lines_option=False, alpha_ci=0.5, alpha_cell_lines=0.5, std_signal=None, matrix=None):
|
|
830
|
+
|
|
831
|
+
|
|
804
832
|
try:
|
|
805
833
|
if 'second' in str(mean_signal):
|
|
806
834
|
self.ax2.plot(line['timeline'] * self.FrameToMin, line[mean_signal], color=color, label=label)
|
|
@@ -1005,10 +1033,10 @@ class ConfigSignalPlot(QWidget, Styles):
|
|
|
1005
1033
|
def switch_ref_time_mode(self):
|
|
1006
1034
|
if self.abs_time_checkbox.isChecked():
|
|
1007
1035
|
self.frame_slider.setEnabled(True)
|
|
1008
|
-
self.cbs[-
|
|
1036
|
+
self.cbs[-2].setEnabled(False)
|
|
1009
1037
|
else:
|
|
1010
1038
|
self.frame_slider.setEnabled(False)
|
|
1011
|
-
self.cbs[-
|
|
1039
|
+
self.cbs[-2].setEnabled(True)
|
|
1012
1040
|
|
|
1013
1041
|
def switch_ci(self):
|
|
1014
1042
|
|