small-fish-gui 1.10.2__tar.gz → 1.10.3__tar.gz

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.
Files changed (49) hide show
  1. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/PKG-INFO +1 -1
  2. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/pyproject.toml +1 -1
  3. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/__init__.py +1 -1
  4. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/batch/integrity.py +3 -2
  5. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/batch/pipeline.py +29 -1
  6. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/interface/inoutput.py +22 -5
  7. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/LICENSE +0 -0
  8. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/README.md +0 -0
  9. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/.github/workflows/python-publish.yml +0 -0
  10. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/LICENSE +0 -0
  11. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/README.md +0 -0
  12. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/__main__.py +0 -0
  13. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/batch/__init__.py +0 -0
  14. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/batch/input.py +0 -0
  15. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/batch/prompt.py +0 -0
  16. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/batch/test.py +0 -0
  17. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/batch/update.py +0 -0
  18. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/batch/utils.py +0 -0
  19. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/batch/values.txt +0 -0
  20. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/__init__.py +0 -0
  21. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/_napari_widgets.py +0 -0
  22. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/animation.py +0 -0
  23. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/layout.py +0 -0
  24. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/napari_visualiser.py +0 -0
  25. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/prompts.py +0 -0
  26. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/screenshot/general_help_screenshot.png +0 -0
  27. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/screenshot/mapping_help_screenshot.png +0 -0
  28. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/screenshot/segmentation_help_screenshot.png +0 -0
  29. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/testing.ipynb +0 -0
  30. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/gui/theme.py +0 -0
  31. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/hints.py +0 -0
  32. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/interface/__init__.py +0 -0
  33. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/interface/image.py +0 -0
  34. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/interface/testing.py +0 -0
  35. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/__init__.py +0 -0
  36. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/_colocalisation.py +0 -0
  37. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/_custom_errors.py +0 -0
  38. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/_preprocess.py +0 -0
  39. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/_signaltonoise.py +0 -0
  40. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/actions.py +0 -0
  41. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/detection.py +0 -0
  42. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/main.py +0 -0
  43. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/segmentation.py +0 -0
  44. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/spots.py +0 -0
  45. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/test.py +0 -0
  46. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/testing.ipynb +0 -0
  47. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/pipeline/utils.py +0 -0
  48. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/requirements.txt +0 -0
  49. {small_fish_gui-1.10.2 → small_fish_gui-1.10.3}/src/small_fish_gui/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: small_fish_gui
3
- Version: 1.10.2
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "small_fish_gui"
7
- version = "1.10.2"
7
+ version = "1.10.3"
8
8
  authors = [
9
9
  { name="Slimani Floric", email="floric.slimani@live.com" },
10
10
  ]
@@ -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.2"
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
@@ -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
 
File without changes