aristoteleo / spateo-viewer

Web application demonstrating 3D modeling of spatial transcriptomics
BSD 2-Clause "Simplified" License
13 stars 3 forks source link

errors when performing align slices #4

Closed JLiLab closed 1 year ago

JLiLab commented 1 year ago

Congratulations on the wonderful work! I ran into errors when using Align slices the sample data. Here is the message:

ERROR:root:Exception raised
ERROR:root:KeyError('obs_index')
ERROR:root:Traceback (most recent call last):
  File "/Users/lab/miniconda3/envs/spateo/lib/python3.9/site-packages/wslink/protocol.py", line 321, in onMessage
    results = func(*args, **kwargs)
  File "/Users/lab/miniconda3/envs/spateo/lib/python3.9/site-packages/trame_server/protocol.py", line 208, in update_state
    self.server.state.update(client_state)
  File "/Users/lab/miniconda3/envs/spateo/lib/python3.9/site-packages/trame_server/state.py", line 226, in __exit__
    self.flush()
  File "/Users/lab/miniconda3/envs/spateo/lib/python3.9/site-packages/trame_server/state.py", line 199, in flush
    coroutine = callback(**self._pushed_state)
  File "/Users/lab/TOOLS/spateo-viewer/stviewer/interactive_viewer/pv_pipeline/pv_callback.py", line 34, in wrapper
    ret = func(self, *args, **kwargs)
  File "/Users/lab/TOOLS/spateo-viewer/stviewer/interactive_viewer/pv_pipeline/pv_callback.py", line 226, in on_slices_alignment
    for i, j in self._state.scalarParameters["obs_index"][
KeyError: 'obs_index'
Xiaojieqiu commented 1 year ago

thanks for using spateo-viewer, please provide more details about this error message for us to reproduce your error. Also appreciate if you can format your error message so it is more readable as well

JLiLab commented 1 year ago

Those were the error message shown in the terminal whenever I turn on "Align slices" to realign slices in the web browser.

Yao-14 commented 1 year ago

Hi @JLiLab , thanks for using spateo-viewer and pointing this out. We have fixed the bug, please update to the latest version of spateo-viewer.

JLiLab commented 1 year ago

Thank you for the prompt response. The Paste method seems working. But when Morpho was used, I got the following error message:

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/lab/miniconda3/envs/spateoV/lib/python3.9/site-packages/wslink/protocol.py", line 321, in onMessage results = func(args, kwargs) File "/Users/lab/miniconda3/envs/spateoV/lib/python3.9/site-packages/trame_server/protocol.py", line 208, in update_state self.server.state.update(client_state) File "/Users/lab/miniconda3/envs/spateoV/lib/python3.9/site-packages/trame_server/state.py", line 226, in exit self.flush() File "/Users/lab/miniconda3/envs/spateoV/lib/python3.9/site-packages/trame_server/state.py", line 199, in flush coroutine = callback(self._pushed_state) File "/Users/lab/TOOLS/spateo-viewer/stviewer/interactive_viewer/pv_pipeline/pv_callback.py", line 34, in wrapper ret = func(self, args, **kwargs) File "/Users/lab/TOOLS/spateo-viewer/stviewer/interactive_viewer/pv_pipeline/pv_callback.py", line 282, in on_slices_alignment aligned_slice = morpho_align( File "/Users/lab/TOOLS/spateo-viewer/stviewer/interactive_viewer/pv_pipeline/pv_alignment.py", line 789, in morpho_align align_Rotation = [future.result()[0] for future in futures] File "/Users/lab/TOOLS/spateo-viewer/stviewer/interactive_viewer/pv_pipeline/pv_alignment.py", line 789, in align_Rotation = [future.result()[0] for future in futures] File "/Users/lab/miniconda3/envs/spateoV/lib/python3.9/concurrent/futures/_base.py", line 439, in result return self.get_result() File "/Users/lab/miniconda3/envs/spateoV/lib/python3.9/concurrent/futures/_base.py", line 391, in get_result raise self._exception File "/Users/lab/miniconda3/envs/spateoV/lib/python3.9/multiprocessing/queues.py", line 244, in _feed obj = _ForkingPickler.dumps(obj) File "/Users/lab/miniconda3/envs/spateoV/lib/python3.9/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) AttributeError: Can't pickle local object 'morpho_align...'

Yao-14 commented 1 year ago

Hi @JLiLab, we have fixed some small bugs in the morpho algorithm, please try again.

JLiLab commented 1 year ago

Thank you! It seems that both methods are now working. But they are very slow. Can spateo use multithreads?

I am glad that you fixed the sample selection function. However, is the output function working? It seems that all the output is doing nothing.

Yao-14 commented 1 year ago

Hi @JLiLab , for slice alignment, we recommend using GPU to run faster. At the same time, when the amount of data is too large, we will automatically downsample the data to ensure the running speed. After you align, you can output the aligned active model (please see https://github.com/aristoteleo/spateo-viewer/blob/main/usage/spateo-viewer.pdf), which contains obs_index information to help you map the aligned coordinates to the anndata object.

Yao-14 commented 1 year ago

We will deploy spateo-viewer to the cloud server for better computing performance in the future.