small-fish-gui 1.9.3__py3-none-any.whl → 1.9.4__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.
small_fish_gui/README.md CHANGED
@@ -1,7 +1,3 @@
1
- ***INSTALATTION ISSUE : Currently the package cannot be installed due to a package deletion on pypi. I will migrate the code to a free, open source gui package and update the dependecies list***
2
-
3
- --> Requirements have been updated, pip installation is still not working but it is possible to install through git cloning
4
-
5
1
  # Small Fish
6
2
  **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.
7
3
 
@@ -99,9 +95,10 @@ Note that for training it is recommended to first set up your GPU as training co
99
95
  Optional features to include in future versions :
100
96
 
101
97
  **Major Dev**
102
- - time stack (which would include cell tracking)
103
- - 3D segmentation
98
+ * time stack (which would include cell tracking)
99
+ * 3D segmentation
104
100
 
105
101
  **Minor features**
106
- - allows npz files with multiple masks in load segmentation by asking user which one to select
107
- - fix parquet format or replace to another compressed format
102
+ * allows npz files with multiple masks in load segmentation by asking user which one to select
103
+ * fix parquet format or replace to another compressed format
104
+ * In Napari viewer, or add an extra spot layer to visualsize spots that are in foci or color spots that are in clusters in specific color.
@@ -36,6 +36,5 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36
36
  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
-
40
39
  """
41
- __version__ = "1.9.3"
40
+ __version__ = "1.9.4"
@@ -1,20 +1,32 @@
1
- import sys, subprocess
2
- import FreeSimpleGUI as sg
3
-
1
+ import sys, subprocess, traceback, os, re
4
2
  from small_fish_gui import __version__
5
3
 
6
4
  def main():
7
5
  import small_fish_gui.pipeline.main
8
6
 
9
- def is_last_version() :
10
- latest_version = str(subprocess.run([sys.executable, '-m', 'pip', 'install', '{}==random'.format('small_fish_gui')], capture_output=True, text=True))
11
- latest_version = latest_version[latest_version.find('(from versions:')+15:]
12
- latest_version = latest_version[:latest_version.find(')')]
13
- latest_version = latest_version.replace(' ','').split(',')[-1]
7
+ def _get_version() :
8
+ return __version__
14
9
 
15
- current_version = __version__
10
+ AVAILABLE_ARGUMENTS = {
11
+ ('-v','--v','--version') : "Prompt the software version.",
12
+ ('--launch', '-l') : "Launch small fish gui, equivalent to no arguments.",
13
+ ('-h', '--help', '--h') : "Prompt this help menu."
14
+ }
16
15
 
17
- return current_version == latest_version
16
+ def is_last_version() :
17
+
18
+ query = subprocess.run([sys.executable, '-m', 'pip', 'index', 'versions', 'small_fish_gui'], capture_output=True, text=True)
19
+ all_version = query.stdout.split(',')
20
+ latest_version = all_version[0]
21
+ regex = r"\d+\.\d+\.\d+"
22
+ latest = re.findall(regex, latest_version)
23
+
24
+ current_version = _get_version()
25
+
26
+ if len(latest) == 0 :
27
+ return current_version
28
+ else :
29
+ return current_version == latest[-1]
18
30
 
19
31
  if __name__ == "__main__":
20
32
 
@@ -22,8 +34,29 @@ if __name__ == "__main__":
22
34
  print("A new version of Small Fish is available. To update close small fish and type :\npip install --upgrade small_fish_gui")
23
35
 
24
36
  try :
37
+ arguments = sys.argv
38
+
39
+ if len(arguments) > 1 :
40
+ if arguments[1] in ['-v','--v','--version'] :
41
+ print(_get_version())
42
+ quit()
43
+ elif arguments[1] in ['--launch', '-l'] :
44
+ pass
45
+ elif arguments[1] in ['-h', '--help', '--h'] :
46
+ for key, help in AVAILABLE_ARGUMENTS.items() :
47
+ print(f"{key} : {help}")
48
+ quit()
49
+ else :
50
+ print(f"Incorrect argument : {arguments}, to launch small fish don't pass any argument or pick amongst {AVAILABLE_ARGUMENTS.keys()}")
51
+
25
52
  sys.exit(main())
53
+
26
54
  except Exception as error :
27
- sg.popup("Sorry. Something went wrong...\nIf you have some time to spare could you please communicate the error you encountered (next window) on :\nhttps://github.com/2Echoes/small_fish/issues.")
28
- sg.popup_error_with_traceback(error)
29
- raise error
55
+ with open("error_log.txt",'a') as error_log :
56
+ error_log.writelines([
57
+ f"version {_get_version()}",
58
+ f"error : {error}",
59
+ f"traceback :\n{traceback.format_exc()}",
60
+ ])
61
+
62
+ print(f"error_log saved at {os.getcwd()}/error_log.txt. Please consider reporting this by opening an issue on github.")
@@ -15,6 +15,7 @@ from .prompts import ask_cancel_detection
15
15
  from .prompts import ask_cancel_segmentation
16
16
  from .prompts import ask_help
17
17
  from .prompts import ask_detection_confirmation
18
+ from .prompts import prompt_restore_main_menu
18
19
 
19
20
  #Helpers to build windows
20
21
  from .layout import parameters_layout
@@ -222,7 +222,6 @@ def detection_parameters_promt(
222
222
  else : values['dim'] = 2
223
223
  return values
224
224
 
225
-
226
225
  def ask_replace_file(filename:str) :
227
226
  layout = [
228
227
  [sg.Text("{0} already exists, replace ?")],
@@ -341,7 +340,6 @@ def ask_cancel_detection() :
341
340
  else :
342
341
  return True
343
342
 
344
-
345
343
  def ask_confirmation(question_displayed : str) :
346
344
  layout =[
347
345
  [sg.Text(question_displayed, font= 'bold 10')],
@@ -355,7 +353,6 @@ def ask_confirmation(question_displayed : str) :
355
353
  else :
356
354
  return True
357
355
 
358
-
359
356
  def prompt_save_segmentation() -> 'dict[Literal["folder","filename","ext"]]':
360
357
  while True :
361
358
  relaunch = False
@@ -406,4 +403,29 @@ def prompt_load_segmentation() -> 'dict[Literal["nucleus","cytoplasm"]]':
406
403
  if not relaunch : break
407
404
 
408
405
 
409
- return values
406
+ return values
407
+
408
+ def prompt_restore_main_menu() -> bool :
409
+ """
410
+ Warn user that software will try to go back to main menu while saving parameters, and propose to save results and quit if stuck.
411
+
412
+ Returns True if user want to save and quit else False, to raise error close window.
413
+ """
414
+
415
+
416
+ layout = [
417
+ [sg.Text("An error was caught while proceeding.\nSoftware can try to save parameters and return to main menu or save results and quit.")],
418
+ [sg.Button("Return to main menu", key='menu'), sg.Button("Save and quit", key='save')]
419
+ ]
420
+
421
+ window = sg.Window('small fish', layout=layout, margins=(10,10), auto_size_text=True, resizable=True)
422
+ event, values = window.read(close=True)
423
+
424
+ if event is None :
425
+ return None
426
+ elif event == "save" :
427
+ return True
428
+ elif event == "menu" :
429
+ return False
430
+ else :
431
+ raise AssertionError("Unforseen answer")
@@ -2,9 +2,10 @@
2
2
  This script is called when software starts; it is the main loop.
3
3
  """
4
4
 
5
+ import traceback
5
6
  import pandas as pd
6
7
  import FreeSimpleGUI as sg
7
- from ..gui import hub_prompt
8
+ from ..gui import hub_prompt, prompt_restore_main_menu
8
9
  from .actions import add_detection, save_results, compute_colocalisation, delete_acquisitions, rename_acquisitions, save_segmentation, load_segmentation, segment_cells
9
10
  from ._preprocess import clean_unused_parameters_cache
10
11
  from ..batch import batch_promp
@@ -109,5 +110,21 @@ while True : #Break this loop to close small_fish
109
110
 
110
111
  except Exception as error :
111
112
  sg.popup(str(error))
112
- raise error
113
+
114
+ save_quit = prompt_restore_main_menu()
115
+
116
+ if save_quit is None :
117
+ raise error
118
+
119
+ elif save_quit :
120
+ save_results(
121
+ result_df=result_df,
122
+ cell_result_df=cell_result_df,
123
+ global_coloc_df=global_coloc_df,
124
+ cell_coloc_df = cell_coloc_df,
125
+ )
126
+ quit()
127
+ else :
128
+ continue
129
+
113
130
  quit()
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: small_fish_gui
3
- Version: 1.9.3
3
+ Version: 1.9.4
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
+ Project-URL: Wiki, https://github.com/2Echoes/small_fish_gui/wiki
6
7
  Project-URL: Issues, https://github.com/2Echoes/small_fish/issues
7
8
  Author-email: Slimani Floric <floric.slimani@live.com>
8
9
  License-File: LICENSE
@@ -1,8 +1,8 @@
1
1
  small_fish_gui/LICENSE,sha256=-iFy8VGBYs5VsHglKpk4D-hxqQ2jMJaqmfq_ulIzDks,1303
2
- small_fish_gui/README.md,sha256=4Nf5uOLMlNoX-3Kb9KZclLzPUAxWNAMi9el2a_7I9kA,4829
2
+ small_fish_gui/README.md,sha256=rhcqAWtQWPEmheUzChY_ok-ytAkZlboNQHdx19LRutw,4643
3
3
  small_fish_gui/Segmentation example.jpg,sha256=opfiSbjmfF6z8kBs08sg_FNR2Om0AcMPU5sSwSLHdoQ,215038
4
- small_fish_gui/__init__.py,sha256=OM_dE2QL2JVZ_bqEZmk2UdSJCocITwnLP3M5MzBs4as,1941
5
- small_fish_gui/__main__.py,sha256=Ssw1cF5FxExyEeFcRHEZYX_q7VNUExZkQ3wjQBotRNQ,1145
4
+ small_fish_gui/__init__.py,sha256=WGaTzQTK6LJ7mTFtO3En_DlnGCBHIf8HLnam2jRXKjk,1940
5
+ small_fish_gui/__main__.py,sha256=ngHNZr9ui8FTE9FPUJ9ULFGMs-5Wenpbcq__wAwFOAI,2128
6
6
  small_fish_gui/hints.py,sha256=_AhC-Th36ELxinjMyGtjIqJfZkISPr1YwhQ9ifD9Kj4,1926
7
7
  small_fish_gui/napari_detection_example.png,sha256=l5EZlrbXemLiGqb5inSVsD6Kko1Opz528-go-fBfrw8,977350
8
8
  small_fish_gui/requirements.txt,sha256=z8iaxqarErZuMpmRKqcW07nfb_tQAOOkQ4LQSA9ovCk,322
@@ -17,13 +17,13 @@ small_fish_gui/batch/test.py,sha256=FcoCngSeueociwVoG8V3C6lQO7rrRHUfIVA2hJKr4v4,
17
17
  small_fish_gui/batch/update.py,sha256=uVenjjJBHZ3MeW5b20HzlSBueu3QZWEGLIEHRnPm-Tg,5044
18
18
  small_fish_gui/batch/utils.py,sha256=Pnmzlen8gmLBYBthMiUiK0TErjBBSId9SjKeBd9U6-U,1784
19
19
  small_fish_gui/batch/values.txt,sha256=eS19O1pdj0HYfwGUlWIpkvfNZQFxA3F4BDR8qahXh28,999
20
- small_fish_gui/gui/__init__.py,sha256=xQ_BfYcnQmKZtx_0leO4OmbkLNLv49ZPqEu_UXMgmDc,867
20
+ small_fish_gui/gui/__init__.py,sha256=-t93Mz9AkpZsTH3XdYGj5-CXJNbWJ62k40QTWgpAGQA,913
21
21
  small_fish_gui/gui/_napari_widgets.py,sha256=8IMppaPZU37ANdZwTZOhwqCEly0hokzYL7UIVIixGns,3022
22
22
  small_fish_gui/gui/animation.py,sha256=MnYsA1kxQZ72L_H0knxOs41lG0ZZv1re7gSgYNmZY00,983
23
23
  small_fish_gui/gui/help_module.py,sha256=_6ZTiCym1uYJTlKekPSmGCXQVr6z7TRaxEhRAL90Eko,9614
24
24
  small_fish_gui/gui/layout.py,sha256=ew5d3Mlr0DnC3j3uCWBzykEHJ8faa4wmKHZbiNOjdJY,14188
25
25
  small_fish_gui/gui/napari_visualiser.py,sha256=AmpUErfko1ZamYoORRsgR4JT9xRzQKpi-sFok-FFKtg,14569
26
- small_fish_gui/gui/prompts.py,sha256=1J1pohfNR0FBwqyUUp-fdA4IEH389Ope2KxVq_3bjrY,15408
26
+ small_fish_gui/gui/prompts.py,sha256=Kqqhb3DJujHE3NNWMZKMTBQ7h1B79GicvdnaG4i3HG4,16301
27
27
  small_fish_gui/gui/testing.ipynb,sha256=5xoMDR2a3aa4q8KoEoJ22HrcWDyHkCF4arVeVVm7ovs,71500
28
28
  small_fish_gui/gui/screenshot/general_help_screenshot.png,sha256=X4E6Td5f04K-pBUPDaBJRAE3D5b8fuEdiAUKhkIDr-0,54210
29
29
  small_fish_gui/gui/screenshot/mapping_help_screenshot.png,sha256=HcuRh5TYciUogUasza5vZ_QSshaiHsskQK23mh9vQS8,34735
@@ -39,13 +39,13 @@ small_fish_gui/pipeline/_preprocess.py,sha256=f8TSoieM8PXgEVemnOa1zW8LrfXdE9ZZ61
39
39
  small_fish_gui/pipeline/_signaltonoise.py,sha256=7A9t7xu7zghI6cr201Ldm-LjJ5NOuP56VSeJ8KIzcUo,8497
40
40
  small_fish_gui/pipeline/actions.py,sha256=YLuRoVwG0bdQ3LvwQDrObQZaHzsOMlntrayfxY13OCw,15941
41
41
  small_fish_gui/pipeline/detection.py,sha256=Pe_1e8FKqvVyhuDOPdb2LmDKpuvS7Vg1IXWX83HqTz4,35556
42
- small_fish_gui/pipeline/main.py,sha256=EmFiQoA86uLOmVAKZFjXW-wbgcQtCFMdFHKnkNUbZ1U,4831
42
+ small_fish_gui/pipeline/main.py,sha256=X8xyTXxNIgK25LO7X29BpIglR5zwEHh8fpyaROLD7HE,5260
43
43
  small_fish_gui/pipeline/segmentation.py,sha256=8oZVs6EF0cE89OfauR_sxpzf9uxtqjAuzi5FxkbOS7Q,19913
44
44
  small_fish_gui/pipeline/spots.py,sha256=9hNOGnOZhrtrIORt8UGBcI-SGCh1XftcUGerkBwN-QY,2201
45
45
  small_fish_gui/pipeline/test.py,sha256=w4ZMGDmUDXxVgWTlZ2TKw19W8q5gcE9gLMKe0SWnRrw,2827
46
46
  small_fish_gui/pipeline/testing.ipynb,sha256=Rs7VQ7TImNyUzT2_59JgbOjR5_Qs-0NjHHnqS87eiwA,76481
47
47
  small_fish_gui/pipeline/utils.py,sha256=run6qtqCAe_mFnE3o1CnmF1xBBmK3ydgc8-jOV9P-_w,448
48
- small_fish_gui-1.9.3.dist-info/METADATA,sha256=9_cLPkb_KqtU1no-mlAqrJL9z04IwpFYNkNnmrLnFqE,2568
49
- small_fish_gui-1.9.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
50
- small_fish_gui-1.9.3.dist-info/licenses/LICENSE,sha256=-iFy8VGBYs5VsHglKpk4D-hxqQ2jMJaqmfq_ulIzDks,1303
51
- small_fish_gui-1.9.3.dist-info/RECORD,,
48
+ small_fish_gui-1.9.4.dist-info/METADATA,sha256=Bgc5DOz2cWZrBxt8V9ePZ2d40tTDmDwhDcYp9yHGKgk,2634
49
+ small_fish_gui-1.9.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
50
+ small_fish_gui-1.9.4.dist-info/licenses/LICENSE,sha256=-iFy8VGBYs5VsHglKpk4D-hxqQ2jMJaqmfq_ulIzDks,1303
51
+ small_fish_gui-1.9.4.dist-info/RECORD,,