MarioniLab / miloR

R package implementation of Milo for testing for differential abundance in KNN graphs
https://bioconductor.org/packages/release/bioc/html/miloR.html
GNU General Public License v3.0
316 stars 20 forks source link

object 'as.SimpleList' of mode 'function' was not found when running calcNhoodDistance #332

Closed shuaizh117 closed 1 month ago

shuaizh117 commented 1 month ago

I was trying to run "milo.PH <- calcNhoodDistance(milo.PH, d=25, reduced.dim = "HARMONY")", and it's been running without giving any error, however, when I click on STOP, it gave the error as "Error in get(as.character(FUN), mode = "function", envir = envir) : object 'as.SimpleList' of mode 'function' was not found"

All previous steps work fine as below:

sce<- as.SingleCellExperiment(PH.lung.sct)

create a milo object

milo.PH <- Milo(sce)

construct KNN graph

milo.PH <- buildGraph(milo.PH, k = 30, d = 25, reduced.dim = "HARMONY")

Defining representative neighborhoods on the KNN graph

milo.PH <- makeNhoods(milo.PH, prop = 0.05, k = 30, d=25, refined = TRUE, reduced_dims = "HARMONY") plotNhoodSizeHist(milo.PH)

Counting cells in neighbourhoods

milo.PH <- countCells(milo.PH, meta.data = as.data.frame(colData(milo.PH)), sample="patient") head(nhoodCounts(milo.PH))

Any suggestions or comments would be appreciated!

MikeDMorgan commented 1 month ago

First, if you kill an Rsession mid-execution it will give often an error around where the code was executing at the time - so this error message is irrelvant.

Second, switch to using refinement_scheme="graph" in makeNhoods and fdr.weighting="graph-overlap" in testNhoods - these supercede the old calcNhoodDistances approach to refining nhoods.

Finally, please refer to the GitHub readme about posting issues, i.e. sessionInfo, etc.

shuaizh117 commented 1 month ago

First, if you kill an Rsession mid-execution it will give often an error around where the code was executing at the time - so this error message is irrelvant.

Second, switch to using refinement_scheme="graph" in makeNhoods and fdr.weighting="graph-overlap" in testNhoods - these supercede the old calcNhoodDistances approach to refining nhoods.

Finally, please refer to the GitHub readme about posting issues, i.e. sessionInfo, etc.

I didn't realize it would take 1h-ish for calcNhoodDistance to complete the job (~ 70K cells). Thank you for your comments and will follow what you advised.