annotate FlowSOMGenerateTree.R @ 0:54a25f1139b4 draft

"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
author azomics
date Tue, 23 Jun 2020 12:46:08 -0400
parents
children 0efc47dba930
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
1 #!/usr/bin/Rscript
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
2 # Module for Galaxy
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
3 # Generates FlowSOM reference tree
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
4 # with FlowSOM AggregateFlowFrames
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
5 ######################################################################
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
6 # Copyright (c) 2017 Northrop Grumman.
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
7 # All rights reserved.
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
8 ######################################################################
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
9 #
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
10 # Version 1
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
11 # Cristel Thomas
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
12 #
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
13 #
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
14 library(FlowSOM)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
15 library(flowCore)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
16
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
17 generateTree <- function(ff, output="", columns=list(), cluster=10, xgrid=10,
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
18 ygrid=10,plot="", plot_pdf=FALSE, mplot="", flag_def=T,
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
19 table="", mtable="", flag_meta=FALSE, user_seed=42,
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
20 flag_nodesize=F) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
21
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
22 # check default -- if def get all except FSC/SSC
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
23 # also check nb of markers/channels and indices
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
24 markers <- colnames(ff)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
25 print_markers <- as.vector(pData(parameters(ff))$desc)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
26 # Update print_markers if the $P?S not in the FCS file
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
27 for (i in 1:length(print_markers)) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
28 if (is.na(print_markers[i])) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
29 print_markers[i] <- markers[i]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
30 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
31 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
32
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
33 if (flag_def){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
34 channels_to_exclude <- c(grep(markers, pattern="FSC"),
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
35 grep(markers, pattern="SSC"),
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
36 grep(markers, pattern="Time"))
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
37 columns <- markers[-channels_to_exclude]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
38 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
39
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
40 set.seed(user_seed)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
41 fs <- ReadInput(ff, compensate=F, transform=F, scale=T)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
42 fs <- BuildSOM(fs, colsToUse = columns, xdim=xgrid, ydim=ygrid)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
43 fst <- BuildMST(fs, tSNE=T)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
44
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
45 if (!mplot==""){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
46 pdf(mplot, useDingbats=FALSE, onefile=TRUE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
47 for (marker in markers){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
48 PlotMarker(fst, marker)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
49 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
50 dev.off()
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
51 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
52 metaC <- metaClustering_consensus(fst$map$codes, k=cluster, seed=user_seed)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
53
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
54 if (!plot==""){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
55 if (flag_nodesize){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
56 fst <- UpdateNodeSize(fst, reset=TRUE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
57 fst$MST$size <- fst$MST$size/2
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
58 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
59 if (plot_pdf) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
60 pdf(plot, useDingbats=FALSE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
61 PlotStars(fst, backgroundValues = as.factor(metaC))
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
62 dev.off()
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
63 } else {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
64 png(plot, type="cairo", height=800, width=800)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
65 PlotStars(fst, backgroundValues = as.factor(metaC))
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
66 dev.off()
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
67 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
68 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
69 if (!table==""){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
70 m <- matrix(0,nrow=nrow(ff),ncol=1)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
71 s <- seq_len(nrow(ff))
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
72 if (flag_meta){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
73 m[s,] <- metaC[fst$map$mapping[,1]]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
74 } else {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
75 m[s,] <- fst$map$mapping[,1]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
76 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
77 colnames(m) <- "FlowSOM"
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
78 ff <- cbind2(ff,m)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
79 out <- exprs(ff)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
80 print_markers <- append(print_markers, "Population")
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
81 colnames(out) <- print_markers
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
82 write.table(out, file=table, quote=F, row.names=F, col.names=T, sep='\t',
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
83 append=F)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
84
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
85 nb_nodes <- max(fst$map$mapping[,1])
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
86 mm <- matrix(0, nrow=nb_nodes, ncol=2)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
87 ss <- seq_len(nb_nodes)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
88 mm[,1]<- as.character(ss)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
89 mm[ss,2]<- as.character(metaC)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
90 colnames(mm) <- c("Node", "Meta-Cluster")
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
91 write.table(mm, file=mtable, quote=F, row.names=F, col.names=T, sep='\t',
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
92 append=F)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
93
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
94 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
95 saveRDS(fst, file = output)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
96 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
97
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
98 flowFrameOrFCS <- function(input, output="", columns=list(),cluster=10,xgrid=10,
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
99 ygrid=10,plot="",plot_pdf=FALSE, mplot="", default=T,
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
100 table="", mtable="", flag_meta=FALSE, user_seed=42,
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
101 nodesize=FALSE) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
102 isValid <- F
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
103 is_fcs <- F
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
104 is_ff <- F
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
105 ff <- ""
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
106 tryCatch({
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
107 is_fcs <- isFCSfile(input)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
108 }, error = function(ex) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
109 print(paste(ex))
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
110 })
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
111
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
112 if (!is_fcs){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
113 tryCatch({
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
114 ff <- readRDS(input)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
115 is_ff <- T
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
116 }, error = function(ex) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
117 print(paste(ex))
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
118 })
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
119 } else {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
120 ff <- read.FCS(input, transformation=FALSE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
121 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
122
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
123 if (!is_ff && !is_fcs) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
124 quit(save = "no", status = 10, runLast = FALSE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
125 } else {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
126 for (cols in columns){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
127 if (cols > length(colnames(ff))){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
128 quit(save = "no", status = 12, runLast = FALSE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
129 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
130 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
131 generateTree(ff, output, columns, cluster, xgrid, ygrid, plot, plot_pdf,
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
132 mplot, default, table, mtable, flag_meta, user_seed, nodesize)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
133 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
134 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
135
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
136 args <- commandArgs(trailingOnly = TRUE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
137 flag_default <- FALSE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
138 columns <- list()
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
139
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
140 if (args[3] == "" || args[3] == "i.e.:1,2,5") {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
141 flag_default <- TRUE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
142 } else {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
143 #rm last X if it's there
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
144 columns <- as.numeric(strsplit(args[3], ",")[[1]])
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
145 for (col in columns){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
146 if (is.na(col)){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
147 quit(save = "no", status = 11, runLast = FALSE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
148 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
149 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
150 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
151
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
152 cluster <- 10
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
153 if (!args[4] == ""){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
154 if (!is.na(as.integer(args[4]))){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
155 cluster <- as.integer(args[4])
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
156 } else {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
157 quit(save = "no", status = 13, runLast = FALSE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
158 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
159 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
160
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
161 xgrid <- 10
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
162 if (!args[5] == ""){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
163 if (!is.na(as.integer(args[5]))){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
164 cluster <- as.integer(args[5])
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
165 } else {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
166 quit(save = "no", status = 14, runLast = FALSE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
167 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
168 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
169
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
170 ygrid <- 10
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
171 if (!args[6] == ""){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
172 if (!is.na(as.integer(args[6]))){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
173 cluster <- as.integer(args[6])
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
174 } else {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
175 quit(save = "no", status = 14, runLast = FALSE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
176 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
177 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
178 seed <- 42
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
179 if (!args[7]==""){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
180 if (!is.na(as.integer(args[7]))){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
181 seed <- as.integer(args[7])
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
182 } else {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
183 quit(save = "no", status = 15, runLast = FALSE)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
184 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
185 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
186
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
187 plot <- ""
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
188 mplot <- ""
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
189 plot_pdf <- FALSE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
190 table <- ""
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
191 mtable <- ""
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
192 flag_meta <- FALSE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
193 nodesize <- FALSE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
194 nb_args <- length(args)
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
195
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
196 if (nb_args==16) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
197 plot <- args[8]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
198 if (args[9]=='PDF') {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
199 plot_pdf <- TRUE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
200 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
201 nodesize <- args[10]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
202 mplot <- args[11]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
203 table <- args[13]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
204 mtable <- args[14]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
205 if (args[12]=='meta'){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
206 flag_meta<-TRUE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
207 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
208 } else if (nb_args==15){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
209 plot <- args[8]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
210 if (args[9]=='PDF') {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
211 plot_pdf <- TRUE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
212 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
213 nodesize <- args[10]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
214 table <- args[12]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
215 mtable <- args[13]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
216 if (args[11]=='meta'){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
217 flag_meta<-TRUE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
218 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
219 } else if (nb_args==13) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
220 mplot <- args[8]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
221 table <- args[10]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
222 mtable <- args[11]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
223 if (args[9]=='meta'){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
224 flag_meta<-TRUE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
225 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
226 } else if (nb_args==12) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
227 table <- args[9]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
228 mtable <- args[10]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
229 if (args[8]=='meta'){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
230 flag_meta<-TRUE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
231 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
232 } else if (nb_args==11) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
233 plot <- args[8]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
234 if (args[9]=='PDF') {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
235 plot_pdf <- TRUE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
236 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
237 nodesize <- args[10]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
238 mplot <- args[11]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
239 } else if (nb_args==10) {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
240 plot <- args[8]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
241 if (args[9]=='PDF') {
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
242 plot_pdf <- TRUE
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
243 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
244 nodesize <- args[10]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
245 } else if (nb_args==8){
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
246 mplot <- args[8]
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
247 }
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
248
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
249 flowFrameOrFCS(args[1], args[2], columns, cluster, xgrid, ygrid, plot, plot_pdf,
54a25f1139b4 "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowsom_tree commit b183455dde52e5b870fe898df9863b924e5370bd"
azomics
parents:
diff changeset
250 mplot, flag_default, table, mtable, flag_meta, seed, nodesize)