1
1
# 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 .
3
3
# Please contact Tao Peng: pengt@email.chop.edu if you have any questions
4
4
# about the scripts or data
5
5
@@ -540,12 +540,14 @@ save(data_select,meta_data,file = paste0("data_sc_bulk/sc_",tissue_name,".RData"
540
540
# Prepare the data used for the imputation
541
541
# ---------------------------------------------------------------------------------
542
542
543
- # Define the tissue name
543
+ # Define the tissue name and file name of the bulk RNAseq data
544
544
data_tissue_file <- read.table(file = " data/bulk_data_name.txt" , sep = " ," )
545
545
546
+ # The tissue name
546
547
common_tissue <- c(" FetalBrain" , " SmallIntestine" , " Kidney" , " Liver" ,
547
548
" Spleen" , " Placenta" , " FetalLiver" , " Lung" )
548
549
550
+ # get the data for the imputation
549
551
for (i in c(1 : 8 )){
550
552
551
553
get_data(common_tissue [i ], data_tissue_file )
@@ -560,7 +562,7 @@ for(i in c(1:8)){
560
562
common_tissue <- c(" FetalBrain" , " SmallIntestine" , " Kidney" , " Liver" ,
561
563
" Spleen" , " Placenta" , " FetalLiver" , " Lung" )
562
564
563
- # do the imputation
565
+ # do the imputation and save the data in the folder "/imputation_data"
564
566
for (i in c(1 : 8 )){
565
567
566
568
tissue_name <- common_tissue [i ]
@@ -569,7 +571,7 @@ for(i in c(1:8)){
569
571
570
572
extdata <- DrImpute(data [[1 ]])
571
573
572
- saveRDS(extdata , file = paste0(cwd , " /imputation_data/" ,
574
+ saveRDS(extdata , file = paste0(" /imputation_data/" ,
573
575
tissue_name ,
574
576
" _drimpute_imputation.rds" ))
575
577
@@ -584,39 +586,38 @@ for(i in c(1:8)){
584
586
common_tissue <- c(" FetalBrain" , " SmallIntestine" , " Kidney" , " Liver" ,
585
587
" Spleen" , " Placenta" , " FetalLiver" , " Lung" )
586
588
587
- # do the imputation
589
+ # do the imputation and save the data in the folder "/imputation_data"
588
590
for (i in c(1 : 8 )){
589
591
590
592
tissue_name <- common_tissue [i ]
591
593
592
594
data <- readRDS(paste0(" /data_sc_bulk/" ,tissue_name ," _imputation.rds" ))
593
595
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" ),
597
597
sep = ' ,' ,
598
598
row.names = TRUE ,
599
599
col.names = TRUE
600
600
)
601
601
602
602
scimpute(
603
- paste0(" imputation_data/" ,tissue_name ," _scimpute.csv" ),
603
+ paste0(" / imputation_data/" ,tissue_name ," _scimpute.csv" ),
604
604
infile = " csv" ,
605
605
outfile = " csv" ,
606
- out_dir = paste0(" imputation_data/scImpute_" , tissue_name , " _" ),
606
+ out_dir = paste0(" / imputation_data/scImpute_" , tissue_name , " _" ),
607
607
drop_thre = 0.5 ,
608
608
Kcluster = 2 ,
609
609
ncores = 2 )
610
610
611
- data_dropout <- read.table( file = paste0(" imputation_data/scImpute_" , tissue_name ,
611
+ data_scimpute <- read.table( file = paste0(" / imputation_data/scImpute_" , tissue_name ,
612
612
" _scimpute_count.csv" ) ,
613
613
header = TRUE , sep = " ," )
614
614
615
- data_dropout $ X <- NULL
615
+ data_scimpute $ X <- NULL
616
616
617
- system(paste0(" rm imputation_data/scImpute_" , tissue_name ," *" ))
617
+ system(paste0(" rm -R imputation_data/scImpute_" , tissue_name ," *" ))
618
618
619
- saveRDS(data_dropout , file = paste0(" /imputation_data/" ,
619
+ # save the data
620
+ saveRDS(data_scimpute , file = paste0(" /imputation_data/" ,
620
621
tissue_name ,
621
622
" _scimpute_imputation.rds" ))
622
623
@@ -667,7 +668,7 @@ parameterT <- rbind(c(1,1e-7,1e-1),
667
668
c(1 ,1e-7 ,1e-1 ),
668
669
c(1 ,1e-7 ,1e-2 ))
669
670
670
- # do the imputation
671
+ # do the imputation and save the data in the folder "/imputation_data
671
672
for (i in c(1 : 8 )){
672
673
673
674
tissue_select <- common_tissue [i ]
@@ -744,7 +745,7 @@ for(i in c(1:8)){
744
745
perplexity = perplexity_value )
745
746
746
747
747
- # load the imputation results by MAGIC
748
+ # load the imputation results by MAGIC and calculate the tSNE matrix
748
749
data_magic <- read.table( file = paste0(" imputation_data/" ,
749
750
tissue_name ,
750
751
" _magic_imputation.csv" ),
0 commit comments