forked from rkitchen/exceRpt
-
Notifications
You must be signed in to change notification settings - Fork 11
/
mergePipelineRuns.R
58 lines (47 loc) · 1.92 KB
/
mergePipelineRuns.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
#######################################################################################
## ##
## Script to combine pipeline runs for individual samples into something more useful ##
## ##
## Author: Rob Kitchen (r.r.kitchen@gmail.com) ##
## ##
## Version 3.2.0 (2015-11-02) ##
## ##
#######################################################################################
##
## Check inputs
##
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 mergePipelineRuns.R <data path> [output path]\n\n")
}else{
data.dir = args[1]
if(length(args) >= 2){
output.dir = args[2]
if(length(args) == 3){
classifier.path = args[3]
}
}else{
output.dir = data.dir
}
##
## Find the relative path to the script containing the required functions
##
initial.options <- commandArgs(trailingOnly = FALSE)
file.arg.name <- "--file="
script.name <- sub(file.arg.name, "", initial.options[grep(file.arg.name, initial.options)])
script.basename <- dirname(script.name)
if(length(script.basename) > 0){
other.name <- paste(sep="/", script.basename, "mergePipelineRuns_functions.R")
}else{
other.name = "mergePipelineRuns_functions.R"
}
print(paste("Sourcing",other.name,"from",script.basename))
source(other.name)
cat("\n")
##
## Process all samples under this directory
##
processSamplesInDir(data.dir, output.dir, scriptDir=script.basename)
}