@@ -85,21 +85,21 @@ plot_correlations_dna <- function(data, plot_data, condition, r1, r2, name) {
8585 geom_point() +
8686 xlab(sprintf(paste(" log2 Normalized DNA count per barcode,\n replicate" , r1 ))) +
8787 ylab(sprintf(paste(" log2 Normalized DNA count per barcode,\n replicate" , r2 ))) +
88- geom_text(x = min + 0.5 , y = max - 0.5 , label = sprintf(" r = %.2f" , cor(data $ DNA_normalized_log2.x , data $ DNA_normalized_log2.y , method = " pearson" )), size = 10 ) +
89- geom_text(x = min + 0.5 , y = max - 1.0 , label = sprintf(" rho = %.2f" , cor(data $ DNA_normalized.x , data $ DNA_normalized.y , method = " spearman" )), size = 10 ) +
88+ geom_text(x = - Inf , y = Inf , hjust = 0 , vjust = 1 , label = sprintf(" r = %.2f" , cor(data $ DNA_normalized_log2.x , data $ DNA_normalized_log2.y , method = " pearson" )), size = 10 ) +
89+ geom_text(x = - Inf , y = Inf , hjust = 0 , vjust = 2.1 , label = sprintf(" rho = %.2f" , cor(data $ DNA_normalized.x , data $ DNA_normalized.y , method = " spearman" )), size = 10 ) +
9090 geom_abline(intercept = 0 , slope = 1 ) +
9191 theme_classic(base_size = 30 )
9292 return (dna_p )
9393}
9494plot_correlations_rna <- function (data , plot_data , condition , r1 , r2 , name ) {
95- max <- max(data $ `RNA_normalized.y_log2 ` )
96- min <- min(data $ `RNA_normalized.x_log2 ` )
95+ max <- max(data $ `RNA_normalized_log2.y ` )
96+ min <- min(data $ `RNA_normalized_log2.x ` )
9797 rna_p <- ggplot(plot_data , aes(RNA_normalized_log2.x , RNA_normalized_log2.y )) +
9898 geom_point() +
9999 xlab(sprintf(paste(" log2 Normalized RNA count per barcode,\n replicate" , r1 ))) +
100100 ylab(sprintf(paste(" log2 Normalized RNA count per barcode,\n replicate" , r2 ))) +
101- geom_text(x = min + 0.5 , y = max - 0.5 , label = sprintf(" r = %.2f" , cor(data $ RNA_normalized_log2.x , data $ RNA_normalized_log2.y , method = " pearson" )), size = 10 ) +
102- geom_text(x = min + 0.5 , y = max - 1.0 , label = sprintf(" rho = %.2f" , cor(data $ RNA_normalized.x , data $ RNA_normalized.y , method = " spearman" )), size = 10 ) +
101+ geom_text(x = - Inf , y = Inf , hjust = 0 , vjust = 1 , label = sprintf(" r = %.2f" , cor(data $ RNA_normalized_log2.x , data $ RNA_normalized_log2.y , method = " pearson" )), size = 10 ) +
102+ geom_text(x = - Inf , y = Inf , hjust = 0 , vjust = 2.1 , label = sprintf(" rho = %.2f" , cor(data $ RNA_normalized.x , data $ RNA_normalized.y , method = " spearman" )), size = 10 ) +
103103 geom_abline(intercept = 0 , slope = 1 ) +
104104 theme_classic(base_size = 30 )
105105 return (rna_p )
@@ -111,8 +111,8 @@ plot_correlations_ratio <- function(data, plot_data, condition, r1, r2, name) {
111111 geom_point() +
112112 xlab(sprintf(paste(" log2 RNA/DNA per barcode,\n replicate" , r1 ))) +
113113 ylab(sprintf(paste(" log2 RNA/DNA per barcode,\n replicate" , r2 ))) +
114- geom_text(x = min + 0.5 , y = max - 0.5 , label = sprintf(" r = %.2f" , cor(data $ Ratio_log2.x , res $ Ratio_log2.y , method = " pearson" )), size = 10 ) +
115- geom_text(x = min + 0.5 , y = max - 1.0 , label = sprintf(" rho = %.2f" , cor(data $ Ratio.x , data $ Ratio.y , method = " spearman" )), size = 10 ) +
114+ geom_text(x = - Inf , y = Inf , hjust = 0 , vjust = 1 , label = sprintf(" r = %.2f" , cor(data $ Ratio_log2.x , res $ Ratio_log2.y , method = " pearson" )), size = 10 ) +
115+ geom_text(x = - Inf , y = Inf , hjust = 0 , vjust = 2.1 , label = sprintf(" rho = %.2f" , cor(data $ Ratio.x , data $ Ratio.y , method = " spearman" )), size = 10 ) +
116116 geom_abline(intercept = 0 , slope = 1 ) +
117117 theme_classic(base_size = 30 )
118118 return (ratio_p )
@@ -225,4 +225,5 @@ if (data %>% nrow() > 1) {
225225 writeCorrelationPlots(plots_correlations_rna , sprintf(" %s_barcode_RNA_pairwise.png" , outdir ))
226226 writeCorrelationPlots(plots_correlations_ratio , sprintf(" %s_barcode_Ratio_pairwise.png" , outdir ))
227227
228- }
228+ }
229+
0 commit comments