forked from mcrewcow/axolotl_JWhited
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slingshot.R
34 lines (24 loc) · 1.01 KB
/
slingshot.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
library(slingshot)
dimred <- axolotl_intact@[email protected]
clustering <- axolotl_intact$RNA_snn_res.1
counts <- as.matrix(axolotl_intact@assays$RNA@counts[axolotl_intact@[email protected], ])
BiocManager::install("DelayedMatrixStats")
set.seed(1)
lineages <- getLineages(data = dimred, clusterLabels = clustering)
lineages
pto<-getLineages(dimred, clustering)
sds<-as.SlingshotDataSet(pto)
plot(dimred, col = clustering,asp=1)
lines(sds,type='l',lwd=3)
par(mfrow = c(1, 2))
plot(dimred[, 1:2], col = pal[clustering], cex = 0.5, pch = 16)
for (i in levels(clustering)) {
text(mean(dimred[clustering == i, 1]), mean(dimred[clustering == i, 2]), labels = i, font = 2)
}
plot(dimred[, 1:2], col = pal[clustering], cex = 0.5, pch = 16)
lines(sds,type='l',lwd=3)
curves <- getCurvesptoapprox_points = 300, thresh = 0.01, stretch = 0.8, allow.breaks = FALSE, shrink = 0.99)
curves
sds<-as.SlingshotDataSet(curves)
plot(dimred, col = pal[clustering], asp = 1, pch = 16)
lines(sds, lwd = 3, col = "black")