diff mutational_patterns.R @ 12:7954f0d3517f draft

"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mutational_patterns commit 7c990ad7024035342c4abd6e3fa8feb1b2f2ac2c"
author artbio
date Thu, 22 Oct 2020 21:47:48 +0000
parents 7995a949189f
children 6741b819cc15
line wrap: on
line diff
--- a/mutational_patterns.R	Thu Oct 22 00:18:38 2020 +0000
+++ b/mutational_patterns.R	Thu Oct 22 21:47:48 2020 +0000
@@ -353,7 +353,11 @@
     if (!is.na(opt$sig_contrib_matrix)) {
         output_table <- t(fit_res$contribution)/rowSums(t(fit_res$contribution))
         colnames(output_table) <- paste0("s", colnames(output_table))
+        if (length(levels(factor(levels_table$level))) > 1) {
+            output_table <- data.frame(sample=worklist$sample, output_table)
+            } else {
         output_table <- data.frame(sample=rownames(output_table), output_table)
+        }
         write.table(output_table, file = opt$sig_contrib_matrix, sep = "\t", quote = F, row.names = F)
     }