SpatialDM
SpatialDM copied to clipboard
spatialdm_global does not work with a list of specified index, pair_selection_matrix would change adata
Hi I found out there's a bug in spatialdm_global https://github.com/StatBiomed/SpatialDM/blob/aa1762496437a45787314a27e88313bdec6287c0/spatialdm/main.py#L155
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.
https://github.com/StatBiomed/SpatialDM/blob/aa1762496437a45787314a27e88313bdec6287c0/spatialdm/utils.py#L92
I tried to fix the first problem in this commit https://github.com/StatBiomed/SpatialDM/commit/7bdcaa1e928400cffdc28a111f17822d07638210