Mercurial > repos > artbio > mutational_patterns
comparison mutational_patterns.R @ 11:7995a949189f draft
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mutational_patterns commit 94919d0f442fe7059afa2e07898c149b126a5460"
author | artbio |
---|---|
date | Thu, 22 Oct 2020 00:18:38 +0000 |
parents | 59c0e2a7965c |
children | 7954f0d3517f |
comparison
equal
deleted
inserted
replaced
10:59c0e2a7965c | 11:7995a949189f |
---|---|
81 make_option( | 81 make_option( |
82 "--output_cosmic", | 82 "--output_cosmic", |
83 default = NA, | 83 default = NA, |
84 type = 'character', | 84 type = 'character', |
85 help = "path to output dataset" | 85 help = "path to output dataset" |
86 ), | |
87 make_option( | |
88 "--sig_contrib_matrix", | |
89 default = NA, | |
90 type = 'character', | |
91 help = "path to signature contribution matrix" | |
86 ), | 92 ), |
87 make_option( | 93 make_option( |
88 c("-r", "--rdata"), | 94 c("-r", "--rdata"), |
89 type="character", | 95 type="character", |
90 default=NULL, | 96 default=NULL, |
341 if (length(vcf_paths) > 1) { | 347 if (length(vcf_paths) > 1) { |
342 p8 <- plot_contribution_heatmap(fit_res$contribution, cluster_samples = TRUE, method = "complete") | 348 p8 <- plot_contribution_heatmap(fit_res$contribution, cluster_samples = TRUE, method = "complete") |
343 grid.arrange(p8) | 349 grid.arrange(p8) |
344 } | 350 } |
345 | 351 |
352 # export relative contribution matrix | |
353 if (!is.na(opt$sig_contrib_matrix)) { | |
354 output_table <- t(fit_res$contribution)/rowSums(t(fit_res$contribution)) | |
355 colnames(output_table) <- paste0("s", colnames(output_table)) | |
356 output_table <- data.frame(sample=rownames(output_table), output_table) | |
357 write.table(output_table, file = opt$sig_contrib_matrix, sep = "\t", quote = F, row.names = F) | |
358 } | |
359 | |
346 # calculate all pairwise cosine similarities | 360 # calculate all pairwise cosine similarities |
347 cos_sim_ori_rec <- cos_sim_matrix(pseudo_mut_mat, fit_res$reconstructed) | 361 cos_sim_ori_rec <- cos_sim_matrix(pseudo_mut_mat, fit_res$reconstructed) |
348 # extract cosine similarities per sample between original and reconstructed | 362 # extract cosine similarities per sample between original and reconstructed |
349 cos_sim_ori_rec <- as.data.frame(diag(cos_sim_ori_rec)) | 363 cos_sim_ori_rec <- as.data.frame(diag(cos_sim_ori_rec)) |
350 | 364 |