44 lines
907 B
R
44 lines
907 B
R
#!/usr/bin/env Rscript
|
|
|
|
args<-commandArgs(TRUE)
|
|
|
|
if (length(args) == 0) {
|
|
stop("\n\n\tusage: plot_ExN50_statistic.Rscript sampleA.ExN50.stats [ sampleB.ExN50.stats ... ] \n\n\n")
|
|
}
|
|
|
|
|
|
library(tidyverse)
|
|
|
|
alldata = NULL
|
|
|
|
for (i in 1:length(args)) {
|
|
filename = args[i]
|
|
|
|
message(sprintf("parsing: %s", filename))
|
|
data = read.table(filename, header=T, row.names=NULL)
|
|
|
|
data$sample = filename
|
|
|
|
if (is.null(alldata)) {
|
|
alldata <- data
|
|
} else {
|
|
alldata <- rbind(alldata, data)
|
|
}
|
|
}
|
|
|
|
if (length(args) == 1) {
|
|
pdf_filename = paste0(basename(args[1]), ".ExN50_plot.pdf")
|
|
} else {
|
|
pdf_filename = "ExN50_plot.pdf"
|
|
}
|
|
pdf(pdf_filename)
|
|
|
|
p = alldata %>% filter(Ex >= 30) %>% ggplot(aes(x=Ex, y=ExN50, color=sample)) + geom_line() + xlim(c(30,100))
|
|
|
|
plot(p)
|
|
|
|
write(cat("ExN50 data plotted as:", pdf_filename), stderr())
|
|
|
|
quit(save = "no", status = 0, runLast = FALSE)
|
|
|