comparison mutational_patterns.R @ 7:34626b2b9907 draft

"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mutational_patterns commit a9c23b9c740ae50087777e336b4775e1f8035261"
author artbio
date Fri, 16 Oct 2020 10:00:41 +0000
parents 2c1d58f5c296
children e0dad46148bf
comparison
equal deleted inserted replaced
6:2c1d58f5c296 7:34626b2b9907
269 scale_fill_manual(name = "Cosmic\nSignatures", values = cosmic_colors) + 269 scale_fill_manual(name = "Cosmic\nSignatures", values = cosmic_colors) +
270 labs(x = "Samples", y = "Absolute contribution") + theme_bw() + 270 labs(x = "Samples", y = "Absolute contribution") + theme_bw() +
271 theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right", 271 theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right",
272 text = element_text(size=8), 272 text = element_text(size=8),
273 axis.text.x = element_text(angle=90, hjust=1)) + 273 axis.text.x = element_text(angle=90, hjust=1)) +
274 facet_grid(~level, scales = "free_x") 274 facet_grid(~level, scales = "free_x", space="free")
275 pc4_data <- pc4$data 275 pc4_data <- pc4$data
276 pc4_data <- merge (pc4_data, metadata_table[,c(1,3)], by.x="Sample", by.y="element_identifier") 276 pc4_data <- merge (pc4_data, metadata_table[,c(1,3)], by.x="Sample", by.y="element_identifier")
277 pc4 <- ggplot(pc4_data, aes(x=Sample, y=Contribution, fill=as.factor(Signature))) + 277 pc4 <- ggplot(pc4_data, aes(x=Sample, y=Contribution, fill=as.factor(Signature))) +
278 geom_bar(stat="identity", position='fill') + 278 geom_bar(stat="identity", position='fill') +
279 scale_fill_manual(name = "Cosmic\nSignatures", values = cosmic_colors) + 279 scale_fill_manual(name = "Cosmic\nSignatures", values = cosmic_colors) +
280 scale_y_continuous(labels = scales::percent_format(accuracy = 1)) + 280 scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
281 labs(x = "Samples", y = "Relative contribution") + theme_bw() + 281 labs(x = "Samples", y = "Relative contribution") + theme_bw() +
282 theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right", 282 theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), legend.position="right",
283 text = element_text(size=8), 283 text = element_text(size=8),
284 axis.text.x = element_text(angle=90, hjust=1)) + 284 axis.text.x = element_text(angle=90, hjust=1)) +
285 facet_grid(~level, scales = "free_x") 285 facet_grid(~level, scales = "free_x", space="free")
286 } 286 }
287 # Combine the two plots: 287 # Combine the two plots:
288 grid.arrange(pc3, pc4, top = textGrob("Absolute and Relative Contributions of Cosmic signatures to mutational patterns",gp=gpar(fontsize=12,font=3))) 288 grid.arrange(pc3, pc4, top = textGrob("Absolute and Relative Contributions of Cosmic signatures to mutational patterns",gp=gpar(fontsize=12,font=3)))
289 289
290 # Select signatures with some contribution (above a threshold) 290 # Select signatures with some contribution (above a threshold)