Open jflusche opened 1 year ago
Hi @jflusche, you should be able to run milopy using a neighbor graph built on the scVI embedding with no problem, the function picks the same representation used for KNN graph construction (see here).
Is your KNN graph based on scVI dimensions stored in adata.uns['neighbors']
or under another name? If the name is different you might need to pass a neighbors_key
. Otherwise, could this be related to https://github.com/emdann/milopy/issues/34?
Thank you for the prompt response! I looked into your suggestions for this issue, but have not seemed to find a solution yet.
Here are my findings:
1) I confirmed that the KNN graph is stored in adata.uns['neighbors'] (the correct name). 2) I attempted to use the 'quick fixes' from #34 but found was that X_dimred was already an array type (not a dataframe), so this solution did not change the object X_dimred (or the error I get in make_nhoods).
Hi Emma,
Really looking forward to trying the Milo implementation in Python.
When I run:
milo.make_nhoods(adata_LP_ILE, prop=0.1)
I get the following error:
I would like Milo to use the previously calculated KNN graph and connectivities based on the scVI reduced dimension space, so I skipped recalculating them based on PCA. When I recalculated neighbors based on PCA, Milo ran without errors. To try to troubleshoot where the error was coming from when using the scVI-based neighbors, I ran through make_nhoods line-by-line. I noticed there were empty arrays at certain indices of non_zero_rows. This happened at random indices (the first two times being at indices 196 and 351). The function ran normally for other indices.
For example, at index 196, this line was producing an array of nan values and the 'Mean of empty slice' error:
Thank you for your help!