annotate FlowSOMMApIndividualFCS.R @ 1:a1054bd1060a draft

planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
author azomics
date Mon, 25 Sep 2023 22:04:40 +0000
parents e796ed5dfd02
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
1 #!/usr/bin/Rscript
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
2 # Module for Galaxy
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
3 # Generates FlowSOM reference tree
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
4 # with FlowSOM AggregateFlowFrames
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
5 ######################################################################
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
6 # Copyright (c) 2017 Northrop Grumman.
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
7 # All rights reserved.
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
8 ######################################################################
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
9 #
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
10 # Version 1
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
11 # Cristel Thomas
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
12 #
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
13 #
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
14 library(FlowSOM)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
15 library(flowCore)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
16
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
17 ## geometric mean from
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
18 # https://stackoverflow.com/questions/2602583/geometric-mean-is-there-a-built-in
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
19 gm_mean <- function(x, na_rm = TRUE) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
20 exp(sum(log(x[x > 0]), na.rm = na_rm) / length(x))
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
21 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
22
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
23 pretty_marker_names <- function(flow_frame) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
24 n <- flow_frame@parameters@data[, "name"]
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
25 d <- flow_frame@parameters@data[, "desc"]
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
26 d[is.na(d)] <- n[is.na(d)]
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
27 pretty_names <- list()
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
28 if (any(grepl("#", d))) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
29 # Support for hashtag notation:
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
30 pretty_names <- gsub("#(.*)$", " (\\1)", d)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
31 } else {
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
32 pretty_names <- paste(d, " <", n, ">", sep = "")
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
33 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
34 return(pretty_names)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
35 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
36
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
37 check_markers <- function(fcsfiles, flag_ff = FALSE) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
38 marker_check <- TRUE
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
39 for (i in seq_along(fcsfiles)) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
40 if (flag_ff) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
41 fcs <- readRDS(fcsfiles[i])
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
42 } else {
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
43 fcs <- read.FCS(fcsfiles[i], transformation = FALSE)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
44 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
45 if (i == 1) {
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
46 m1 <- as.vector(pData(parameters(fcs))$desc)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
47 } else {
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
48 m2 <- as.vector(pData(parameters(fcs))$desc)
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
49 if (is.na(all(m1 == m2))) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
50 mm1 <- is.na(m1)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
51 mm2 <- is.na(m2)
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
52 if (all(mm1 == mm2)) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
53 if (!all(m1 == m2, na.rm = TRUE)) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
54 marker_check <- FALSE
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
55 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
56 } else {
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
57 marker_check <- FALSE
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
58 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
59 } else if (!all(m1 == m2)) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
60 marker_check <- FALSE
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
61 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
62 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
63 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
64 if (!marker_check) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
65 quit(save = "no", status = 13, runLast = FALSE)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
66 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
67 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
68
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
69 map_to_tree <- function(filenames, filepaths,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
70 flag_ff = FALSE, reftree, cluster = 10,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
71 outdir = "", flag_meta = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
72 mfi = "mfi", stat1 = "", stat2 = "",
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
73 stat3 = "", plot = "", mplot = "") {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
74
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
75 check_markers(filepaths, flag_ff)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
76 # get tree
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
77 fst <- readRDS(reftree)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
78 plots <- FALSE
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
79 mplots <- FALSE
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
80 dir.create(outdir)
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
81 if (!plot == "") {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
82 dir.create(plot)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
83 plots <- TRUE
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
84 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
85 if (!mplot == "") {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
86 dir.create(mplot)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
87 mplots <- TRUE
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
88 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
89 meta_c <- metaClustering_consensus(fst$map$codes, k = cluster, seed = 33)
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
90 nb_pop <- if (flag_meta) cluster else max(fst$map$mapping[, 1])
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
91 nb_samples <- length(filepaths)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
92 nb_marker <- length(fst$prettyColnames)
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
93 print_markers <- gsub(" <.*>", "", fst$prettyColnames)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
94 print_markers_ff <- append(print_markers, "Population")
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
95
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
96 m_stat1 <- matrix(0, nrow = nb_samples, ncol = (nb_pop + 2))
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
97 colnames(m_stat1) <- c("FileID", "SampleName", seq_len(nb_pop))
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
98
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
99 sink(stat2)
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
100 cat(print_markers, sep = "\t")
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
101 cat("\tPercentage\tPopulation\tSampleName\n")
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
102 sink()
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
103
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
104 col_m3 <- c("Population")
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
105 for (m in print_markers){
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
106 m1 <- paste(m, "mean", sep = "_")
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
107 m2 <- paste(m, "median", sep = "_")
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
108 m3 <- paste(m, "stdev", sep = "_")
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
109 col_m3 <- append(col_m3, c(m1, m2, m3))
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
110 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
111 col_stat3 <- c(col_m3,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
112 "Percentage_mean",
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
113 "Percentage_median",
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
114 "Percentage_stdev")
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
115
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
116 for (i in seq_along(filepaths)) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
117 if (flag_ff) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
118 ff <- readRDS(filepaths[i])
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
119 } else {
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
120 ff <- read.FCS(filepaths[i], transformation = FALSE)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
121 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
122 if (i == 1) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
123 # compare to tree markers
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
124 pm <- pretty_marker_names(ff)
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
125 if (!all(fst$prettyColnames %in% pm)) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
126 quit(save = "no", status = 14, runLast = FALSE)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
127 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
128 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
129
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
130 fsom <- NewData(fst, ff)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
131
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
132 if (mplots) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
133 markers <- colnames(ff)
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
134 tmpmplot <- paste(filenames[i], "marker_plots.pdf", sep = "_")
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
135 pdf(file.path(mplot, tmpmplot), useDingbats = FALSE, onefile = TRUE)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
136 for (marker in markers){
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
137 PlotMarker(fsom, marker)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
138 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
139 dev.off()
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
140 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
141
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
142 if (!plot == "") {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
143 plotpath <- paste(filenames[i], "tree.png", sep = "_")
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
144 png(file.path(plot, plotpath), type = "cairo", height = 800, width = 800)
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
145 PlotStars(fsom, backgroundValues = as.factor(meta_c))
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
146 dev.off()
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
147 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
148
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
149 m <- matrix(0, nrow = nrow(ff), ncol = 1)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
150 s <- seq_len(nrow(ff))
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
151 if (flag_meta) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
152 m[s, ] <- meta_c[fsom$map$mapping[, 1]]
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
153 } else {
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
154 m[s, ] <- fsom$map$mapping[, 1]
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
155 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
156 colnames(m) <- "FlowSOM"
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
157 ff <- cbind2(ff, m)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
158 out <- exprs(ff)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
159 colnames(out) <- print_markers_ff
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
160
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
161 clr_table <- paste(filenames[i], "clustered.flowclr", sep = "_")
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
162 write.table(out,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
163 file = file.path(outdir, clr_table),
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
164 quote = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
165 row.names = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
166 col.names = TRUE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
167 sep = "\t",
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
168 append = FALSE)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
169
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
170 cluster_count <- table(out[, "Population"])
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
171 cluster_prop <- prop.table(cluster_count) * 100
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
172 m1_tmp <- numeric(nb_pop)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
173 for (j in 1:nb_pop){
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
174 if (as.character(j) %in% names(cluster_count)) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
175 m1_tmp[[j]] <- format(
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
176 round(cluster_prop[[as.character(j)]], 2),
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
177 nsmall = 2)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
178 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
179 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
180 samplename <- paste("Sample", i, sep = "")
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
181 m_stat1[i, ] <- c(filenames[i], samplename, m1_tmp)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
182 # flowstat2
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
183 # Marker1 Marker2 Marker3 ... Population Percentage SampleName
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
184 # MFIs for each marker
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
185 # dimension ==> col = nb of markers + 3; row = nb of files * nb of clusters
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
186 if (mfi == "mfi") {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
187 m2 <- aggregate(out[, 1:nb_marker], list(out[, nb_marker + 1]), mean)
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
188 } else if (mfi == "mdfi") {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
189 m2 <- aggregate(out[, 1:nb_marker], list(out[, nb_marker + 1]), median)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
190 } else {
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
191 m2 <- aggregate(out[, 1:nb_marker], list(out[, nb_marker + 1]), gm_mean)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
192 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
193
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
194 m2["Percentage"] <- as.character(cluster_prop)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
195 m2["Population"] <- as.character(m2$Group.1)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
196 m2["SampleName"] <- samplename
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
197 m2t <- as.matrix(m2[2:length(m2)])
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
198 write.table(m2t,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
199 file = stat2,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
200 quote = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
201 row.names = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
202 col.names = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
203 sep = "\t",
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
204 append = TRUE)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
205
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
206 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
207 write.table(m_stat1,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
208 file = stat1,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
209 quote = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
210 row.names = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
211 col.names = TRUE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
212 sep = "\t",
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
213 append = FALSE)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
214
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
215 m2df <- read.table(stat2, sep = "\t", header = TRUE)
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
216 ag <- aggregate(m2df[, 0:nb_marker + 1],
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
217 list(m2df[, nb_marker + 2]),
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
218 function(x) c(mn = mean(x), med = median(x), stdv = sd(x)))
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
219 m3t <- as.matrix(ag)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
220 colnames(m3t) <- col_stat3
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
221 write.table(m3t, file = stat3,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
222 quote = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
223 row.names = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
224 col.names = TRUE, sep = "\t",
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
225 append = FALSE)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
226 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
227
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
228 flow_frame_or_fcs <- function(filenames,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
229 filepaths,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
230 reftree,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
231 cluster = 10, outdir = "",
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
232 flag_meta = FALSE,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
233 mfi = "mfi", stat1 = "", stat2 = "",
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
234 stat3 = "", plot = "", mplot = "") {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
235 is_fcs <- FALSE
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
236 is_ff <- FALSE
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
237 flag_ff <- FALSE
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
238 i <- 0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
239 for (f in filepaths){
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
240 tryCatch({
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
241 is_fcs <- isFCSfile(f)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
242 }, error = function(ex) {
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
243 print(paste(ex))
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
244 })
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
245 if (!is_fcs) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
246 tryCatch({
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
247 ff <- readRDS(f)
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
248 is_ff <- TRUE
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
249 }, error = function(ex) {
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
250 print(paste(ex))
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
251 })
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
252 } else {
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
253 i <- i + 1
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
254 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
255 if (!is_ff && !is_fcs) {
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
256 quit(save = "no", status = 10, runLast = FALSE)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
257 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
258 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
259 if (i == 0) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
260 flag_ff <- TRUE
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
261 } else if (!i == length(filenames)) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
262 quit(save = "no", status = 12, runLast = FALSE)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
263 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
264 map_to_tree(filenames,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
265 filepaths,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
266 flag_ff, reftree, cluster, outdir, flag_meta,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
267 mfi, stat1, stat2, stat3, plot, mplot)
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
268 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
269
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
270 args <- commandArgs(trailingOnly = TRUE)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
271 plot <- ""
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
272 mplot <- ""
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
273 m <- 8
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
274 flag_meta <- FALSE
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
275 if (args[4] == "meta") {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
276 flag_meta <- TRUE
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
277 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
278 if (args[9] == "newDataTrees") {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
279 plot <- "newDataTrees"
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
280 m <- m + 1
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
281 if (args[10] == "newDataMarkers") {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
282 mplot <- "newDataMarkers"
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
283 m <- m + 1
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
284 }
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
285 } else if (args[9] == "newDataMarkers") {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
286 mplot <- "newDataMarkers"
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
287 m <- m + 1
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
288 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
289
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
290 n <- m + 1
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
291 nb_files <- (length(args) - m) / 2
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
292 files1 <- character(nb_files)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
293 files2 <- character(nb_files)
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
294 j <- 1
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
295 file_list <- args[n:length(args)]
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
296 for (i in seq_along(file_list)) {
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
297 if (i %% 2) {
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
298 files1[[j]] <- file_list[i]
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
299 files2[[j]] <- file_list[i + 1]
0
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
300 j <- j + 1
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
301 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
302 }
e796ed5dfd02 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit 2f04d23cb47d9b233d159c54ff406e56c87746e0"
azomics
parents:
diff changeset
303
1
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
304 flow_frame_or_fcs(files2,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
305 files1, args[1], as.numeric(args[3]), args[2], flag_meta,
a1054bd1060a planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_cross_comp commit f2ed3cfcc71ccf61cf6058533d217443318fd024
azomics
parents: 0
diff changeset
306 args[5], args[6], args[7], args[8], plot, mplot)