@@ -107,6 +107,24 @@ for(i in c(1:7)){
107
107
sep = ' ,' )
108
108
}
109
109
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
+
110
128
# ---------------------------------------------------------------------------------
111
129
# Run DrImpute
112
130
# ---------------------------------------------------------------------------------
@@ -169,7 +187,7 @@ for(i in c(1:7)){
169
187
# impute the data using scImpute
170
188
data_dropout <- data_sc
171
189
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" ),
173
191
sep = ' ,' ,
174
192
row.names = TRUE ,
175
193
col.names = TRUE
@@ -196,7 +214,9 @@ for(i in c(1:7)){
196
214
data_sc1 [index_sc ,] <- as.matrix(data_dropout )
197
215
198
216
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" ))
200
220
201
221
}
202
222
@@ -291,149 +311,6 @@ for(i in c(1:7)){
291
311
}
292
312
293
313
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
-
437
314
# ---------------------------------------------------------------------------------
438
315
# Generate the ratio
439
316
# ---------------------------------------------------------------------------------
@@ -453,7 +330,7 @@ for(j in c(1:3)){
453
330
454
331
values <- calculate_ratio(celltype [i ], pathways [j ], method_name [k ])
455
332
456
- saveRDS(values , file = paste0(cwd , " /data_all/data_" ,
333
+ saveRDS(values , file = paste0(" /data_all/data_" ,
457
334
celltype [i ], " _" ,pathways [j ],
458
335
" _" , method_name [k ]," .rds" ))
459
336
}
@@ -503,4 +380,4 @@ for(j in c(1:3)){
503
380
height = 5
504
381
)
505
382
506
- }
383
+ }
0 commit comments