forked from rkitchen/exceRpt
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathplotExogenous.R
64 lines (49 loc) · 2.36 KB
/
plotExogenous.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
##########################################################################################
## ##
## Functions to combine pipeline runs for individual samples into something more useful ##
## ##
## Author: Rob Kitchen ([email protected]) ##
## ##
## Version 4.6.3 (2016-10-08) ##
## ##
##########################################################################################
##
## Find the relative path to the script containing the required functions
##
initial.options <- commandArgs(trailingOnly = FALSE)
script.name <- sub("--file=", "", initial.options[grep("--file=", initial.options)])
script.basename <- dirname(script.name)
#if(length(script.basename) > 0){
# functions_master <- paste(sep="/", script.basename, "functions_master.R")
# functions_doDEX <- paste(sep="/", script.basename, "functions_doDifferentialExpression.R")
#}else{
# functions_master = "functions_master.R"
# functions_doDEX = "functions_doDifferentialExpression.R"
#}
#invisible(source(functions_master))
#printMessage(paste("Sourcing",functions_doDEX,"from",script.basename)); invisible(source(functions_doDEX)); cat("\n")
##
## Check inputs and do the plots
##
args<-commandArgs(TRUE)
if(length(args) == 0){
## if no data directory is specified, throw an error message
cat("\nERROR: no input data directory specified!\n\n")
cat("Usage: Rscript plotExogenous.R <data path> [output path]\n\n")
}else{
data.dir = args[1]
if(length(args) >= 2){
output.dir = args[2]
}else{
output.dir = data.dir
}
paths = unique(SearchForSampleData(data.dir))
if(!is.null(paths)){
library(readr)
data = as.data.frame(read_tsv(paths[1]))
counts = data.frame(s1=data$readCount_direct)
cumcounts = data.frame(s1=data$readCount_inherited)
rownames(counts) = rownames(cumcounts) = data$ID
plotExogenousTaxonomyTrees(counts, cumcounts, what="s1", output.dir, taxonomyInfo=data[,1:5], fontScale=2, sampleGroups=NA, minPercent=0.5)
}
}