comparison scripts/clusterinspect.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 a6821f856a1e
children
comparison
equal deleted inserted replaced
9:a6821f856a1e 10:6e90c8adf84f
1 #!/usr/bin/env R 1 #!/usr/bin/env R
2 VERSION <- "0.5" # nolint 2 VERSION <- "0.5" # nolint
3 3
4 args <- commandArgs(trailingOnly = TRUE) 4 args <- commandArgs(trailingOnly = TRUE)
5 5
6 if (length(args) != 1) { 6 if (length(args) != 1) {
7 message(paste("VERSION:", VERSION)) 7 message(paste("VERSION:", VERSION))
8 stop("Please provide the config file") 8 stop("Please provide the config file")
9 } 9 }
10 10
11 suppressWarnings(suppressPackageStartupMessages(require(RaceID))) 11 suppressWarnings(suppressPackageStartupMessages(require(RaceID)))
12 source(args[1]) 12 source(args[1])
13 13
47 print(plotmap(sc_tmp, final = TRUE, fr = TRUE)) 47 print(plotmap(sc_tmp, final = TRUE, fr = TRUE))
48 print(do.call(mtext, c("Final Clustering Fruchterman-Reingold", test))) 48 print(do.call(mtext, c("Final Clustering Fruchterman-Reingold", test)))
49 } 49 }
50 50
51 51
52 do.inspect.symbolmap <- function(sc) { # nolint 52 do.inspect.symbolmap <- function(sc) { # nolint
53 if (!is.null(plotsym.use.typeremoveregex)) { 53 if (!is.null(plotsym.use.typeremoveregex)) {
54 plotsym$types <- sub(plotsym.use.typeremoveregex, "", 54 plotsym$types <- sub(
55 colnames(sc@ndata)) 55 plotsym.use.typeremoveregex, "",
56 colnames(sc@ndata)
57 )
56 58
57 if (!is.null(plotsym.use.typeremoveregex.subselect)) { 59 if (!is.null(plotsym.use.typeremoveregex.subselect)) {
58 plotsym$subset <- plotsym$types[grep( 60 plotsym$subset <- plotsym$types[grep(
59 plotsym.use.typeremoveregex.subselect, 61 plotsym.use.typeremoveregex.subselect,
60 plotsym$types)] 62 plotsym$types
63 )]
61 } 64 }
62 } 65 }
63 plotsym$fr <- FALSE 66 plotsym$fr <- FALSE
64 print(do.call(plotsymbolsmap, c(sc, plotsym))) 67 print(do.call(plotsymbolsmap, c(sc, plotsym)))
65 print(do.call(mtext, c("Symbols tSNE", test))) 68 print(do.call(mtext, c("Symbols tSNE", test)))
66 plotsym$fr <- TRUE 69 plotsym$fr <- TRUE
67 print(do.call(plotsymbolsmap, c(sc, plotsym))) 70 print(do.call(plotsymbolsmap, c(sc, plotsym)))
68 print(do.call(mtext, c("Symbols FR", test))) 71 print(do.call(mtext, c("Symbols FR", test)))
69 } 72 }
70 73
71 do.inspect.diffgene <- function(sc) { # nolint 74 do.inspect.diffgene <- function(sc) { # nolint
72 75
73 getSubNames <- function(lob, sc) { # nolint 76 getSubNames <- function(lob, sc) { # nolint
74 use_names <- NULL 77 use_names <- NULL
75 if (!is.null(lob$manual)) { 78 if (!is.null(lob$manual)) {
76 use_names <- lob$manual 79 use_names <- lob$manual
77 }else if (!is.null(lob$regex)) { 80 } else if (!is.null(lob$regex)) {
78 nm <- colnames(sc@ndata) 81 nm <- colnames(sc@ndata)
79 use_names <- nm[grep(lob$regex, nm)] 82 use_names <- nm[grep(lob$regex, nm)]
80 }else if (!is.null(lob$cln)) { 83 } else if (!is.null(lob$cln)) {
81 use_names <- names(sc@cpart)[sc@cpart %in% lob$cln] 84 use_names <- names(sc@cpart)[sc@cpart %in% lob$cln]
82 } 85 }
83 if (is.null(use_names)) { 86 if (is.null(use_names)) {
84 stop("A or B names not given!") 87 stop("A or B names not given!")
85 } 88 }
96 print(do.call(plotdiffgenesnb, c(plotdiffg))) 99 print(do.call(plotdiffgenesnb, c(plotdiffg)))
97 print(do.call(mtext, c("Diff Genes", test))) 100 print(do.call(mtext, c("Diff Genes", test)))
98 } 101 }
99 102
100 103
101 do.inspect.genesofinterest <- function(sc) { # nolint 104 do.inspect.genesofinterest <- function(sc) { # nolint
102 if (is.null(plotexp$n)) { ## No title, and one gene? Use gene name 105 if (is.null(plotexp$n)) { ## No title, and one gene? Use gene name
103 if (length(plotexp$g) == 1) { 106 if (length(plotexp$g) == 1) {
104 plotexp$n <- plotexp$g 107 plotexp$n <- plotexp$g
105 } else { 108 } else {
106 plotexp$n <- paste(plotexp$g, collapse = ", ") 109 plotexp$n <- paste(plotexp$g, collapse = ", ")