From ed83d4c5347ebf43b2de55782b290b66bada4561 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 22 Feb 2021 23:26:29 +0100 Subject: more script consolidations --- scripts/pa-groups.R | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'scripts/pa-groups.R') diff --git a/scripts/pa-groups.R b/scripts/pa-groups.R index ae4a3c3..3c6ce2c 100755 --- a/scripts/pa-groups.R +++ b/scripts/pa-groups.R @@ -1,11 +1,33 @@ #!/usr/bin/env Rscript library(ggplot2) -data <- read.csv("pyrrolizidine-alkaloids/pa-predictions.csv") +args = commandArgs(trailingOnly=TRUE) +groups = read.csv(args[1],header=T) +data = read.csv(args[2]) for (i in c(2:10)) { - name <- names(data)[i] - cols <- append(c(15,17),c(19:28)) - group <- data[data[i] == 1,cols] - freq <- 100*colSums(group,na.rm=TRUE)/colSums(!is.na(group)) - plot <- ggplot(data.frame(freq),aes(x=names(data)[cols],y=freq)) + geom_bar(stat="identity") + ylab("% mutagenic") + xlab(element_blank()) + ylim(c(0,100)) + theme(axis.text.x = element_text(angle=90)) + name = names(groups)[i] + cols = c(2:15) + group = data[groups[i] == 1,cols] + freq = 100*colSums(group,na.rm=TRUE)/colSums(!is.na(group)) + algos = toupper(names(data)[cols]) + algos = gsub("HIGH",'HC',algos) + algos = gsub(".CONFIDENCE",'',algos) + algos = gsub("\\.",'-',algos) + algos <- factor(algos,levels=rev(c( + "MP2D-LAZAR-ALL", + "MP2D-LAZAR-HC", + "MP2D-RF", + "MP2D-LR", + "MP2D-LR2", + "MP2D-NN", + "MP2D-SVM", + "CDK-LAZAR-ALL", + "CDK-LAZAR-HC", + "CDK-RF", + "CDK-LR", + "CDK-LR2", + "CDK-NN", + "CDK-SVM" + ))) + plot = ggplot(data.frame(freq),aes(x=freq,y=algos)) + geom_bar(stat="identity") + xlab("% mutagenic") + ylab(element_blank()) + xlim(c(0,100))# + theme(axis.text.x = element_text(angle=90)) ggsave(paste("figures/",name,".png",sep="")) } -- cgit v1.2.3