comparison mutational_patterns.R @ 9:4ff3c984523b draft

"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mutational_patterns commit 109570d3d5f2c232d3bc976590295c1b83bfc9c3"
author artbio
date Mon, 19 Oct 2020 14:55:54 +0000
parents e0dad46148bf
children 59c0e2a7965c
comparison
equal deleted inserted replaced
8:e0dad46148bf 9:4ff3c984523b
314 worklist[[i]] <- worklist[[i]][order(worklist[[i]][ ,"sum"], decreasing = T), ] 314 worklist[[i]] <- worklist[[i]][order(worklist[[i]][ ,"sum"], decreasing = T), ]
315 worklist[[i]] <- worklist[[i]][1:opt$signum,] 315 worklist[[i]] <- worklist[[i]][1:opt$signum,]
316 worklist[[i]] <- worklist[[i]][ , -length(as.data.frame(worklist[[i]]))] 316 worklist[[i]] <- worklist[[i]][ , -length(as.data.frame(worklist[[i]]))]
317 } 317 }
318 worklist <- as.data.frame(melt(worklist)) 318 worklist <- as.data.frame(melt(worklist))
319 worklist[,2] <- paste0(worklist[,2], " - ", worklist[,4])
320 head(worklist)
319 } 321 }
320 322
321 colnames(worklist) <- c("signature", "sample", "value", "level") 323 colnames(worklist) <- c("signature", "sample", "value", "level")
322 print(worklist)
323 worklist <- as.data.frame(worklist %>% group_by(sample) %>% mutate(value=value/sum(value)*100)) 324 worklist <- as.data.frame(worklist %>% group_by(sample) %>% mutate(value=value/sum(value)*100))
324 worklist$pos <- cumsum(worklist$value) - worklist$value/2 325 worklist$pos <- cumsum(worklist$value) - worklist$value/2
325 worklist$label <- factor(worklist$signature) 326 worklist$label <- factor(worklist$signature)
326 worklist$signature <- factor(worklist$signature) 327 worklist$signature <- factor(worklist$signature)
327 p7 <- ggplot(worklist, aes(x="", y=value, group=signature, fill=signature)) + 328 p7 <- ggplot(worklist, aes(x="", y=value, group=signature, fill=signature)) +