diff mutational_patterns.R @ 6:2c1d58f5c296 draft

"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mutational_patterns commit 93dc5ba0403cb447a78e466f568234bd1be9e31a"
author artbio
date Fri, 09 Oct 2020 17:06:51 +0000
parents fe31d059a482
children 34626b2b9907
line wrap: on
line diff
--- a/mutational_patterns.R	Tue Oct 06 13:33:44 2020 +0000
+++ b/mutational_patterns.R	Fri Oct 09 17:06:51 2020 +0000
@@ -246,7 +246,9 @@
                coord_flip() +
                scale_fill_manual(name = "Cosmic\nSignatures", values = cosmic_colors) +
                labs(x = "Samples", y = "Absolute contribution") + theme_bw() + 
-               theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right")
+               theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right",
+                     text = element_text(size=8),
+                     axis.text.x = element_text(angle=90, hjust=1))
         pc4_data <- pc4$data
         pc4 <- ggplot(pc4_data, aes(x=Sample, y=Contribution, fill=as.factor(Signature))) +
                geom_bar(stat="identity", position='fill') +
@@ -254,7 +256,9 @@
                scale_fill_manual(name = "Cosmic\nSignatures", values = cosmic_colors) +
                scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
                labs(x = "Samples", y = "Relative contribution") + theme_bw() + 
-               theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right")
+               theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right",
+                     text = element_text(size=8),
+                     axis.text.x = element_text(angle=90, hjust=1))
     #####
     # ggplot2 alternative
     if (!is.na(opt$levels)[1]) {  # if there are levels to display in graphs
@@ -264,7 +268,9 @@
                geom_bar(stat="identity", position='stack') +
                scale_fill_manual(name = "Cosmic\nSignatures", values = cosmic_colors) +
                labs(x = "Samples", y = "Absolute contribution") + theme_bw() + 
-               theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right") + 
+               theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right",
+                     text = element_text(size=8),
+                     axis.text.x = element_text(angle=90, hjust=1)) + 
                facet_grid(~level, scales = "free_x")
         pc4_data <- pc4$data
         pc4_data <- merge (pc4_data, metadata_table[,c(1,3)], by.x="Sample", by.y="element_identifier")
@@ -273,7 +279,9 @@
                scale_fill_manual(name = "Cosmic\nSignatures", values = cosmic_colors) +
                scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
                labs(x = "Samples", y = "Relative contribution") + theme_bw() + 
-               theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right") + 
+               theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right",
+                     text = element_text(size=8),
+                     axis.text.x = element_text(angle=90, hjust=1)) + 
                facet_grid(~level, scales = "free_x")
     }
     # Combine the two plots: