comparison 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
comparison
equal deleted inserted replaced
11:7995a949189f 12:7954f0d3517f
351 351
352 # export relative contribution matrix 352 # export relative contribution matrix
353 if (!is.na(opt$sig_contrib_matrix)) { 353 if (!is.na(opt$sig_contrib_matrix)) {
354 output_table <- t(fit_res$contribution)/rowSums(t(fit_res$contribution)) 354 output_table <- t(fit_res$contribution)/rowSums(t(fit_res$contribution))
355 colnames(output_table) <- paste0("s", colnames(output_table)) 355 colnames(output_table) <- paste0("s", colnames(output_table))
356 if (length(levels(factor(levels_table$level))) > 1) {
357 output_table <- data.frame(sample=worklist$sample, output_table)
358 } else {
356 output_table <- data.frame(sample=rownames(output_table), output_table) 359 output_table <- data.frame(sample=rownames(output_table), output_table)
360 }
357 write.table(output_table, file = opt$sig_contrib_matrix, sep = "\t", quote = F, row.names = F) 361 write.table(output_table, file = opt$sig_contrib_matrix, sep = "\t", quote = F, row.names = F)
358 } 362 }
359 363
360 # calculate all pairwise cosine similarities 364 # calculate all pairwise cosine similarities
361 cos_sim_ori_rec <- cos_sim_matrix(pseudo_mut_mat, fit_res$reconstructed) 365 cos_sim_ori_rec <- cos_sim_matrix(pseudo_mut_mat, fit_res$reconstructed)