Mercurial > repos > iuc > raceid_clustering
diff scripts/trajectoryinspect.R @ 9:0bff0ee0683a draft
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:06 +0000 |
parents | a4b734cd253b |
children | 49776718ae90 |
line wrap: on
line diff
--- a/scripts/trajectoryinspect.R Mon Dec 20 10:12:47 2021 +0000 +++ b/scripts/trajectoryinspect.R Wed Aug 24 18:09:06 2022 +0000 @@ -1,7 +1,7 @@ #!/usr/bin/env R VERSION <- "0.2" # nolint -args <- commandArgs(trailingOnly = T) +args <- commandArgs(trailingOnly = TRUE) if (length(args) != 1) { message(paste("VERSION:", VERSION)) @@ -19,7 +19,7 @@ second$cex <- 0.5 second$line <- 2.5 -do.trajectoryinspection.stemID <- function(ltr) { # nolint +do.trajectoryinspection.stemid <- function(ltr) { # nolint makeBranchLink <- function(i, j, k) { # nolint ingoing <- paste(sort(c(i, j)), collapse = ".") outgoing <- paste(sort(c(j, k)), collapse = ".") @@ -51,57 +51,57 @@ print(do.call(mtext, c("Final Clusters (F-R)", test))) } -do.trajectoryinspection.fateID <- function(ltr) { # nolint - n <- do.call(cellsfromtree, c(ltr, trjfid.cellsfrom)) +do.trajectoryinspection.fateid <- function(ltr) { # nolint + n <- do.call(cellsfromtree, c(ltr, trjfid_cellsfrom)) x <- getfdata(ltr@sc) - trjfid.filterset$x <- x - trjfid.filterset$n <- n$f - fs <- do.call(filterset, c(trjfid.filterset)) - trjfid.getsom$x <- fs - s1d <- do.call(getsom, c(trjfid.getsom)) - trjfid.procsom$s1d <- s1d - ps <- do.call(procsom, c(trjfid.procsom)) + trjfid_filterset$x <- x + trjfid_filterset$n <- n$f + fs <- do.call(filterset, c(trjfid_filterset)) + trjfid_getsom$x <- fs + s1d <- do.call(getsom, c(trjfid_getsom)) + trjfid_procsom$s1d <- s1d + ps <- do.call(procsom, c(trjfid_procsom)) y <- ltr@sc@cpart[n$f] fcol <- ltr@sc@fcol - trjfid.plotheat$xpart <- y - trjfid.plotheat$xcol <- fcol + trjfid_plotheat$xpart <- y + trjfid_plotheat$xcol <- fcol test$side <- 3 test$line <- 3 ##Plot average z-score for all modules derived from the SOM: - trjfid.plotheat$x <- ps$nodes.z - trjfid.plotheat$ypart <- unique(ps$nodes) - print(do.call(plotheatmap, c(trjfid.plotheat))) + trjfid_plotheat$x <- ps$nodes.z + trjfid_plotheat$ypart <- unique(ps$nodes) + print(do.call(plotheatmap, c(trjfid_plotheat))) print(do.call(mtext, c("Average z-score for all modules derived from SOM", test))) ##Plot z-score profile of each gene ordered by SOM modules: - trjfid.plotheat$x <- ps$all.z - trjfid.plotheat$ypart <- ps$nodes - print(do.call(plotheatmap, c(trjfid.plotheat))) + trjfid_plotheat$x <- ps$all.z + trjfid_plotheat$ypart <- ps$nodes + print(do.call(plotheatmap, c(trjfid_plotheat))) print(do.call(mtext, c(paste0("z-score profile of each gene", "ordered by SOM modules"), test))) ##Plot normalized expression profile of each gene ordered by SOM modules: - trjfid.plotheat$x <- ps$all.e - trjfid.plotheat$ypart <- ps$nodes - print(do.call(plotheatmap, c(trjfid.plotheat))) + trjfid_plotheat$x <- ps$all.e + trjfid_plotheat$ypart <- ps$nodes + print(do.call(plotheatmap, c(trjfid_plotheat))) print(do.call(mtext, c(paste0("Normalized expression profile of each", "gene ordered by SOM modules"), test))) ##Plot binarized expression profile of each gene ##(z-score < -1, -1 < z-score < 1, z-score > 1) - trjfid.plotheat$x <- ps$all.b - trjfid.plotheat$ypart <- ps$nodes - print(do.call(plotheatmap, c(trjfid.plotheat))) + trjfid_plotheat$x <- ps$all.b + trjfid_plotheat$ypart <- ps$nodes + print(do.call(plotheatmap, c(trjfid_plotheat))) print(do.call(mtext, c("Binarized expression profile of each gene", test))) ## This should be written out, and passed back into the tool ## to perform sominspect return(list(fs = fs, ps = ps, y = y, fcol = fcol, nf = n$f)) } -do.trajectoryinspection.fateID.sominspect <- function(domo) { # nolint +do.trajectoryinspection.fateid.sominspect <- function(domo) { # nolint g <- trjfidsomi.use.genes if (class(g) == "numeric") { g <- names(ps$nodes)[ps$nodes %in% g] @@ -135,11 +135,11 @@ ltr <- in.rdat pdf(out.pdf) -if (perform.stemID) do.trajectoryinspection.stemID(ltr) -if (perform.fateID) { - domo <- do.trajectoryinspection.fateID(ltr) - if (perform.fateID.sominspect) { - do.trajectoryinspection.fateID.sominspect(domo) +if (perform.stemid) do.trajectoryinspection.stemid(ltr) +if (perform.fateid) { + domo <- do.trajectoryinspection.fateid(ltr) + if (perform.fateid.sominspect) { + do.trajectoryinspection.fateid.sominspect(domo) } } dev.off()