Mercurial > repos > iuc > raceid_trajectory
annotate scripts/trajectoryinspect.R @ 9:2af7c5086a96 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
author | iuc |
---|---|
date | Wed, 24 Aug 2022 18:09:40 +0000 |
parents | 72979cac22b2 |
children |
rev | line source |
---|---|
0
ff7cd3c7c1df
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
72979cac22b2
"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
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
3 |
9
2af7c5086a96
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
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
5 |
6
72979cac22b2
"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
ff7cd3c7c1df
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)) |
ff7cd3c7c1df
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") |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
9 } |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
10 |
ff7cd3c7c1df
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))) |
ff7cd3c7c1df
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))) |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
13 source(args[1]) |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
14 |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
15 test <- list() |
6
72979cac22b2
"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 |
72979cac22b2
"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
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
18 second <- test |
6
72979cac22b2
"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 |
72979cac22b2
"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
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
21 |
9
2af7c5086a96
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
72979cac22b2
"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 |
72979cac22b2
"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 = ".") |
72979cac22b2
"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 = ".") |
72979cac22b2
"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
ff7cd3c7c1df
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]])) |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
28 } |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
29 |
ff7cd3c7c1df
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)) |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
31 bra <- branchcells( |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
32 ltr, |
ff7cd3c7c1df
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)) |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
34 ) |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
35 write.table( |
ff7cd3c7c1df
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
72979cac22b2
"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
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
38 |
6
72979cac22b2
"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) |
72979cac22b2
"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
ff7cd3c7c1df
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
72979cac22b2
"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
ff7cd3c7c1df
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
72979cac22b2
"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))) |
72979cac22b2
"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))) |
72979cac22b2
"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))) |
72979cac22b2
"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))) |
72979cac22b2
"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
ff7cd3c7c1df
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
72979cac22b2
"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
ff7cd3c7c1df
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))) |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
52 } |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
53 |
9
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
54 do.trajectoryinspection.fateid <- function(ltr) { # nolint |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
55 n <- do.call(cellsfromtree, c(ltr, trjfid_cellsfrom)) |
0
ff7cd3c7c1df
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) |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
57 |
9
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
58 trjfid_filterset$x <- x |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
59 trjfid_filterset$n <- n$f |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
60 fs <- do.call(filterset, c(trjfid_filterset)) |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
61 trjfid_getsom$x <- fs |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
62 s1d <- do.call(getsom, c(trjfid_getsom)) |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
63 trjfid_procsom$s1d <- s1d |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
64 ps <- do.call(procsom, c(trjfid_procsom)) |
0
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
65 |
ff7cd3c7c1df
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] |
ff7cd3c7c1df
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 |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
68 |
9
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
69 trjfid_plotheat$xpart <- y |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
70 trjfid_plotheat$xcol <- fcol |
6
72979cac22b2
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
71 |
72979cac22b2
"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 |
72979cac22b2
"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
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
74 |
ff7cd3c7c1df
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: |
9
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
76 trjfid_plotheat$x <- ps$nodes.z |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
77 trjfid_plotheat$ypart <- unique(ps$nodes) |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
78 print(do.call(plotheatmap, c(trjfid_plotheat))) |
6
72979cac22b2
"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", |
72979cac22b2
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
80 test))) |
0
ff7cd3c7c1df
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: |
9
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
82 trjfid_plotheat$x <- ps$all.z |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
83 trjfid_plotheat$ypart <- ps$nodes |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
84 print(do.call(plotheatmap, c(trjfid_plotheat))) |
6
72979cac22b2
"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", |
72979cac22b2
"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
ff7cd3c7c1df
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: |
9
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
88 trjfid_plotheat$x <- ps$all.e |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
89 trjfid_plotheat$ypart <- ps$nodes |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
90 print(do.call(plotheatmap, c(trjfid_plotheat))) |
6
72979cac22b2
"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", |
72979cac22b2
"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))) |
72979cac22b2
"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 |
72979cac22b2
"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) |
9
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
95 trjfid_plotheat$x <- ps$all.b |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
96 trjfid_plotheat$ypart <- ps$nodes |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
97 print(do.call(plotheatmap, c(trjfid_plotheat))) |
0
ff7cd3c7c1df
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))) |
ff7cd3c7c1df
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 |
ff7cd3c7c1df
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
72979cac22b2
"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
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
102 } |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
103 |
9
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
104 do.trajectoryinspection.fateid.sominspect <- function(domo) { # nolint |
0
ff7cd3c7c1df
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
72979cac22b2
"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
ff7cd3c7c1df
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] |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
108 } |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
109 |
6
72979cac22b2
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
110 typ <- NULL |
72979cac22b2
"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)) { |
72979cac22b2
"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
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
113 } |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
114 |
6
72979cac22b2
"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 |
72979cac22b2
"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 |
72979cac22b2
"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 |
72979cac22b2
"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 |
72979cac22b2
"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 |
72979cac22b2
"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
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
121 |
ff7cd3c7c1df
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 |
ff7cd3c7c1df
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
72979cac22b2
"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)) |
72979cac22b2
"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 |
72979cac22b2
"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 |
72979cac22b2
"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
ff7cd3c7c1df
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
72979cac22b2
"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
ff7cd3c7c1df
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" |
ff7cd3c7c1df
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))) |
ff7cd3c7c1df
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))) |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
133 } |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
134 |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
135 ltr <- in.rdat |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
136 |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
137 pdf(out.pdf) |
9
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
138 if (perform.stemid) do.trajectoryinspection.stemid(ltr) |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
139 if (perform.fateid) { |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
140 domo <- do.trajectoryinspection.fateid(ltr) |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
141 if (perform.fateid.sominspect) { |
2af7c5086a96
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 82a18e57158136e265a26f27feb40f8dc13437bf
iuc
parents:
6
diff
changeset
|
142 do.trajectoryinspection.fateid.sominspect(domo) |
0
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
143 } |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
144 } |
ff7cd3c7c1df
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
145 dev.off() |