# HG changeset patch # User artbio # Date 1634511901 0 # Node ID 69f09dff98f9e4067e7d79743e25196dbf3f0763 # Parent 8d9f31389f3324c87a30749747619338f4dc49ae "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mutational_patterns commit db5fd077ec6c840b7b6eda331820999f85fd7c26" diff -r 8d9f31389f33 -r 69f09dff98f9 mutational_patterns.R --- a/mutational_patterns.R Sun Oct 17 15:51:05 2021 +0000 +++ b/mutational_patterns.R Sun Oct 17 23:05:01 2021 +0000 @@ -236,7 +236,7 @@ cosmic_urls$cosmic_version == opt$cosmic_version] sbs_signatures <- read.table(paste0(opt$tooldir, cosmic_sbs_file), sep = "\t", header = TRUE) - tag <- paste(opt$genome, "COSMIC", opt$cosmic_version, sep = " ") + tag <- paste(gsub("BSgenome.Hsapiens.UCSC.", "", opt$genome), "COSMIC", opt$cosmic_version, sep = " ") } # Prepare user-defined signatures if (!is.na(opt$own_signatures)) { @@ -267,8 +267,6 @@ # Plot mutational profiles of the COSMIC signatures - # to do: this is largely optional and should be graphically improved anyway - pdf(opt$output_sigpattern, paper = "special", width = 11.69, height = 11.69) for (i in head(seq(1, ncol(sbs_signatures), by = 20), -1)) { p6 <- plot_96_profile(sbs_signatures[, i:(i + 19)], condensed = TRUE, ymax = 0.3) @@ -281,6 +279,8 @@ grid.arrange(p6, top = textGrob(paste0(tag, " profiles (", trunc(ncol(sbs_signatures) / 20) + 1, " of ", trunc(ncol(sbs_signatures) / 20) + 1, " pages)"), gp = gpar(fontsize = 12, font = 3))) + + # Find optimal contribution of COSMIC signatures to reconstruct 96 mutational profiles pseudo_mut_mat <- mut_mat + 0.0001 # First add a small pseudocount to the mutation count matrix fit_res <- fit_to_signatures(pseudo_mut_mat, sbs_signatures) @@ -293,7 +293,7 @@ pc3 <- ggplot(pc3_data, aes(x = Sample, y = Contribution, fill = as.factor(Signature))) + geom_bar(stat = "identity", position = "stack") + coord_flip() + - scale_fill_manual(name = "Cosmic\nSignatures", values = signature_colors[]) + + scale_fill_manual(name = tag, values = signature_colors[]) + labs(x = "Samples", y = "Absolute contribution") + theme_bw() + theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), @@ -304,7 +304,7 @@ pc4 <- ggplot(pc4_data, aes(x = Sample, y = Contribution, fill = as.factor(Signature))) + geom_bar(stat = "identity", position = "fill") + coord_flip() + - scale_fill_manual(name = "Cosmic\nSignatures", values = signature_colors) + + scale_fill_manual(name = tag, values = signature_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", @@ -318,7 +318,7 @@ pc3_data <- merge(pc3_data, metadata_table[, c(1, 3)], by.x = "Sample", by.y = "element_identifier") pc3 <- ggplot(pc3_data, aes(x = Sample, y = Contribution, fill = as.factor(Signature))) + geom_bar(stat = "identity", position = "stack") + - scale_fill_manual(name = "Cosmic\nSignatures", values = signature_colors) + + scale_fill_manual(name = tag, values = signature_colors) + labs(x = "Samples", y = "Absolute contribution") + theme_bw() + theme(panel.grid.minor.x = element_blank(), panel.grid.major.x = element_blank(), @@ -330,7 +330,7 @@ pc4_data <- merge(pc4_data, metadata_table[, c(1, 3)], by.x = "Sample", by.y = "element_identifier") pc4 <- ggplot(pc4_data, aes(x = Sample, y = Contribution, fill = as.factor(Signature))) + geom_bar(stat = "identity", position = "fill") + - scale_fill_manual(name = "Cosmic\nSignatures", values = signature_colors) + + scale_fill_manual(name = tag, values = signature_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(), diff -r 8d9f31389f33 -r 69f09dff98f9 mutational_patterns.xml --- a/mutational_patterns.xml Sun Oct 17 15:51:05 2021 +0000 +++ b/mutational_patterns.xml Sun Oct 17 23:05:01 2021 +0000 @@ -1,4 +1,4 @@ - + from genomic variations in vcf files bioconductor-mutationalpatterns