annotate pathifier.R @ 0:fec313f5c889 draft

"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
author artbio
date Mon, 12 Apr 2021 09:55:24 +0000
parents
children 0960bd1161fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
1 ##################################################################################################
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
2 # Running PATHIFIER (Drier et al., 2013)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
3 # Based on the work of Author: Miguel Angel Garcia-Campos - Github: https://github.com/AngelCampos
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
4 ##################################################################################################
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
5
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
6
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
7 options(show.error.messages = F, error = function() {
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
8 cat(geterrmessage(), file = stderr()); q("no", 1, F)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
9 }
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
10 )
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
11 # we need that to not crash galaxy with an UTF8 error on German LC settings.
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
12 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
13
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
14 library(pathifier)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
15 library(optparse)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
16 library(pheatmap)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
17 library(scatterplot3d)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
18 library(circlize)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
19
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
20 option_list <- list(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
21 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
22 "--exp",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
23 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
24 help = "Expression matrix"),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
25 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
26 "--sep",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
27 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
28 default = "\t",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
29 help = "File separator [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
30 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
31 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
32 "--genes",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
33 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
34 help = "Gene sets Pathways : gmt format (one pathway per line : Name, description, genes (one by column), tab separated)"),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
35 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
36 "--is_normal",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
37 default = F,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
38 type = "logical",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
39 help = "Define normals cells in your data"),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
40 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
41 "--normals",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
42 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
43 help = "A vector of sample status : 1 = Healthy, 0 = Tumor. Must be in the same order as in expression data"),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
44 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
45 "--logfile",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
46 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
47 default = "log.txt",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
48 help = "Log file name [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
49 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
50 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
51 "--max_stability",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
52 type = "logical",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
53 default = T,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
54 help = "If true, throw away components leading to low stability of sampling noise [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
55 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
56 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
57 "--attempts",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
58 type = "integer",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
59 default = 10,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
60 help = "Number of runs to determine stability. [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
61 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
62 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
63 "--min_std",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
64 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
65 default = "0.4",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
66 help = "Minimum of standard deviation to filter out low variable genes.
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
67 Use --min.std data, to use the minimum std of your data [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
68 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
69 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
70 "--min_exp",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
71 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
72 default = "4",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
73 help = "Minimum of gene expression to filter out low expressed genes.
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
74 Use --min.exp data, to use the minimum expression of your data [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
75 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
76 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
77 "--pds",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
78 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
79 default = "PDS.tsv",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
80 help = "Output PDS (Pathway deregulation score) of Pathifier in tabular file [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
81 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
82 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
83 "--heatmap_cluster_cells",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
84 type = "logical",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
85 default = TRUE,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
86 help = "Cluster columns (cells) in the heatmap [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
87 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
88 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
89 "--heatmap_cluster_pathways",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
90 type = "logical",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
91 default = TRUE,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
92 help = "Cluster rows (pathways) in the heatmap [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
93 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
94 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
95 "--heatmap_show_cell_labels",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
96 type = "logical",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
97 default = FALSE,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
98 help = "Print column names (cells) on the heatmap [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
99 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
100 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
101 "--heatmap_show_pathway_labels",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
102 type = "logical",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
103 default = FALSE,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
104 help = "Print row names (pathways) on the heatmap [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
105 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
106 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
107 "--plot",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
108 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
109 default = "./plot.pdf",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
110 help = "Pathifier visualization [default : '%default']"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
111 ),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
112 make_option(
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
113 "--rdata",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
114 type = "character",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
115 default = "./results.rdata",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
116 help = "Pathifier object (S4) [default : '%default']"))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
117 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
118 args <- parse_args(parser)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
119 if (args$sep == "tab") {
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
120 args$sep <- "\t"
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
121 }
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
122
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
123
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
124 # set seed for reproducibility
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
125 set.seed(123)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
126
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
127 # Load expression data for PATHIFIER
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
128 exp_matrix <- as.matrix(read.delim(file = args$exp,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
129 as.is = T,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
130 row.names = 1,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
131 sep = args$sep,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
132 check.names = F))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
133
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
134 # Load Genesets annotation
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
135 gene_sets_file <- file(args$genes, open = "r")
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
136 gene_sets <- readLines(gene_sets_file)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
137 close(gene_sets_file)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
138
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
139 # Generate a list that contains genes in genesets
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
140 gs <- strsplit(gene_sets, "\t")
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
141 names(gs) <- lapply(gs, function(x) x[1])
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
142 gs <- lapply(gs, function(x) x[-c(1:2)])
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
143
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
144 # Generate a list that contains the names of the genesets used
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
145 pathwaynames <- names(gs)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
146
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
147 # Prepare data and parameters ##################################################
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
148 # Extract information from binary phenotypes. 1 = Normal, 0 = Tumor
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
149 if (args$is_normal == T) {
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
150 normals <- read.delim(file = args$normals, h = F)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
151 normals <- as.logical(normals[, 2])
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
152 n_exp_matrix <- exp_matrix[, normals]
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
153 } else n_exp_matrix <- exp_matrix
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
154
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
155 # Calculate MIN_STD
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
156 rsd <- apply(n_exp_matrix, 1, sd)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
157 min_std <- quantile(rsd, 0.25)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
158
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
159 # Calculate MIN_EXP
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
160 min_exp <- quantile(as.vector(as.matrix(exp_matrix)),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
161 0.1) # Percentile 10 of data
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
162
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
163 # Filter low value genes. At least 10% of samples with values over min_exp
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
164 # Set expression levels < MIN_EXP to MIN_EXP
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
165 over <- apply(exp_matrix, 1, function(x) x > min_exp)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
166 g_over <- apply(over, 2, mean)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
167 g_over <- names(g_over)[g_over > 0.1]
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
168 exp_matrix_filtered <- exp_matrix[g_over, ]
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
169 exp_matrix_filtered[exp_matrix_filtered < min_exp] <- min_exp
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
170
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
171 # Set maximum 5000 genes with more variance
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
172 variable_genes <- names(sort(apply(exp_matrix_filtered, 1, var), decreasing = T))[1:5000]
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
173 variable_genes <- variable_genes[!is.na(variable_genes)]
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
174 exp_matrix_filtered <- exp_matrix_filtered[variable_genes, ]
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
175 allgenes <- as.vector(rownames(exp_matrix_filtered))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
176
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
177
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
178 if (args$min_std == "data") {
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
179 args$min_std <- min_std
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
180 } else args$min_std <- as.numeric(args$min_std)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
181
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
182 if (args$min_exp == "data") {
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
183 args$min_exp <- min_exp
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
184 } else args$min_exp <- as.numeric(args$min_exp)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
185
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
186
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
187 # Open pdf
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
188 pdf(args$plot)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
189
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
190 # Construct continuous color scale
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
191 col_score_fun <- colorRamp2(c(0, 0.5, 1), c("#4575B4", "#FFFFBF", "#D73027"))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
192
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
193 # Run Pathifier
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
194 if (args$is_normal == T) {
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
195 pds <- quantify_pathways_deregulation(exp_matrix_filtered,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
196 allgenes,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
197 gs,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
198 pathwaynames,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
199 normals,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
200 maximize_stability = args$max_stability,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
201 attempts = args$attempts,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
202 logfile = args$logfile,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
203 min_std = args$min_std,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
204 min_exp = args$min_exp)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
205 for (i in pathwaynames) {
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
206 df <- data.frame(pds$curves[[i]][, 1:3],
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
207 normal = normals,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
208 PDS = as.numeric(pds$scores[[i]]),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
209 curve_order = as.vector(pds$curves_order[[i]]))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
210 ordered <- df[df$curve_order, ]
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
211
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
212
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
213 layout(cbind(1:2, 1:2), heights = c(7, 1))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
214 sc3 <- scatterplot3d(ordered[, 1:3],
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
215 main = paste("Principal curve of", i),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
216 box = F, pch = 19, type = "l")
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
217 sc3$points3d(ordered[, 1:3], box = F, pch = 19,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
218 col = col_score_fun(ordered$PDS))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
219
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
220 # Plot color scale legend
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
221 par(mar = c(5, 3, 0, 3))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
222 plot(seq(min(ordered$PDS), max(ordered$PDS), length = 100), rep(0, 100), pch = 15,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
223 axes = TRUE, yaxt = "n", xlab = "Color scale of PDS", ylab = "", bty = "n",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
224 col = col_score_fun(seq(min(ordered$PDS), max(ordered$PDS), length = 100)))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
225
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
226
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
227 cols_status <- ifelse(ordered$normal, "blue", "red")
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
228 sc3 <- scatterplot3d(ordered[, 1:3],
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
229 main = paste("Principal curve of", i),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
230 box = F, pch = "", type = "l")
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
231 sc3$points3d(ordered[, 1:3], box = F,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
232 pch = ifelse(ordered$normal, 19, 8),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
233 col = ifelse(ordered$normal, "blue", "red"))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
234 legend("topright", pch = c(19, 8), yjust = 0,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
235 legend = c("normal", "cancer"),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
236 col = c("blue", "red"), cex = 1.1)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
237
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
238 ## annotation for heatmap
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
239 sample_status <- data.frame(Status = factor(ifelse(df$normal, "normal", "tumor")))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
240 rownames(sample_status) <- colnames(exp_matrix_filtered)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
241 color_status_heatmap <- list(Status = c(normal = "blue", tumor = "red"))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
242 }
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
243 } else{
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
244 pds <- quantify_pathways_deregulation(exp_matrix_filtered,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
245 allgenes,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
246 gs,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
247 pathwaynames,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
248 maximize_stability = args$max_stability,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
249 attempts = args$attempts,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
250 logfile = args$logfile,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
251 min_std = args$min_std,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
252 min_exp = args$min_exp)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
253 for (i in pathwaynames) {
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
254 df <- data.frame(pds$curves[[i]][, 1:3],
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
255 PDS = as.numeric(pds$scores[[i]]),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
256 curve_order = as.vector(pds$curves_order[[i]]))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
257 ordered <- df[df$curve_order, ]
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
258
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
259 layout(cbind(1:2, 1:2), heights = c(7, 1))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
260 sc3 <- scatterplot3d(ordered[, 1:3],
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
261 main = paste("Principal curve of", i),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
262 box = F, pch = 19, type = "l")
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
263 sc3$points3d(ordered[, 1:3], box = F, pch = 19,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
264 col = col_score_fun(ordered$PDS))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
265
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
266 # Plot color scale legend
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
267 par(mar = c(5, 3, 0, 3))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
268 plot(seq(min(ordered$PDS), max(ordered$PDS), length = 100), rep(0, 100), pch = 15,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
269 axes = TRUE, yaxt = "n", xlab = "Color scale of PDS", ylab = "", bty = "n",
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
270 col = col_score_fun(seq(min(ordered$PDS), max(ordered$PDS), length = 100)))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
271
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
272
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
273 ## annotation for heatmap (for the moment none for this situation)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
274 sample_status <- NA
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
275 color_status_heatmap <- NA
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
276 }
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
277 }
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
278
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
279 ## Create dataframe from Pathifier list and round score to 4 digits
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
280 pds_scores <- mapply(FUN = function(x) cbind(round(x, 4)), pds$scores)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
281 dimnames(pds_scores) <- list(colnames(exp_matrix_filtered), names(pds$scores))
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
282
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
283 ## plot heatmap
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
284 if (ncol(pds_scores) > 1) {
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
285 pheatmap(t(pds_scores),
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
286 main = "Heatmap of Pathway Deregulation Score", # heat map title
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
287 cluster_rows = args$heatmap_cluster_pathways, # apply clustering method
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
288 cluster_cols = args$heatmap_cluster_cells, # apply clustering method
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
289
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
290 #Additional Options
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
291 ## Color labeled columns
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
292 annotation_col = sample_status,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
293 annotation_colors = color_status_heatmap,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
294 show_rownames = args$heatmap_show_pathway_labels,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
295 show_colnames = args$heatmap_show_cell_labels,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
296 border_color = NA,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
297 legend = TRUE)
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
298 }
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
299 dev.off()
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
300
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
301
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
302 ## write table
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
303 write.table(pds_scores,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
304 args$pds,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
305 row.names = T,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
306 col.names = T,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
307 quote = F,
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
308 sep = "\t")
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
309
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
310 ## write S4 pathifier object
fec313f5c889 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pathifier commit b94cfc7bf8df30aa8e9249b75ea31332ee2bada1"
artbio
parents:
diff changeset
311 save(pds, file = args$rdata)