annotate scripts/trajectoryinspect.R @ 6:43c146e25a43 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
author iuc
date Thu, 15 Apr 2021 19:00:38 +0000
parents 8dc8ff057b0f
children b83fbc90161e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8dc8ff057b0f 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
43c146e25a43 "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
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
3
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
4 args <- commandArgs(trailingOnly = T)
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
5
6
43c146e25a43 "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) {
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
7 message(paste("VERSION:", VERSION))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
8 stop("Please provide the config file")
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
9 }
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
10
8dc8ff057b0f 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)))
8dc8ff057b0f 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)))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
13 source(args[1])
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
14
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
15 test <- list()
6
43c146e25a43 "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
43c146e25a43 "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
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
18 second <- test
6
43c146e25a43 "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
43c146e25a43 "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
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
21
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
22 do.trajectoryinspection.stemID <- function(ltr) { # nolint
43c146e25a43 "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
43c146e25a43 "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 = ".")
43c146e25a43 "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 = ".")
43c146e25a43 "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
8dc8ff057b0f 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]]))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
28 }
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
29
8dc8ff057b0f 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))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
31 bra <- branchcells(
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
32 ltr,
8dc8ff057b0f 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))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
34 )
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
35 write.table(
8dc8ff057b0f 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),
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
37 file = out.diffgenes)
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
38
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
39 par(mfrow = c(3, 2), cex = 0.5)
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
40 print(do.call(plotmap, c(bra$scl, final = FALSE, fr = FALSE)))
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
41 print(do.call(mtext, c("Initial Clusters (tSNE)", test)))
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
42 print(do.call(plotmap, c(bra$scl, final = TRUE, fr = FALSE)))
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
43 print(do.call(mtext, c("Final Clusters (tSNE)", test)))
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
44 print(do.call(plotmap, c(bra$scl, final = FALSE, um = TRUE)))
43c146e25a43 "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(mtext, c("Initial Clusters (UMAP)", test)))
43c146e25a43 "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(plotmap, c(bra$scl, final = TRUE, um = TRUE)))
43c146e25a43 "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(mtext, c("Final Clusters (UMAP)", test)))
43c146e25a43 "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(plotmap, c(bra$scl, final = FALSE, fr = TRUE)))
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
49 print(do.call(mtext, c("Initial Clusters (F-R)", test)))
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
50 print(do.call(plotmap, c(bra$scl, final = TRUE, fr = TRUE)))
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
51 print(do.call(mtext, c("Final Clusters (F-R)", test)))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
52 }
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
53
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
54 do.trajectoryinspection.fateID <- function(ltr) { # nolint
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
55 n <- do.call(cellsfromtree, c(ltr, trjfid.cellsfrom))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
56 x <- getfdata(ltr@sc)
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
57
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
58 trjfid.filterset$x <- x
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
59 trjfid.filterset$n <- n$f
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
60 fs <- do.call(filterset, c(trjfid.filterset))
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
61 trjfid.getsom$x <- fs
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
62 s1d <- do.call(getsom, c(trjfid.getsom))
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
63 trjfid.procsom$s1d <- s1d
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
64 ps <- do.call(procsom, c(trjfid.procsom))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
65
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
66 y <- ltr@sc@cpart[n$f]
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
67 fcol <- ltr@sc@fcol
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
68
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
69 trjfid.plotheat$xpart <- y
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
70 trjfid.plotheat$xcol <- fcol
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
71
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
72 test$side <- 3
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
73 test$line <- 3
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
74
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
75 ##Plot average z-score for all modules derived from the SOM:
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
76 trjfid.plotheat$x <- ps$nodes.z
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
77 trjfid.plotheat$ypart <- unique(ps$nodes)
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
78 print(do.call(plotheatmap, c(trjfid.plotheat)))
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
79 print(do.call(mtext, c("Average z-score for all modules derived from SOM",
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
80 test)))
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
81 ##Plot z-score profile of each gene ordered by SOM modules:
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
82 trjfid.plotheat$x <- ps$all.z
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
83 trjfid.plotheat$ypart <- ps$nodes
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
84 print(do.call(plotheatmap, c(trjfid.plotheat)))
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
85 print(do.call(mtext, c(paste0("z-score profile of each gene",
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
86 "ordered by SOM modules"), test)))
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
87 ##Plot normalized expression profile of each gene ordered by SOM modules:
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
88 trjfid.plotheat$x <- ps$all.e
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
89 trjfid.plotheat$ypart <- ps$nodes
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
90 print(do.call(plotheatmap, c(trjfid.plotheat)))
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
91 print(do.call(mtext, c(paste0("Normalized expression profile of each",
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
92 "gene ordered by SOM modules"), test)))
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
93 ##Plot binarized expression profile of each gene
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
94 ##(z-score < -1, -1 < z-score < 1, z-score > 1)
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
95 trjfid.plotheat$x <- ps$all.b
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
96 trjfid.plotheat$ypart <- ps$nodes
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
97 print(do.call(plotheatmap, c(trjfid.plotheat)))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
98 print(do.call(mtext, c("Binarized expression profile of each gene", test)))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
99 ## This should be written out, and passed back into the tool
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
100 ## to perform sominspect
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
101 return(list(fs = fs, ps = ps, y = y, fcol = fcol, nf = n$f))
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
102 }
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
103
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
104 do.trajectoryinspection.fateID.sominspect <- function(domo) { # nolint
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
105 g <- trjfidsomi.use.genes
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
106 if (class(g) == "numeric") {
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
107 g <- names(ps$nodes)[ps$nodes %in% g]
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
108 }
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
109
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
110 typ <- NULL
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
111 if (!is.null(trjfidsomi.use.types)) {
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
112 typ <- sub(trjfidsomi.use.types, "", domo$nf)
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
113 }
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
114
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
115 trjfidsomi$x <- domo$fs
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
116 trjfidsomi$y <- domo$y
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
117 trjfidsomi$g <- g
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
118 trjfidsomi$n <- domo$nf
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
119 trjfidsomi$col <- domo$fcol
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
120 trjfidsomi$types <- typ
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
121
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
122 ## The average pseudo-temporal expression profile of this group
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
123 ## can be plotted by the function plotexpression:
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
124 par(mfrow = c(1, 1))
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
125 test$cex <- 1
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
126 second$line <- 1.5
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
127 if (trjfidsomi$name == "Title") trjfidsomi$name <- ""
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
128 print(do.call(plotexpression, c(trjfidsomi)))
6
43c146e25a43 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents: 0
diff changeset
129 mess2 <- paste(c(trjfidsomi.use.genes), collapse = ", ")
0
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
130 mess1 <- "Average pseudo-temporal expression profile"
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
131 print(do.call(mtext, c(mess1, test)))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
132 print(do.call(mtext, c(mess2, second)))
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
133 }
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
134
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
135 ltr <- in.rdat
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
136
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
137 pdf(out.pdf)
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
138 if (perform.stemID) do.trajectoryinspection.stemID(ltr)
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
139 if (perform.fateID) {
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
140 domo <- do.trajectoryinspection.fateID(ltr)
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
141 if (perform.fateID.sominspect) {
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
142 do.trajectoryinspection.fateID.sominspect(domo)
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
143 }
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
144 }
8dc8ff057b0f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff changeset
145 dev.off()