Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta value for binned Visium HD data & error with slice indices #90

Open
Demond-dev opened this issue Dec 11, 2024 · 0 comments
Open

Beta value for binned Visium HD data & error with slice indices #90

Demond-dev opened this issue Dec 11, 2024 · 0 comments

Comments

@Demond-dev
Copy link

Hi,

I'm attempting to use SpaGCN on Visium HD data that I've binned. I was wondering what the ideal beta value to use would be? After binning the 2micron bins the anndata object has a calculated spot size diameter. Would it be appropriate to use that value or the 2 micron bin size for performing clustering?

Also I'm running into an error with running clustering with histology where slice indices are not being returned as integers.

# Read in full resolution image

img = cv2.imread(source_image_path)
# Calculate adjacent matrix
adj = spg.calculate_adj_matrix(
    x = x_pixel,
    y = y_pixel,
    x_pixel = x_pixel,
    y_pixel = y_pixel,
    image = img,
    beta = 29.367863437955762,
    alpha = 1,
    histology = True,
)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[16], [line 2](vscode-notebook-cell:?execution_count=16&line=2)
      [1](vscode-notebook-cell:?execution_count=16&line=1) # Calculate adjacent matrix
----> [2](vscode-notebook-cell:?execution_count=16&line=2) adj = spg.calculate_adj_matrix(
      [3](vscode-notebook-cell:?execution_count=16&line=3)     x = x_pixel,
      [4](vscode-notebook-cell:?execution_count=16&line=4)     y = y_pixel,
      [5](vscode-notebook-cell:?execution_count=16&line=5)     x_pixel = x_pixel,
      [6](vscode-notebook-cell:?execution_count=16&line=6)     y_pixel = y_pixel,
      [7](vscode-notebook-cell:?execution_count=16&line=7)     image = img,
      [8](vscode-notebook-cell:?execution_count=16&line=8)     beta = 29.367863437955762,
      [9](vscode-notebook-cell:?execution_count=16&line=9)     alpha = 1,
     [10](vscode-notebook-cell:?execution_count=16&line=10)     histology = True,
     [11](vscode-notebook-cell:?execution_count=16&line=11) )

File /data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/SpaGCN/calculate_adj.py:57, in calculate_adj_matrix(x, y, x_pixel, y_pixel, image, beta, alpha, histology)
     [55](https://vscode-remote+ssh-002dremote-002bcn4248.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/SpaGCN/calculate_adj.py:55) 	max_x=image.shape[0]
     [56](https://vscode-remote+ssh-002dremote-002bcn4248.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/SpaGCN/calculate_adj.py:56) 	max_y=image.shape[1]
---> [57](https://vscode-remote+ssh-002dremote-002bcn4248.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/SpaGCN/calculate_adj.py:57) 	nbs=image[max(0,x_pixel[i]-beta_half):min(max_x,x_pixel[i]+beta_half+1),max(0,y_pixel[i]-beta_half):min(max_y,y_pixel[i]+beta_half+1)]
     [58](https://vscode-remote+ssh-002dremote-002bcn4248.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/SpaGCN/calculate_adj.py:58) 	g.append(np.mean(np.mean(nbs,axis=0),axis=0))
     [59](https://vscode-remote+ssh-002dremote-002bcn4248.vscode-resource.vscode-cdn.net/data/williamsd7/conda/envs/spatialstuff/lib/python3.12/site-packages/SpaGCN/calculate_adj.py:59) c0, c1, c2=[], [], []

TypeError: slice indices must be integers or None or have an __index__ method

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant