Mercurial > repos > artbio > mutational_patterns
comparison mutational_patterns.R @ 16:31e7a33ecd71 draft
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mutational_patterns commit 9deb533aabc9dc24bb88b98c57e242785142df75"
author | artbio |
---|---|
date | Mon, 04 Oct 2021 00:35:06 +0000 |
parents | 8182d1625433 |
children | 8c6ee1c2248f |
comparison
equal
deleted
inserted
replaced
15:8182d1625433 | 16:31e7a33ecd71 |
---|---|
218 | 218 |
219 if (!is.na(opt$output_cosmic)[1]) { | 219 if (!is.na(opt$output_cosmic)[1]) { |
220 pdf(opt$output_cosmic, paper = "special", width = 11.69, height = 11.69) | 220 pdf(opt$output_cosmic, paper = "special", width = 11.69, height = 11.69) |
221 pseudo_mut_mat <- mut_mat + 0.0001 # First add a small psuedocount to the mutation count matrix | 221 pseudo_mut_mat <- mut_mat + 0.0001 # First add a small psuedocount to the mutation count matrix |
222 if (opt$cosmic_version == "v2") { | 222 if (opt$cosmic_version == "v2") { |
223 sp_url <- paste("https://cancer.sanger.ac.uk/cancergenome/assets/", "signatures_probabilities.txt", sep = "") | 223 sp_url <- "https://cancer.sanger.ac.uk/signatures/documents/420/COSMIC_v2_SBS_GRCh38.txt" |
224 cancer_signatures <- read.table(sp_url, sep = "\t", header = TRUE) | 224 cancer_signatures <- read.table(sp_url, sep = "\t", header = TRUE) |
225 new_order <- match(row.names(pseudo_mut_mat), cancer_signatures$Somatic.Mutation.Type) | 225 new_order <- match(row.names(pseudo_mut_mat), cancer_signatures$Type) |
226 cancer_signatures <- cancer_signatures[as.vector(new_order), ] | 226 cancer_signatures <- cancer_signatures[as.vector(new_order), ] |
227 row.names(cancer_signatures) <- cancer_signatures$Somatic.Mutation.Type | 227 row.names(cancer_signatures) <- cancer_signatures$Type |
228 cancer_signatures <- as.matrix(cancer_signatures[, 4:33]) | 228 cancer_signatures <- as.matrix(cancer_signatures[, 2:31]) |
229 colnames(cancer_signatures) <- gsub("Signature.", "", colnames(cancer_signatures)) # shorten signature labels | 229 colnames(cancer_signatures) <- gsub("Signature_", "", colnames(cancer_signatures)) # shorten signature labels |
230 cosmic_tag <- "Signatures (Cosmic v2, March 2015)" | 230 cosmic_tag <- "Signatures (Cosmic v2, March 2015)" |
231 cosmic_colors <- col_vector[1:30] | 231 cosmic_colors <- col_vector[1:30] |
232 names(cosmic_colors) <- colnames(cancer_signatures) | 232 names(cosmic_colors) <- colnames(cancer_signatures) |
233 } else { | 233 } else { |
234 sp_url <- "https://raw.githubusercontent.com/ARTbio/startbio/master/sigProfiler_SBS_signatures_2019_05_22.tsv" | 234 sp_url <- "https://cancer.sanger.ac.uk/signatures/documents/431/COSMIC_v3_SBS_GRCh38.txt" |
235 cancer_signatures <- read.table(sp_url, sep = "\t", header = TRUE) | 235 cancer_signatures <- read.table(sp_url, sep = "\t", header = TRUE) |
236 new_order <- match(row.names(pseudo_mut_mat), cancer_signatures$Somatic.Mutation.Type) | 236 new_order <- match(row.names(pseudo_mut_mat), cancer_signatures$Type) |
237 cancer_signatures <- cancer_signatures[as.vector(new_order), ] | 237 cancer_signatures <- cancer_signatures[as.vector(new_order), ] |
238 row.names(cancer_signatures) <- cancer_signatures$Somatic.Mutation.Type | 238 row.names(cancer_signatures) <- cancer_signatures$Type |
239 cancer_signatures <- as.matrix(cancer_signatures[, 4:70]) | 239 cancer_signatures <- as.matrix(cancer_signatures[, 2:68]) |
240 colnames(cancer_signatures) <- gsub("SBS", "", colnames(cancer_signatures)) # shorten signature labels | 240 colnames(cancer_signatures) <- gsub("SBS", "", colnames(cancer_signatures)) # shorten signature labels |
241 cosmic_tag <- "Signatures (Cosmic v3, May 2019)" | 241 cosmic_tag <- "Signatures (Cosmic v3, May 2019)" |
242 cosmic_colors <- col_vector[1:67] | 242 cosmic_colors <- col_vector[1:67] |
243 names(cosmic_colors) <- colnames(cancer_signatures) | 243 names(cosmic_colors) <- colnames(cancer_signatures) |
244 } | 244 } |