SpatialHackathon / SpaceHack2023

MIT No Attribution
16 stars 3 forks source link

Method SCAN-IT #211

Closed Jieran-S closed 9 months ago

Jieran-S commented 9 months ago

https://github.com/SpatialHackathon/SpaceHack2023/blob/2e81727c99ddd5171d403915834d1474820384d2/method/SCAN-IT/method_scanit.py#L133-L138

SCAN-IT optargs:

https://github.com/SpatialHackathon/SpaceHack2023/blob/2e81727c99ddd5171d403915834d1474820384d2/method/SCAN-IT/scanit_optargs.json#L1-L7

  1. Whenever I run the pipeline, it always return me error:
    Traceback (most recent call last):
    File "/home/jovyan/scratch/SpaceHack2/userfolders/jsun/workflow/SpaceHack2023/method/SCAN-IT/method_scanit.py", line 138, in <module>
    scanit.tl.spatial_representation(adata, n_h=30, n_epoch=2000, lr=0.001, device=device, n_consensus=1, projection='mds', python_seed=seed, torch_seed=seed, numpy_seed=seed)
    File "/home/jovyan/scratch/SpaceHack2/userfolders/jsun/workflow/SpaceHack2023/workflows/.snakemake/conda/c1cb81294961543ca9929264d1a144fd_/lib/python3.11/site-packages/scanit/tools/_scanit_representation.py", line 66, in spatial_representation
    X_embed = rep_dgi(n_h, X_processed, A, 
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/jovyan/scratch/SpaceHack2/userfolders/jsun/workflow/SpaceHack2023/workflows/.snakemake/conda/c1cb81294961543ca9929264d1a144fd_/lib/python3.11/site-packages/scanit/_utils/_dgi.py", line 37, in rep_dgi
    n_f = X.shape[1]
          ~~~~~~~^^^
    IndexError: tuple index out of range
    Traceback (most recent call last):
    File "/home/jovyan/scratch/SpaceHack2/userfolders/jsun/workflow/SpaceHack2023/method/SCAN-IT/method_scanit.py", line 138, in <module>
    scanit.tl.spatial_representation(adata, n_h=30, n_epoch=2000, lr=0.001, device=device, n_consensus=1, projection='mds', python_seed=seed, torch_seed=seed, numpy_seed=seed)
    File "/home/jovyan/scratch/SpaceHack2/userfolders/jsun/workflow/SpaceHack2023/workflows/.snakemake/conda/c1cb81294961543ca9929264d1a144fd_/lib/python3.11/site-packages/scanit/tools/_scanit_representation.py", line 66, in spatial_representation
    X_embed = rep_dgi(n_h, X_processed, A, 
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/jovyan/scratch/SpaceHack2/userfolders/jsun/workflow/SpaceHack2023/workflows/.snakemake/conda/c1cb81294961543ca9929264d1a144fd_/lib/python3.11/site-packages/scanit/_utils/_dgi.py", line 37, in rep_dgi
    n_f = X.shape[1]
          ~~~~~~~^^^
    IndexError: tuple index out of range

    Checking its source code here.

Also, in their github they always do a preprocessing to select spatial variable genes. I'm not fully understanding what's happening here. Do we need additional preprocessing besides the current implementation?

sv-gene-selection: https://github.com/zcang/SCAN-IT/blob/main/examples/seqFISH-mouse-SScortex/somde_preprocess.py their paper: https://www.bmvc2021-virtualconference.com/assets/papers/1139.pdf

niklasmueboe commented 9 months ago

It seems that it currently can't handle sparse matrices as input.

The corresponding code does not transform the data from sparse to dense format but rather generates an invalid array.

Jieran-S commented 9 months ago

Methods runnable after adding scanpy scaling function sc.pp.scale(adata)(Data transformed into dense matrix format automatically). Will close this issue now.