small-fish-gui 1.10.1__py3-none-any.whl → 1.10.3__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.
@@ -37,7 +37,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37
37
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38
38
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
39
  """
40
- __version__ = "1.10.1"
40
+ __version__ = "1.10.3"
41
41
  __wiki__ = "https://github.com/2Echoes/small_fish_gui/wiki"
42
42
 
43
43
  import os
@@ -8,6 +8,7 @@ import bigfish.stack as stack
8
8
  import numpy as np
9
9
  import FreeSimpleGUI as sg
10
10
 
11
+ from ..hints import pipeline_parameters
11
12
  from ..pipeline._preprocess import check_integrity, convert_parameters_types, ParameterInputError, _check_segmentation_parameters
12
13
  from ..pipeline.segmentation import _cast_segmentation_parameters
13
14
 
@@ -100,7 +101,7 @@ def check_segmentation_parameters(
100
101
  return segmentation_is_ok, values
101
102
 
102
103
  def check_detection_parameters(
103
- values,
104
+ values : pipeline_parameters,
104
105
  do_dense_region_deconvolution,
105
106
  do_clustering,
106
107
  is_multichannel,
@@ -117,7 +118,7 @@ def check_detection_parameters(
117
118
  do_dense_region_deconvolution=do_dense_region_deconvolution,
118
119
  do_clustering=do_clustering,
119
120
  multichannel=is_multichannel,
120
- segmentation_done=None,
121
+ segmentation_done= values['do_segmentation'],
121
122
  map_=map_,
122
123
  shape=shape
123
124
  )
@@ -49,6 +49,9 @@ def batch_pipeline(
49
49
  if parameters['save segmentation'] : os.makedirs(main_dir + "segmentation/", exist_ok=True)
50
50
  if parameters['save detection'] : os.makedirs(main_dir + "detection/", exist_ok=True)
51
51
  if parameters['extract spots'] : os.makedirs(main_dir + "results/spots_extraction", exist_ok=True)
52
+ first_save = True # init for excel append
53
+ append_to_line = 1 #Start at line one
54
+ cell_append_to_line = 1 #Start at line one
52
55
 
53
56
  #Setting spot detection dimension
54
57
  parameters['dim'] = 3 if is_3D else 2
@@ -62,6 +65,12 @@ def batch_pipeline(
62
65
  error_log = open(main_dir + "error_log", mode='w')
63
66
  error_count = 0
64
67
 
68
+ #These columns usually kept for coloc analysis will be dropped for memory gain in batch mode
69
+ COLUMNS_TO_DROP = ['image', 'spots', 'clusters', 'rna_coords', 'cluster_coords',"rna_coords", "cluster_coords", "free_spots_coords", "clustered_spots_coords"]
70
+ for col in COLUMNS_TO_DROP :
71
+ if col in cell_results_df : cell_results_df.drop(columns=col)
72
+ if col in results_df : results_df.drop(columns=col)
73
+
65
74
  for acquisition_id, file in enumerate(filenames_list) :
66
75
  try :
67
76
 
@@ -192,6 +201,10 @@ def batch_pipeline(
192
201
  frame_results=frame_result,
193
202
  )
194
203
 
204
+ for col in COLUMNS_TO_DROP :
205
+ if col in new_cell_results_df : new_cell_results_df.drop(columns=col)
206
+ if col in new_results_df : new_results_df.drop(columns=col)
207
+
195
208
  results_df = pd.concat([
196
209
  results_df.reset_index(drop=True), new_results_df.reset_index(drop=True)
197
210
  ], axis=0)
@@ -202,6 +215,10 @@ def batch_pipeline(
202
215
 
203
216
 
204
217
  #6. Saving results
218
+ if parameters['xlsx'] :
219
+ if first_save : xlsx_header = True
220
+ else : xlsx_header = False
221
+
205
222
  window_print(batch_window,"saving image_results...")
206
223
  #1 file per batch + 1 file per batch if segmentation
207
224
  acquisition_success = write_results(
@@ -212,7 +229,12 @@ def batch_pipeline(
212
229
  do_feather= parameters["feather"],
213
230
  do_csv= parameters["csv"],
214
231
  overwrite=True,
232
+ batch_mode=True,
233
+ header=first_save,
234
+ xlsx_start_line=append_to_line
215
235
  )
236
+ append_to_line += len(results_df)
237
+ results_df = results_df.drop(results_df.index)
216
238
 
217
239
  if do_segmentation :
218
240
  cell_success = write_results(
@@ -223,10 +245,16 @@ def batch_pipeline(
223
245
  do_feather= parameters["feather"],
224
246
  do_csv= parameters["csv"],
225
247
  overwrite=True,
248
+ batch_mode=True,
249
+ header=first_save,
250
+ xlsx_start_line=cell_append_to_line
226
251
  )
227
-
252
+ cell_append_to_line += len(cell_results_df)
253
+ cell_results_df = cell_results_df.drop(cell_results_df.index)
254
+ first_save = False
228
255
  window_print(batch_window,"Sucessfully saved.")
229
256
 
257
+
230
258
  except Exception as error :
231
259
 
232
260
  error_count +=1
@@ -133,7 +133,7 @@ class SegmentationReseter(NapariWidget) :
133
133
  def __init__(self, label_list: 'list[Labels]'):
134
134
  self.label_list = label_list
135
135
  if len(self.label_list) == 0 : raise ValueError("Empty label list")
136
- self.save = self._get_save()
136
+ self.save = self._get_save(label_list)
137
137
  super().__init__()
138
138
 
139
139
 
@@ -71,7 +71,20 @@ def write_list_of_results(
71
71
  return True
72
72
 
73
73
 
74
- def write_results(dataframe: pd.DataFrame, path:str, filename:str, do_excel= True, do_feather= False, do_csv=False, overwrite=False, reset_index=True) :
74
+ def write_results(
75
+ dataframe: pd.DataFrame,
76
+ path:str,
77
+ filename:str,
78
+ do_excel= True,
79
+ do_feather= False,
80
+ do_csv=False,
81
+ overwrite=False,
82
+ reset_index=True,
83
+ batch_mode = False,
84
+ header = True,
85
+ xlsx_start_line = 1,
86
+ ) :
87
+
75
88
  check_parameter(dataframe= pd.DataFrame, path= str, filename = str, do_excel = bool, do_feather = bool)
76
89
 
77
90
  if len(dataframe) == 0 : return True
@@ -103,16 +116,20 @@ def write_results(dataframe: pd.DataFrame, path:str, filename:str, do_excel= Tru
103
116
 
104
117
  if reset_index : dataframe = dataframe.reset_index(drop=True)
105
118
 
106
- if do_csv : dataframe.to_csv(path + new_filename + '.csv', sep=";")
119
+ if do_csv :
120
+ if batch_mode : mode = 'a'
121
+ else : mode = 'w'
122
+ dataframe.to_csv(path + new_filename + '.csv', sep=";", header=header, mode=mode)
107
123
  if do_excel :
108
124
  if len(dataframe) < MAX_LEN_EXCEL :
109
- dataframe.to_excel(path + new_filename + '.xlsx')
125
+ dataframe.to_excel(path + new_filename + '.xlsx', header=header, startrow=xlsx_start_line)
110
126
  else :
111
127
  print("Error : Table too big to be saved in excel format.")
112
128
  return False
113
129
 
114
- if do_feather :
115
- dataframe.to_parquet(path + new_filename + '.parquet')
130
+ if do_feather :
131
+ print("feather saving is depreciated, please use csv instead")
132
+ pass
116
133
 
117
134
  return True
118
135
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: small_fish_gui
3
- Version: 1.10.1
3
+ Version: 1.10.3
4
4
  Summary: Small Fish is a python application for the analysis of smFish images. It provides a ready to use graphical interface to combine famous python packages for cell analysis without any need for coding.
5
5
  Project-URL: Homepage, https://github.com/2Echoes/small_fish
6
6
  Project-URL: Wiki, https://github.com/2Echoes/small_fish_gui/wiki
@@ -1,6 +1,6 @@
1
1
  small_fish_gui/LICENSE,sha256=-iFy8VGBYs5VsHglKpk4D-hxqQ2jMJaqmfq_ulIzDks,1303
2
2
  small_fish_gui/README.md,sha256=SFXhmWiISVrOd_cBUodAYaHhMPeKBXyVoPe-fiBxuBw,4671
3
- small_fish_gui/__init__.py,sha256=44EaSpou5NLatD2ClFxZDEBAJwaf4uIHVZEIGzgeOI0,2050
3
+ small_fish_gui/__init__.py,sha256=u3_GHTV7nTxsPq7gk2dj3ZOgHGhW-U1wWMt0T2PNXck,2050
4
4
  small_fish_gui/__main__.py,sha256=mgO_BmBGBsp8steg_lcwCPZ7QzgjgeScL8Npgs1D9Pk,1643
5
5
  small_fish_gui/hints.py,sha256=57pO8WA_PymBm5QyXCgYxnZIqqt86B-hO_s_6sv8b5s,1962
6
6
  small_fish_gui/requirements.txt,sha256=udO54grAFrmnEqUQC4rDeUMaIyBz3hYB1LJtu1ld7tg,354
@@ -8,15 +8,15 @@ small_fish_gui/utils.py,sha256=LM6QW2ono_LIRv7JXIIq7ZxxbDXqBtZ5uR9gjKJfwM8,1903
8
8
  small_fish_gui/.github/workflows/python-publish.yml,sha256=5Ltnuhw9TevhzndlBmdUgYMnS73xEAxSyd1u8DHdn5s,1084
9
9
  small_fish_gui/batch/__init__.py,sha256=ku2_Yate-UG89Q0BmE2B9kFV4kOz-u9Lf2lj6VsdFXs,127
10
10
  small_fish_gui/batch/input.py,sha256=mqnP8LBhyNbtlcqjVlUiVeuHw4YxOX3GgzJbq03isKE,1477
11
- small_fish_gui/batch/integrity.py,sha256=qyttOwsukds6eE2j6NRmA8-fQtHxlnP4tgwQqrs3EWs,4853
12
- small_fish_gui/batch/pipeline.py,sha256=-XSyGTrk7WYhgLZLZeUoJvyzfcoprJTofUuIz623Irw,10419
11
+ small_fish_gui/batch/integrity.py,sha256=pc8qaM5hf8EkLVgOC6BLUmmoO51_zbk_GQET_JRe0t8,4937
12
+ small_fish_gui/batch/pipeline.py,sha256=1Uk0jSYcYGCT80putAUiuja8yNrdMPa-uozYK-OlMys,11850
13
13
  small_fish_gui/batch/prompt.py,sha256=pGwcszKkKrEr5MizlKk9e9a0mt7CGttqf3xl-3BuXR0,18851
14
14
  small_fish_gui/batch/test.py,sha256=FcoCngSeueociwVoG8V3C6lQO7rrRHUfIVA2hJKr4v4,213
15
15
  small_fish_gui/batch/update.py,sha256=opSwMLlQDUtCwWpx9d2GfNKVA-t90ziqc1qofDH74D8,5044
16
16
  small_fish_gui/batch/utils.py,sha256=Pnmzlen8gmLBYBthMiUiK0TErjBBSId9SjKeBd9U6-U,1784
17
17
  small_fish_gui/batch/values.txt,sha256=XY8FBgAqExVKbtCXLztptaOUTFKj0G6t1_xX-zjYuTk,999
18
18
  small_fish_gui/gui/__init__.py,sha256=k08QFdLv2IXR8a6f8aPzy6iJ6MjDI7ZV143CH-BEXuA,845
19
- small_fish_gui/gui/_napari_widgets.py,sha256=SohHKdlPrnky4He-tbw6X10FOGSAUA0dN-3eEs_keU0,18781
19
+ small_fish_gui/gui/_napari_widgets.py,sha256=4wVm09PWyudhSBIaKf5_a3oCfeRty6mitI04X3ems9k,18791
20
20
  small_fish_gui/gui/animation.py,sha256=MnYsA1kxQZ72L_H0knxOs41lG0ZZv1re7gSgYNmZY00,983
21
21
  small_fish_gui/gui/layout.py,sha256=f45acK2I7o9Q3LYY23G4XAJ8HPoD9mp7AJNNlLbUByI,14371
22
22
  small_fish_gui/gui/napari_visualiser.py,sha256=g9ZIcCBQ3HHjclbk8EsJYLLAIdCK-uSYg123-vjP5PQ,10011
@@ -28,7 +28,7 @@ small_fish_gui/gui/screenshot/mapping_help_screenshot.png,sha256=HcuRh5TYciUogUa
28
28
  small_fish_gui/gui/screenshot/segmentation_help_screenshot.png,sha256=rbSgIydT0gZtfMh1qk4mdMbEIyCaakvHmxa2eOrLwO0,118944
29
29
  small_fish_gui/interface/__init__.py,sha256=tS4nWOTX2RpzRpzLbjvo5gbfqgvgLXEzjpUh7W-1RUE,311
30
30
  small_fish_gui/interface/image.py,sha256=SOe3zlyTKqkkQflb3A9EJok8QduUn2ue6bMH9Ma2hKU,1933
31
- small_fish_gui/interface/inoutput.py,sha256=FXKSSRrVou5VBWvTbiBjSCr7DncIyZbcV5MfRa6J64g,5467
31
+ small_fish_gui/interface/inoutput.py,sha256=toB2SNNZNiupZTT2-zQKJ6ewI-_DJTVrXIkdq8TMWXY,5793
32
32
  small_fish_gui/interface/testing.py,sha256=AUdqmFJ6kBvFTOLRfZZJBBe3nm1key2bGpUDXJRaueI,2561
33
33
  small_fish_gui/pipeline/__init__.py,sha256=Oww6dcuvnktl5jFKLriz8ZXObKo9MkneE739A8C1reY,739
34
34
  small_fish_gui/pipeline/_colocalisation.py,sha256=PJ9IkICwPiaTNRTX4xqPhf1J3wyE2yAFRPtYEbw2k-A,21298
@@ -43,7 +43,7 @@ small_fish_gui/pipeline/spots.py,sha256=9hNOGnOZhrtrIORt8UGBcI-SGCh1XftcUGerkBwN
43
43
  small_fish_gui/pipeline/test.py,sha256=w4ZMGDmUDXxVgWTlZ2TKw19W8q5gcE9gLMKe0SWnRrw,2827
44
44
  small_fish_gui/pipeline/testing.ipynb,sha256=Rs7VQ7TImNyUzT2_59JgbOjR5_Qs-0NjHHnqS87eiwA,76481
45
45
  small_fish_gui/pipeline/utils.py,sha256=run6qtqCAe_mFnE3o1CnmF1xBBmK3ydgc8-jOV9P-_w,448
46
- small_fish_gui-1.10.1.dist-info/METADATA,sha256=plUMEokmc4m78E11yK6v-oNmqIuEiDfmskj9XrTMpy0,2670
47
- small_fish_gui-1.10.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
48
- small_fish_gui-1.10.1.dist-info/licenses/LICENSE,sha256=-iFy8VGBYs5VsHglKpk4D-hxqQ2jMJaqmfq_ulIzDks,1303
49
- small_fish_gui-1.10.1.dist-info/RECORD,,
46
+ small_fish_gui-1.10.3.dist-info/METADATA,sha256=RD1JG9SuZum1q1vpqYGjVOBcC2uo5rf32fGGKUjlT1E,2670
47
+ small_fish_gui-1.10.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
48
+ small_fish_gui-1.10.3.dist-info/licenses/LICENSE,sha256=-iFy8VGBYs5VsHglKpk4D-hxqQ2jMJaqmfq_ulIzDks,1303
49
+ small_fish_gui-1.10.3.dist-info/RECORD,,