Skip to content

Commit 0009a46

Browse files
authored
Add files via upload
1 parent 0113e03 commit 0009a46

File tree

1 file changed

+24
-147
lines changed

1 file changed

+24
-147
lines changed

R/BenchMark/ESC_human/analysis_main.R

Lines changed: 24 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,24 @@ for(i in c(1:7)){
107107
sep = ',')
108108
}
109109

110+
111+
# Generate the index of the pathway databases
112+
# ---------------------------------------------------------------------------------
113+
# Generate the index
114+
# ---------------------------------------------------------------------------------
115+
116+
celltype <- c("H9", "DEC", "EC", "HFF", "NPC", "TB", "H1")
117+
118+
pathways <- c("IPA", "KEGG", "REACTOME")
119+
120+
for(i in c(1:7)){
121+
for(j in c(1:3)){
122+
123+
generate_index(celltype[i], pathways[j])
124+
125+
}
126+
}
127+
110128
# ---------------------------------------------------------------------------------
111129
# Run DrImpute
112130
# ---------------------------------------------------------------------------------
@@ -169,7 +187,7 @@ for(i in c(1:7)){
169187
# impute the data using scImpute
170188
data_dropout <- data_sc
171189

172-
write.table(data_dropout,paste0("/imputation_scimpute_data/sdropout_scimpute_",i,".csv"),
190+
write.table(data_dropout,paste0("/imputation_scimpute_data/dropout_scimpute_",i,".csv"),
173191
sep=',',
174192
row.names = TRUE,
175193
col.names = TRUE
@@ -196,7 +214,9 @@ for(i in c(1:7)){
196214
data_sc1[index_sc,] <- as.matrix(data_dropout)
197215

198216
saveRDS(data_sc1,
199-
file = paste0("/imputation_scimpute_data/data_",celltype[i],"_scimpute_imputation.rds"))
217+
file = paste0("/imputation_scimpute_data/data_",
218+
celltype[i],
219+
"_scimpute_imputation.rds"))
200220

201221
}
202222

@@ -291,149 +311,6 @@ for(i in c(1:7)){
291311
}
292312

293313

294-
# Generate the index of the pathway databases
295-
296-
# ---------------------------------------------------------------------------------
297-
# Run IPA
298-
# ---------------------------------------------------------------------------------
299-
300-
# load the gene
301-
data_gene <- fread(file = "data_all/gene_ESC.csv",
302-
header = FALSE)
303-
304-
data_sc <- as.matrix(fread(file = paste0("data_all/data_sc_",
305-
"DEC",
306-
".csv")))
307-
308-
309-
var0 <- MatVar(data_sc,1)
310-
311-
index_sc <- var0 > 1e-10
312-
313-
data_gene <- data_gene[index_sc,]
314-
315-
316-
n_gene <- dim(data_gene)[1]
317-
318-
319-
# IPA
320-
N <- 186
321-
index <- list()
322-
for(i in c(1:N)){
323-
324-
tmp <- fread(file = paste0("data_all/IPA/IPA_gene_",i,".csv"),
325-
header = FALSE)
326-
327-
tmp <- match(tmp$V1, data_gene$V1)
328-
329-
tmp <- tmp[!is.na(tmp)]
330-
331-
index[[i]] <- tmp
332-
}
333-
334-
for(i in c(1:N)){
335-
336-
tmp <- c()
337-
338-
k <- length(index[[i]])
339-
340-
for(j in c(1:100)){
341-
set.seed(j)
342-
tmp <- rbind(tmp, sample(1:n_gene,k))
343-
}
344-
345-
index[[i]] <- rbind(index[[i]],tmp)
346-
347-
}
348-
349-
saveRDS(index, file = "data_all/IPA_index.rds")
350-
351-
# ---------------------------------------------------------------------------------
352-
# RunKEGG
353-
# ---------------------------------------------------------------------------------
354-
355-
N <- 186
356-
index <- list()
357-
for(i in c(1:N)){
358-
359-
tmp <- fread(file = paste0("data_all/KEGG/KEGG_gene_",i,".csv"),
360-
header = FALSE)
361-
362-
tmp <- match(tmp$V1, data_gene$V1)
363-
364-
tmp <- tmp[!is.na(tmp)]
365-
366-
index[[i]] <- tmp
367-
}
368-
369-
for(i in c(1:N)){
370-
371-
tmp <- c()
372-
373-
k <- length(index[[i]])
374-
375-
for(j in c(1:100)){
376-
set.seed(j)
377-
tmp <- rbind(tmp, sample(1:n_gene,k))
378-
}
379-
380-
index[[i]] <- rbind(index[[i]],tmp)
381-
382-
}
383-
384-
saveRDS(index, file = "data_all/KEGG_index.rds")
385-
386-
# ---------------------------------------------------------------------------------
387-
# Run REACTOME
388-
# ---------------------------------------------------------------------------------
389-
#
390-
N <- 674
391-
index <- list()
392-
for(i in c(1:N)){
393-
394-
tmp <- fread(file = paste0("data_all/REACTOME/REACTOME_gene_",i,".csv"),
395-
header = FALSE)
396-
397-
tmp <- match(tmp$V1, data_gene$V1)
398-
399-
tmp <- tmp[!is.na(tmp)]
400-
401-
index[[i]] <- tmp
402-
}
403-
404-
for(i in c(1:N)){
405-
406-
tmp <- c()
407-
408-
k <- length(index[[i]])
409-
410-
for(j in c(1:100)){
411-
set.seed(j)
412-
tmp <- rbind(tmp, sample(1:n_gene,k))
413-
}
414-
415-
index[[i]] <- rbind(index[[i]],tmp)
416-
417-
}
418-
419-
saveRDS(index, file = "data_all/REACTOME_index.rds")
420-
421-
# ---------------------------------------------------------------------------------
422-
# Generate the index
423-
# ---------------------------------------------------------------------------------
424-
425-
celltype <- c("H9", "DEC", "EC", "HFF", "NPC", "TB", "H1")
426-
427-
pathways <- c("IPA", "KEGG", "REACTOME")
428-
429-
for(i in c(1:7)){
430-
for(j in c(1:3)){
431-
432-
generate_index(celltype[i], pathways[j])
433-
434-
}
435-
}
436-
437314
# ---------------------------------------------------------------------------------
438315
# Generate the ratio
439316
# ---------------------------------------------------------------------------------
@@ -453,7 +330,7 @@ for(j in c(1:3)){
453330

454331
values <- calculate_ratio(celltype[i], pathways[j], method_name[k])
455332

456-
saveRDS(values, file = paste0(cwd,"/data_all/data_",
333+
saveRDS(values, file = paste0("/data_all/data_",
457334
celltype[i], "_",pathways[j],
458335
"_", method_name[k],".rds"))
459336
}
@@ -503,4 +380,4 @@ for(j in c(1:3)){
503380
height = 5
504381
)
505382

506-
}
383+
}

0 commit comments

Comments
 (0)