-
Notifications
You must be signed in to change notification settings - Fork 0
/
accuracy_ST.R
47 lines (35 loc) · 1.27 KB
/
accuracy_ST.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
35
36
37
38
39
40
41
42
43
44
library(tidyr)
library(reshape2)
library(Seurat)
#load package (if not installed)
setwd("~/spatialNetSmooth/")
devtools::load_all()
accuracy <- NULL
accuracy_raw <- NULL
letters <- c("A1", "B1", "C1", "D1", "E1")
for (letter in letters) {
path <- paste("~/BA/images ST/", letter, "/", sep="")
setwd(path)
truth <- read.csv("truth.csv", row.names=1)
raw <- read.csv("gsea_raw.csv", row.names=1)
nn_spatial <- read.csv(paste("nn_spatial_scores_", letter, ".csv", sep=""), row.names=1)[,16]
d <-roc_quant(truth$V1, nn_spatial)
f <- roc_quant(truth$V1, raw$V1)
accuracy_raw <- append(accuracy_raw, f$accuracy)
accuracy <- append(accuracy, d$accuracy)
}
letter <- "H1"
path <- paste("~/BA/images ST/", letter, "/", sep="")
setwd(path)
truth <- read.csv("truth.csv", row.names=1)
raw <- read.csv("gsea_raw.csv", row.names=1)
nn_spatial <- read.csv(paste("nn_spatial_scores_", letter, ".csv", sep=""), row.names=1)[,8]
d <-roc_quant(truth$V1, nn_spatial)
f <- roc_quant(truth$V1, raw$V1)
accuracy_raw <- append(accuracy_raw, f$accuracy)
accuracy <- append(accuracy, d$accuracy)
accuracy <- rbind(accuracy_raw, accuracy)
rownames(accuracy) <- c("unsmoothed", "smoothed")
colnames(accuracy) <- c(letters, "H1")
setwd("~/BA/images ST/")
write.csv(accuracy, "accuracy_comp_ST.csv")