annotate w4mcorcov_wrapper.R @ 1:e25fd8a13665 draft

planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
author eschen42
date Mon, 16 Oct 2017 09:18:29 -0400
parents 50a07adddfbd
children a06344808ffc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
1 #!/usr/bin/env Rscript
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
2
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
3 # This script assumes that it is being executed in a current working directory containing the following files:
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
4 # - w4mcorcov_lib.R
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
5 # - w4mcorcov_input.R
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
6 # - w4mcorcov_calc.R
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
7
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
8 ## constants
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
9 ##----------
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
10
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
11 modNamC <- "w4mcorcov" ## module name
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
12
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
13 topEnvC <- environment()
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
14 nl <- "\n"
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
15
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
16 ## options
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
17 ##--------
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
18
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
19 strAsFacL <- options()$stringsAsFactors
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
20 options(stringsAsFactors = FALSE)
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
21
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
22 ## subroutines
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
23 ##----------
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
24
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
25 source("w4mcorcov_lib.R")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
26 source("w4mcorcov_util.R")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
27 source("w4mcorcov_input.R")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
28 source("w4mcorcov_salience.R")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
29 source("w4mcorcov_calc.R")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
30 source("w4mcorcov_output.R")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
31
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
32 ## log file
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
33 ##---------
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
34
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
35 my_log <- function(x, ...) { cat(paste(iso8601.znow(), " ", x, ..., nl, sep=""))}
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
36 my_fatal <- function(x, ...) {
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
37 my_log("ERROR: ", x, ...)
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
38 quit(save = "no", status = 11, runLast = TRUE)
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
39 }
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
40
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
41 my_log("Start of the '", modNamC, "' Galaxy module call: ")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
42
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
43
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
44 ########
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
45 # MAIN #
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
46 ########
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
47
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
48 argVc <- unlist(parseCommandArgs(evaluate=FALSE))
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
49 my_env <- new.env()
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
50
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
51 ##------------------------------
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
52 ## Initializing
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
53 ##------------------------------
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
54
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
55 ## arguments
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
56 ##----------
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
57
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
58 # files
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
59
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
60 my_env$dataMatrix_in <- as.character(argVc["dataMatrix_in"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
61 my_env$sampleMetadata_in <- as.character(argVc["sampleMetadata_in"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
62 my_env$variableMetadata_in <- as.character(argVc["variableMetadata_in"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
63 my_env$contrast_detail <- as.character(argVc["contrast_detail"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
64 my_env$contrast_corcov <- as.character(argVc["contrast_corcov"])
1
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
65 my_env$contrast_salience <- as.character(argVc["contrast_salience"])
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
66 # print(sprintf("contrast_salience: %s", my_env$contrast_salience))
0
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
67
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
68 # other parameters
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
69
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
70 my_env$tesC <- as.character(argVc["tesC"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
71 my_env$facC <- as.character(argVc["facC"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
72 my_env$pairSigFeatOnly <- as.logical(argVc["pairSigFeatOnly"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
73 my_env$levCSV <- as.character(argVc["levCSV"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
74 my_env$matchingC <- as.character(argVc["matchingC"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
75 my_env$labelFeatures <- as.logical(argVc["labelFeatures"])
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
76
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
77 tsv_action_factory <- function(file, colnames, append) {
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
78 return (
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
79 function(tsv) {
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
80 write.table(
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
81 x = tsv
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
82 , file = file
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
83 , sep = "\t"
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
84 , quote = FALSE
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
85 , row.names = FALSE
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
86 , col.names = colnames
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
87 , append = append
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
88 )
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
89 }
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
90 )
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
91 }
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
92
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
93 corcov_tsv_colnames <- TRUE
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
94 corcov_tsv_append <- FALSE
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
95 corcov_tsv_action <- function(tsv) {
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
96 tsv_action_factory(
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
97 file = my_env$contrast_corcov
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
98 , colnames = corcov_tsv_colnames
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
99 , append = corcov_tsv_append
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
100 )(tsv)
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
101 corcov_tsv_colnames <<- FALSE
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
102 corcov_tsv_append <<- TRUE
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
103 }
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
104
1
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
105 salience_tsv_colnames <- TRUE
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
106 salience_tsv_append <- FALSE
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
107 salience_tsv_action <- function(tsv) {
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
108 tsv_action_factory(
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
109 file = my_env$contrast_salience
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
110 , colnames = salience_tsv_colnames
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
111 , append = salience_tsv_append
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
112 )(tsv)
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
113 salience_tsv_colnames <<- FALSE
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
114 salience_tsv_append <<- TRUE
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
115 }
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
116
0
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
117 my_log( "-------------------------- Reading input data --------------------------")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
118
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
119 # read_inputs is defined in w4mcorcov_input.R
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
120 my_result <- read_inputs(input_env = my_env, failure_action = my_log)
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
121
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
122 if ( is.logical(my_result) && my_result) {
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
123 my_log( "-------------------------- Beginning data processing --------------------------")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
124
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
125 # receiver for result of the call to corcov_calc
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
126 my_result <- NULL
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
127
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
128 # compute and plot the correlation_vs_covariance details plot
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
129 # The parameter settings here are generally taken from bioconductor ropls::plot.opls source.
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
130 marVn <- c(4.6, 4.1, 2.6, 1.6)
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
131 old_par <- par(
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
132 font = 2 # bold font face
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
133 , font.axis = 2 # bold font face for axis
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
134 , font.lab = 2 # bold font face for x and y labels
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
135 , lwd = 2 # line-width - interpretation is device spcific
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
136 , mar = marVn # margins
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
137 , pch = 18 # black diamond plot-character, see help for graphics::points
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
138 # , mfrow = c(2,2) # two rows by two columns
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
139 , pty = "s" # force plots to be square
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
140 )
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
141 plot2pdf(
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
142 file.name = my_env$contrast_detail
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
143 , width = 8
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
144 , height = 8
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
145 , plot.function = function() {
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
146 # plot layout four plots per page
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
147 layout(matrix(1:4, byrow = TRUE, nrow = 2))
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
148 my_result <<- corcov_calc(
1
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
149 calc_env = my_env
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
150 , failure_action = my_fatal
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
151 , progress_action = my_log
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
152 , corcov_tsv_action = corcov_tsv_action
e25fd8a13665 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents: 0
diff changeset
153 , salience_tsv_action = salience_tsv_action
0
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
154 )
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
155 }
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
156 )
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
157 par(old_par)
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
158
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
159 my_log( "-------------------------- Finished data processing --------------------------")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
160 }
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
161
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
162 my_log( "End of the '", modNamC, "' Galaxy module call")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
163
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
164 if (is.logical(my_result) && my_result) {
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
165 quit(save = "no", status = 0, runLast = TRUE)
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
166 } else {
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
167 my_log("failure :(")
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
168 quit(save = "no", status = 10, runLast = TRUE)
50a07adddfbd planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 52e588e19fe93d83d221710bb75559c5700ba637
eschen42
parents:
diff changeset
169 }