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
344 stars 22 forks source link

Results Changed #313

Open ShashTrip1 opened 8 months ago

ShashTrip1 commented 8 months ago

I ran the same code (listed below) on two different occasions and got two very different results with certain idents switching from being up in group A to being up in Group B.

alldata_milo = Milo(as.SingleCellExperiment(alldata)) alldata_milo <- buildGraph(alldata_milo, k = 20, d = 30) alldata_milo <- makeNhoods(alldata_milo, prop = 0.05, k = 20, d=30, refined = TRUE) alldata_milo <- countCells(alldata_milo, meta.data = data.frame(colData(alldata_milo)), samples="orig.ident") alldata_design <- data.frame(colData(alldata_milo))[,c("orig.ident", "Type")] alldata_design <- distinct(alldata_design) rownames(alldata_design) <- alldata_design$orig.ident alldata_design <- alldata_design[colnames(nhoodCounts(alldata_milo)), , drop=FALSE] alldata_design alldata_milo <- calcNhoodDistance(alldata_milo, d=30) rownames(alldata_design) <- alldata_design$orig.ident da_results <- testNhoods(alldata_milo, design = ~ Type, design.df = alldata_design) da_results <- annotateNhoods(alldata_milo, da_results, coldata_col = "ident")

da_results$ident <- ifelse(da_results$ident_fraction < 0.7, "Mixed", da_results$ident)

plotDAbeeswarm(da_results, group.by = "ident")

MikeDMorgan commented 8 months ago

Did you use set.seed()?

ShashTrip1 commented 8 months ago

No, I did not. But I would be surprised if that changed the results that dramatically where only certain idents change which group is upregulated.

For example two of my annotated groups (radial glial cells and angio-macros) switched from logFC of -5 to 5 while the other groups stayed similar (I understand some changes due to different random number).