annotate scripts/trajectoryinspect.R @ 10:49776718ae90 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
author iuc
date Tue, 05 Nov 2024 16:33:40 +0000
parents 0bff0ee0683a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
1 #!/usr/bin/env R
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
2 VERSION <- "0.2" # nolint
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
3
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
4 args <- commandArgs(trailingOnly = TRUE)
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
5
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
6 if (length(args) != 1) {
10
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
7 message(paste("VERSION:", VERSION))
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
8 stop("Please provide the config file")
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
9 }
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
10
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
11 suppressWarnings(suppressPackageStartupMessages(require(RaceID)))
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
12 suppressWarnings(suppressPackageStartupMessages(require(FateID)))
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
13 source(args[1])
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
14
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
15 test <- list()
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
16 test$side <- 3
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
17 test$line <- 2.5
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
18 second <- test
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
19 second$cex <- 0.5
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
20 second$line <- 2.5
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
21
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
22 do.trajectoryinspection.stemid <- function(ltr) { # nolint
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
23 makeBranchLink <- function(i, j, k) { # nolint
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
24 ingoing <- paste(sort(c(i, j)), collapse = ".")
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
25 outgoing <- paste(sort(c(j, k)), collapse = ".")
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
26 messed <- sort(c(ingoing, outgoing))
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
27 return(list(messed[[1]], messed[[2]]))
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
28 }
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
29
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
30 zzz <- do.call(getproj, c(ltr, trjsid.getproj))
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
31 bra <- branchcells(
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
32 ltr,
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
33 do.call("makeBranchLink", as.list(trjsid.branchcells.ijk))
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
34 )
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
35 write.table(
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
36 head(bra$diffgenes$z, trjsid.numdiffgenes),
10
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
37 file = out.diffgenes
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
38 )
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
39
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
40 par(mfrow = c(3, 2), cex = 0.5)
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
41 print(do.call(plotmap, c(bra$scl, final = FALSE, fr = FALSE)))
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
42 print(do.call(mtext, c("Initial Clusters (tSNE)", test)))
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
43 print(do.call(plotmap, c(bra$scl, final = TRUE, fr = FALSE)))
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
44 print(do.call(mtext, c("Final Clusters (tSNE)", test)))
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
45 print(do.call(plotmap, c(bra$scl, final = FALSE, um = TRUE)))
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
46 print(do.call(mtext, c("Initial Clusters (UMAP)", test)))
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
47 print(do.call(plotmap, c(bra$scl, final = TRUE, um = TRUE)))
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
48 print(do.call(mtext, c("Final Clusters (UMAP)", test)))
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
49 print(do.call(plotmap, c(bra$scl, final = FALSE, fr = TRUE)))
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
50 print(do.call(mtext, c("Initial Clusters (F-R)", test)))
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
51 print(do.call(plotmap, c(bra$scl, final = TRUE, fr = TRUE)))
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
52 print(do.call(mtext, c("Final Clusters (F-R)", test)))
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
53 }
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
54
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
55 do.trajectoryinspection.fateid <- function(ltr) { # nolint
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
56 n <- do.call(cellsfromtree, c(ltr, trjfid_cellsfrom))
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
57 x <- getfdata(ltr@sc)
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
58
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
59 trjfid_filterset$x <- x
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
60 trjfid_filterset$n <- n$f
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
61 fs <- do.call(filterset, c(trjfid_filterset))
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
62 trjfid_getsom$x <- fs
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
63 s1d <- do.call(getsom, c(trjfid_getsom))
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
64 trjfid_procsom$s1d <- s1d
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
65 ps <- do.call(procsom, c(trjfid_procsom))
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
66
10
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
67 y <- ltr@sc@cpart[n$f]
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
68 fcol <- ltr@sc@fcol
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
69
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
70 trjfid_plotheat$xpart <- y
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
71 trjfid_plotheat$xcol <- fcol
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
72
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
73 test$side <- 3
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
74 test$line <- 3
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
75
10
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
76 ## Plot average z-score for all modules derived from the SOM:
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
77 trjfid_plotheat$x <- ps$nodes.z
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
78 trjfid_plotheat$ypart <- unique(ps$nodes)
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
79 print(do.call(plotheatmap, c(trjfid_plotheat)))
10
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
80 print(do.call(mtext, c(
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
81 "Average z-score for all modules derived from SOM",
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
82 test
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
83 )))
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
84 ## Plot z-score profile of each gene ordered by SOM modules:
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
85 trjfid_plotheat$x <- ps$all.z
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
86 trjfid_plotheat$ypart <- ps$nodes
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
87 print(do.call(plotheatmap, c(trjfid_plotheat)))
10
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
88 print(do.call(mtext, c(paste0(
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
89 "z-score profile of each gene",
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
90 "ordered by SOM modules"
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
91 ), test)))
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
92 ## Plot normalized expression profile of each gene ordered by SOM modules:
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
93 trjfid_plotheat$x <- ps$all.e
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
94 trjfid_plotheat$ypart <- ps$nodes
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
95 print(do.call(plotheatmap, c(trjfid_plotheat)))
10
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
96 print(do.call(mtext, c(paste0(
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
97 "Normalized expression profile of each",
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
98 "gene ordered by SOM modules"
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
99 ), test)))
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
100 ## Plot binarized expression profile of each gene
49776718ae90 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents: 9
diff changeset
101 ## (z-score < -1, -1 < z-score < 1, z-score > 1)
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
102 trjfid_plotheat$x <- ps$all.b
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
103 trjfid_plotheat$ypart <- ps$nodes
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
104 print(do.call(plotheatmap, c(trjfid_plotheat)))
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
105 print(do.call(mtext, c("Binarized expression profile of each gene", test)))
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
106 ## This should be written out, and passed back into the tool
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
107 ## to perform sominspect
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
108 return(list(fs = fs, ps = ps, y = y, fcol = fcol, nf = n$f))
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
109 }
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
110
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
111 do.trajectoryinspection.fateid.sominspect <- function(domo) { # nolint
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
112 g <- trjfidsomi.use.genes
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
113 if (class(g) == "numeric") {
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
114 g <- names(ps$nodes)[ps$nodes %in% g]
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
115 }
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
116
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
117 typ <- NULL
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
118 if (!is.null(trjfidsomi.use.types)) {
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
119 typ <- sub(trjfidsomi.use.types, "", domo$nf)
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
120 }
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
121
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
122 trjfidsomi$x <- domo$fs
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
123 trjfidsomi$y <- domo$y
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
124 trjfidsomi$g <- g
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
125 trjfidsomi$n <- domo$nf
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
126 trjfidsomi$col <- domo$fcol
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
127 trjfidsomi$types <- typ
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
128
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
129 ## The average pseudo-temporal expression profile of this group
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
130 ## can be plotted by the function plotexpression:
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
131 par(mfrow = c(1, 1))
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
132 test$cex <- 1
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
133 second$line <- 1.5
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
134 if (trjfidsomi$name == "Title") trjfidsomi$name <- ""
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
135 print(do.call(plotexpression, c(trjfidsomi)))
6
a4b734cd253b "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
136 mess2 <- paste(c(trjfidsomi.use.genes), collapse = ", ")
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
137 mess1 <- "Average pseudo-temporal expression profile"
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
138 print(do.call(mtext, c(mess1, test)))
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
139 print(do.call(mtext, c(mess2, second)))
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
140 }
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
141
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
142 ltr <- in.rdat
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
143
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
144 pdf(out.pdf)
9
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
145 if (perform.stemid) do.trajectoryinspection.stemid(ltr)
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
146 if (perform.fateid) {
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
147 domo <- do.trajectoryinspection.fateid(ltr)
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
148 if (perform.fateid.sominspect) {
0bff0ee0683a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents: 6
diff changeset
149 do.trajectoryinspection.fateid.sominspect(domo)
0
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
150 }
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
151 }
4ea021bd7513 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
152 dev.off()