Mercurial > repos > iuc > raceid_inspecttrajectory
annotate scripts/pseudotemporal.R @ 10:6e90c8adf84f 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:56 +0000 |
parents | c8434a623268 |
children |
rev | line source |
---|---|
0
e0e9b24d76aa
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
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
2 VERSION <- "0.1" # nolint |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
3 |
6
c8434a623268
"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) # nolint |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
5 |
6
c8434a623268
"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
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
7 message(paste("VERSION:", VERSION)) |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
8 stop("Please provide the config file") |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
9 } |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
10 |
e0e9b24d76aa
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))) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
12 source(args[1]) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
13 |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
14 test <- list() |
6
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
15 test$side <- 3 |
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
16 test$line <- 3 |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
17 second <- test |
6
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
18 second$cex <- 0.5 |
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
19 second$line <- 2.5 |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
20 |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
21 |
6
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
22 do.pseudotemp <- function(sc) { # nolint |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
23 pdf(out.pdf) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
24 ltr <- Ltree(sc) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
25 ltr <- compentropy(ltr) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
26 ltr <- do.call(projcells, c(ltr, pstc.projc)) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
27 ltr <- do.call(projback, c(ltr, pstc.projb)) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
28 ltr <- lineagegraph(ltr) |
6
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
29 ltr <- do.call(comppvalue, c(ltr, pstc.comppval)) |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
30 x <- do.call(compscore, c(ltr, pstc.compscore)) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
31 print(do.call(mtext, c("Compute Score", test))) |
10
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
32 print(do.call(mtext, c( |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
33 paste0( |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
34 "No. of inter-cluster links / ", |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
35 "Delta median entropy of each cluster / ", |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
36 "StemID2 score (combination of both)" |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
37 ), |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
38 second |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
39 ))) |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
40 plotdistanceratio(ltr) |
e0e9b24d76aa
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("Cell-to-Cell Distance Ratio", test))) |
10
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
42 print(do.call(mtext, c( |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
43 "Original vs High-dimensional Embedded Space", |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
44 second |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
45 ))) |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
46 do.call(plotgraph, c(ltr, pstc.plotgraph)) |
6
c8434a623268
"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(paste0(c("Lineage Trajectories", rep(" ", 54)), |
10
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
48 collapse = "" |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
49 ), test))) |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
50 print(do.call(mtext, c(paste0(c( |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
51 paste0( |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
52 "Colour = Level of Significance, ", |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
53 "Width = Link Score" |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
54 ), |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
55 rep(" ", 106) |
6e90c8adf84f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 0ffa71ef9f8d020fe7ba94502db8cec26fd8741f
iuc
parents:
6
diff
changeset
|
56 ), collapse = ""), second))) |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
57 plotspantree(ltr) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
58 print(do.call(mtext, c("Minimum Spanning Tree", test))) |
6
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
59 plotspantree(ltr, projections = TRUE) |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
60 print(do.call(mtext, c("Minimum Spanning Tree", test))) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
61 print(do.call(mtext, c("Cells Projected onto Links", second))) |
6
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
62 test$side <- 4 |
c8434a623268
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit 53916f6803b93234f992f5fd4fad61d7013d82af"
iuc
parents:
0
diff
changeset
|
63 test$line <- 0 |
0
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
64 plotlinkscore(ltr) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
65 print(do.call(mtext, c("Link Score", test))) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
66 projenrichment(ltr) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
67 print(do.call(mtext, c("Enrichment Ratios", test))) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
68 dev.off() |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
69 |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
70 return(ltr) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
71 } |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
72 |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
73 ltr <- do.pseudotemp(in.rdat) |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
74 |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
75 |
e0e9b24d76aa
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid3 commit f880060c478d42202df5b78a81329f8af56b1138
iuc
parents:
diff
changeset
|
76 saveRDS(ltr, out.rdat) |