StatBiomed/SpatialDM

spatialdm_global does not work with a list of specified index, pair_selection_matrix would change adata

wyq977 opened this issue · 1 comments

Hi I found out there's a bug in spatialdm_global

adata.uns['global_stat']['z']['st'] = globle_st_compute(adata)

For example, if there are 400 lr pairs after extract_lr, one select 10 pairs for computation.

User cannot specify specified_ind as in globle_st_compute(adata) would also be still 400 (or 400x400)

That would throw a error in calculation due to

adata.uns['global_stat']['z']['st'].shape != np.zeros(total_len).shape

Also in this function, it would change/remove the ligand, receptor and geneInter in adata. Namely, the changes to adata would NOT be local.

For example, if one only specify 2 pairs, after calculation, ligand, receptor and geneInter would be reduced to 2.

You have to re-run extract_lr to get the full list.

def pair_selection_matrix(adata, n_perm, sel_ind, method):

I tried to fix the first problem in this commit 7bdcaa1