zhoux85 / STAligner

STAligner is a tool for alignment and integration of spatially resolved transcriptomics data.
MIT License
28 stars 5 forks source link

Tutorial 4 Running STAligner Error #7

Closed leonli1010 closed 11 months ago

leonli1010 commented 11 months ago

When I try to run the "Running STAligner" step in Tutorial 4, I encounter this error. Any idea how to fix this? Thanks.

(I'm only using the first two sections 'E9.5_E1S1', 'E10.5_E2S1' to run the tutorial as my computer cannot handle running all 4 sections; that requires around 68.5GB of memory.)



``` adata_concat = STAligner.train_STAligner(adata_concat, verbose=True, knn_neigh = 100, iter_comb = iter_comb,
                                         margin=2.5,  device=used_device)
STAligner(
  (conv1): GATConv(2002, 512, heads=1)
  (conv2): GATConv(512, 30, heads=1)
  (conv3): GATConv(30, 512, heads=1)
  (conv4): GATConv(512, 2002, heads=1)
)
Pretrain with STAGATE...
100%|██████████| 500/500 [06:51<00:00,  1.22it/s]
Train with STAligner...
Update spot triplets at epoch 500
  0%|          | 0/500 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.2\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
    coro = func()
           ^^^^^^
  File "<input>", line 1, in <module>
  File "C:\Users\leon\PycharmProjects\pythonProject\venv\Lib\site-packages\staligner-1.0.0-py3.11.egg\STAligner\train_STAligner.py", line 188, in train_STAligner
    mnn_dict = create_dictionary_mnn(adata, use_rep='STAGATE', batch_name='batch_name', k=knn_neigh,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leon\PycharmProjects\pythonProject\venv\Lib\site-packages\staligner-1.0.0-py3.11.egg\STAligner\mnn_utils.py", line 45, in create_dictionary_mnn
    match = mnn(ds1, ds2, names1, names2, knn=k, save_on_disk = save_on_disk, approx = approx)
                                                                ^^^^^^^^^^^^
NameError: name 'save_on_disk' is not defined
zhoux85 commented 11 months ago

Hi. Thanks for your reporting. It's a bug. I fixed it by adding save_on_disk = True in the function create_dictionary_mnn in mnn_utils.py. Hope it helpful.

leonli1010 commented 11 months ago

Thank you so much! That worked and the problem was fixed.