annotate CEMiTool.R @ 0:3f9ff31c88bb draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
author iuc
date Mon, 10 Oct 2022 16:55:19 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
1 # Load all required libraries
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
2 library(CEMiTool, quietly = TRUE, warn.conflicts = FALSE)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
3 library(ggplot2, quietly = TRUE, warn.conflicts = FALSE)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
4 library(getopt, quietly = TRUE, warn.conflicts = FALSE)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
5 # setup R error handling to go to stderr
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
6 options(
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
7 show.error.messages = FALSE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
8 error = function() {
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
9 cat(geterrmessage(), file = stderr())
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
10 q("no", 1, FALSE)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
11 }
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
12 )
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
13
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
14 # we need that to not crash galaxy with an UTF8 error on German LC settings.
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
15 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
16
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
17 ################################################################################
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
18 ### Input Processing
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
19 ################################################################################
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
20
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
21 # Collect arguments from command line
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
22 args <- commandArgs(trailingOnly = TRUE)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
23
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
24 # Get options, using the spec as defined by the enclosed list.
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
25 # Read the options from the default: commandArgs(TRUE).
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
26 spec <- matrix(c(
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
27 "expressionMatrix", "M", 1, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
28 "sampleAnnotation", "A", 2, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
29 "pathwayList", "P", 2, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
30 "interactions", "I", 2, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
31 "filter", "f", 1, "logical",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
32 "filter_pval", "i", 1, "numeric",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
33 "apply_vst", "a", 1, "logical",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
34 "n_genes", "n", 1, "integer",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
35 "eps", "e", 1, "numeric",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
36 "cor_method", "c", 1, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
37 "cor_function", "y", 1, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
38 "network_type", "x", 1, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
39 "tom_type", "t", 1, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
40 "merge_similar", "m", 1, "logical",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
41 "rank_method", "r", 1, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
42 "min_ngen", "g", 1, "integer",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
43 "diss_thresh", "d", 1, "numeric",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
44 "center_func", "h", 1, "character",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
45 "ora_pval", "o", 1, "numeric",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
46 "gsea_scale", "l", 1, "logical",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
47 "gsea_min_size", "w", 1, "integer",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
48 "gsea_max_size", "z", 1, "integer",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
49 "sample_column_name", "v", 1, "character"),
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
50 byrow = TRUE, ncol = 4
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
51 )
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
52
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
53 opt <- getopt(spec)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
54 counts <- read.table(
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
55 opt$expressionMatrix,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
56 header = TRUE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
57 sep = "\t",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
58 strip.white = TRUE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
59 stringsAsFactors = FALSE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
60 check.names = FALSE
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
61 )
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
62
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
63
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
64 # Run CEMiTool
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
65
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
66 if (is.null(opt$sampleAnnotation)) {
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
67 cem <- cemitool(
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
68 counts,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
69 filter = opt$filter,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
70 filter_pval = opt$filter_pval,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
71 apply_vst = opt$apply_vst,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
72 n_genes = opt$n_genes,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
73 eps = opt$eps,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
74 cor_method = opt$cor_method,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
75 cor_function = opt$cor_function,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
76 network_type = opt$network_type,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
77 tom_type = opt$tom_type,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
78 merge_similar = opt$merge_similar,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
79 min_ngen = opt$min_ngen,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
80 diss_thresh = opt$diss_thresh,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
81 center_func = opt$center_func,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
82 verbose = TRUE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
83 ora_pval = opt$ora_pval
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
84 )
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
85 } else {
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
86 annotation <- read.table(
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
87 opt$sampleAnnotation,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
88 header = TRUE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
89 sep = "\t",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
90 strip.white = TRUE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
91 stringsAsFactors = FALSE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
92 check.names = FALSE
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
93 )
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
94 cem <- cemitool(
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
95 counts,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
96 annotation,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
97 filter = opt$filter,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
98 filter_pval = opt$filter_pval,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
99 apply_vst = opt$apply_vst,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
100 n_genes = opt$n_genes,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
101 eps = opt$eps,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
102 cor_method = opt$cor_method,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
103 cor_function = opt$cor_function,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
104 network_type = opt$network_type,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
105 tom_type = opt$tom_type,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
106 merge_similar = opt$merge_similar,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
107 min_ngen = opt$min_ngen,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
108 diss_thresh = opt$diss_thresh,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
109 center_func = opt$center_func,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
110 verbose = TRUE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
111 ora_pval = opt$ora_pval,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
112 sample_name_column = opt$sample_column_name,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
113 class_column = "Class",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
114 order_by_class = TRUE
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
115 )
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
116 cem <- mod_gsea(
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
117 cem,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
118 gsea_scale = opt$gsea_scale,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
119 gsea_min_size = opt$gsea_min_size,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
120 gsea_max_size = opt$gsea_max_size,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
121 rank_method = opt$rank_method
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
122 )
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
123 cem <- plot_gsea(cem)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
124 }
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
125
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
126 if (!is.null(opt$pathwayList)) {
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
127 gmt_in <- read_gmt(opt$pathwayList)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
128 cem <- mod_ora(cem, gmt_in)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
129 cem <- plot_ora(cem)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
130 }
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
131
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
132 if (!is.null(opt$interactions)) {
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
133 interactions <- read.table(
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
134 opt$interactions,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
135 header = TRUE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
136 sep = "\t",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
137 strip.white = TRUE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
138 stringsAsFactors = FALSE,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
139 check.names = FALSE
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
140 )
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
141 interactions_data(cem) <- interactions # add interactions
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
142 cem <- plot_interactions(cem)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
143 }
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
144
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
145 ## Write analysis results into files
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
146 write_files(cem,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
147 directory = "./Tables",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
148 force = TRUE)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
149
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
150 generate_report(cem)
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
151
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
152 save_plots(cem,
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
153 value = "all",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
154 directory = "./Plots",
3f9ff31c88bb planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cemitool commit 07372bcbc3a94f886436a7263f4cfcb01981c7f3
iuc
parents:
diff changeset
155 force = TRUE)