Mercurial > repos > eschen42 > w4mcorcov
comparison w4mcorcov_calc.R @ 4:8bba31f628da draft
planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
author | eschen42 |
---|---|
date | Sun, 04 Mar 2018 14:51:42 -0500 |
parents | 5aaab36bc523 |
children | 50f60f94c034 |
comparison
equal
deleted
inserted
replaced
3:5aaab36bc523 | 4:8bba31f628da |
---|---|
7 #### OPLS-DA | 7 #### OPLS-DA |
8 algoC <- "nipals" | 8 algoC <- "nipals" |
9 | 9 |
10 do_detail_plot <- function(x_dataMatrix, x_predictor, x_is_match, x_algorithm, x_prefix, x_show_labels, x_show_loado_labels, x_progress = print, x_env, x_crossval_i) { | 10 do_detail_plot <- function(x_dataMatrix, x_predictor, x_is_match, x_algorithm, x_prefix, x_show_labels, x_show_loado_labels, x_progress = print, x_env, x_crossval_i) { |
11 off <- function(x) if (x_show_labels == "0") 0 else x | 11 off <- function(x) if (x_show_labels == "0") 0 else x |
12 if (x_is_match && ncol(x_dataMatrix) > 0 && length(unique(x_predictor))> 1) { | 12 if ( x_is_match && ncol(x_dataMatrix) > 0 && length(unique(x_predictor))> 1 && x_crossval_i < nrow(x_dataMatrix) ) { |
13 my_oplsda <- opls( | 13 my_oplsda <- opls( |
14 x = x_dataMatrix | 14 x = x_dataMatrix |
15 , y = x_predictor | 15 , y = x_predictor |
16 , algoC = x_algorithm | 16 , algoC = x_algorithm |
17 , predI = 1 | 17 , predI = 1 |
119 my_typevc <- c("(dummy)","overview","(dummy)") | 119 my_typevc <- c("(dummy)","overview","(dummy)") |
120 } | 120 } |
121 for (my_type in my_typevc) { | 121 for (my_type in my_typevc) { |
122 if (my_type %in% typeVc) { | 122 if (my_type %in% typeVc) { |
123 # print(sprintf("plotting type %s", my_type)) | 123 # print(sprintf("plotting type %s", my_type)) |
124 plot( | 124 tryCatch({ |
125 x = my_oplsda | 125 plot( |
126 , typeVc = my_type | 126 x = my_oplsda |
127 , parCexN = 0.4 | 127 , typeVc = my_type |
128 , parDevNewL = FALSE | 128 , parCexN = 0.4 |
129 , parLayL = TRUE | 129 , parDevNewL = FALSE |
130 , parEllipsesL = TRUE | 130 , parLayL = TRUE |
131 , parEllipsesL = TRUE | |
131 ) | 132 ) |
133 }, error = function(e) { | |
134 x_progress(sprintf("factor level %s or %s may have only one sample", fctr_lvl_1, fctr_lvl_2)) | |
135 }) | |
132 } else { | 136 } else { |
133 # print("plotting dummy graph") | 137 # print("plotting dummy graph") |
134 plot(x=1, y=1, xaxt="n", yaxt="n", xlab="", ylab="", type="n") | 138 plot(x=1, y=1, xaxt="n", yaxt="n", xlab="", ylab="", type="n") |
135 text(x=1, y=1, labels="no orthogonal projection is possible") | 139 text(x=1, y=1, labels="no orthogonal projection is possible") |
136 } | 140 } |
304 , x_algorithm = algoC | 308 , x_algorithm = algoC |
305 , x_prefix = if (pairSigFeatOnly) "Significantly contrasting features" else "Significant features" | 309 , x_prefix = if (pairSigFeatOnly) "Significantly contrasting features" else "Significant features" |
306 , x_show_labels = labelFeatures | 310 , x_show_labels = labelFeatures |
307 , x_show_loado_labels = labelOrthoFeatures | 311 , x_show_loado_labels = labelOrthoFeatures |
308 , x_progress = progress_action | 312 , x_progress = progress_action |
309 , x_crossval_i = min(7, length(chosen_samples)) | 313 , x_crossval_i = min(7, length(chosen_samples)) |
310 , x_env = calc_env | 314 , x_env = calc_env |
311 ) | 315 ) |
312 if ( is.null(my_cor_cov) ) { | 316 if ( is.null(my_cor_cov) ) { |
313 progress_action("NOTHING TO PLOT.") | 317 progress_action("NOTHING TO PLOT.") |
314 } else { | 318 } else { |
361 , x_algorithm = algoC | 365 , x_algorithm = algoC |
362 , x_prefix = if (pairSigFeatOnly) "Significantly contrasting features" else "Significant features" | 366 , x_prefix = if (pairSigFeatOnly) "Significantly contrasting features" else "Significant features" |
363 , x_show_labels = labelFeatures | 367 , x_show_labels = labelFeatures |
364 , x_show_loado_labels = labelOrthoFeatures | 368 , x_show_loado_labels = labelOrthoFeatures |
365 , x_progress = progress_action | 369 , x_progress = progress_action |
366 , x_crossval_i = min(7, length(chosen_samples)) | 370 , x_crossval_i = min(7, length(chosen_samples)) |
367 , x_env = calc_env | 371 , x_env = calc_env |
368 ) | 372 ) |
369 if ( is.null(my_cor_cov) ) { | 373 if ( is.null(my_cor_cov) ) { |
370 progress_action("NOTHING TO PLOT.") | 374 progress_action("NOTHING TO PLOT.") |
371 } else { | 375 } else { |
415 , x_algorithm = algoC | 419 , x_algorithm = algoC |
416 , x_prefix = "Features" | 420 , x_prefix = "Features" |
417 , x_show_labels = labelFeatures | 421 , x_show_labels = labelFeatures |
418 , x_show_loado_labels = labelOrthoFeatures | 422 , x_show_loado_labels = labelOrthoFeatures |
419 , x_progress = progress_action | 423 , x_progress = progress_action |
420 , x_crossval_i = min(7, length(chosen_samples)) | 424 , x_crossval_i = min(7, length(chosen_samples)) |
421 , x_env = calc_env | 425 , x_env = calc_env |
422 ) | 426 ) |
423 if ( is.null(my_cor_cov) ) { | 427 if ( is.null(my_cor_cov) ) { |
424 progress_action("NOTHING TO PLOT") | 428 progress_action("NOTHING TO PLOT") |
425 } else { | 429 } else { |
461 , x_algorithm = algoC | 465 , x_algorithm = algoC |
462 , x_prefix = "Features" | 466 , x_prefix = "Features" |
463 , x_show_labels = labelFeatures | 467 , x_show_labels = labelFeatures |
464 , x_show_loado_labels = labelOrthoFeatures | 468 , x_show_loado_labels = labelOrthoFeatures |
465 , x_progress = progress_action | 469 , x_progress = progress_action |
466 , x_crossval_i = min(7, length(chosen_samples)) | 470 , x_crossval_i = min(7, length(chosen_samples)) |
467 , x_env = calc_env | 471 , x_env = calc_env |
468 ) | 472 ) |
469 if ( is.null(my_cor_cov) ) { | 473 if ( is.null(my_cor_cov) ) { |
470 progress_action("NOTHING TO PLOT") | 474 progress_action("NOTHING TO PLOT") |
471 } else { | 475 } else { |