Created
September 28, 2022 07:24
-
-
Save emdann/05b4438415e5f5f1ec7fa6bc92d01742 to your computer and use it in GitHub Desktop.
Milo implementation using graph based features for neighbourhood sampling and SpatialFDR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(miloR) | |
## Load dummy data | |
data(sim_trajectory) | |
milo.meta <- sim_trajectory$meta | |
milo.obj <- Milo(sim_trajectory$SCE) | |
## Build KNN graph neighbourhoods | |
milo.obj <- buildGraph(milo.obj, k=20, d=30) | |
milo.obj <- makeNhoods(milo.obj, k=20, d=30, refined=TRUE, prop=0.2, refinement_scheme="graph") | |
## Count cells in nhoods | |
milo.obj <- countCells(milo.obj, samples="Sample", meta.data=milo.meta) | |
## Test for differential abundance | |
milo.design <- as.data.frame(xtabs(~ Condition + Sample, data=milo.meta)) | |
milo.design <- milo.design[milo.design$Freq > 0, ] | |
rownames(milo.design) <- milo.design$Sample | |
milo.design <- milo.design[colnames(nhoodCounts(milo.obj)),] | |
milo_res <- testNhoods(milo.obj, design=~Condition, design.df=milo.design, fdr.weighting="graph-overlap") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment