annotate w4mcorcov_calc.R @ 6:7bd523ca1f9a draft

planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
author eschen42
date Wed, 18 Jul 2018 12:35:55 -0400
parents 50f60f94c034
children 066b1f409e9f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
1 # center with 'colMeans()' - ref: http://gastonsanchez.com/visually-enforced/how-to/2014/01/15/Center-data-in-R/
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
2 center_colmeans <- function(x) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
3 xcenter = colMeans(x)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
4 x - rep(xcenter, rep.int(nrow(x), ncol(x)))
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
5 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
6
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
7 #### OPLS-DA
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
8 algoC <- "nipals"
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
9
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
10 do_detail_plot <- function(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
11 x_dataMatrix
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
12 , x_predictor
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
13 , x_is_match
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
14 , x_algorithm
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
15 , x_prefix
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
16 , x_show_labels
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
17 , x_progress = print
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
18 , x_env
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
19 , x_crossval_i
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
20 ) {
2
e03582f26617 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 7682e8e7ae2bfb926d94b414b9a1649389f33582
eschen42
parents: 1
diff changeset
21 off <- function(x) if (x_show_labels == "0") 0 else x
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
22 if ( x_is_match
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
23 && ncol(x_dataMatrix) > 0
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
24 && length(unique(x_predictor))> 1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
25 && x_crossval_i < nrow(x_dataMatrix)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
26 ) {
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
27 my_oplsda <- opls(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
28 x = x_dataMatrix
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
29 , y = x_predictor
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
30 , algoC = x_algorithm
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
31 , predI = 1
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
32 , orthoI = if (ncol(x_dataMatrix) > 1) 1 else 0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
33 , printL = FALSE
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
34 , plotL = FALSE
3
5aaab36bc523 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 88004a3cf8868d68da1ec5bd2c1be53746350367
eschen42
parents: 2
diff changeset
35 , crossvalI = x_crossval_i
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
36 , scaleC = "none" # data have been pareto scaled outside this routine and must not be scaled again. This line fixes issue #2.
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
37 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
38 my_oplsda_suppLs_y_levels <- levels(as.factor(my_oplsda@suppLs$y))
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
39 fctr_lvl_1 <- my_oplsda_suppLs_y_levels[1]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
40 fctr_lvl_2 <- my_oplsda_suppLs_y_levels[2]
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
41 do_s_plot <- function(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
42 x_env
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
43 , predictor_projection_x = TRUE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
44 , cplot_x = FALSE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
45 , cor_vs_cov_x = NULL
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
46 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
47 {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
48 #print(ls(x_env)) # "cplot_y" etc
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
49 #print(str(x_env$cplot_y)) # chr "covariance"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
50 if (cplot_x) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
51 #print(x_env$cplot_y) # "covariance"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
52 cplot_y_correlation <- (x_env$cplot_y == "correlation")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
53 #print(cplot_y_correlation) # FALSE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
54 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
55 if (is.null(cor_vs_cov_x)) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
56 my_cor_vs_cov <- cor_vs_cov(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
57 matrix_x = x_dataMatrix
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
58 , ropls_x = my_oplsda
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
59 , predictor_projection_x = predictor_projection_x
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
60 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
61 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
62 my_cor_vs_cov <- cor_vs_cov_x
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
63 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
64 # print("str(my_cor_vs_cov)")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
65 # str(my_cor_vs_cov)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
66 if (sum(!is.na(my_cor_vs_cov$tsv1$covariance)) < 2) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
67 x_progress("No cor_vs_cov data produced")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
68 plot(x=1, y=1, xaxt="n", yaxt="n", xlab="", ylab="", type="n")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
69 text(x=1, y=1, labels="too few covariance data")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
70 return(my_cor_vs_cov)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
71 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
72 with(
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
73 my_cor_vs_cov
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
74 , {
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
75 min_x <- min(covariance, na.rm = TRUE)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
76 max_x <- max(covariance, na.rm = TRUE)
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
77 lim_x <- max(sapply(X=c(min_x, max_x), FUN=abs))
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
78 covariance <- covariance / lim_x
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
79 lim_x <- 1.2
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
80 # "It is generally accepted that a variable should be selected if vj>1, [27–29],
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
81 # but a proper threshold between 0.83 and 1.21 can yield more relevant variables according to [28]."
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
82 # (Mehmood 2012 doi:10.1186/1748-7188-6-27)
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
83 plus_cor <- correlation
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
84 plus_cov <- covariance
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
85 cex <- 0.65
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
86 which_projection <- if (projection == 1) "t1" else "o1"
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
87 which_loading <- if (projection == 1) "parallel" else "orthogonal"
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
88 if (projection == 1) { # predictor-projection
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
89 vipcp <- pmax(0, pmin(1,(vip4p-0.83)/(1.21-0.83)))
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
90 if (!cplot_x) { # S-plot predictor-projection
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
91 my_xlab <- "relative covariance(feature,t1)"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
92 my_x <- plus_cov
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
93 my_ylab <- "correlation(feature,t1)"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
94 my_y <- plus_cor
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
95 } else { # C-plot predictor-projection
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
96 my_xlab <- "variable importance in predictor-projection"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
97 my_x <- vip4p
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
98 if (cplot_y_correlation) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
99 my_ylab <- "correlation(feature,t1)"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
100 my_y <- plus_cor
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
101 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
102 my_ylab <- "relative covariance(feature,t1)"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
103 my_y <- plus_cov
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
104 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
105 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
106 if (cplot_x) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
107 lim_x <- max(my_x, na.rm = TRUE) * 1.1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
108 my_xlim <- c( 0, lim_x + off(0.2) )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
109 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
110 my_xlim <- c( -lim_x - off(0.2), lim_x + off(0.2) )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
111 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
112 my_ylim <- c( -1.0 - off(0.2), 1.0 + off(0.2) )
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
113 my_load_distal <- loadp
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
114 my_load_proximal <- loado
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
115 red <- as.numeric(correlation > 0) * vipcp
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
116 blue <- as.numeric(correlation < 0) * vipcp
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
117 alpha <- 0.1 + 0.4 * vipcp
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
118 red[is.na(red)] <- 0
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
119 blue[is.na(blue)] <- 0
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
120 alpha[is.na(alpha)] <- 0
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
121 my_col <- rgb(blue = blue, red = red, green = 0, alpha = alpha)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
122 main_label <- sprintf("%s for level %s versus %s"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
123 , x_prefix, fctr_lvl_1, fctr_lvl_2)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
124 } else { # orthogonal projection
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
125 vipco <- pmax(0, pmin(1,(vip4o-0.83)/(1.21-0.83)))
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
126 if (!cplot_x) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
127 my_xlab <- "relative covariance(feature,to1)"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
128 my_x <- -plus_cov
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
129 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
130 my_xlab <- "variable importance in orthogonal projection"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
131 my_x <- vip4o
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
132 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
133 if (!cplot_x) { # S-plot orthogonal projection
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
134 my_xlim <- c( -lim_x - off(0.2), lim_x + off(0.2) )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
135 my_ylab <- "correlation(feature,to1)"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
136 my_y <- plus_cor
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
137 } else { # C-plot orthogonal projection
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
138 lim_x <- max(my_x, na.rm = TRUE) * 1.1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
139 my_xlim <- c( 0, lim_x + off(0.2) )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
140 if (cplot_y_correlation) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
141 my_ylab <- "correlation(feature,to1)"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
142 my_y <- plus_cor
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
143 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
144 my_ylab <- "relative covariance(feature,to1)"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
145 my_y <- plus_cov
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
146 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
147 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
148 my_ylim <- c( -1.0 - off(0.2), 1.0 + off(0.2) )
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
149 my_load_distal <- loado
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
150 my_load_proximal <- loadp
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
151 alpha <- 0.1 + 0.4 * vipco
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
152 alpha[is.na(alpha)] <- 0
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
153 my_col <- rgb(blue = 0, red = 0, green = 0, alpha = alpha)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
154 main_label <- sprintf(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
155 "Features influencing orthogonal projection for %s versus %s"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
156 , fctr_lvl_1, fctr_lvl_2)
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
157 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
158 main_cex <- min(1.0, 46.0/nchar(main_label))
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
159 my_feature_label_slant <- -30 # slant feature labels 30 degrees downward
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
160 plot(
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
161 y = my_y
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
162 , x = my_x
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
163 , type = "p"
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
164 , xlim = my_xlim
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
165 , ylim = my_ylim
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
166 , xlab = my_xlab
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
167 , ylab = my_ylab
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
168 , main = main_label
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
169 , cex.main = main_cex
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
170 , cex = cex
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
171 , pch = 16
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
172 , col = my_col
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
173 )
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
174 low_x <- -0.7 * lim_x
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
175 high_x <- 0.7 * lim_x
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
176 if (projection == 1 && !cplot_x) {
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
177 text(x = low_x, y = -0.05, labels = fctr_lvl_1, col = "blue")
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
178 text(x = high_x, y = 0.05, labels = fctr_lvl_2, col = "red")
2
e03582f26617 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 7682e8e7ae2bfb926d94b414b9a1649389f33582
eschen42
parents: 1
diff changeset
179 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
180 if ( x_show_labels != "0" ) {
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
181 names(my_load_distal) <- tsv1$featureID
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
182 names(my_load_proximal) <- tsv1$featureID
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
183 if ( x_show_labels == "ALL" ) {
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
184 n_labels <- length(my_load_distal)
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
185 } else {
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
186 n_labels <- as.numeric(x_show_labels)
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
187 }
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
188 n_labels <- min( n_labels, (1 + length(my_load_distal)) / 2 )
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
189 labels_to_show <- c(
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
190 names(head(sort(my_load_distal),n = n_labels))
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
191 , names(tail(sort(my_load_distal),n = n_labels))
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
192 )
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
193 labels <- unname(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
194 sapply(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
195 X = tsv1$featureID
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
196 , FUN = function(x) if( x %in% labels_to_show ) x else ""
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
197 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
198 )
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
199 x_text_offset <- 0.024
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
200 y_text_off <- 0.017
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
201 if (!cplot_x) { # S-plot
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
202 y_text_offset <- if (projection == 1) -y_text_off else y_text_off
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
203 } else { # C-plot
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
204 y_text_offset <-
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
205 sapply(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
206 X = (my_y > 0)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
207 , FUN = function(x) { if (x) y_text_off else -y_text_off }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
208 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
209 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
210 label_features <- function(x_arg, y_arg, labels_arg, slant_arg) {
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
211 # print("str(x_arg)")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
212 # print(str(x_arg))
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
213 # print("str(y_arg)")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
214 # print(str(y_arg))
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
215 # print("str(labels_arg)")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
216 # print(str(labels_arg))
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
217 if (length(labels_arg) > 0) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
218 unique_slant <- unique(slant_arg)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
219 if (length(unique_slant) == 1) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
220 text(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
221 y = y_arg
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
222 , x = x_arg + x_text_offset
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
223 , cex = 0.4
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
224 , labels = labels_arg
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
225 , col = rgb(blue = 0, red = 0, green = 0, alpha = 0.5) # grey semi-transparent labels
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
226 , srt = slant_arg
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
227 , adj = 0 # left-justified
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
228 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
229 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
230 for (slant in unique_slant) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
231 text(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
232 y = y_arg[slant_arg == slant]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
233 , x = x_arg[slant_arg == slant] + x_text_offset
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
234 , cex = 0.4
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
235 , labels = labels_arg[slant_arg == slant]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
236 , col = rgb(blue = 0, red = 0, green = 0, alpha = 0.5) # grey semi-transparent labels
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
237 , srt = slant
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
238 , adj = 0 # left-justified
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
239 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
240 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
241 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
242 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
243 }
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
244 if (!cplot_x) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
245 my_slant <- (if (projection == 1) 1 else -1) * my_feature_label_slant
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
246 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
247 my_slant <- sapply(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
248 X = (my_y > 0)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
249 , FUN = function(x) if (x) 2 else -2
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
250 ) * my_feature_label_slant
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
251 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
252 if (length(my_x) > 1) {
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
253 label_features(
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
254 x_arg = my_x [my_x > 0]
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
255 , y_arg = my_y [my_x > 0] - y_text_offset
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
256 , labels_arg = labels[my_x > 0]
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
257 , slant_arg = (if (!cplot_x) -my_slant else (my_slant))
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
258 )
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
259 if (!cplot_x) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
260 label_features(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
261 x_arg = my_x [my_x < 0]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
262 , y_arg = my_y [my_x < 0] + y_text_offset
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
263 , labels_arg = labels[my_x < 0]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
264 , slant_arg = my_slant
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
265 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
266 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
267 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
268 if (!cplot_x) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
269 my_slant <- (if (my_x > 1) -1 else 1) * my_slant
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
270 my_y_arg = my_y + (if (my_x > 1) -1 else 1) * y_text_offset
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
271 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
272 my_slant <- (if (my_y > 1) -1 else 1) * my_slant
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
273 my_y_arg = my_y + (if (my_y > 1) -1 else 1) * y_text_offset
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
274 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
275 label_features(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
276 x_arg = my_x
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
277 , y_arg = my_y_arg
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
278 , labels_arg = labels
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
279 , slant_arg = my_slant
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
280 )
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
281 }
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
282 }
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
283 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
284 )
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
285 return (my_cor_vs_cov)
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
286 }
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
287 my_cor_vs_cov <- do_s_plot(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
288 x_env = x_env
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
289 , predictor_projection_x = TRUE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
290 , cplot_x = FALSE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
291 )
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
292 typeVc <- c("correlation", # 1
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
293 "outlier", # 2
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
294 "overview", # 3
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
295 "permutation", # 4
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
296 "predict-train", # 5
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
297 "predict-test", # 6
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
298 "summary", # 7 = c(2,3,4,9)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
299 "x-loading", # 8
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
300 "x-score", # 9
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
301 "x-variance", # 10
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
302 "xy-score", # 11
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
303 "xy-weight" # 12
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
304 ) # [c(3,8,9)] # [c(4,3,8,9)]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
305 if ( length(my_oplsda@orthoVipVn) > 0 ) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
306 my_typevc <- typeVc[c(9,3,8)]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
307 } else {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
308 my_typevc <- c("(dummy)","overview","(dummy)")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
309 }
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
310 my_ortho_cor_vs_cov_exists <- FALSE
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
311 for (my_type in my_typevc) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
312 if (my_type %in% typeVc) {
4
8bba31f628da planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
eschen42
parents: 3
diff changeset
313 tryCatch({
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
314 if ( my_type != "x-loading" ) {
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
315 plot(
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
316 x = my_oplsda
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
317 , typeVc = my_type
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
318 , parCexN = 0.4
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
319 , parDevNewL = FALSE
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
320 , parLayL = TRUE
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
321 , parEllipsesL = TRUE
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
322 )
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
323 if (my_type == "overview") {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
324 sub_label <- sprintf("%s versus %s", fctr_lvl_1, fctr_lvl_2)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
325 title(sub = sub_label)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
326 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
327 } else {
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
328 my_ortho_cor_vs_cov <- do_s_plot(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
329 x_env = x_env
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
330 , predictor_projection_x = FALSE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
331 , cplot_x = FALSE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
332 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
333 my_ortho_cor_vs_cov_exists <- TRUE
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
334 }
4
8bba31f628da planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
eschen42
parents: 3
diff changeset
335 }, error = function(e) {
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
336 x_progress(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
337 sprintf(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
338 "factor level %s or %s may have only one sample - %s"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
339 , fctr_lvl_1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
340 , fctr_lvl_2
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
341 , e$message
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
342 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
343 )
4
8bba31f628da planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
eschen42
parents: 3
diff changeset
344 })
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
345 } else {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
346 plot(x=1, y=1, xaxt="n", yaxt="n", xlab="", ylab="", type="n")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
347 text(x=1, y=1, labels="no orthogonal projection is possible")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
348 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
349 }
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
350 cplot_p <- x_env$cplot_p
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
351 cplot_o <- x_env$cplot_o
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
352 if (cplot_p || cplot_o) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
353 if (cplot_p) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
354 do_s_plot(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
355 x_env = x_env
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
356 , predictor_projection_x = TRUE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
357 , cplot_x = TRUE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
358 , cor_vs_cov_x = my_cor_vs_cov
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
359 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
360 did_plots <- 1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
361 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
362 did_plots <- 0
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
363 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
364 if (cplot_o) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
365 if (my_ortho_cor_vs_cov_exists) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
366 do_s_plot(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
367 x_env = x_env
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
368 , predictor_projection_x = FALSE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
369 , cplot_x = TRUE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
370 , cor_vs_cov_x = my_ortho_cor_vs_cov
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
371 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
372 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
373 plot(x=1, y=1, xaxt="n", yaxt="n", xlab="", ylab="", type="n")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
374 text(x=1, y=1, labels="no orthogonal projection is possible")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
375 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
376 did_plots <- 1 + did_plots
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
377 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
378 if (did_plots == 1) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
379 plot(x=1, y=1, xaxt="n", yaxt="n", xlab="", ylab="", type="n", fg = "white")
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
380 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
381 }
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
382 return (my_cor_vs_cov)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
383 } else {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
384 return (NULL)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
385 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
386 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
387
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
388 # S-PLOT and OPLS reference: Wiklund_2008 doi:10.1021/ac0713510
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
389 corcov_calc <- function(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
390 calc_env
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
391 , failure_action = stop
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
392 , progress_action = function(x) { }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
393 , corcov_tsv_action = function(t) { }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
394 , salience_tsv_action = function(t) { }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
395 , extra_plots = c()
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
396 ) {
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
397 if ( ! is.environment(calc_env) ) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
398 failure_action("corcov_calc: fatal error - 'calc_env' is not an environment")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
399 return ( FALSE )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
400 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
401 if ( ! is.function(corcov_tsv_action) ) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
402 failure_action("corcov_calc: fatal error - 'corcov_tsv_action' is not a function")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
403 return ( FALSE )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
404 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
405 if ( ! is.function(salience_tsv_action) ) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
406 failure_action("salience_calc: fatal error - 'salience_tsv_action' is not a function")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
407 return ( FALSE )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
408 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
409
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
410 # extract parameters from the environment
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
411 vrbl_metadata <- calc_env$vrbl_metadata
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
412 vrbl_metadata_names <- vrbl_metadata[,1]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
413 smpl_metadata <- calc_env$smpl_metadata
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
414 data_matrix <- calc_env$data_matrix
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
415 pairSigFeatOnly <- calc_env$pairSigFeatOnly
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
416 facC <- calc_env$facC
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
417 tesC <- calc_env$tesC
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
418 # extract the levels from the environment
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
419 originalLevCSV <- levCSV <- calc_env$levCSV
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
420 # matchingC is one of { "none", "wildcard", "regex" }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
421 matchingC <- calc_env$matchingC
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
422 labelFeatures <- calc_env$labelFeatures
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
423
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
424 # arg/env checking
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
425 if (!(facC %in% names(smpl_metadata))) {
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
426 failure_action(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
427 sprintf("bad parameter! Factor name '%s' not found in sampleMetadata"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
428 , facC))
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
429 return ( FALSE )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
430 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
431
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
432 mz <- vrbl_metadata$mz
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
433 names(mz) <- vrbl_metadata$variableMetadata
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
434 mz_lookup <- function(feature) unname(mz[feature])
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
435
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
436 rt <- vrbl_metadata$rt
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
437 names(rt) <- vrbl_metadata$variableMetadata
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
438 rt_lookup <- function(feature) unname(rt[feature])
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
439
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
440 # calculate salience_df as data.frame(feature, max_level, max_median, max_rcv, mean_median, salience, salient_rcv)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
441 salience_df <- calc_env$salience_df <- w4msalience(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
442 data_matrix = data_matrix
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
443 , sample_class = smpl_metadata[,facC]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
444 , failure_action = failure_action
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
445 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
446 salience_tsv_action({
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
447 my_df <- data.frame(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
448 featureID = salience_df$feature
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
449 , salientLevel = salience_df$max_level
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
450 , salientRCV = salience_df$salient_rcv
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
451 , salience = salience_df$salience
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
452 , mz = mz_lookup(salience_df$feature)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
453 , rt = rt_lookup(salience_df$feature)
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
454 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
455 my_df[order(-my_df$salience),]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
456 })
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
457
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
458 # transform wildcards to regexen
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
459 if (matchingC == "wildcard") {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
460 # strsplit(x = "hello,wild,world", split = ",")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
461 levCSV <- gsub("[.]", "[.]", levCSV)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
462 levCSV <- strsplit(x = levCSV, split = ",")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
463 levCSV <- sapply(levCSV, utils::glob2rx, trim.tail = FALSE)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
464 levCSV <- paste(levCSV, collapse = ",")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
465 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
466 # function to determine whether level is a member of levCSV
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
467 isLevelSelected <- function(lvl) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
468 matchFun <- if (matchingC != "none") grepl else `==`
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
469 return(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
470 Reduce(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
471 f = "||"
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
472 , x = sapply(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
473 X = strsplit(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
474 x = levCSV
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
475 , split = ","
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
476 , fixed = TRUE
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
477 )[[1]]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
478 , FUN = matchFun
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
479 , lvl
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
480 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
481 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
482 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
483 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
484
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
485 # transpose matrix because ropls matrix is the transpose of XCMS matrix
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
486 # Wiklund_2008 centers and pareto-scales data before OPLS-DA S-plot
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
487 # center
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
488 cdm <- center_colmeans(t(data_matrix))
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
489 # pareto-scale
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
490 my_scale <- sqrt(apply(cdm, 2, sd, na.rm=TRUE))
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
491 scdm <- sweep(cdm, 2, my_scale, "/")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
492
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
493 # pattern to match column names like k10_kruskal_k4.k3_sig
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
494 col_pattern <- sprintf('^%s_%s_(.*)[.](.*)_sig$', facC, tesC)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
495 # column name like k10_kruskal_sig
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
496 intersample_sig_col <- sprintf('%s_%s_sig', facC, tesC)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
497 # get the facC column from sampleMetadata, dropping to one dimension
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
498 smpl_metadata_facC <- smpl_metadata[,facC]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
499
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
500 # allocate a slot in the environment for the contrast_list, each element of which will be a data.frame with this structure:
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
501 # - feature ID
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
502 # - value1
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
503 # - value2
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
504 # - Wiklund_2008 correlation
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
505 # - Wiklund_2008 covariance
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
506 # - Wiklund_2008 VIP
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
507 calc_env$contrast_list <- list()
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
508
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
509
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
510 did_plot <- FALSE
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
511 if (tesC != "none") {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
512 # for each column name, extract the parts of the name matched by 'col_pattern', if any
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
513 the_colnames <- colnames(vrbl_metadata)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
514 if ( ! Reduce( f = "||", x = grepl(tesC, the_colnames) ) ) {
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
515 failure_action(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
516 sprintf(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
517 "bad parameter! variableMetadata must contain results of W4M Univariate test '%s'."
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
518 , tesC))
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
519 return ( FALSE )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
520 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
521 col_matches <- lapply(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
522 X = the_colnames,
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
523 FUN = function(x) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
524 regmatches( x, regexec(col_pattern, x) )[[1]]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
525 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
526 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
527 ## first contrast each selected level with all other levels combined into one "super-level" ##
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
528 # process columns matching the pattern
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
529 level_union <- c()
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
530 for (i in 1:length(col_matches)) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
531 col_match <- col_matches[[i]]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
532 if (length(col_match) > 0) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
533 # it's an actual match; extract the pieces, e.g., k10_kruskal_k4.k3_sig
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
534 vrbl_metadata_col <- col_match[1] # ^^^^^^^^^^^^^^^^^^^^^ # Column name
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
535 fctr_lvl_1 <- col_match[2] # ^^ # Factor-level 1
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
536 fctr_lvl_2 <- col_match[3] # ^^ # Factor-level 2
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
537 # only process this column if both factors are members of lvlCSV
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
538 is_match <- isLevelSelected(fctr_lvl_1) && isLevelSelected(fctr_lvl_2)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
539 if (is_match) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
540 level_union <- c(level_union, col_match[2], col_match[3])
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
541 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
542 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
543 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
544 level_union <- unique(sort(level_union))
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
545 overall_significant <- 1 == (
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
546 if (intersample_sig_col %in% colnames(vrbl_metadata)) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
547 vrbl_metadata[,intersample_sig_col]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
548 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
549 1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
550 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
551 )
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
552 if ( length(level_union) > 2 ) {
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
553 chosen_samples <- smpl_metadata_facC %in% level_union
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
554 chosen_facC <- as.character(smpl_metadata_facC[chosen_samples])
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
555 col_selector <- vrbl_metadata_names[ overall_significant ]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
556 my_matrix <- scdm[ chosen_samples, col_selector, drop = FALSE ]
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
557 plot_action <- function(fctr_lvl_1, fctr_lvl_2) {
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
558 progress_action(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
559 sprintf("calculating/plotting contrast of %s vs. %s"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
560 , fctr_lvl_1, fctr_lvl_2))
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
561 predictor <- sapply(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
562 X = chosen_facC
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
563 , FUN = function(fac) if ( fac == fctr_lvl_1 ) fctr_lvl_1 else fctr_lvl_2
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
564 )
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
565 my_cor_cov <- do_detail_plot(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
566 x_dataMatrix = my_matrix
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
567 , x_predictor = predictor
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
568 , x_is_match = is_match
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
569 , x_algorithm = algoC
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
570 , x_prefix = if (pairSigFeatOnly) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
571 "Significantly contrasting features"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
572 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
573 "Significant features"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
574 }
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
575 , x_show_labels = labelFeatures
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
576 , x_progress = progress_action
4
8bba31f628da planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
eschen42
parents: 3
diff changeset
577 , x_crossval_i = min(7, length(chosen_samples))
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
578 , x_env = calc_env
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
579 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
580 if ( is.null(my_cor_cov) ) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
581 progress_action("NOTHING TO PLOT.")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
582 } else {
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
583 my_tsv <- my_cor_cov$tsv1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
584 my_tsv$mz <- mz_lookup(my_tsv$featureID)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
585 my_tsv$rt <- rt_lookup(my_tsv$featureID)
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
586 my_tsv["level1Level2Sig"] <- vrbl_metadata[
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
587 match(my_tsv$featureID, vrbl_metadata_names)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
588 , vrbl_metadata_col
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
589 ]
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
590 tsv <<- my_tsv
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
591 corcov_tsv_action(tsv)
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
592 did_plot <<- TRUE
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
593 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
594 }
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
595 if ( length(level_union) != 2 ) {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
596 fctr_lvl_2 <- "other"
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
597 for ( fctr_lvl_1 in level_union[1:length(level_union)] ) {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
598 plot_action(fctr_lvl_1, fctr_lvl_2)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
599 }
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
600 } else {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
601 plot_action(fctr_lvl_1 = level_union[1], fctr_lvl_2 = level_union[2])
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
602 }
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
603 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
604
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
605 if ( length(level_union) > 1 ) {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
606 ## next, contrast each selected level with each of the other levels individually ##
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
607 # process columns matching the pattern
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
608 for (i in 1:length(col_matches)) {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
609 # for each potential match of the pattern
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
610 col_match <- col_matches[[i]]
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
611 if (length(col_match) > 0) {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
612 # it's an actual match; extract the pieces, e.g., k10_kruskal_k4.k3_sig
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
613 vrbl_metadata_col <- col_match[1] # ^^^^^^^^^^^^^^^^^^^^^ # Column name
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
614 fctr_lvl_1 <- col_match[2] # ^^ # Factor-level 1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
615 fctr_lvl_2 <- col_match[3] # ^^ # Factor-level 2
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
616 # only process this column if both factors are members of lvlCSV
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
617 is_match <- isLevelSelected(fctr_lvl_1) && isLevelSelected(fctr_lvl_2)
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
618 progress_action(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
619 sprintf("calculating/plotting contrast of %s vs. %s"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
620 , fctr_lvl_1, fctr_lvl_2))
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
621 # choose only samples with one of the two factors for this column
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
622 chosen_samples <- smpl_metadata_facC %in% c(fctr_lvl_1, fctr_lvl_2)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
623 predictor <- smpl_metadata_facC[chosen_samples]
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
624 # extract only the significantly-varying features and the chosen samples
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
625 fully_significant <- 1 == vrbl_metadata[,vrbl_metadata_col] *
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
626 ( if (intersample_sig_col %in% colnames(vrbl_metadata)) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
627 vrbl_metadata[,intersample_sig_col]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
628 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
629 1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
630 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
631 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
632 col_selector <- vrbl_metadata_names[
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
633 if ( pairSigFeatOnly ) fully_significant else overall_significant
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
634 ]
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
635 my_matrix <- scdm[ chosen_samples, col_selector, drop = FALSE ]
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
636 my_cor_cov <- do_detail_plot(
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
637 x_dataMatrix = my_matrix
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
638 , x_predictor = predictor
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
639 , x_is_match = is_match
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
640 , x_algorithm = algoC
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
641 , x_prefix = if (pairSigFeatOnly) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
642 "Significantly contrasting features"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
643 } else {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
644 "Significant features"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
645 }
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
646 , x_show_labels = labelFeatures
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
647 , x_progress = progress_action
4
8bba31f628da planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
eschen42
parents: 3
diff changeset
648 , x_crossval_i = min(7, length(chosen_samples))
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
649 , x_env = calc_env
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
650 )
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
651 if ( is.null(my_cor_cov) ) {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
652 progress_action("NOTHING TO PLOT.")
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
653 } else {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
654 tsv <- my_cor_cov$tsv1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
655 tsv$mz <- mz_lookup(tsv$featureID)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
656 tsv$rt <- rt_lookup(tsv$featureID)
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
657 tsv["level1Level2Sig"] <- vrbl_metadata[
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
658 match(tsv$featureID, vrbl_metadata_names)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
659 , vrbl_metadata_col
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
660 ]
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
661 corcov_tsv_action(tsv)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
662 did_plot <- TRUE
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
663 }
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
664 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
665 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
666 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
667 } else { # tesC == "none"
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
668 level_union <- unique(sort(smpl_metadata_facC))
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
669 if ( length(level_union) > 1 ) {
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
670 if ( length(level_union) > 2 ) {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
671 ## pass 1 - contrast each selected level with all other levels combined into one "super-level" ##
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
672 completed <- c()
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
673 lapply(
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
674 X = level_union
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
675 , FUN = function(x) {
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
676 fctr_lvl_1 <- x[1]
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
677 fctr_lvl_2 <- {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
678 if ( fctr_lvl_1 %in% completed )
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
679 return("DUMMY")
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
680 # strF(completed)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
681 completed <<- c(completed, fctr_lvl_1)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
682 setdiff(level_union, fctr_lvl_1)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
683 }
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
684 chosen_samples <- smpl_metadata_facC %in% c(fctr_lvl_1, fctr_lvl_2)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
685 fctr_lvl_2 <- "other"
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
686 progress_action(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
687 sprintf("calculating/plotting contrast of %s vs. %s"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
688 , fctr_lvl_1, fctr_lvl_2)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
689 )
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
690 if (length(unique(chosen_samples)) < 1) {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
691 progress_action("NOTHING TO PLOT...")
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
692 } else {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
693 chosen_facC <- as.character(smpl_metadata_facC[chosen_samples])
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
694 predictor <- sapply(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
695 X = chosen_facC
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
696 , FUN = function(fac) {
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
697 if ( fac == fctr_lvl_1 ) fctr_lvl_1 else fctr_lvl_2
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
698 }
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
699 )
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
700 my_matrix <- scdm[ chosen_samples, , drop = FALSE ]
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
701 # only process this column if both factors are members of lvlCSV
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
702 is_match <- isLevelSelected(fctr_lvl_1)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
703 my_cor_cov <- do_detail_plot(
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
704 x_dataMatrix = my_matrix
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
705 , x_predictor = predictor
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
706 , x_is_match = is_match
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
707 , x_algorithm = algoC
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
708 , x_prefix = "Features"
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
709 , x_show_labels = labelFeatures
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
710 , x_progress = progress_action
4
8bba31f628da planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
eschen42
parents: 3
diff changeset
711 , x_crossval_i = min(7, length(chosen_samples))
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
712 , x_env = calc_env
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
713 )
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
714 if ( is.null(my_cor_cov) ) {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
715 progress_action("NOTHING TO PLOT")
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
716 } else {
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
717 tsv <- my_cor_cov$tsv1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
718 tsv$mz <- mz_lookup(tsv$featureID)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
719 tsv$rt <- rt_lookup(tsv$featureID)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
720 corcov_tsv_action(tsv)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
721 did_plot <<- TRUE
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
722 }
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
723 }
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
724 "dummy" # need to return a value; otherwise combn fails with an error
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
725 }
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
726 )
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
727 }
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
728 ## pass 2 - contrast each selected level with each of the other levels individually ##
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
729 completed <- c()
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
730 utils::combn(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
731 x = level_union
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
732 , m = 2
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
733 , FUN = function(x) {
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
734 fctr_lvl_1 <- x[1]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
735 fctr_lvl_2 <- x[2]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
736 chosen_samples <- smpl_metadata_facC %in% c(fctr_lvl_1, fctr_lvl_2)
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
737 progress_action(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
738 sprintf("calculating/plotting contrast of %s vs. %s"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
739 , fctr_lvl_1, fctr_lvl_2))
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
740 if (length(unique(chosen_samples)) < 1) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
741 progress_action("NOTHING TO PLOT...")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
742 } else {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
743 chosen_facC <- as.character(smpl_metadata_facC[chosen_samples])
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
744 predictor <- chosen_facC
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
745 my_matrix <- scdm[ chosen_samples, , drop = FALSE ]
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
746 # only process this column if both factors are members of lvlCSV
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
747 is_match <- isLevelSelected(fctr_lvl_1) && isLevelSelected(fctr_lvl_2)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
748 my_cor_cov <- do_detail_plot(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
749 x_dataMatrix = my_matrix
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
750 , x_predictor = predictor
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
751 , x_is_match = is_match
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
752 , x_algorithm = algoC
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
753 , x_prefix = "Features"
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
754 , x_show_labels = labelFeatures
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
755 , x_progress = progress_action
4
8bba31f628da planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
eschen42
parents: 3
diff changeset
756 , x_crossval_i = min(7, length(chosen_samples))
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
757 , x_env = calc_env
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
758 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
759 if ( is.null(my_cor_cov) ) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
760 progress_action("NOTHING TO PLOT")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
761 } else {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
762 tsv <- my_cor_cov$tsv1
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
763 tsv$mz <- mz_lookup(tsv$featureID)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
764 tsv$rt <- rt_lookup(tsv$featureID)
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
765 corcov_tsv_action(tsv)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
766 did_plot <<- TRUE
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
767 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
768 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
769 "dummy" # need to return a value; otherwise combn fails with an error
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
770 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
771 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
772 } else {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
773 progress_action("NOTHING TO PLOT....")
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
774 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
775 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
776 if (!did_plot) {
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
777 failure_action(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
778 sprintf(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
779 "bad parameter! sampleMetadata must have at least two levels of factor '%s' matching '%s'"
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
780 , facC, originalLevCSV))
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
781 return ( FALSE )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
782 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
783 return ( TRUE )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
784 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
785
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
786 # Calculate data for correlation-versus-covariance plot
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
787 # Adapted from:
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
788 # Wiklund_2008 doi:10.1021/ac0713510
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
789 # Galindo_Prieto_2014 doi:10.1002/cem.2627
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
790 # https://github.com/HegemanLab/extra_tools/blob/master/generic_PCA.R
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
791 cor_vs_cov <- function(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
792 matrix_x, ropls_x
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
793 , predictor_projection_x = TRUE
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
794 ) {
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
795 x_class <- class(ropls_x)
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
796 if ( !( as.character(x_class) == "opls" ) ) { # || !( attr(class(x_class),"package") == "ropls" ) )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
797 stop(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
798 paste(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
799 "cor_vs_cov: Expected ropls_x to be of class ropls::opls but instead it was of class "
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
800 , as.character(x_class)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
801 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
802 )
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
803 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
804 result <- list()
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
805 result$projection <- projection <- if (predictor_projection_x) 1 else 2
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
806 # suppLs$algoC - Character: algorithm used - "svd" for singular value decomposition; "nipals" for NIPALS
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
807 if ( ropls_x@suppLs$algoC == "nipals") {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
808 # Equations (1) and (2) from *Supplement to* Wiklund 2008, doi:10.1021/ac0713510
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
809 mag <- function(one_dimensional) sqrt(sum(one_dimensional * one_dimensional))
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
810 mag_xi <- sapply(X = 1:ncol(matrix_x), FUN = function(x) mag(matrix_x[,x]))
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
811 if (predictor_projection_x)
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
812 score_matrix <- ropls_x@scoreMN
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
813 else
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
814 score_matrix <- ropls_x@orthoScoreMN
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
815 score_matrix_transposed <- t(score_matrix)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
816 score_matrix_magnitude <- mag(score_matrix)
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
817 result$covariance <-
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
818 score_matrix_transposed %*% matrix_x / ( score_matrix_magnitude * score_matrix_magnitude )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
819 result$correlation <-
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
820 score_matrix_transposed %*% matrix_x / ( score_matrix_magnitude * mag_xi )
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
821 } else {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
822 # WARNING - untested code - I don't have test data to exercise this branch
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
823 # Equations (1) and (2) from Wiklund 2008, doi:10.1021/ac0713510
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
824 # scoreMN - Numerical matrix of x scores (T; dimensions: nrow(x) x predI) X = TP' + E; Y = TC' + F
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
825 if (predictor_projection_x)
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
826 score_matrix <- ropls_x@scoreMN
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
827 else
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
828 score_matrix <- ropls_x@orthoScoreMN
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
829 score_matrix_transposed <- t(score_matrix)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
830 cov_divisor <- nrow(matrix_x) - 1
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
831 result$covariance <- sapply(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
832 X = 1:ncol(matrix_x)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
833 , FUN = function(x) score_matrix_transposed %*% matrix_x[,x] / cov_divisor
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
834 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
835 score_sd <- sapply(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
836 X = 1:ncol(score_matrix)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
837 , FUN = function(x) sd(score_matrix[,x])
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
838 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
839 # xSdVn - Numerical vector: variable standard deviations of the 'x' matrix
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
840 xSdVn <- ropls_x@xSdVn
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
841 result$correlation <- sapply(
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
842 X = 1:ncol(matrix_x)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
843 , FUN = function(x) {
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
844 ( score_matrix_transposed / score_sd ) %*% ( matrix_x[,x] / (xSdVn[x] * cov_divisor) )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
845 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
846 )
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
847 }
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
848 result$correlation <- result$correlation[ 1, , drop = TRUE ]
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
849 result$covariance <- result$covariance [ 1, , drop = TRUE ]
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
850
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
851 # Variant 4 of Variable Influence on Projection for OPLS from Galindo_Prieto_2014
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
852 # Length = number of features; labels = feature identifiers. (The same is true for $correlation and $covariance.)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
853 result$vip4p <- as.numeric(ropls_x@vipVn)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
854 result$vip4o <- as.numeric(ropls_x@orthoVipVn)
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
855 result$loadp <- as.numeric(ropls_x@loadingMN)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
856 result$loado <- as.numeric(ropls_x@orthoLoadingMN)
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
857 # get the level names
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
858 level_names <- sort(levels(as.factor(ropls_x@suppLs$y)))
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
859 fctr_lvl_1 <- level_names[1]
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
860 fctr_lvl_2 <- level_names[2]
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
861 feature_count <- length(ropls_x@vipVn)
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
862 result$level1 <- rep.int(x = fctr_lvl_1, times = feature_count)
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
863 result$level2 <- rep.int(x = fctr_lvl_2, times = feature_count)
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
864 superresult <- list()
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
865 if (length(result$vip4o) == 0) result$vip4o <- NA
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
866 greaterLevel <- sapply(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
867 X = result$correlation
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
868 , FUN = function(my_corr) if ( my_corr < 0 ) fctr_lvl_1 else fctr_lvl_2
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
869 )
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
870
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
871 # begin fixes for https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/issues/1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
872 featureID <- names(ropls_x@vipVn)
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
873 greaterLevel <- greaterLevel[featureID]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
874 result$correlation <- result$correlation[featureID]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
875 result$covariance <- result$covariance[featureID]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
876 # end fixes for https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/issues/1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
877
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
878 tsv1 <- data.frame(
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
879 featureID = featureID
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
880 , factorLevel1 = result$level1
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
881 , factorLevel2 = result$level2
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
882 , greaterLevel = greaterLevel
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
883 , projection = result$projection
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
884 , correlation = result$correlation
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
885 , covariance = result$covariance
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
886 , vip4p = result$vip4p
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
887 , vip4o = result$vip4o
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
888 , loadp = result$loadp
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
889 , loado = result$loado
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
890 , row.names = NULL
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
891 )
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
892 tsv1 <- tsv1[!is.na(tsv1$correlation),]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
893 tsv1 <- tsv1[!is.na(tsv1$covariance),]
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
894 superresult$tsv1 <- tsv1
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
895 rownames(superresult$tsv1) <- tsv1$featureID
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
896 superresult$projection <- result$projection
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
897 superresult$covariance <- result$covariance
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
898 superresult$correlation <- result$correlation
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
899 superresult$vip4p <- result$vip4p
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
900 superresult$vip4o <- result$vip4o
1
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
901 superresult$loadp <- result$loadp
0c2ad44b6c9c planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 01d4a951cf09e7b88fcec96b8043bc7568cc5c92
eschen42
parents: 0
diff changeset
902 superresult$loado <- result$loado
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
903 superresult$details <- result
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
904 result$superresult <- superresult
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
905 # Include thise in case future consumers of this routine want to use it in currently unanticipated ways
6
7bd523ca1f9a planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit cafda5095a79ce2376325b57337302f95137195d
eschen42
parents: 5
diff changeset
906 result$oplsda <- ropls_x
0
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
907 result$predictor <- ropls_x@suppLs$y # in case future consumers of this routine want to use it in currently unanticipated ways
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
908 return (superresult)
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
909 }
23f9fad4edfc planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit bd26542b811de06c1a877337a2840a9f899c2b94
eschen42
parents:
diff changeset
910
5
50f60f94c034 planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit aff1790e25523d038a1e9528de748191c096132f
eschen42
parents: 4
diff changeset
911 # vim: sw=2 ts=2 et :