... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Package: RGMQL |
2 | 2 |
Type: Package |
3 | 3 |
Title: GenoMetric Query Language for R/Bioconductor |
4 |
-Version: 0.99.36 |
|
4 |
+Version: 0.99.37 |
|
5 | 5 |
Author: Simone Pallotta, Marco Masseroli |
6 | 6 |
Maintainer: Simone Pallotta <simonepallotta@hotmail.com> |
7 | 7 |
Description: This package brings the GenoMetric Query Language (GMQL) |
... | ... |
@@ -82,7 +82,6 @@ biocViews: |
82 | 82 |
Collate: |
83 | 83 |
'AllClasses.R' |
84 | 84 |
'AllGenerics.R' |
85 |
- 'GMQL4TFarm.R' |
|
86 | 85 |
'GMQLtoGRanges.R' |
87 | 86 |
'GRangesToGMQL.R' |
88 | 87 |
'S3Aggregates.R' |
... | ... |
@@ -91,6 +90,7 @@ Collate: |
91 | 90 |
'S3Operator.R' |
92 | 91 |
'Utils.R' |
93 | 92 |
'evaluation-functions.R' |
93 |
+ 'filter-extract-function.R' |
|
94 | 94 |
'gmql_cover.R' |
95 | 95 |
'gmql_difference.R' |
96 | 96 |
'gmql_extend.R' |
... | ... |
@@ -29,7 +29,6 @@ export(SQRT) |
29 | 29 |
export(STD) |
30 | 30 |
export(SUM) |
31 | 31 |
export(UP) |
32 |
-export(collect) |
|
33 | 32 |
export(compile_query) |
34 | 33 |
export(compile_query_fromfile) |
35 | 34 |
export(delete_dataset) |
... | ... |
@@ -86,8 +85,12 @@ importFrom(S4Vectors,aggregate) |
86 | 85 |
importFrom(S4Vectors,merge) |
87 | 86 |
importFrom(S4Vectors,metadata) |
88 | 87 |
importFrom(data.table,fread) |
88 |
+importFrom(dplyr,arrange) |
|
89 | 89 |
importFrom(dplyr,bind_cols) |
90 |
+importFrom(dplyr,collect) |
|
90 | 91 |
importFrom(dplyr,filter) |
92 |
+importFrom(dplyr,group_by) |
|
93 |
+importFrom(dplyr,select) |
|
91 | 94 |
importFrom(glue,glue) |
92 | 95 |
importFrom(methods,is) |
93 | 96 |
importFrom(methods,isClass) |
... | ... |
@@ -1,20 +1,9 @@ |
1 |
-#' Method filter |
|
2 |
-#' |
|
3 |
-#' Wrapper to GMQL select function |
|
4 |
-#' |
|
5 |
-#' @name filter |
|
6 |
-#' @rdname filter-GMQLDataset-method |
|
7 |
-#' @aliases filter |
|
8 |
-#' |
|
9 |
-setGeneric("filter", function(.data, m_predicate = NULL, r_predicate = NULL, |
|
10 |
- semijoin = NULL, ...) standardGeneric("filter")) |
|
11 |
- |
|
12 | 1 |
#' Method cover |
13 | 2 |
#' |
14 |
-#' Wrapper to GMQL cover function |
|
3 |
+#' Wrapper to GMQL COVER operator |
|
15 | 4 |
#' |
16 | 5 |
#' @name cover |
17 |
-#' @rdname cover-GMQLDataset-method |
|
6 |
+#' @rdname cover |
|
18 | 7 |
#' @aliases cover |
19 | 8 |
#' |
20 | 9 |
setGeneric("cover", function(data, ...) standardGeneric("cover")) |
... | ... |
@@ -24,29 +13,20 @@ setGeneric("cover", function(data, ...) standardGeneric("cover")) |
24 | 13 |
#' Wrapper to GMQL map function |
25 | 14 |
#' |
26 | 15 |
#' @name map |
27 |
-#' @rdname map-GMQLDataset-method |
|
28 |
-#' @aliases map |
|
16 |
+#' @rdname map |
|
17 |
+#' @aliases map,GMQLDataset-method |
|
29 | 18 |
#' |
30 | 19 |
setGeneric("map", function(x, y, ...) standardGeneric("map")) |
31 | 20 |
|
32 | 21 |
|
33 |
-#' Method collect |
|
34 |
-#' |
|
35 |
-#' Wrapper to GMQL materialize function |
|
36 |
-#' |
|
37 |
-#' @name collect |
|
38 |
-#' @rdname collect-GMQLDataset-method |
|
39 |
-#' @export |
|
40 |
-setGeneric("collect", function(x, dir_out = getwd(), name = "ds1", ...) |
|
41 |
- standardGeneric("collect")) |
|
42 |
- |
|
43 |
- |
|
44 | 22 |
#' Method take |
45 | 23 |
#' |
46 | 24 |
#' Wrapper to take function |
47 | 25 |
#' |
48 | 26 |
#' @name take |
49 |
-#' @rdname take-GMQLDataset-method |
|
27 |
+#' @rdname take |
|
28 |
+#' @aliases take,GMQLDataset-method |
|
29 |
+#' |
|
50 | 30 |
setGeneric("take", function(data, ...) standardGeneric("take")) |
51 | 31 |
|
52 | 32 |
|
... | ... |
@@ -55,39 +35,8 @@ setGeneric("take", function(data, ...) standardGeneric("take")) |
55 | 35 |
#' Wrapper to GMQL extend function |
56 | 36 |
#' |
57 | 37 |
#' @name extend |
58 |
-#' @rdname extend-GMQLDataset-method |
|
59 |
-#' @aliases extend GMQLDataset-method |
|
60 |
-setGeneric("extend", function(.data, ...) standardGeneric("extend")) |
|
61 |
- |
|
62 |
-#' Method select |
|
38 |
+#' @rdname extend |
|
39 |
+#' @aliases extend,GMQLDataset-method |
|
63 | 40 |
#' |
64 |
-#' Wrapper to GMQL project function |
|
65 |
-#' |
|
66 |
-#' @name select |
|
67 |
-#' @rdname select-GMQLDataset-method |
|
68 |
-#' @aliases select |
|
69 |
-setGeneric("select", function(.data, ...) standardGeneric("select")) |
|
70 |
- |
|
71 |
- |
|
72 |
-#' Method arrange |
|
73 |
-#' |
|
74 |
-#' Wrapper to GMQL order function |
|
75 |
-#' |
|
76 |
-#' @name arrange |
|
77 |
-#' @rdname arrange-GMQLDataset-method |
|
78 |
-#' @aliases arrange |
|
79 |
-#' |
|
80 |
-setGeneric("arrange", function(.data, metadata_ordering = NULL, |
|
81 |
- regions_ordering = NULL, fetch_opt = NULL, num_fetch = 0, |
|
82 |
- reg_fetch_opt = NULL, reg_num_fetch = 0, ...) |
|
83 |
- standardGeneric("arrange")) |
|
84 |
- |
|
85 |
-#' Method group_by |
|
86 |
-#' |
|
87 |
-#' Wrapper to GMQL group function |
|
88 |
-#' |
|
89 |
-#' @name group_by |
|
90 |
-#' @rdname group_by-GMQLDataset-method |
|
91 |
-#' @aliases group_by |
|
92 |
-setGeneric("group_by", function(.data, ...) standardGeneric("group_by")) |
|
41 |
+setGeneric("extend", function(.data, ...) standardGeneric("extend")) |
|
93 | 42 |
|
... | ... |
@@ -158,7 +158,7 @@ take_value.META_AGGREGATES <- function(obj){ |
158 | 158 |
#' res = extend(exp, m_score = MEDIAN("score")) |
159 | 159 |
#' |
160 | 160 |
#' |
161 |
-#' @name SUM |
|
161 |
+#' @name AGGREGATES-Object |
|
162 | 162 |
#' @aliases SUM |
163 | 163 |
#' @rdname aggr-class |
164 | 164 |
#' @export |
... | ... |
@@ -173,7 +173,7 @@ SUM <- function(value) |
173 | 173 |
return(list) |
174 | 174 |
} |
175 | 175 |
|
176 |
-#' @name MIN |
|
176 |
+#' @name AGGREGATES-Object |
|
177 | 177 |
#' @aliases MIN |
178 | 178 |
#' @rdname aggr-class |
179 | 179 |
#' @export |
... | ... |
@@ -189,7 +189,7 @@ MIN <- function(value) |
189 | 189 |
} |
190 | 190 |
|
191 | 191 |
|
192 |
-#' @name MAX |
|
192 |
+#' @name AGGREGATES-Object |
|
193 | 193 |
#' @aliases MAX |
194 | 194 |
#' @rdname aggr-class |
195 | 195 |
#' @export |
... | ... |
@@ -204,7 +204,7 @@ MAX <- function(value) |
204 | 204 |
return(list) |
205 | 205 |
} |
206 | 206 |
|
207 |
-#' @name AVG |
|
207 |
+#' @name AGGREGATES-Object |
|
208 | 208 |
#' @aliases AVG |
209 | 209 |
#' @rdname aggr-class |
210 | 210 |
#' @export |
... | ... |
@@ -219,7 +219,7 @@ AVG <- function(value) |
219 | 219 |
return(list) |
220 | 220 |
} |
221 | 221 |
|
222 |
-#' @name BAG |
|
222 |
+#' @name AGGREGATES-Object |
|
223 | 223 |
#' @aliases BAG |
224 | 224 |
#' @rdname aggr-class |
225 | 225 |
#' @export |
... | ... |
@@ -234,7 +234,7 @@ BAG <- function(value) |
234 | 234 |
return(list) |
235 | 235 |
} |
236 | 236 |
|
237 |
-#' @name COUNT |
|
237 |
+#' @name AGGREGATES-Object |
|
238 | 238 |
#' @aliases COUNT |
239 | 239 |
#' @rdname aggr-class |
240 | 240 |
#' @export |
... | ... |
@@ -252,7 +252,7 @@ as.character.COUNT <- function(obj) { |
252 | 252 |
} |
253 | 253 |
check.COUNT <- function(obj){} |
254 | 254 |
|
255 |
-#' @name STD |
|
255 |
+#' @name AGGREGATES-Object |
|
256 | 256 |
#' @aliases STD |
257 | 257 |
#' @rdname aggr-class |
258 | 258 |
#' @export |
... | ... |
@@ -268,7 +268,7 @@ STD <- function(value) |
268 | 268 |
} |
269 | 269 |
|
270 | 270 |
|
271 |
-#' @name MEDIAN |
|
271 |
+#' @name AGGREGATES-Object |
|
272 | 272 |
#' @aliases MEDIAN |
273 | 273 |
#' @rdname aggr-class |
274 | 274 |
#' @export |
... | ... |
@@ -283,7 +283,7 @@ MEDIAN <- function(value) |
283 | 283 |
return(list) |
284 | 284 |
} |
285 | 285 |
|
286 |
-#' @name Q1 |
|
286 |
+#' @name AGGREGATES-Object |
|
287 | 287 |
#' @aliases Q1 |
288 | 288 |
#' @rdname aggr-class |
289 | 289 |
#' @export |
... | ... |
@@ -298,7 +298,7 @@ Q1 <- function(value) |
298 | 298 |
return(list) |
299 | 299 |
} |
300 | 300 |
|
301 |
-#' @name Q2 |
|
301 |
+#' @name AGGREGATES-Object |
|
302 | 302 |
#' @aliases Q2 |
303 | 303 |
#' @rdname aggr-class |
304 | 304 |
#' @export |
... | ... |
@@ -312,7 +312,7 @@ Q2 <- function(value) |
312 | 312 |
return(list) |
313 | 313 |
} |
314 | 314 |
|
315 |
-#' @name Q3 |
|
315 |
+#' @name AGGREGATES-Object |
|
316 | 316 |
#' @aliases Q3 |
317 | 317 |
#' @rdname aggr-class |
318 | 318 |
#' @export |
... | ... |
@@ -327,7 +327,7 @@ Q3 <- function(value) |
327 | 327 |
return(list) |
328 | 328 |
} |
329 | 329 |
|
330 |
-#' @name BAGD |
|
330 |
+#' @name AGGREGATES-Object |
|
331 | 331 |
#' @aliases BAGD |
332 | 332 |
#' @rdname aggr-class |
333 | 333 |
#' @export |
... | ... |
@@ -25,34 +25,48 @@ print.PARAMETER <- function(obj){ |
25 | 25 |
#' to be used in GMQL cover method |
26 | 26 |
#' |
27 | 27 |
#' \itemize{ |
28 |
-#' \item{ANY: It defines any amount of overlapping regions to be considered.} |
|
29 |
-#' \item{ALL: It defines the minimum (and/or maximum) to the number of samples |
|
30 |
-#' in the input dataset.} |
|
28 |
+#' \item{ALL: It represents the number of samples in the input dataset.} |
|
29 |
+#' \item{ANY: It represents any amount of overlapping regions to be |
|
30 |
+#' considered.} |
|
31 | 31 |
#' } |
32 | 32 |
#' |
33 |
-#' @return param object |
|
33 |
+#' @return Param object |
|
34 | 34 |
#' |
35 | 35 |
#' @examples |
36 | 36 |
#' |
37 |
+#' ## This statement initializes and runs the GMQL server for local execution |
|
38 |
+#' ## and creation of results on disk. Then, with system.file() it defines |
|
39 |
+#' ## the path to the file "DATASET" in the subdirectory "example" |
|
40 |
+#' ## of the package "RGMQL" and opens such file as a GMQL dataset named "exp" |
|
41 |
+#' ## using customParser |
|
42 |
+#' |
|
37 | 43 |
#' init_gmql() |
38 | 44 |
#' test_path <- system.file("example", "DATASET", package = "RGMQL") |
39 | 45 |
#' exp = read_dataset(test_path) |
40 | 46 |
#' |
41 |
-#' ## This statement produces an output dataset with a single output sample. |
|
42 |
-#' ## The COVER operation considers all areas defined by a minimum |
|
43 |
-#' ## of two overlapping regions in the input samples, |
|
44 |
-#' ## up to maximum amount of overlapping regions. |
|
47 |
+#' ## The following statement produces an output dataset with a single |
|
48 |
+#' ## output sample. The COVER operation considers all areas defined by |
|
49 |
+#' ## a minimum of two overlapping regions in the input samples, |
|
50 |
+#' ## up to maximum amount of overlapping regions equal to the number |
|
51 |
+#' ## of input samples. |
|
45 | 52 |
#' |
46 | 53 |
#' res = cover(exp, 2, ALL()) |
47 | 54 |
#' |
48 |
-#' ## This statement produces an output dataset with a single output sample. |
|
49 |
-#' ## The COVER operation considers all areas defined by a minimum |
|
50 |
-#' ## of two overlapping regions in the input samples, |
|
55 |
+#' ## The following statement produces an output dataset with a single |
|
56 |
+#' ## output sample. The COVER operation considers all areas defined by |
|
57 |
+#' ## a minimum of two overlapping regions in the input samples, |
|
58 |
+#' ## up to any amount of overlapping regions. |
|
59 |
+#' |
|
60 |
+#' res = cover(exp, 2, ANY()) |
|
61 |
+#' |
|
62 |
+#' ## The following statement produces an output dataset with a single |
|
63 |
+#' ## output sample. The COVER operation considers all areas defined by |
|
64 |
+#' ## a half of maximum amount of overlapping regions in the input samples, |
|
51 | 65 |
#' ## up to any amount of overlapping regions. |
52 | 66 |
#' |
53 |
-#' res = cover(exp, 2, ANY()+2/3) |
|
67 |
+#' res = cover(exp, ALL()/2, ANY()) |
|
54 | 68 |
#' |
55 |
-#' @name ALL |
|
69 |
+#' @name Cover-Param |
|
56 | 70 |
#' @aliases ALL |
57 | 71 |
#' @rdname cover-param-class |
58 | 72 |
#' @export |
... | ... |
@@ -65,7 +79,7 @@ ALL <- function() |
65 | 79 |
return(list) |
66 | 80 |
} |
67 | 81 |
|
68 |
-#' @name ANY |
|
82 |
+#' @name Cover-Param |
|
69 | 83 |
#' @aliases ANY |
70 | 84 |
#' @rdname cover-param-class |
71 | 85 |
#' @export |
... | ... |
@@ -101,7 +101,7 @@ check.DISTAL <- function(value) |
101 | 101 |
#' genometric_predicate = list(MD(1), DGE(12000), DOWN()), |
102 | 102 |
#' DF("provider"), region_output = "RIGHT") |
103 | 103 |
#' |
104 |
-#' @name DL |
|
104 |
+#' @name DISTAL-Object |
|
105 | 105 |
#' @aliases DL |
106 | 106 |
#' @rdname distal-class |
107 | 107 |
#' @export |
... | ... |
@@ -129,7 +129,7 @@ DG <- function(value) |
129 | 129 |
return(list) |
130 | 130 |
} |
131 | 131 |
|
132 |
-#' @name DLE |
|
132 |
+#' @name DISTAL-Object |
|
133 | 133 |
#' @aliases DLE |
134 | 134 |
#' @rdname distal-class |
135 | 135 |
#' @export |
... | ... |
@@ -143,7 +143,7 @@ DLE <- function(value) |
143 | 143 |
return(list) |
144 | 144 |
} |
145 | 145 |
|
146 |
-#' @name DGE |
|
146 |
+#' @name DISTAL-Object |
|
147 | 147 |
#' @aliases DGE |
148 | 148 |
#' @rdname distal-class |
149 | 149 |
#' @export |
... | ... |
@@ -157,7 +157,7 @@ DGE <- function(value) |
157 | 157 |
return(list) |
158 | 158 |
} |
159 | 159 |
|
160 |
-#' @name MD |
|
160 |
+#' @name DISTAL-Object |
|
161 | 161 |
#' @aliases MD |
162 | 162 |
#' @rdname distal-class |
163 | 163 |
#' @export |
... | ... |
@@ -172,7 +172,7 @@ MD <- function(value) |
172 | 172 |
} |
173 | 173 |
|
174 | 174 |
|
175 |
-#' @name UP |
|
175 |
+#' @name DISTAL-Object |
|
176 | 176 |
#' @aliases UP |
177 | 177 |
#' @rdname distal-class |
178 | 178 |
#' @export |
... | ... |
@@ -190,7 +190,7 @@ as.character.UP <- function(obj) { |
190 | 190 |
} |
191 | 191 |
|
192 | 192 |
|
193 |
-#' @name DOWN |
|
193 |
+#' @name DISTAL-Object |
|
194 | 194 |
#' @aliases DOWN |
195 | 195 |
#' @rdname distal-class |
196 | 196 |
#' @export |
... | ... |
@@ -87,7 +87,7 @@ as.character.OPERATOR <- function(obj) { |
87 | 87 |
#' exp = read_dataset(test_path) |
88 | 88 |
#' out = select(exp, metadata_update = list(concSq = SQRT("concentration"))) |
89 | 89 |
#' |
90 |
-#' @name META |
|
90 |
+#' @name OPERATOR-Object |
|
91 | 91 |
#' @aliases META |
92 | 92 |
#' @rdname operator-class |
93 | 93 |
#' @export |
... | ... |
@@ -123,7 +123,7 @@ check.META <- function(type) |
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
|
126 |
-#' @name NIL |
|
126 |
+#' @name OPERATOR-Object |
|
127 | 127 |
#' @aliases NIL |
128 | 128 |
#' @rdname operator-class |
129 | 129 |
#' @export |
... | ... |
@@ -147,7 +147,7 @@ check.NIL <- function(value) |
147 | 147 |
|
148 | 148 |
} |
149 | 149 |
|
150 |
-#' @name SQRT |
|
150 |
+#' @name OPERATOR-Object |
|
151 | 151 |
#' @aliases SQRT |
152 | 152 |
#' @rdname operator-class |
153 | 153 |
#' @export |
... | ... |
@@ -4,9 +4,9 @@ |
4 | 4 |
|
5 | 5 |
#' Condition evaluation functions |
6 | 6 |
#' |
7 |
-#' These functions is used to support joinBy and/or groupBy function parameter. |
|
7 |
+#' These functions are used to support joinBy and/or groupBy function parameter. |
|
8 | 8 |
#' It create a list of one element: matrix containing the two coloumn: |
9 |
-#' type of condition evaluation and the metadata attribute |
|
9 |
+#' type of condition evaluation and the metadata attribute name |
|
10 | 10 |
#' |
11 | 11 |
#' \itemize{ |
12 | 12 |
#' \item{FN: It defines a FULL (FULLNAME) evaluation of the input values. |
... | ... |
@@ -26,11 +26,9 @@ |
26 | 26 |
#' |
27 | 27 |
#' @examples |
28 | 28 |
#' |
29 |
-#' init_gmql() |
|
30 |
-#' test_path <- system.file("example", "DATASET", package = "RGMQL") |
|
31 |
-#' r = read_dataset(test_path) |
|
29 |
+#' "where is my example?" |
|
32 | 30 |
#' |
33 |
-#' @name FN |
|
31 |
+#' @name Evaluation-Function |
|
34 | 32 |
#' @aliases FN |
35 | 33 |
#' @rdname condition_eval_func |
36 | 34 |
#' @export |
... | ... |
@@ -51,7 +49,7 @@ FN <- function(...) |
51 | 49 |
join_condition_matrix |
52 | 50 |
} |
53 | 51 |
|
54 |
-#' @name EX |
|
52 |
+#' @name Evaluation-Function |
|
55 | 53 |
#' @aliases EX |
56 | 54 |
#' @rdname condition_eval_func |
57 | 55 |
#' @export |
... | ... |
@@ -72,7 +70,7 @@ EX <- function(...) |
72 | 70 |
join_condition_matrix |
73 | 71 |
} |
74 | 72 |
|
75 |
-#' @name DF |
|
73 |
+#' @name Evaluation-Function |
|
76 | 74 |
#' @aliases DF |
77 | 75 |
#' @rdname condition_eval_func |
78 | 76 |
#' @export |
79 | 77 |
similarity index 86% |
80 | 78 |
rename from R/GMQL4TFarm.R |
81 | 79 |
rename to R/filter-extract-function.R |
... | ... |
@@ -1,44 +1,44 @@ |
1 |
-#' FILTER AND EXTRACT |
|
1 |
+#' Filter and extract function |
|
2 | 2 |
#' |
3 |
-#' This function let user to create a new GRangeslist with fixed information: |
|
4 |
-#' seqnames,ranges ans strand and a variable part made up by the regions |
|
5 |
-#' defined as input. |
|
6 |
-#' The metadata and metadata_prefix are used to filter the data and choose |
|
7 |
-#' only the samples that match at least one metdatata with its prefix. |
|
8 |
-#' The input regions are shown for each sample obtained from filtering. |
|
3 |
+#' This function lets user to create a new GRangesList with fixed information: |
|
4 |
+#' seqnames, ranges and strand, and a variable part made up by the regions |
|
5 |
+#' defined as input. The metadata and metadata_prefix are used to filter |
|
6 |
+#' the data and choose only the samples that match at least one metdatata |
|
7 |
+#' with its prefix. The input regions are shown for each sample obtained |
|
8 |
+#' from filtering. |
|
9 | 9 |
#' |
10 | 10 |
#' @import xml2 |
11 | 11 |
#' @importFrom dplyr bind_cols |
12 | 12 |
#' @importFrom data.table fread |
13 | 13 |
#' @importFrom rtracklayer import |
14 | 14 |
#' |
15 |
-#' @param data string GMQL dataset folder path or GrangesList |
|
15 |
+#' @param data string GMQL dataset folder path or GRangesList |
|
16 | 16 |
#' object |
17 |
-#' @param metadata vector of character containing names of metadata |
|
17 |
+#' @param metadata vector of strings containing names of metadata attributes |
|
18 | 18 |
#' to be searched for in metadata files. |
19 |
-#' data will be extracted if at least one condition is satisfied: |
|
20 |
-#' this condition will be logically "ANDed" with prefix filtering (see below) |
|
21 |
-#' if NULL no filtering action occured |
|
22 |
-#' (i.e every sample will be taken for regions filtering) |
|
23 |
-#' @param metadata_prefix vector of character that will filter metadata |
|
19 |
+#' Data will be extracted if at least one condition is satisfied: |
|
20 |
+#' this condition is logically "ANDed" with prefix filtering (see below) |
|
21 |
+#' if NULL no filtering action occures |
|
22 |
+#' (i.e every sample is taken for region filtering) |
|
23 |
+#' @param metadata_prefix vector of strings that will filter metadata |
|
24 | 24 |
#' containing rispectively every element of this vector. |
25 |
-#' number of elelment in both vector must match |
|
26 |
-#' @param regions vector of character that will extract only region |
|
27 |
-#' attribute specified; if NULL no regions will be taken and the output |
|
28 |
-#' will be only GRanges made up by the first attribute |
|
29 |
-#' (seqnames,start,end,strand) |
|
25 |
+#' number of element in both vector must match |
|
26 |
+#' @param regions vector of strings that extracts only region attribute |
|
27 |
+#' specified; if NULL no regions attribute is taken and the output is only |
|
28 |
+#' GRanges made up by the region coordinate attributes |
|
29 |
+#' (seqnames, start, end, strand) |
|
30 | 30 |
#' @param suffix name for each metadata column of GRanges. by default is the |
31 | 31 |
#' "antibody_target". This string is taken from sample metadata file or from |
32 | 32 |
#' metadata() associated. If not present, the column name is the name of |
33 | 33 |
#' selected regions |
34 | 34 |
#' |
35 | 35 |
#' @details |
36 |
-#' This function works only with datatset or Grangeslist that have the same |
|
36 |
+#' This function works only with datatset or GRangesList that has the same |
|
37 | 37 |
#' information about regions attribute (but of course different value) |
38 | 38 |
#' In case of Grangeslist data input the function will search for metadata |
39 | 39 |
#' into metadata() function associated to Grangeslist. |
40 | 40 |
#' |
41 |
-#' @return granges with selected regions (if any) in elementMetadata |
|
41 |
+#' @return Granges with selected regions (if any) in elementMetadata |
|
42 | 42 |
#' |
43 | 43 |
#' @examples |
44 | 44 |
#' |
... | ... |
@@ -5,14 +5,15 @@ |
5 | 5 |
#' specified) by “collapsing” the input dataset samples and their regions |
6 | 6 |
#' according to certain rules specified by the input parameters. |
7 | 7 |
#' The attributes of the output genomic regions are only the region |
8 |
-#' coordinates, and Jaccard indexes (JaccardIntersect and JaccardResult). |
|
8 |
+#' coordinates, and Jaccard indexes (\emph{JaccardIntersect} and |
|
9 |
+#' \emph{JaccardResult}). |
|
9 | 10 |
#' Jaccard Indexes are standard measures of similarity of the contributing |
10 | 11 |
#' regions, added as default region attributes. |
11 | 12 |
#' The JaccardIntersect index is calculated as the ratio between the lengths |
12 | 13 |
#' of the intersection and of the union of the contributing regions; |
13 | 14 |
#' the JaccardResult index is calculated as the ratio between the lengths |
14 | 15 |
#' of the result and the union of the contributing regions. |
15 |
-#' If aggregate functions are specified, a new attributes is added for |
|
16 |
+#' If aggregate functions are specified, a new attribute is added for |
|
16 | 17 |
#' each aggregate function specified. |
17 | 18 |
#' Output metadata are the union of the input ones. |
18 | 19 |
#' If \emph{groupby} clause is specified, the input samples are partitioned |
... | ... |
@@ -24,54 +25,47 @@ |
24 | 25 |
#' |
25 | 26 |
#' @include AllClasses.R |
26 | 27 |
#' @importFrom methods is |
27 |
-#' @importFrom rJava J |
|
28 |
-#' @importFrom rJava .jnull |
|
29 |
-#' @importFrom rJava .jarray |
|
28 |
+#' @importFrom rJava J .jnull .jarray |
|
30 | 29 |
#' |
31 | 30 |
#' @param data GMQLDataset class object |
32 | 31 |
#' @param min_acc minimum number of overlapping regions to be considered |
33 |
-#' during execution |
|
34 |
-#' Is a integer number, declared also as string. |
|
35 |
-#' minAcc accept also: |
|
32 |
+#' during execution. It is an integer number, declared also as string. |
|
33 |
+#' minAcc accepts also: |
|
36 | 34 |
#' \itemize{ |
37 |
-#' \item{PARAMETER class object: \code{\link{ALL}} that represents the number |
|
35 |
+#' \item{PARAMETER class object: \code{\link{ALL}}, that represents the number |
|
38 | 36 |
#' of samples in the input dataset} |
39 |
-#' \item{and expression built using PARAMETER object: (ALL() + N) / K or |
|
40 |
-#' ALL() / K } |
|
37 |
+#' \item{an expression built using PARAMETER object: (ALL() + N) / K or |
|
38 |
+#' ALL() / K, with N and K integer values } |
|
41 | 39 |
#' } |
42 | 40 |
#' @param max_acc maximum number of overlapping regions to be considered |
43 |
-#' during execution |
|
44 |
-#' Is a integer number, declared also as string. |
|
41 |
+#' during execution. It is an integer number, declared also as string. |
|
45 | 42 |
#' maxAcc accept also: |
46 | 43 |
#' \itemize{ |
47 |
-#' \item{PARAMETER class object: \code{\link{ALL}} that represents the number |
|
44 |
+#' \item{PARAMETER class object: \code{\link{ALL}}, that represents the number |
|
48 | 45 |
#' of samples in the input dataset} |
49 |
-#' \item{PARAMETER calss object: \code{\link{ANY}}} that acts as a wildcard, |
|
50 |
-#' considering any amount of overlapping. |
|
51 |
-#' \item{and expression built using PARAMETER object: (ALL() + N) / K or |
|
52 |
-#' ALL() / K } |
|
46 |
+#' \item{PARAMETER class object: \code{\link{ANY}}}, that acts as a wildcard, |
|
47 |
+#' considering any amount of overlapping regions. |
|
48 |
+#' \item{an expression built using PARAMETER object: (ALL() + N) / K or |
|
49 |
+#' ALL() / K, with N and K integer values } |
|
53 | 50 |
#' } |
54 |
-#' @param groupBy list of evalation function to define condition |
|
55 |
-#' evaluation on metadata: |
|
51 |
+#' @param groupBy list of evalation functions to define evaluation on metadata: |
|
56 | 52 |
#' \itemize{ |
57 |
-#' \item{\code{\link{FN}}: Fullname evaluation, two attributes match |
|
58 |
-#' if they both end with value and, if they have a further prefixes, |
|
53 |
+#' \item{\code{\link{FN}}(value): Fullname evaluation, two attributes match |
|
54 |
+#' if they both end with \emph{value} and, if they have further prefixes, |
|
59 | 55 |
#' the two prefix sequence are identical} |
60 |
-#' \item{\code{\link{EX}}: Exact evaluation, only attributes exactly |
|
61 |
-#' as value will match; no further prefixes are allowed. } |
|
62 |
-#' \item{\code{\link{DF}}: Default evaluation, the two attributes match |
|
63 |
-#' if both end with value.} |
|
56 |
+#' \item{\code{\link{EX}}(value): Exact evaluation, only attributes exactly |
|
57 |
+#' as \emph{value} match; no further prefixes are allowed. } |
|
58 |
+#' \item{\code{\link{DF}}(value): Default evaluation, the two attributes match |
|
59 |
+#' if both end with \emph{value}.} |
|
64 | 60 |
#' } |
65 |
-#' @param ... Additional arguments for use in specific methods. |
|
66 |
-#' |
|
67 |
-#' In this case a series of element in the form \emph{key} = \emph{aggregate}. |
|
68 |
-#' The \emph{aggregate} is an object of class AGGREGATES |
|
69 |
-#' The aggregate functions available are: \code{\link{SUM}}, |
|
61 |
+#' @param ... a series of expressions separated by comma in the form |
|
62 |
+#' \emph{key} = \emph{aggregate}. The \emph{aggregate} is an object of |
|
63 |
+#' class AGGREGATES. The aggregate functions available are: \code{\link{SUM}}, |
|
70 | 64 |
#' \code{\link{COUNT}}, \code{\link{MIN}}, \code{\link{MAX}}, |
71 | 65 |
#' \code{\link{AVG}}, \code{\link{MEDIAN}}, \code{\link{STD}}, |
72 | 66 |
#' \code{\link{BAG}}, \code{\link{BAGD}}, \code{\link{Q1}}, |
73 | 67 |
#' \code{\link{Q2}}, \code{\link{Q3}}. |
74 |
-#' Every aggregate accepts a string value, execet for COUNT, which does not |
|
68 |
+#' Every aggregate accepts a string value, except for COUNT, which does not |
|
75 | 69 |
#' have any value. |
76 | 70 |
#' Argument of 'aggregate function' must exist in schema, i.e. among region |
77 | 71 |
#' attributes. Two style are allowed: |
... | ... |
@@ -81,53 +75,60 @@ |
81 | 75 |
#' } |
82 | 76 |
#' "mixed style" is not allowed |
83 | 77 |
#' |
84 |
-#' @param variation string identifying the cover GMQL function variation. |
|
85 |
-#' The admissible string are: |
|
78 |
+#' @param variation string identifying the cover GMQL operator variation. |
|
79 |
+#' The admissible strings are: |
|
86 | 80 |
#' \itemize{ |
87 |
-#' \item{FLAT: returns the contiguous region that starts from the first end |
|
88 |
-#' and stops at the last end of the regions which would contribute |
|
89 |
-#' to each region of the \emph{cover}.} |
|
90 |
-#' \item{SUMMIT: returns regions that start from a position |
|
81 |
+#' \item{FLAT: It returns the regions that start from the first end and stop |
|
82 |
+#' at the last end of the regions which would contribute to each region |
|
83 |
+#' of the \emph{cover}.} |
|
84 |
+#' \item{SUMMIT: It returns regions that start from a position |
|
91 | 85 |
#' where the number of intersecting regions is not increasing afterwards and |
92 |
-#' stops at a position where either the number of intersecting regions |
|
86 |
+#' stop at a position where either the number of intersecting regions |
|
93 | 87 |
#' decreases, or it violates the max accumulation index.} |
94 |
-#' \item{HISTOGRAM: returns the non-overlapping regions contributing to |
|
95 |
-#' the cover, each with its accumulation index value, which is assigned to |
|
96 |
-#' the AccIndex region attribute.} |
|
88 |
+#' \item{HISTOGRAM: It returns the non-overlapping regions contributing to |
|
89 |
+#' the \emph{cover}, each with its accumulation index value, which is assigned |
|
90 |
+#' to the \emph{AccIndex} region attribute.} |
|
97 | 91 |
#' \item{COVER: default value.} |
98 | 92 |
#' } |
93 |
+#' Can be all caps or lowercase |
|
99 | 94 |
#' |
100 | 95 |
#' @return GMQLDataset object. It contains the value to use as input |
101 | 96 |
#' for the subsequent GMQLDataset method |
102 | 97 |
#' |
103 | 98 |
#' @examples |
104 | 99 |
#' |
105 |
-#' ## This statement produces an output dataset with a single output sample. |
|
106 |
-#' ## The COVER operation considers all areas defined by a minimum |
|
107 |
-#' ## of two overlapping regions in the input samples, |
|
108 |
-#' ## up to any amount of overlapping regions. |
|
100 |
+#' ## This statement initializes and runs the GMQL server for local execution |
|
101 |
+#' ## and creation of results on disk. Then, with system.file() it defines |
|
102 |
+#' ## the path to the folder "DATASET" in the subdirectory "example" |
|
103 |
+#' ## of the package "RGMQL" and opens such file as a GMQL dataset named "exp" |
|
104 |
+#' ## using customParser |
|
109 | 105 |
#' |
110 | 106 |
#' init_gmql() |
111 | 107 |
#' test_path <- system.file("example","DATASET",package = "RGMQL") |
112 | 108 |
#' exp = read_dataset(test_path) |
109 |
+#' |
|
110 |
+#' ## the following statement produces an output dataset with a single output |
|
111 |
+#' ## sample. The COVER operation considers all areas defined by a minimum |
|
112 |
+#' ## of two overlapping regions in the input samples, up to any amount of |
|
113 |
+#' ## overlapping regions. |
|
114 |
+#' |
|
113 | 115 |
#' res = cover(exp, 2, ANY()) |
114 | 116 |
#' |
115 |
-#' \dontrun{ |
|
116 |
-#' ## This GMQL statement computes the result grouping the input exp samples |
|
117 |
-#' ## by the values of their cell metadata attribute, |
|
117 |
+#' ## The following GMQL statement computes the result grouping the input |
|
118 |
+#' ## exp samples by the values of their cell metadata attribute, |
|
118 | 119 |
#' ## thus one output res sample is generated for each cell type; |
119 | 120 |
#' ## output regions are produced where at least 2 and at most 3 regions |
120 | 121 |
#' ## of grouped exp samples overlap, setting as attributes of the resulting |
121 | 122 |
#' ## regions the minimum pvalue of the overlapping regions (min_pvalue) |
122 | 123 |
#' ## and their Jaccard indexes (JaccardIntersect and JaccardResult). |
123 | 124 |
#' |
124 |
-#' test_path <- system.file("example", "DATASET", package = "RGMQL") |
|
125 |
-#' exp = read_dataset(test_path) |
|
126 | 125 |
#' res = cover(exp, 2, 3, groupBy = list(DF("cell")), |
127 | 126 |
#' min_pValue = MIN("pvalue")) |
128 |
-#' } |
|
129 | 127 |
#' |
130 |
-#' @aliases cover cover-method |
|
128 |
+#' @name cover |
|
129 |
+#' @rdname cover |
|
130 |
+#' @aliases cover,GMQLDataset-method |
|
131 |
+#' @aliases cover-method |
|
131 | 132 |
#' @export |
132 | 133 |
setMethod("cover", "GMQLDataset", |
133 | 134 |
function(data, min_acc, max_acc, groupBy = NULL, |
... | ... |
@@ -1,32 +1,83 @@ |
1 |
+group_by.GMQLDateset <- function(.data, groupBy_meta = NULL, |
|
2 |
+ groupBy_regions = NULL, region_aggregates = NULL, meta_aggregates = NULL) |
|
3 |
+{ |
|
4 |
+ ptr_data = .data@value |
|
5 |
+ gmql_group(ptr_data, groupBy_meta, groupBy_regions, region_aggregates, |
|
6 |
+ meta_aggregates) |
|
7 |
+} |
|
8 |
+ |
|
1 | 9 |
#' Method group_by |
2 | 10 |
#' |
11 |
+#' @description Wrapper to GMQL GROUP operator |
|
3 | 12 |
#' |
4 | 13 |
#' @importFrom rJava J .jarray .jnull |
5 |
-#' |
|
14 |
+#' @importFrom dplyr group_by |
|
6 | 15 |
#' |
7 | 16 |
#' @param .data GMQLDataset object |
8 |
-#' |
|
17 |
+#' @param groupBy_meta it define condition evaluation on metadata. |
|
18 |
+#' \itemize{ |
|
19 |
+#' \item{\code{\link{FN}}: Fullname evaluation, two attributes match |
|
20 |
+#' if they both end with value and, if they have a further prefixes, |
|
21 |
+#' the two prefix sequence are identical} |
|
22 |
+#' \item{\code{\link{EX}}: Exact evaluation, only attributes exactly |
|
23 |
+#' as value will match; no further prefixes are allowed. } |
|
24 |
+#' \item{\code{\link{DF}}: Default evaluation, the two attributes match |
|
25 |
+#' if both end with value.} |
|
26 |
+#' } |
|
27 |
+#' @param groupBy_regions vector of string made up by schema field attribute |
|
28 |
+#' @param region_aggregates It accept a series of aggregate function on |
|
29 |
+#' region attribute. |
|
30 |
+#' All the element in the form \emph{key} = \emph{aggregate}. |
|
31 |
+#' The \emph{aggregate} is an object of class AGGREGATES |
|
32 |
+#' The aggregate functions available are: \code{\link{SUM}}, |
|
33 |
+#' \code{\link{COUNT}}, \code{\link{MIN}}, \code{\link{MAX}}, |
|
34 |
+#' \code{\link{AVG}}, \code{\link{MEDIAN}}, \code{\link{STD}}, |
|
35 |
+#' \code{\link{BAG}}, \code{\link{BAGD}}, \code{\link{Q1}}, |
|
36 |
+#' \code{\link{Q2}}, \code{\link{Q3}}. |
|
37 |
+#' Every aggregate accepts a string value, execet for COUNT, which does not |
|
38 |
+#' have any value. |
|
39 |
+#' Argument of 'aggregate function' must exist in schema, i.e. among region |
|
40 |
+#' attributes. Two style are allowed: |
|
41 |
+#' \itemize{ |
|
42 |
+#' \item list of key-value pairs: e.g. sum = SUM("pvalue") |
|
43 |
+#' \item list of values: e.g. SUM("pvalue") |
|
44 |
+#' } |
|
45 |
+#' "mixed style" is not allowed |
|
46 |
+#' @param meta_aggregates It accept a series of aggregate function on |
|
47 |
+#' metadata attribute. |
|
48 |
+#' All the element in the form \emph{key} = \emph{aggregate}. |
|
49 |
+#' The \emph{aggregate} is an object of class AGGREGATES |
|
50 |
+#' The aggregate functions available are: \code{\link{SUM}}, |
|
51 |
+#' \code{\link{COUNT}}, \code{\link{MIN}}, \code{\link{MAX}}, |
|
52 |
+#' \code{\link{AVG}}, \code{\link{MEDIAN}}, \code{\link{STD}}, |
|
53 |
+#' \code{\link{BAG}}, \code{\link{BAGD}}, \code{\link{Q1}}, |
|
54 |
+#' \code{\link{Q2}}, \code{\link{Q3}}. |
|
55 |
+#' Every aggregate accepts a string value, execet for COUNT, which does not |
|
56 |
+#' have any value. |
|
57 |
+#' Argument of 'aggregate function' must exist in schema, i.e. among region |
|
58 |
+#' attributes. Two style are allowed: |
|
59 |
+#' \itemize{ |
|
60 |
+#' \item list of key-value pairs: e.g. sum = SUM("cell") |
|
61 |
+#' \item list of values: e.g. SUM("cell") |
|
62 |
+#' } |
|
63 |
+#' "mixed style" is not allowed |
|
64 |
+#' |
|
65 |
+#' |
|
9 | 66 |
#' @return GMQLDataset object. It contains the value to use as input |
10 | 67 |
#' for the subsequent GMQLDataset method |
11 | 68 |
#' |
12 | 69 |
#' @examples |
13 | 70 |
#' |
14 |
-#' |
|
15 |
-#' |
|
16 |
-#' @aliases group_by group_by-method |
|
71 |
+#' @name group_by |
|
72 |
+#' @rdname group_by |
|
73 |
+#' @aliases group_by,GMQLDataset-method |
|
74 |
+#' @aliases group_by-method |
|
17 | 75 |
#' @export |
18 |
-setMethod("group_by","GMQLDataset", |
|
19 |
- function(.data, groupBy_meta = NULL, groupBy_regions = NULL, |
|
20 |
- region_aggregates = NULL, meta_aggregates = NULL) |
|
21 |
- { |
|
22 |
- ptr_data = .data@value |
|
23 |
- gmql_group(ptr_data, groupBy_meta, groupBy_regions, |
|
24 |
- region_aggregates, meta_aggregates) |
|
25 |
- }) |
|
76 |
+setMethod("group_by","GMQLDataset",group_by.GMQLDateset) |
|
26 | 77 |
|
27 |
-gmql_group <- function(input_data, group_meta, group_reg) |
|
78 |
+gmql_group <- function(input_data, group_meta, group_reg, region_aggregates, |
|
79 |
+ meta_aggregates) |
|
28 | 80 |
{ |
29 |
- |
|
30 | 81 |
if(!is.null(group_meta)) |
31 | 82 |
{ |
32 | 83 |
cond <- .join_condition(group_meta) |
... | ... |
@@ -69,7 +120,7 @@ gmql_group <- function(input_data, group_meta, group_reg) |
69 | 120 |
|
70 | 121 |
WrappeR <- J("it/polimi/genomics/r/Wrapper") |
71 | 122 |
response <- WrappeR$group(join_condition_matrix, metadata_matrix, |
72 |
- groupBy_regions, region_matrix, input_data) |
|
123 |
+ group_reg, region_matrix, input_data) |
|
73 | 124 |
error <- strtoi(response[1]) |
74 | 125 |
data <- response[2] |
75 | 126 |
if(error!=0) |
... | ... |
@@ -13,7 +13,7 @@ |
13 | 13 |
#' test_path <- system.file("example","DATASET",package = "RGMQL") |
14 | 14 |
#' rd = read_dataset(test_path) |
15 | 15 |
#' filtered = filter(rd) |
16 |
-#' aggr = aggregate(filtered, DF("antibody_targer","cell_karyotype")) |
|
16 |
+#' aggr = aggregate(filtered, list(DF("antibody_targer","cell_karyotype"))) |
|
17 | 17 |
#' collect(aggr, dir_out = test_path) |
18 | 18 |
#' |
19 | 19 |
#' \dontrun{ |
... | ... |
@@ -65,45 +65,61 @@ execute <- function() |
65 | 65 |
} |
66 | 66 |
} |
67 | 67 |
|
68 |
+collect.GMQLDataset <- function(x, dir_out = getwd(), name = "ds1") |
|
69 |
+{ |
|
70 |
+ ptr_data <- x@value |
|
71 |
+ gmql_materialize(ptr_data, dir_out, name) |
|
72 |
+} |
|
68 | 73 |
|
69 | 74 |
|
70 | 75 |
#' Method collect |
71 | 76 |
#' |
72 |
-#' It saves the contents of a dataset that contains samples metadata and |
|
73 |
-#' samples regions. |
|
74 |
-#' It is normally used to persist the contents of any dataset generated |
|
75 |
-#' during a GMQL query. |
|
77 |
+#' @description Wrapper to GMQL MATERIALIZE operator |
|
78 |
+#' |
|
79 |
+#' @description It saves the content of a dataset that contains samples |
|
80 |
+#' metadata and regions. It is normally used to persist the content of any |
|
81 |
+#' dataset generated during a GMQL query. |
|
76 | 82 |
#' Any dataset can be materialized, but the operation can be time-consuming. |
77 | 83 |
#' For best performance, materialize the relevant data only. |
78 | 84 |
#' |
79 | 85 |
#' @importFrom rJava J |
86 |
+#' @importFrom dplyr collect |
|
80 | 87 |
#' |
81 | 88 |
#' @param x GMQLDataset class object |
82 | 89 |
#' @param dir_out destination folder path. |
83 |
-#' by default is current working directory of the R process |
|
84 |
-#' @param name name of the result dataset |
|
90 |
+#' by default it is the current working directory of the R process |
|
91 |
+#' @param name name of the result dataset. by default it is the string "ds1" |
|
85 | 92 |
#' |
86 |
-#' @param ... Additional arguments for use in specific methods |
|
93 |
+#' @details |
|
94 |
+#' |
|
95 |
+#' An error occures if the directory already exist at the destination |
|
96 |
+#' folder path |
|
87 | 97 |
#' |
88 | 98 |
#' @return None |
89 | 99 |
#' |
90 | 100 |
#' @examples |
101 |
+#' |
|
102 |
+#' ## This statement initializes and runs the GMQL server for local execution |
|
103 |
+#' ## and creation of results on disk. Then, with system.file() it defines |
|
104 |
+#' ## the path to the folder "DATASET" in the subdirectory "example" |
|
105 |
+#' ## of the package "RGMQL" and opens such file as a GMQL dataset named |
|
106 |
+#' ## "data" using customParser |
|
91 | 107 |
#' |
92 | 108 |
#' init_gmql() |
93 |
-#' test_path <- system.file("example","DATASET",package = "RGMQL") |
|
94 |
-#' r = read_dataset(test_path) |
|
95 |
-#' s = filter(r) |
|
96 |
-#' m = aggregate(s, DF("antibody_targer","cell_karyotype")) |
|
97 |
-#' collect(m, dir_out = test_path) |
|
109 |
+#' test_path <- system.file("example", "DATASET", package = "RGMQL") |
|
110 |
+#' data = read_dataset(test_path) |
|
111 |
+#' |
|
112 |
+#' ## The following statement materialize the dataset, previoulsy read, at |
|
113 |
+#' ## th specific destination path into local folder "ds1" opportunely created |
|
114 |
+#' |
|
115 |
+#' collect(data, dir_out = test_path) |
|
98 | 116 |
#' |
117 |
+#' @name collect |
|
118 |
+#' @rdname collect |
|
119 |
+#' @aliases collect,GMQLDataset-method |
|
99 | 120 |
#' @aliases collect-method |
100 | 121 |
#' @export |
101 |
-setMethod("collect", "GMQLDataset", |
|
102 |
- function(x, dir_out = getwd(), name = "ds1") |
|
103 |
- { |
|
104 |
- ptr_data <- x@value |
|
105 |
- gmql_materialize(ptr_data, dir_out, name) |
|
106 |
- }) |
|
122 |
+setMethod("collect", "GMQLDataset",collect.GMQLDataset) |
|
107 | 123 |
|
108 | 124 |
gmql_materialize <- function(input_data, dir_out, name) |
109 | 125 |
{ |
... | ... |
@@ -157,9 +173,11 @@ gmql_materialize <- function(input_data, dir_out, name) |
157 | 173 |
#' init_gmql() |
158 | 174 |
#' test_path <- system.file("example", "DATASET", package = "RGMQL") |
159 | 175 |
#' rd = read_dataset(test_path) |
160 |
-#' aggr = aggregate(rd, DF("antibody_target", "cell_karyotype")) |
|
176 |
+#' aggr = aggregate(rd, list(DF("antibody_target", "cell_karyotype"))) |
|
161 | 177 |
#' taken <- take(aggr, rows = 45) |
162 | 178 |
#' |
179 |
+#' @name take |
|
180 |
+#' @rdname take |
|
163 | 181 |
#' @aliases take-method |
164 | 182 |
#' @export |
165 | 183 |
setMethod("take", "GMQLDataset", |
... | ... |
@@ -169,7 +187,6 @@ setMethod("take", "GMQLDataset", |
169 | 187 |
gmql_take(ptr_data, rows) |
170 | 188 |
}) |
171 | 189 |
|
172 |
- |
|
173 | 190 |
gmql_take <- function(input_data, rows = 0L) |
174 | 191 |
{ |
175 | 192 |
rows <- as.integer(rows[1]) |
... | ... |
@@ -1,60 +1,73 @@ |
1 | 1 |
#' Method aggregate |
2 | 2 |
#' |
3 |
-#' It builds a dataset consisting of a single sample having as many regions as |
|
4 |
-#' the number of regions of the input data and as many metadata as the union of |
|
5 |
-#' the 'attribute-value' tuples of the input samples. |
|
6 |
-#' If at least one evaluation function is specified: the samples are then |
|
3 |
+#' @description Wrapper to GMQL MERGE operator |
|
4 |
+#' |
|
5 |
+#' @description It builds a dataset consisting of a single sample having as |
|
6 |
+#' many regions as the number of regions of all the input dataset samples |
|
7 |
+#' and as many metadata as the union of the 'attribute-value' tuples of the |
|
8 |
+#' input samples. If \emph{groupBy} is specified: the samples are then |
|
7 | 9 |
#' partitioned in groups, each with a distinct value of the grouping metadata |
8 | 10 |
#' attributes. The operation is separately applied to each group, yielding |
9 |
-#' one sample in the result for each group. |
|
10 |
-#' Samples whose names are not present in the grouping metadata parameter |
|
11 |
-#' are disregarded. |
|
11 |
+#' one sample in the result for each group. Samples whose metadata are |
|
12 |
+#' not present in the grouping metadata parameter are disregarded. |
|
12 | 13 |
#' |
13 | 14 |
#' @importFrom rJava J .jarray .jnull |
14 | 15 |
#' @importFrom S4Vectors aggregate |
15 | 16 |
#' |
16 | 17 |
#' @param x GMQLDataset class object |
17 |
-#' @param ... Additional arguments for use in specific methods. |
|
18 |
-#' It accepts a list of evalation function to define evaluation on metadata: |
|
18 |
+#' @param groupBy list of evalation functions to define evaluation on metadata: |
|
19 | 19 |
#' \itemize{ |
20 |
-#' \item{\code{\link{FN}}: Fullname evaluation, two attributes match |
|
21 |
-#' if they both end with value and, if they have a further prefixes, |
|
22 |
-#' the two prefix sequence are identical} |
|
23 |
-#' \item{\code{\link{EX}}: Exact evaluation, only attributes exactly |
|
24 |
-#' as value will match; no further prefixes are allowed. } |
|
25 |
-#' \item{\code{\link{DF}}: Default evaluation, the two attributes match |
|
26 |
-#' if both end with value.} |
|
20 |
+#' \item{\code{\link{FN}}(value): Fullname evaluation, two attributes match |
|
21 |
+#' if they both end with \emph{value} and, if they have further prefixes, |
|
22 |
+#' the two prefix sequences are identical} |
|
23 |
+#' \item{\code{\link{EX}}(value): Exact evaluation, only attributes exactly |
|
24 |
+#' as \emph{value} match; no further prefixes are allowed. } |
|
25 |
+#' \item{\code{\link{DF}}(value): Default evaluation, the two attributes match |
|
26 |
+#' if both end with \emph{value}.} |
|
27 | 27 |
#' } |
28 | 28 |
#' |
29 | 29 |
#' @return GMQLDataset object. It contains the value to use as input |
30 | 30 |
#' for the subsequent GMQLDataset method |
31 | 31 |
#' |
32 | 32 |
#' @examples |
33 |
-#' |
|
34 |
-#' # It creates a dataset called merged which contains one sample for each |
|
35 |
-#' # antibody_target value found within the metadata of the exp dataset sample; |
|
36 |
-#' # each created sample contains all regions from all 'exp' samples |
|
37 |
-#' # with a specific value for their antibody_target and cell metadata |
|
38 |
-#' # attributes. |
|
33 |
+#' |
|
34 |
+#' ## This statement initializes and runs the GMQL server for local execution |
|
35 |
+#' ## and creation of results on disk. Then, with system.file() it defines |
|
36 |
+#' ## the path to the folder "DATASET" in the subdirectory "example" |
|
37 |
+#' ## of the package "RGMQL" and opens such file as a GMQL dataset named "exp" |
|
38 |
+#' ## using customParser |
|
39 | 39 |
#' |
40 | 40 |
#' init_gmql() |
41 | 41 |
#' test_path <- system.file("example","DATASET",package = "RGMQL") |
42 | 42 |
#' exp = read_dataset(test_path) |
43 |
-#' merged = aggregate(exp, DF("antibody_target","cell")) |
|
44 | 43 |
#' |
44 |
+#' ## This statement creates a dataset called merged which contains one |
|
45 |
+#' ## sample for each antibody_target and cell value found within the metadata |
|
46 |
+#' ## of the exp dataset sample; each created sample contains all regions |
|
47 |
+#' ## from all 'exp' samples with a specific value for their |
|
48 |
+#' ## antibody_target and cell metadata |
|
49 |
+#' ## attributes. |
|
50 |
+#' |
|
51 |
+#' merged = aggregate(exp, list(DF("antibody_target","cell"))) |
|
52 |
+#' |
|
53 |
+#' @name aggregate |
|
54 |
+#' @rdname aggregate |
|
55 |
+#' @aliases aggregate,GMQLDataset-method |
|
45 | 56 |
#' @aliases aggregate-method |
46 | 57 |
#' @export |
47 | 58 |
#' |
48 | 59 |
setMethod("aggregate", "GMQLDataset", |
49 |
- function(x, ...) |
|
60 |
+ function(x, groupBy = NULL) |
|
50 | 61 |
{ |
51 | 62 |
ptr_data = x@value |
52 |
- groupBy = list(...) |
|
53 | 63 |
gmql_merge(ptr_data, groupBy) |
54 | 64 |
}) |
55 | 65 |
|
56 | 66 |
gmql_merge <- function(input_data, groupBy) |
57 | 67 |
{ |
68 |
+ if(!is.list(groupBy)) |
|
69 |
+ stop("groupBy must be list") |
|
70 |
+ |
|
58 | 71 |
if(!is.null(groupBy) && !length(groupBy) == 0) |
59 | 72 |
{ |
60 | 73 |
cond <- .join_condition(groupBy) |
... | ... |
@@ -1,77 +1,89 @@ |
1 |
+arrange.GMQLDataset <- function(.data, metadata_ordering = NULL, |
|
2 |
+ regions_ordering = NULL, fetch_opt = NULL, num_fetch = 0, |
|
3 |
+ reg_fetch_opt = NULL, reg_num_fetch = 0) |
|
4 |
+{ |
|
5 |
+ ptr_data <- .data@value |
|
6 |
+ gmql_order(ptr_data, metadata_ordering, regions_ordering, |
|
7 |
+ fetch_opt, num_fetch, reg_fetch_opt, reg_num_fetch) |
|
8 |
+} |
|
9 |
+ |
|
1 | 10 |
#' Method arrange |
2 |
-#' |
|
3 |
-#' It is used to order either samples or sample regions or both, according to |
|
4 |
-#' a set of metadata and/or region attributes, and/or region coordinates. |
|
5 |
-#' Order can be specified as ascending / descending for every attribute |
|
6 |
-#' The number of samples and their regions remain the same |
|
7 |
-#' (unless fetching options are specified) but a new ordering metadata |
|
8 |
-#' and/or region attribute is added. |
|
11 |
+#' |
|
12 |
+#' @description Wrapper to GMQL ORDER operator |
|
13 |
+#' |
|
14 |
+#' @description It is used to order either samples or sample regions or both, |
|
15 |
+#' according to a set of metadata and/or region attributes. |
|
16 |
+#' Order can be specified as ascending / descending for every attribute. |
|
17 |
+#' The number of samples and their regions remain the same as well as |
|
18 |
+#' their attributes, (unless fetching options are specified) but a new |
|
19 |
+#' ordering metadata and/or region attribute is added. |
|
9 | 20 |
#' Sorted samples or regions have a new attribute "order", |
10 | 21 |
#' added to either metadata, or regions, or both of them as specified in inputs |
11 | 22 |
#' |
12 |
-#' @importFrom rJava J |
|
13 |
-#' @importFrom rJava .jnull |
|
14 |
-#' @importFrom rJava .jarray |
|
23 |
+#' @importFrom rJava J .jnull .jarray |
|
24 |
+#' @importFrom dplyr arrange |
|
15 | 25 |
#' |
16 | 26 |
#' @param .data GMQLDataset class object |
17 |
-#' @param metadata_ordering list of ordering function contains name of |
|
18 |
-#' metadata. |
|
19 |
-#' The function available are: \code{\link{ASC}}, \code{\link{DESC}} |
|
27 |
+#' @param metadata_ordering list of ordering functions containing name of |
|
28 |
+#' metadata attribute. |
|
29 |
+#' The functions available are: \code{\link{ASC}}, \code{\link{DESC}} |
|
20 | 30 |
#' |
21 | 31 |
#' @param fetch_opt string indicating the option used to fetch the |
22 |
-#' first k sample: |
|
32 |
+#' first k samples; it can assume the values: |
|
23 | 33 |
#' \itemize{ |
24 |
-#' \item{mtop: it fetch the first k sample} |
|
25 |
-#' \item{mtopp: it fetch the first k sample in each group.} |
|
26 |
-#' \item{mtopg: it fetch the percentage of sample.} |
|
34 |
+#' \item{mtop: it fetches the first k samples} |
|
35 |
+#' \item{mtopg: it fetches the percentage of samples.} |
|
36 |
+#' \item{mtopp: it fetches the first k samples in each group.} |
|
37 |
+#' |
|
27 | 38 |
#' } |
28 | 39 |
#' if NULL, \emph{num_fetch} is not considered |
29 | 40 |
#' |
30 |
-#' @param num_fetch integer value identifying the number of region to fetch |
|
31 |
-#' by default is 0, that's means all sample are fetched |
|
41 |
+#' @param num_fetch integer value identifying the number of samples to fetch; |
|
42 |
+#' by default it is 0, that means all samples are fetched |
|
32 | 43 |
#' s |
33 |
-#' @param regions_ordering list of ordering function contains |
|
34 |
-#' name of region schema value. |
|
35 |
-#' The function available are: \code{\link{ASC}}, \code{\link{DESC}}. |
|
44 |
+#' @param regions_ordering list of ordering functions containing name of |
|
45 |
+#' region attribute. |
|
46 |
+#' The functions available are: \code{\link{ASC}}, \code{\link{DESC}}. |
|
36 | 47 |
#' |
37 | 48 |
#' @param reg_fetch_opt string indicating the option used to fetch the |
38 |
-#' first k regions: |
|
49 |
+#' first k regions; it can assume the values: |
|
39 | 50 |
#' \itemize{ |
40 |
-#' \item{rtop: it fetch the first k regions.} |
|
41 |
-#' \item{rtopp: it fetch the first k regions in each group.} |
|
42 |
-#' \item{rtopg: it fetch the percentage of regions.} |
|
51 |
+#' \item{rtop: it fetches the first k regions.} |
|
52 |
+#' \item{rtopg: it fetches the first k percentage of regions.} |
|
53 |
+#' \item{rtopp: it fetches the first k regions in each group.} |
|
43 | 54 |
#' } |
44 | 55 |
#' if NULL, \emph{reg_num_fetch} is not considered |
45 | 56 |
#' |
46 | 57 |
#' @param reg_num_fetch integer value identifying the number of region to fetch |
47 |
-#' by default is 0, that's means all regions are fetched |
|
48 |
-#' @param ... Additional arguments for use in specific methods. |
|
58 |
+#' by default it is 0, that means all regions are fetched |
|
49 | 59 |
#' |
50 | 60 |
#' @return GMQLDataset object. It contains the value to use as input |
51 | 61 |
#' for the subsequent GMQLDataset method |
52 | 62 |
#' |
53 | 63 |
#' @examples |
54 | 64 |
#' |
55 |
-#' ## It orders the samples according to the Region_count metadata attribute |
|
56 |
-#' ## and takes the two samples that have the highest count. |
|
57 |
-#' |
|
65 |
+#' ## This statement initializes and runs the GMQL server for local execution |
|
66 |
+#' ## and creation of results on disk. Then, with system.file() it defines |
|
67 |
+#' ## the path to the folder "DATASET" in the subdirectory "example" |
|
68 |
+#' ## of the package "RGMQL" and opens such file as a GMQL dataset named |
|
69 |
+#' ## "data" using customParser |
|
70 |
+#' |
|
58 | 71 |
#' init_gmql() |
59 |
-#' test_path <- system.file("example","DATASET",package = "RGMQL") |
|
60 |
-#' r = read_dataset(test_path) |
|
61 |
-#' o = arrange(r, list(ASC("Region_Count")),fetch_opt = "mtop",num_fetch = 2) |
|
72 |
+#' test_path <- system.file("example", "DATASET", package = "RGMQL") |
|
73 |
+#' data = read_dataset(test_path) |
|
62 | 74 |
#' |
75 |
+#' ## The following statement orders the samples according to the Region_Count |
|
76 |
+#' ## metadata attribute and takes the two samples that have the highest count. |
|
77 |
+#' |
|
78 |
+#' o = arrange(data, list(ASC("Region_Count")), fetch_opt = "mtop", |
|
79 |
+#' num_fetch = 2) |
|
63 | 80 |
#' |
64 |
-#' @aliases sort-method |
|
81 |
+#' @name arrange |
|
82 |
+#' @rdname arrange |
|
83 |
+#' @aliases arrange,GMQLDataset-method |
|
84 |
+#' @aliases arrange-method |
|
65 | 85 |
#' @export |
66 |
-setMethod("arrange", "GMQLDataset", |
|
67 |
- function(.data, metadata_ordering = NULL, regions_ordering = NULL, |
|
68 |
- fetch_opt = NULL, num_fetch = 0, reg_fetch_opt = NULL, |
|
69 |
- reg_num_fetch = 0, ...) |
|
70 |
- { |
|
71 |
- ptr_data <- .data@value |
|
72 |
- gmql_order(ptr_data, metadata_ordering, regions_ordering, |
|
73 |
- fetch_opt, num_fetch, reg_fetch_opt, reg_num_fetch) |
|
74 |
- }) |
|
86 |
+setMethod("arrange", "GMQLDataset", arrange.GMQLDataset) |
|
75 | 87 |
|
76 | 88 |
gmql_order <- function(data, metadata_ordering, regions_ordering, |
77 | 89 |
fetch_opt, num_fetch, reg_fetch_opt, reg_num_fetch) |
... | ... |
@@ -135,8 +147,8 @@ gmql_order <- function(data, metadata_ordering, regions_ordering, |
135 | 147 |
{ |
136 | 148 |
opt <- tolower(opt) |
137 | 149 |
if(!identical("mtop",opt) && !identical("mtopp",opt) && |
138 |
- !identical("mtopg",opt) && !identical("rtop",opt) && |
|
139 |
- !identical("rtopp",opt) && !identical("rtopg",opt)) |
|
150 |
+ !identical("mtopg",opt) && !identical("rtop",opt) && |
|
151 |
+ !identical("rtopp",opt) && !identical("rtopg",opt)) |
|
140 | 152 |
stop("option not admissable") |
141 | 153 |
opt |
142 | 154 |
} |
... | ... |
@@ -1,8 +1,37 @@ |
1 |
+select.GMQLDataset <- function(.data, metadata = NULL, metadata_update = NULL, |
|
2 |
+ all_but_meta = FALSE, regions = NULL, |
|
3 |
+ regions_update = NULL, all_but_reg = FALSE) |
|
4 |
+{ |
|
5 |
+ data = .data@value |
|
6 |
+ r_update <- substitute(regions_update) |
|
7 |
+ if(!is.null(r_update)) |
|
8 |
+ { |
|
9 |
+ reg_update <- .trasform_update(deparse(r_update)) |
|
10 |
+ reg_update <- paste(reg_update,collapse = "") |
|
11 |
+ } |
|
12 |
+ else |
|
13 |
+ reg_update <- .jnull("java/lang/String") |
|
14 |
+ |
|
15 |
+ m_update <- substitute(metadata_update) |
|
16 |
+ if(!is.null(m_update)) |
|
17 |
+ { |
|
18 |
+ meta_update <- .trasform_update(deparse(m_update)) |
|
19 |
+ meta_update <- paste(meta_update,collapse = "") |
|
20 |
+ } |
|
21 |
+ else |
|
22 |
+ meta_update <- .jnull("java/lang/String") |
|
23 |
+ |
|
24 |
+ gmql_project(data, metadata, meta_update, all_but_meta, regions, |
|
25 |
+ reg_update, all_but_reg) |
|
26 |
+} |
|
27 |
+ |
|
1 | 28 |
#' Method select |
2 |
-#' |
|
3 |
-#' It creates, from an existing dataset, a new dataset with all the samples |
|
4 |
-#' from input dataset, but keeping for each sample in the input dataset |
|
5 |
-#' only those metadata and/or region attributes expressed. |
|
29 |
+#' |
|
30 |
+#' @description Wrapper to GMQL PROJECT operator |
|
31 |
+#' |
|
32 |
+#' @description It creates, from an existing dataset, a new dataset with all |
|
33 |
+#' the samples from input dataset, but keeping for each sample in the input |
|
34 |
+#' dataset only those metadata and/or region attributes expressed. |
|
6 | 35 |
#' Region coordinates and values of the remaining metadata remain equal to |
7 | 36 |
#' those in the input dataset. It allows to: |
8 | 37 |
#' \itemize{ |
... | ... |
@@ -10,9 +39,8 @@ |
10 | 39 |
#' \item{Update new metadata and/or region attributes in the result} |
11 | 40 |
#' } |
12 | 41 |
#' |
13 |
-#' @importFrom rJava J |
|
14 |
-#' @importFrom rJava .jnull |
|
15 |
-#' @importFrom rJava .jarray |
|
42 |
+#' @importFrom rJava J .jnull .jarray |
|
43 |
+#' @importFrom dplyr select |
|
16 | 44 |
#' |
17 | 45 |
#' @param .data GMQLDataset class object |
18 | 46 |
#' |
... | ... |
@@ -44,9 +72,7 @@ |
44 | 72 |
#' \item{All basic mathematical operations (+, -, *, /), including parenthesis} |
45 | 73 |
#' \item{SQRT, META, NIL constructor object defined by OPERATOR object} |
46 | 74 |
#' } |
47 |
-#' |
|
48 |
-#' @param ... Additional arguments for use in specific methods. |
|
49 |
-#' |
|
75 |
+#' |
|
50 | 76 |
#' @return GMQLDataset object. It contains the value to use as input |
51 | 77 |
#' for the subsequent GMQLDataset method |
52 | 78 |
#' |
... | ... |
@@ -87,37 +113,12 @@ |
87 | 113 |
#' |
88 | 114 |
#' } |
89 | 115 |
#' |
90 |
-#' |
|
91 |
-#' @aliases select, select-method |
|
116 |
+#' @name select |
|
117 |
+#' @rdname select |
|
118 |
+#' @aliases select,GMQLDataset-method |
|
119 |
+#' @aliases select-method |
|
92 | 120 |
#' @export |
93 |
-setMethod("select", "GMQLDataset", |
|
94 |
- function(.data, metadata = NULL, metadata_update = NULL, |
|
95 |
- all_but_meta = FALSE, regions = NULL, |
|
96 |
- regions_update = NULL, all_but_reg = FALSE, ...) |
|
97 |
- { |
|
98 |
- data = .data@value |
|
99 |
- r_update <- substitute(regions_update) |
|
100 |
- if(!is.null(r_update)) |
|
101 |
- { |
|
102 |
- reg_update <- .trasform_update(deparse(r_update)) |
|
103 |
- reg_update <- paste(reg_update,collapse = "") |
|
104 |
- } |
|
105 |
- else |
|
106 |
- reg_update <- .jnull("java/lang/String") |
|
107 |
- |
|
108 |
- m_update <- substitute(metadata_update) |
|
109 |
- if(!is.null(m_update)) |
|
110 |
- { |
|
111 |
- meta_update <- .trasform_update(deparse(m_update)) |
|
112 |
- meta_update <- paste(meta_update,collapse = "") |
|
113 |
- } |
|
114 |
- else |
|
115 |
- meta_update <- .jnull("java/lang/String") |
|
116 |
- |
|
117 |
- gmql_project(data, metadata, meta_update, |
|
118 |
- all_but_meta, regions, |
|
119 |
- reg_update, all_but_reg) |
|
120 |
- }) |
|
121 |
+setMethod("select", "GMQLDataset",select.GMQLDataset) |
|
121 | 122 |
|
122 | 123 |
gmql_project <-function(input_data, metadata, metadata_update, all_but_meta, |
123 | 124 |
regions, regions_update, all_but_reg) |
... | ... |
@@ -1,3 +1,32 @@ |
1 |
+filter.GMQLDateset <- function(.data, m_predicate = NULL, r_predicate = NULL, |
|
2 |
+ semijoin = NULL) |
|
3 |
+{ |
|
4 |
+ val <- .data@value |
|
5 |
+ meta_pred <- substitute(m_predicate) |
|
6 |
+ if(!is.null(meta_pred)) |
|
7 |
+ { |
|
8 |
+ predicate <- .trasform(deparse(meta_pred)) |
|
9 |
+ predicate <- paste(predicate,collapse = "") |
|
10 |
+ predicate <- as.character(glue::glue(predicate)) |
|
11 |
+ |
|
12 |
+ } |
|
13 |
+ else |
|
14 |
+ predicate <- .jnull("java/lang/String") |
|
15 |
+ |
|
16 |
+ reg_pred <- substitute(r_predicate) |
|
17 |
+ if(!is.null(reg_pred)) |
|
18 |
+ { |
|
19 |
+ region_predicate <- .trasform(deparse(reg_pred)) |
|
20 |
+ region_predicate <- paste(region_predicate,collapse = "") |
|
21 |
+ region_predicate <- as.character(glue::glue(region_predicate)) |
|
22 |
+ |
|
23 |
+ } |
|
24 |
+ else |
|
25 |
+ region_predicate <- .jnull("java/lang/String") |
|
26 |
+ |
|
27 |
+ gmql_select(val, predicate, region_predicate, semijoin) |
|
28 |
+} |
|
29 |
+ |
|
1 | 30 |
#' Method filter |
2 | 31 |
#' |
3 | 32 |
#' It creates a new dataset from an existing one by extracting a subset of |
... | ... |
@@ -22,7 +51,6 @@ |
22 | 51 |
#' @param r_predicate logical predicate made up by R logical operation |
23 | 52 |
#' on schema region values. |
24 | 53 |
#' Only !, |, ||, &, && are admitted. |
25 |
-#' @param ... Additional arguments for use in specific methods. |
|
26 | 54 |
#' |
27 | 55 |
#' @param semijoin \code{\link{semijoin}} function to define filter method |
28 | 56 |
#' with semijoin condition (see examples). |
... | ... |
@@ -65,38 +93,12 @@ |
65 | 93 |
#' semijoin(join_data, TRUE, list(DF("cell")))) |
66 | 94 |
#' |
67 | 95 |
#' } |
68 |
-#' |
|
69 |
-#' @aliases filter filter-method |
|
96 |
+#' @name filter |
|
97 |
+#' @rdname filter |
|
98 |
+#' @aliases filter,GMQLDataset-method |
|
99 |
+#' @aliases filter-method |
|
70 | 100 |
#' @export |
71 |
-setMethod("filter", "GMQLDataset", |
|
72 |
- function(.data, m_predicate = NULL, r_predicate = NULL, |
|
73 |
- semijoin = NULL, ...) |
|
74 |
- { |
|
75 |
- val <- .data@value |
|
76 |
- meta_pred <- substitute(m_predicate) |
|
77 |
- if(!is.null(meta_pred)) |
|
78 |
- { |
|
79 |
- predicate <- .trasform(deparse(meta_pred)) |
|
80 |
- predicate <- paste(predicate,collapse = "") |
|
81 |
- predicate <- as.character(glue::glue(predicate)) |
|
82 |
- |
|
83 |
- } |
|
84 |
- else |
|
85 |
- predicate <- .jnull("java/lang/String") |
|
86 |
- |
|
87 |
- reg_pred <- substitute(r_predicate) |
|
88 |
- if(!is.null(reg_pred)) |
|
89 |
- { |
|
90 |
- region_predicate <- .trasform(deparse(reg_pred)) |
|
91 |
- region_predicate <- paste(region_predicate,collapse = "") |
|
92 |
- region_predicate <- as.character(glue::glue(region_predicate)) |
|
93 |
- |
|
94 |
- } |
|
95 |
- else |
|
96 |
- region_predicate <- .jnull("java/lang/String") |
|
97 |
- |
|
98 |
- gmql_select(val, predicate, region_predicate, semijoin) |
|
99 |
- }) |
|
101 |
+setMethod("filter", "GMQLDataset", filter.GMQLDateset) |
|
100 | 102 |
|
101 | 103 |
gmql_select <- function(input_data, predicate, region_predicate, s_join) |
102 | 104 |
{ |
... | ... |
@@ -194,6 +196,8 @@ semijoin <- function(data, not_in = FALSE, groupBy = NULL) |
194 | 196 |
} |
195 | 197 |
|
196 | 198 |
|
199 |
+ |
|
200 |
+ |
|
197 | 201 |
.trasform <- function(predicate=NULL) |
198 | 202 |
{ |
199 | 203 |
predicate <- gsub("&|&&","AND",predicate) |
... | ... |
@@ -6,35 +6,44 @@ |
6 | 6 |
#' Ordering functions |
7 | 7 |
#' |
8 | 8 |
#' These functions is used to create a series of metadata as string |
9 |
-#' that require ordering on value; is used only in arrange method. |
|
10 |
-#' (see example) |
|
9 |
+#' that require ordering on value; is used only in arrange method |
|
10 |
+#' (see example). |
|
11 | 11 |
#' |
12 | 12 |
#' \itemize{ |
13 |
-#' \item{ASC: It defines a ascending order for input value} |
|
13 |
+#' \item{ASC: It defines an ascending order for input value} |
|
14 | 14 |
#' \item{DESC: It defines a descending order for input value} |
15 | 15 |
#' } |
16 | 16 |
#' |
17 | 17 |
#' @param ... series of metatdata as string |
18 | 18 |
#' |
19 |
-#' @return ordering object |
|
19 |
+#' @return Ordering object |
|
20 | 20 |
#' |
21 | 21 |
#' @examples |
22 | 22 < |