Skip to content

Commit 0113e03

Browse files
authored
Add files via upload
1 parent 808985f commit 0113e03

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

R/BenchMark/MCA/analysis_main.R

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This is the main R file to generate the results related our manuscript
2-
# figure 6 and the supplementary figures related to figure 6.
2+
# figure 7 and the supplementary figures related to figure 7.
33
# Please contact Tao Peng: pengt@email.chop.edu if you have any questions
44
# about the scripts or data
55

@@ -540,12 +540,14 @@ save(data_select,meta_data,file = paste0("data_sc_bulk/sc_",tissue_name,".RData"
540540
# Prepare the data used for the imputation
541541
# ---------------------------------------------------------------------------------
542542

543-
# Define the tissue name
543+
# Define the tissue name and file name of the bulk RNAseq data
544544
data_tissue_file <- read.table(file = "data/bulk_data_name.txt", sep = ",")
545545

546+
# The tissue name
546547
common_tissue <- c("FetalBrain", "SmallIntestine", "Kidney", "Liver",
547548
"Spleen", "Placenta", "FetalLiver", "Lung")
548549

550+
# get the data for the imputation
549551
for(i in c(1:8)){
550552

551553
get_data(common_tissue[i], data_tissue_file)
@@ -560,7 +562,7 @@ for(i in c(1:8)){
560562
common_tissue <- c("FetalBrain", "SmallIntestine", "Kidney", "Liver",
561563
"Spleen", "Placenta", "FetalLiver", "Lung")
562564

563-
# do the imputation
565+
# do the imputation and save the data in the folder "/imputation_data"
564566
for(i in c(1:8)){
565567

566568
tissue_name <- common_tissue[i]
@@ -569,7 +571,7 @@ for(i in c(1:8)){
569571

570572
extdata <- DrImpute(data[[1]])
571573

572-
saveRDS(extdata, file = paste0(cwd,"/imputation_data/",
574+
saveRDS(extdata, file = paste0("/imputation_data/",
573575
tissue_name,
574576
"_drimpute_imputation.rds"))
575577

@@ -584,39 +586,38 @@ for(i in c(1:8)){
584586
common_tissue <- c("FetalBrain", "SmallIntestine", "Kidney", "Liver",
585587
"Spleen", "Placenta", "FetalLiver", "Lung")
586588

587-
# do the imputation
589+
# do the imputation and save the data in the folder "/imputation_data"
588590
for(i in c(1:8)){
589591

590592
tissue_name <- common_tissue[i]
591593

592594
data <- readRDS(paste0("/data_sc_bulk/",tissue_name,"_imputation.rds"))
593595

594-
tmp <- as.matrix(data[[1]])
595-
596-
write.table(tmp,paste0("imputation_data/",tissue_name,"_scimpute.csv"),
596+
write.table(as.matrix(data[[1]]), paste0("/imputation_data/",tissue_name,"_scimpute.csv"),
597597
sep=',',
598598
row.names = TRUE,
599599
col.names = TRUE
600600
)
601601

602602
scimpute(
603-
paste0("imputation_data/",tissue_name,"_scimpute.csv"),
603+
paste0("/imputation_data/",tissue_name,"_scimpute.csv"),
604604
infile = "csv",
605605
outfile = "csv",
606-
out_dir = paste0("imputation_data/scImpute_", tissue_name, "_"),
606+
out_dir = paste0("/imputation_data/scImpute_", tissue_name, "_"),
607607
drop_thre = 0.5,
608608
Kcluster = 2,
609609
ncores = 2)
610610

611-
data_dropout <- read.table( file = paste0("imputation_data/scImpute_", tissue_name,
611+
data_scimpute <- read.table( file = paste0("/imputation_data/scImpute_", tissue_name,
612612
"_scimpute_count.csv") ,
613613
header = TRUE, sep=",")
614614

615-
data_dropout$X <- NULL
615+
data_scimpute$X <- NULL
616616

617-
system(paste0("rm imputation_data/scImpute_", tissue_name,"*"))
617+
system(paste0("rm -R imputation_data/scImpute_", tissue_name,"*"))
618618

619-
saveRDS(data_dropout, file = paste0("/imputation_data/",
619+
# save the data
620+
saveRDS(data_scimpute, file = paste0("/imputation_data/",
620621
tissue_name,
621622
"_scimpute_imputation.rds"))
622623

@@ -667,7 +668,7 @@ parameterT <- rbind(c(1,1e-7,1e-1),
667668
c(1,1e-7,1e-1),
668669
c(1,1e-7,1e-2))
669670

670-
# do the imputation
671+
# do the imputation and save the data in the folder "/imputation_data
671672
for(i in c(1:8)){
672673

673674
tissue_select <- common_tissue[i]
@@ -744,7 +745,7 @@ for(i in c(1:8)){
744745
perplexity = perplexity_value)
745746

746747

747-
# load the imputation results by MAGIC
748+
# load the imputation results by MAGIC and calculate the tSNE matrix
748749
data_magic <- read.table( file = paste0("imputation_data/",
749750
tissue_name,
750751
"_magic_imputation.csv"),

0 commit comments

Comments
 (0)