... | ... |
@@ -25,18 +25,14 @@ Imports: |
25 | 25 |
graph, |
26 | 26 |
graphics, |
27 | 27 |
utils, |
28 |
- base64enc, |
|
28 |
+ jsonlite, |
|
29 | 29 |
dplyr, |
30 | 30 |
grDevices, |
31 | 31 |
methods, |
32 | 32 |
ggcyto (>= 1.11.4), |
33 | 33 |
yaml, |
34 |
- lattice, |
|
35 | 34 |
stats, |
36 |
- corpcor, |
|
37 |
- RUnit, |
|
38 |
- tibble, |
|
39 |
- xml2 |
|
35 |
+ tibble |
|
40 | 36 |
biocViews: ImmunoOncology, FlowCytometry, DataImport, DataRepresentation |
41 | 37 |
LinkingTo: cpp11, BH(>= 1.62.0-1), RProtoBufLib, cytolib, Rhdf5lib, flowWorkspace |
42 | 38 |
Suggests: |
... | ... |
@@ -70,6 +66,5 @@ Collate: |
70 | 66 |
'transforms.R' |
71 | 67 |
'utils.R' |
72 | 68 |
'writeGatingML.R' |
73 |
- 'zzz.R' |
|
74 | 69 |
SystemRequirements: xml2, GNU make, C++11 |
75 | 70 |
Encoding: UTF-8 |
... | ... |
@@ -6,8 +6,6 @@ S3method(extend,ellipsoidGate) |
6 | 6 |
S3method(extend,polygonGate) |
7 | 7 |
S3method(extend,rectangleGate) |
8 | 8 |
S3method(print,cytobank_experiment) |
9 |
-export(CytoML.par.get) |
|
10 |
-export(CytoML.par.set) |
|
11 | 9 |
export(GatingSet2cytobank) |
12 | 10 |
export(GatingSet2flowJo) |
13 | 11 |
export(ce_get_channels) |
... | ... |
@@ -84,11 +82,10 @@ importFrom(XML,xmlTreeParse) |
84 | 82 |
importFrom(XML,xmlValue) |
85 | 83 |
importFrom(XML,xpathApply) |
86 | 84 |
importFrom(XML,xpathSApply) |
87 |
-importFrom(base64enc,base64decode) |
|
88 |
-importFrom(base64enc,base64encode) |
|
89 | 85 |
importFrom(cytolib,cytolib_LdFlags) |
90 | 86 |
importFrom(dplyr,"%>%") |
91 | 87 |
importFrom(dplyr,arrange) |
88 |
+importFrom(dplyr,bind_rows) |
|
92 | 89 |
importFrom(dplyr,count) |
93 | 90 |
importFrom(dplyr,enquo) |
94 | 91 |
importFrom(dplyr,filter) |
... | ... |
@@ -189,6 +186,8 @@ importFrom(graph,removeNode) |
189 | 186 |
importFrom(graphics,abline) |
190 | 187 |
importFrom(graphics,polygon) |
191 | 188 |
importFrom(graphics,text) |
189 |
+importFrom(jsonlite,base64_dec) |
|
190 |
+importFrom(jsonlite,base64_enc) |
|
192 | 191 |
importFrom(jsonlite,fromJSON) |
193 | 192 |
importFrom(jsonlite,toJSON) |
194 | 193 |
importFrom(methods,as) |
... | ... |
@@ -202,9 +201,5 @@ importFrom(tibble,tibble) |
202 | 201 |
importFrom(utils,localeToCharset) |
203 | 202 |
importFrom(utils,menu) |
204 | 203 |
importFrom(utils,packageVersion) |
205 |
-importFrom(xml2,read_xml) |
|
206 |
-importFrom(xml2,write_xml) |
|
207 |
-importFrom(xml2,xml_add_sibling) |
|
208 |
-importFrom(xml2,xml_comment) |
|
209 | 204 |
importFrom(yaml,read_yaml) |
210 | 205 |
useDynLib(CytoML,.registration = TRUE) |
... | ... |
@@ -174,9 +174,9 @@ export_gates_cytobank <- function(gs, flowEnv, trans.Gm2objs, trans, compId, sho |
174 | 174 |
} |
175 | 175 |
|
176 | 176 |
|
177 |
-#' @importFrom base64enc base64encode base64decode |
|
177 |
+#' @importFrom jsonlite base64_enc base64_dec |
|
178 | 178 |
base64encode_cytobank <- function(x){ |
179 |
- x <- base64encode(charToRaw(x)) |
|
179 |
+ x <- base64_enc(charToRaw(x)) |
|
180 | 180 |
x <- gsub("=", ".", x) |
181 | 181 |
x <- gsub("\\+", "_", x) |
182 | 182 |
x <- gsub("/", "-", x) |
... | ... |
@@ -186,7 +186,7 @@ base64decode_cytobank <- function(x){ |
186 | 186 |
x <- gsub("\\.", "=", x) |
187 | 187 |
x <- gsub("_", "\\+", x) |
188 | 188 |
x <- gsub("-", "/", x) |
189 |
- base64decode(x) |
|
189 |
+ base64_dec(x) |
|
190 | 190 |
} |
191 | 191 |
|
192 | 192 |
|
... | ... |
@@ -47,7 +47,6 @@ GatingSet2flowJo <- function(...){ |
47 | 47 |
#' @importFrom flowWorkspace gs_clone gs_update_channels pData<- cs_unlock cs_lock gs_copy_tree_only cs_load_meta |
48 | 48 |
#' @export |
49 | 49 |
#' @rdname gatingset_to_flowjo |
50 |
-#' @importFrom xml2 read_xml write_xml |
|
51 | 50 |
gatingset_to_flowjo <- function(gs, outFile, showHidden = FALSE, docker_img = NULL, ...){ |
52 | 51 |
res <- check_binary_status() |
53 | 52 |
if(res!="binary_ok"){ |
... | ... |
@@ -93,24 +92,13 @@ gatingset_to_flowjo <- function(gs, outFile, showHidden = FALSE, docker_img = NU |
93 | 92 |
|
94 | 93 |
if(length(res) > 0) |
95 | 94 |
stop(res) |
96 |
- else |
|
97 |
- { |
|
98 |
- tree <- read_xml(tmpfile) |
|
99 |
- add_version_info(tree) |
|
100 |
- invisible(write_xml(tree, file = outFile)) |
|
101 |
- |
|
95 |
+ else { |
|
96 |
+ file.rename(tmpfile, outFile) |
|
102 | 97 |
} |
103 | 98 |
|
104 | 99 |
} |
105 | 100 |
|
106 |
-#' @importFrom xml2 xml_comment xml_add_sibling |
|
107 |
-add_version_info <- function(tree) |
|
108 |
-{ |
|
109 |
- info <- Sys.info() |
|
110 |
- xml_add_sibling(tree, xml_comment(paste0("CytoML-version: ", packageVersion("CytoML"))), .where = "before") |
|
111 |
- xml_add_sibling(tree, xml_comment(paste0("hostname: ", info[["nodename"]])), .where = "before") |
|
112 |
- xml_add_sibling(tree, xml_comment(paste0("user: ", info[["user"]])), .where = "before") |
|
113 |
-} |
|
101 |
+ |
|
114 | 102 |
check_docker_status <- function(docker_img = NULL){ |
115 | 103 |
if(Sys.info()["sysname"] == "Windows") |
116 | 104 |
errcode <- system2("WHERE", "docker", stdout = FALSE) |
299 | 300 |
deleted file mode 100644 |
... | ... |
@@ -1,106 +0,0 @@ |
1 |
-## Store state info in this internal global environment |
|
2 |
-CytoML.state <- new.env(hash = FALSE) |
|
3 |
-CytoML.state[["par"]] <- list() |
|
4 |
- |
|
5 |
-#' workspace version is parsed from xml node '/Workspace/version' in flowJo workspace |
|
6 |
-#' and matched with this list to dispatch to the one of the three workspace parsers |
|
7 |
-CytoML.par.init <- function(){ |
|
8 |
- |
|
9 |
- fj_ver <- list(win = c("1.61", "1.6") |
|
10 |
- , macII = c("2.0") |
|
11 |
- , macIII = c("3.0") |
|
12 |
- , vX = c("1.8", "20.0") |
|
13 |
- ) |
|
14 |
- |
|
15 |
- mac_II_path <- list(group = "/Workspace/Groups/GroupNode"# abs path |
|
16 |
- , sampleRef = ".//SampleRefs/SampleRef"#relative GroupNode |
|
17 |
- , sample = "/Workspace/SampleList/Sample"#abs path |
|
18 |
- , sampleNode = "./SampleNode"#relative to sample |
|
19 |
- , popNode = "./Population"#relative to sampleNode |
|
20 |
- , attrName = "name" |
|
21 |
- , compMatName = "name" |
|
22 |
- , compMatChName = "name" |
|
23 |
- , compMatVal = "value" |
|
24 |
- ) |
|
25 |
- mac_II_path[["sampleID"]] <- mac_II_path[["sample"]] |
|
26 |
- |
|
27 |
- #mac version 3.0 (flowJo version 9.7.2-9.7.4) |
|
28 |
- mac_III_path <- mac_II_path |
|
29 |
- mac_III_path[["sample"]] <- sub("SampleList", "Samples", mac_III_path[["sample"]]) |
|
30 |
- mac_III_path[["attrName"]] <- "nodeName" |
|
31 |
- mac_III_path[["compMatName"]] <- "matrixName" |
|
32 |
- mac_III_path[["compMatChName"]] <- "fluorName" |
|
33 |
- mac_III_path[["compMatVal"]] <- "spillValue" |
|
34 |
- mac_III_path[["sampleID"]] <- mac_III_path[["sample"]] |
|
35 |
- ####windows version |
|
36 |
- #inherit most paths from mac |
|
37 |
- win_path <- mac_II_path |
|
38 |
- win_path[["popNode"]] <- "./*/Population" |
|
39 |
- win_path[["gateDim"]] <- "*[local-name()='dimension']"#relative to gateNode |
|
40 |
- win_path[["gateParam"]] <- "*[local-name()='parameter']"#relative to dimNode |
|
41 |
- win_path[["sampleID"]] <- file.path(win_path[["sample"]],"DataSet") |
|
42 |
- |
|
43 |
- ####version X |
|
44 |
- #inherit most paths from win |
|
45 |
- vX_path <- win_path |
|
46 |
- vX_path[["gateParam"]] <- "*[local-name()='fcs-dimension']"; |
|
47 |
- |
|
48 |
- CytoML.state[["par"]] <- list(flowJo_versions = fj_ver |
|
49 |
- , nodePath = list(win = win_path |
|
50 |
- , macII = mac_II_path |
|
51 |
- , macIII = mac_III_path |
|
52 |
- , vX = vX_path |
|
53 |
- ) |
|
54 |
- ) |
|
55 |
- |
|
56 |
-} |
|
57 |
- |
|
58 |
-## call the init function |
|
59 |
-CytoML.par.init() |
|
60 |
- |
|
61 |
-#' CytoML.par.set sets a set of parameters in the CytoML package namespace. |
|
62 |
-#' |
|
63 |
-#' @param value A named list of values to set for category name or a list of such lists if name is missing. |
|
64 |
-#' @rdname CytoML.par.get |
|
65 |
-#' @export |
|
66 |
-CytoML.par.set <- function (name, value) |
|
67 |
-{ |
|
68 |
- old <- CytoML.state[["par"]] |
|
69 |
- if(name%in%names(old)){ |
|
70 |
- CytoML.state[["par"]][[name]] <- lattice:::updateList(old[[name]], value) |
|
71 |
- }else |
|
72 |
- stop(name, " is not a valid CytoML parameters!") |
|
73 |
- |
|
74 |
- invisible() |
|
75 |
-} |
|
76 |
- |
|
77 |
-#' Query and set session-wide parameter defaults. |
|
78 |
-#' |
|
79 |
-#' CytoML.par.get gets a set of parameters in the CytoML package namespace. |
|
80 |
-#' |
|
81 |
-#' It is currently used to add/remove the support for a specific flowJo versions (parsed from xml node '/Workspace/version' in flowJo workspace) |
|
82 |
-#' |
|
83 |
-#' @param name The name of a parameter category to get or set. |
|
84 |
-#' |
|
85 |
-#' |
|
86 |
-#' @examples |
|
87 |
-#' #get the flowJo versions currently supported |
|
88 |
-#' old <- CytoML.par.get("flowJo_versions") |
|
89 |
-#' |
|
90 |
-#' #add the new version |
|
91 |
-#' old[["win"]] <- c(old[["win"]], "1.7") |
|
92 |
-#' CytoML.par.set("flowJo_versions", old) |
|
93 |
-#' |
|
94 |
-#' CytoML.par.get("flowJo_versions") |
|
95 |
-#' |
|
96 |
-#' @export |
|
97 |
-#' @rdname CytoML.par.get |
|
98 |
-CytoML.par.get <- function (name = NULL) |
|
99 |
-{ |
|
100 |
- lPars <- CytoML.state[["par"]] |
|
101 |
- if (is.null(name)) |
|
102 |
- lPars |
|
103 |
- else if (name %in% names(lPars)) |
|
104 |
- lPars[[name]] |
|
105 |
- else NULL |
|
106 |
-} |
107 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,33 +0,0 @@ |
1 |
-% Generated by roxygen2: do not edit by hand |
|
2 |
-% Please edit documentation in R/zzz.R |
|
3 |
-\name{CytoML.par.set} |
|
4 |
-\alias{CytoML.par.set} |
|
5 |
-\alias{CytoML.par.get} |
|
6 |
-\title{CytoML.par.set sets a set of parameters in the CytoML package namespace.} |
|
7 |
-\usage{ |
|
8 |
-CytoML.par.set(name, value) |
|
9 |
- |
|
10 |
-CytoML.par.get(name = NULL) |
|
11 |
-} |
|
12 |
-\arguments{ |
|
13 |
-\item{name}{The name of a parameter category to get or set.} |
|
14 |
- |
|
15 |
-\item{value}{A named list of values to set for category name or a list of such lists if name is missing.} |
|
16 |
-} |
|
17 |
-\description{ |
|
18 |
-CytoML.par.get gets a set of parameters in the CytoML package namespace. |
|
19 |
-} |
|
20 |
-\details{ |
|
21 |
-It is currently used to add/remove the support for a specific flowJo versions (parsed from xml node '/Workspace/version' in flowJo workspace) |
|
22 |
-} |
|
23 |
-\examples{ |
|
24 |
- #get the flowJo versions currently supported |
|
25 |
- old <- CytoML.par.get("flowJo_versions") |
|
26 |
- |
|
27 |
- #add the new version |
|
28 |
- old[["win"]] <- c(old[["win"]], "1.7") |
|
29 |
- CytoML.par.set("flowJo_versions", old) |
|
30 |
- |
|
31 |
- CytoML.par.get("flowJo_versions") |
|
32 |
- |
|
33 |
-} |
34 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,13 +0,0 @@ |
1 |
-% Generated by roxygen2: do not edit by hand |
|
2 |
-% Please edit documentation in R/zzz.R |
|
3 |
-\name{CytoML.par.init} |
|
4 |
-\alias{CytoML.par.init} |
|
5 |
-\title{workspace version is parsed from xml node '/Workspace/version' in flowJo workspace |
|
6 |
-and matched with this list to dispatch to the one of the three workspace parsers} |
|
7 |
-\usage{ |
|
8 |
-CytoML.par.init() |
|
9 |
-} |
|
10 |
-\description{ |
|
11 |
-workspace version is parsed from xml node '/Workspace/version' in flowJo workspace |
|
12 |
-and matched with this list to dispatch to the one of the three workspace parsers |
|
13 |
-} |