Browse code

new build

Simone authored on 19/11/2017 00:55:04
Showing 40 changed files

... ...
@@ -29,6 +29,8 @@ export(SQRT)
29 29
 export(STD)
30 30
 export(SUM)
31 31
 export(UP)
32
+export(arrange)
33
+export(collect)
32 34
 export(compile_query)
33 35
 export(compile_query_fromfile)
34 36
 export(delete_dataset)
... ...
@@ -41,7 +43,6 @@ export(import_gmql)
41 43
 export(init_gmql)
42 44
 export(login_gmql)
43 45
 export(logout_gmql)
44
-export(materialize)
45 46
 export(read)
46 47
 export(read_dataset)
47 48
 export(remote_processing)
... ...
@@ -51,6 +52,7 @@ export(sample_metadata)
51 52
 export(sample_region)
52 53
 export(save_query)
53 54
 export(save_query_fromfile)
55
+export(select)
54 56
 export(semijoin)
55 57
 export(show_datasets_list)
56 58
 export(show_job_log)
... ...
@@ -63,15 +65,15 @@ export(take)
63 65
 export(trace_job)
64 66
 export(upload_dataset)
65 67
 exportMethods(aggregate)
68
+exportMethods(arrange)
69
+exportMethods(collect)
66 70
 exportMethods(cover)
67 71
 exportMethods(extend)
68 72
 exportMethods(filter)
69
-exportMethods(join)
70 73
 exportMethods(map)
71
-exportMethods(materialize)
74
+exportMethods(merge)
75
+exportMethods(select)
72 76
 exportMethods(setdiff)
73
-exportMethods(sort)
74
-exportMethods(subset)
75 77
 exportMethods(take)
76 78
 exportMethods(union)
77 79
 import(GenomicRanges)
... ...
@@ -127,7 +127,7 @@
127 127
 #' min_pValue = MIN("pvalue"))
128 128
 #' }
129 129
 #' 
130
-#' @aliases cover, cover-method
130
+#' @aliases cover cover-method
131 131
 #' @export
132 132
 setMethod("cover", "GMQLDataset",
133 133
             function(data, min_acc, max_acc, groupBy = NULL, 
... ...
@@ -148,14 +148,18 @@ gmql_cover <- function(data, min_acc, max_acc, groupBy = NULL,
148 148
 {
149 149
     
150 150
     if(!is.null(groupBy))
151
-        join_condition_matrix <- .jarray(.join_condition(groupBy),
152
-                                            dispatch = TRUE)
151
+    {
152
+        cond <- .join_condition(groupBy)
153
+        join_condition_matrix <- .jarray(cond, dispatch = TRUE)
154
+    }
153 155
     else
154 156
         join_condition_matrix <- .jnull("java/lang/String")
155 157
 
156 158
     if(!is.null(aggregates) && !length(aggregates) == 0)
157
-        metadata_matrix <- .jarray(.aggregates(aggregates,"AGGREGATES"),
158
-                                    dispatch = TRUE)
159
+    {
160
+        aggr <- .aggregates(aggregates,"AGGREGATES")
161
+        metadata_matrix <- .jarray(aggr, dispatch = TRUE)
162
+    }
159 163
     else
160 164
         metadata_matrix <- .jnull("java/lang/String")
161 165
 
... ...
@@ -7,9 +7,8 @@
7 7
 #' regions (with their schema and values) of the left input sample which 
8 8
 #' do not intersect with any region in the right operand sample.
9 9
 #' The optional \emph{joinby} clause is used to extract a subset of couples
10
-#' from the cartesian product of two dataset 
11
-#' \emph{left_input_data} x \emph{right_input_data} on which to apply 
12
-#' the DIFFERENCE operator:
10
+#' from the cartesian product of two dataset \emph{x} and \emph{y} 
11
+#' on which to apply the DIFFERENCE operator:
13 12
 #' only those samples that have the same value for each attribute
14 13
 #' are considered when performing the difference.
15 14
 #'
... ...
@@ -56,7 +56,7 @@
56 56
 #' res = extend(exp, RegionCount = COUNT(), MinP = MIN("pvalue"))
57 57
 #' 
58 58
 #' }
59
-
59
+#' 
60 60
 #' @aliases extend-method
61 61
 #' @export
62 62
 setMethod("extend", "GMQLDataset", function(.data, ...)
... ...
@@ -55,9 +55,6 @@ filter_and_extract <- function(data, metadata = NULL,
55 55
         .extract_from_dataset(data,metadata,metadata_prefix,regions)
56 56
 }
57 57
 
58
-
59
-
60
-
61 58
 .extract_from_dataset <- function(datasetName, metadata = NULL, 
62 59
                         metadata_prefix = NULL, regions = NULL)
63 60
 {
... ...
@@ -47,20 +47,10 @@ setMethod("show", "GMQLDataset",
47 47
 #' @rdname aggregate-GMQLDataset-method
48 48
 #' @aliases aggregate
49 49
 #'  
50
-setGeneric("aggregate", function(data, ...) 
50
+setGeneric("aggregate", function(x, ...) 
51 51
                                     standardGeneric("aggregate"))
52 52
 
53 53
 
54
-#' Method join
55
-#' 
56
-#' Wrapper to GMQL join function
57
-#' 
58
-#' @name join
59
-#' @rdname join-GMQLDataset-method
60
-#' @aliases join
61
-#' 
62
-setGeneric("join", function(x, y, ...) standardGeneric("join"))
63
-
64 54
 
65 55
 #' Method filter
66 56
 #' 
... ...
@@ -70,7 +60,8 @@ setGeneric("join", function(x, y, ...) standardGeneric("join"))
70 60
 #' @rdname filter-GMQLDataset-method
71 61
 #' @aliases filter
72 62
 #' 
73
-setGeneric("filter", function(.data, ...) standardGeneric("filter"))
63
+setGeneric("filter", function(.data, m_predicate = NULL, r_predicate = NULL, 
64
+                            semijoin = NULL, ...) standardGeneric("filter"))
74 65
 
75 66
 #' Method cover
76 67
 #' 
... ...
@@ -80,8 +71,9 @@ setGeneric("filter", function(.data, ...) standardGeneric("filter"))
80 71
 #' @rdname cover-GMQLDataset-method
81 72
 #' @aliases cover
82 73
 #' 
83
-setGeneric("cover", function(data, min_acc, max_acc, ...)
84
-                        standardGeneric("cover"))
74
+setGeneric("cover", function(data, min_acc, max_acc, groupBy = NULL, 
75
+                                variation = "cover", ...)
76
+                                    standardGeneric("cover"))
85 77
 
86 78
 #' Method map
87 79
 #' 
... ...
@@ -94,14 +86,15 @@ setGeneric("cover", function(data, min_acc, max_acc, ...)
94 86
 setGeneric("map", function(x, y, ...) standardGeneric("map"))
95 87
 
96 88
 
97
-#' Method materialize
89
+#' Method collect
98 90
 #' 
99 91
 #' Wrapper to GMQL materialize function
100 92
 #' 
101
-#' @name materialize
102
-#' @rdname materialize-GMQLDataset-method
93
+#' @name collect
94
+#' @rdname collect-GMQLDataset-method
103 95
 #' @export
104
-setGeneric("materialize", function(data, ...) standardGeneric("materialize"))
96
+setGeneric("collect", function(x, dir_out = getwd(), name = "ds1", ...) 
97
+                standardGeneric("collect"))
105 98
 
106 99
 
107 100
 #' Method take
... ...
@@ -120,9 +113,32 @@ setGeneric("take", function(data, ...) standardGeneric("take"))
120 113
 #' 
121 114
 #' @name extend
122 115
 #' @rdname extend-GMQLDataset-method
123
-#' @aliases extend, GMQLDataset-method
116
+#' @aliases extend GMQLDataset-method
124 117
 #' @exportMethod extend
125 118
 setGeneric("extend", function(.data, ...) standardGeneric("extend"))
126 119
 
127 120
 
121
+#' Method select
122
+#' 
123
+#' Wrapper to GMQL project function
124
+#' 
125
+#' @name select
126
+#' @rdname select-GMQLDataset-method
127
+#' @aliases select 
128
+#' @export
129
+setGeneric("select", function(.data, ...) standardGeneric("select"))
130
+
131
+#' Method arrange
132
+#' 
133
+#' Wrapper to GMQL order function
134
+#' 
135
+#' @name arrange
136
+#' @rdname arrange-GMQLDataset-method
137
+#' @aliases arrange 
138
+#' @export
139
+#' 
140
+setGeneric("arrange", function(.data, metadata_ordering = NULL, 
141
+                    regions_ordering = NULL, fetch_opt = NULL, num_fetch = 0, 
142
+                    reg_fetch_opt = NULL, reg_num_fetch = 0, ...) 
143
+                            standardGeneric("arrange"))
128 144
 
... ...
@@ -1,6 +1,6 @@
1
-
2
-
3
-#' GMQL Operation: JOIN
1
+#' Method merge
2
+#' 
3
+#' Wrapper to GMQL join function
4 4
 #'
5 5
 #' It takes in input two datasets, respectively known as nchor (left) 
6 6
 #' and experiment (right) and returns a dataset of samples consisting of 
... ...
@@ -18,7 +18,7 @@
18 18
 #' 
19 19
 #' @param x GMQLDataset class object
20 20
 #' @param y GMQLDataset class object
21
-
21
+#' 
22 22
 #' @param genometric_predicate is a list of lists of DISTAL object
23 23
 #' For details of DISTAL objects see:
24 24
 #' \code{\link{DLE}}, \code{\link{DGE}}, \code{\link{DL}}, \code{\link{DG}},
... ...
@@ -74,14 +74,16 @@
74 74
 #' test_path2 <- system.file("example", "DATASET_GDM", package = "RGMQL")
75 75
 #' TSS = read_dataset(test_path)
76 76
 #' HM = read_dataset(test_path2)
77
-#' join_data = join(TSS, HM, 
77
+#' join_data = merge(TSS, HM, 
78 78
 #' genometric_predicate = list(list(MD(1), DLE(120000))), DF("provider"), 
79 79
 #' region_output = "RIGHT")
80 80
 #' 
81
-
82
-#' @aliases join-method
81
+#' 
82
+#' @name merge
83
+#' @aliases merge,GMQLDataset,GMQLDataset-method
84
+#' @aliases merge-method
83 85
 #' @export
84
-setMethod("join", "GMQLDataset",
86
+setMethod("merge", c("GMQLDataset","GMQLDataset"),
85 87
                 function(x, y, genometric_predicate = NULL, 
86 88
                     region_output = "contig", ...)
87 89
                 {
... ...
@@ -14,7 +14,7 @@
14 14
 #' rd = read_dataset(test_path)
15 15
 #' filtered = filter(rd)
16 16
 #' aggr = aggregate(filtered, DF("antibody_targer","cell_karyotype"))
17
-#' materialize(aggr, dir_out = test_path)
17
+#' collect(aggr, dir_out = test_path)
18 18
 #' 
19 19
 #' \dontrun{
20 20
 #' execute()
... ...
@@ -78,9 +78,10 @@ execute <- function()
78 78
 #'
79 79
 #' @importFrom rJava J
80 80
 #' 
81
-#' @param data GMQLDataset class object
81
+#' @param x GMQLDataset class object
82 82
 #' @param dir_out destination folder path.
83 83
 #' by default is current working directory of the R process
84
+#' @param name name of the result dataset
84 85
 #' 
85 86
 #' @param ... Additional arguments for use in specific methods
86 87
 #' 
... ...
@@ -93,21 +94,27 @@ execute <- function()
93 94
 #' r = read_dataset(test_path)
94 95
 #' s = filter(r)
95 96
 #' m = aggregate(s, DF("antibody_targer","cell_karyotype"))
96
-#' materialize(m, dir_out = test_path)
97
+#' collect(m, dir_out = test_path)
97 98
 #' 
98
-#' @aliases materialize-method
99
+#' @aliases collect-method
99 100
 #' @export
100
-setMethod("materialize", "GMQLDataset",
101
-            function(data, dir_out = getwd())
101
+setMethod("collect", "GMQLDataset",
102
+            function(x, dir_out = getwd(), name = "ds1")
102 103
             {
103
-                ptr_data <- data@value
104
-                gmql_materialize(ptr_data, dir_out)
104
+                ptr_data <- x@value
105
+                gmql_materialize(ptr_data, dir_out, name)
105 106
             })
106 107
 
107
-gmql_materialize <- function(input_data, dir_out)
108
+gmql_materialize <- function(input_data, dir_out, name)
108 109
 {
110
+    dir_out <- sub("/*[/]$","",dir_out)
111
+    
112
+    res_dir_out <- paste0(dir_out,"/",name)
113
+    if(!dir.exists(res_dir_out))
114
+        dir.create(res_dir_out)
115
+    
109 116
     WrappeR <- J("it/polimi/genomics/r/Wrapper")
110
-    response <- WrappeR$materialize(input_data, dir_out)
117
+    response <- WrappeR$materialize(input_data, res_dir_out)
111 118
     error <- strtoi(response[1])
112 119
     data <- response[2]
113 120
     if(error!=0)
... ...
@@ -1,25 +1,22 @@
1 1
 #' GMQL Operation: MERGE
2 2
 #'
3
-#' It builds a dataset consisting of a single sample having as many regions
4
-#' as the number of regions of the input data and as many metadata 
5
-#' as the union of the 'attribute-value' tuples of the input samples.
6
-#' A groupby clause can be specified on metadata: the samples are then 
7
-#' partitioned in groups, each with a distinct value of the grouping
8
-#' metadata attributes.
9
-#' The operation is separately applied to each group, yielding one sample 
10
-#' in the result for each group.
11
-#' Samples whose names are not present in the grouping metadata parameter 
12
-#' are disregarded.
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. A groupby clause can be
6
+#' specified on metadata: the samples are then partitioned in groups, each with
7
+#' a distinct value of the grouping metadata attributes. The operation is
8
+#' separately applied to each group, yielding one sample in the result for each
9
+#' group. Samples whose names are not present in the grouping metadata
10
+#' parameter are disregarded.
13 11
 #'
14 12
 #' @importFrom rJava J
15 13
 #' @importFrom rJava .jnull
16 14
 #' @importFrom rJava .jarray
17
-#'  
18
-#' @param data GMQLDataset class object 
15
+#'
16
+#' @param x GMQLDataset class object
19 17
 #' @param ... Additional arguments for use in specific methods.
20
-#' 
21
-#' 
22
-#' This method accept a function to define condition evaluation on metadata.
18
+#'
19
+#' list of evalation function to define condition evaluation on metadata:
23 20
 #' \itemize{
24 21
 #' \item{\code{\link{FN}}: Fullname evaluation, two attributes match 
25 22
 #' if they both end with value and, if they have a further prefixes,
... ...
@@ -30,29 +27,29 @@
30 27
 #' if both end with value.}
31 28
 #' }
32 29
 #' 
33
-#' @return DataSet class object. It contains the value to use as input 
34
-#' for the subsequent GMQL function
35
-#' 
30
+#' @return DataSet class object. It contains the value to use as input for the
31
+#'   subsequent GMQL function
32
+#'
36 33
 #' @examples
37
-#' 
38
-#' # It creates a dataset called merged which contains one sample for each 
39
-#' # antibody_target value found within the metadata of the exp dataset sample; 
40
-#' # each created sample contains all regions from all 'exp' samples 
41
-#' # with a specific value for their antibody_target and cell metadata 
34
+#'
35
+#' # It creates a dataset called merged which contains one sample for each
36
+#' # antibody_target value found within the metadata of the exp dataset sample;
37
+#' # each created sample contains all regions from all 'exp' samples
38
+#' # with a specific value for their antibody_target and cell metadata
42 39
 #' # attributes.
43
-#' 
40
+#'
44 41
 #' init_gmql()
45 42
 #' test_path <- system.file("example","DATASET",package = "RGMQL")
46 43
 #' exp = read_dataset(test_path)
47 44
 #' merged = aggregate(exp, DF("antibody_target","cell"))
48
-#' 
45
+#'
49 46
 #' @aliases aggregate-method
50 47
 #' @export
51 48
 #' 
52 49
 setMethod("aggregate", "GMQLDataset",
53
-            function(data, ...)
50
+            function(x, ...)
54 51
             {
55
-                ptr_data = data@value
52
+                ptr_data = x@value
56 53
                 groupBy = list(...)
57 54
                 gmql_merge(ptr_data, groupBy)
58 55
             })
... ...
@@ -18,11 +18,7 @@
18 18
 #' @importFrom rJava .jnull
19 19
 #' @importFrom rJava .jarray
20 20
 #' 
21
-#' @param x GMQLDataset class object
22
-#' @param decreasing logical value indicating the sorting for both metadata
23
-#' and regions.
24
-#' if you define \emph{metadata_ordering} or \emph{regions_ordering} 
25
-#' defyinig order objects, this value is discarded 
21
+#' @param .data GMQLDataset class object
26 22
 #' @param metadata_ordering list of order objects where every object 
27 23
 #' contains the name of metadata.
28 24
 #' The ORDER's available are: \code{\link{ASC}}, \code{\link{DESC}}
... ...
@@ -56,6 +52,7 @@
56 52
 #' 
57 53
 #' @param reg_num_fetch integer value identifying the number of region to fetch
58 54
 #' by default is 0, that's means all regions are fetched
55
+#' @param ... Additional arguments for use in specific methods.
59 56
 #' 
60 57
 #' 
61 58
 #' @return DataSet class object. It contains the value to use as input 
... ...
@@ -70,31 +67,22 @@
70 67
 #' init_gmql()
71 68
 #' test_path <- system.file("example","DATASET",package = "RGMQL")
72 69
 #' r = read_dataset(test_path)
73
-#' o = sort(r,TRUE, c("Region_Count"),fetch_opt= "mtop",num_fetch = 2)
70
+#' o = arrange(r, list(ASC("Region_Count")),fetch_opt = "mtop",num_fetch = 2)
74 71
 #' 
75 72
 #' 
76
-#' \dontrun{
77
-#' 
78
-#' ## the same result is obtained with using GMQL-syntax like:
79
-#' ## in this case decreasing parameter TRUE is not considerd
80
-#' o = sort(r,TRUE, c(DESC("Region_Count")), fetch_opt = "mtop", 
81
-#' num_fetch = 2)
82
-#' 
83
-#' }
84
-#' 
85 73
 #' @aliases sort-method
86 74
 #' @export
87
-setMethod("sort", "GMQLDataset",
88
-            function(x, decreasing = FALSE, metadata_ordering = NULL, 
89
-                    regions_ordering = NULL, fetch_opt = NULL, 
90
-                    num_fetch = 0, reg_fetch_opt = NULL, reg_num_fetch = 0)
75
+setMethod("arrange", "GMQLDataset",
76
+            function(.data, metadata_ordering = NULL, regions_ordering = NULL, 
77
+                    fetch_opt = NULL, num_fetch = 0, reg_fetch_opt = NULL, 
78
+                    reg_num_fetch = 0, ...)
91 79
             {
92
-                gmql_order(x@value, decreasing, metadata_ordering, 
93
-                            regions_ordering, fetch_opt, num_fetch, 
94
-                            reg_fetch_opt, reg_num_fetch)
80
+                ptr_data <- .data@value
81
+                gmql_order(ptr_data, metadata_ordering, regions_ordering, 
82
+                    fetch_opt, num_fetch, reg_fetch_opt, reg_num_fetch)
95 83
             })
96 84
 
97
-gmql_order <- function(data, decreasing, metadata_ordering, regions_ordering,
85
+gmql_order <- function(data, metadata_ordering, regions_ordering,
98 86
                     fetch_opt, num_fetch, reg_fetch_opt, reg_num_fetch)
99 87
 {
100 88
     if(!is.null(fetch_opt))
... ...
@@ -119,7 +107,7 @@ gmql_order <- function(data, decreasing, metadata_ordering, regions_ordering,
119 107
     
120 108
     if(!is.null(metadata_ordering))
121 109
     {
122
-        meta_matrix <- .ordering_meta(metadata_ordering, decreasing)
110
+        meta_matrix <- .ordering_meta(metadata_ordering)
123 111
         meta_matrix <- .jarray(meta_matrix, dispatch = TRUE)
124 112
     }
125 113
     else
... ...
@@ -127,7 +115,7 @@ gmql_order <- function(data, decreasing, metadata_ordering, regions_ordering,
127 115
     
128 116
     if(!is.null(regions_ordering))
129 117
     {
130
-        region_matrix <- .ordering_meta(regions_ordering, decreasing)
118
+        region_matrix <- .ordering_meta(regions_ordering)
131 119
         region_matrix <- .jarray(region_matrix, dispatch = TRUE)
132 120
     }
133 121
     else
... ...
@@ -146,34 +134,10 @@ gmql_order <- function(data, decreasing, metadata_ordering, regions_ordering,
146 134
 }
147 135
 
148 136
 
149
-.ordering_meta <- function(ordering, decreasing)
137
+.ordering_meta <- function(ordering)
150 138
 {
151
-    if(is.list(ordering))
152
-    {
153
-        order_matrix <- t(mapply(function(x,dec){
154
-            new_value <- as.character(x)
155
-            if(length(new_value)==1 && dec == FALSE)
156
-                new_value = c("ASC",new_value)
157
-            else if(length(new_value)==1 && dec == TRUE)
158
-                new_value = c("DESC",new_value)
159
-            else if(!identical("ASC",new_value[1]) && 
160
-                    !identical("DESC",new_value[1]))
161
-                stop("no more than one value")
162
-            matrix <- matrix(new_value)
163
-        },ordering, decreasing))
164
-    }
165
-    else if(is.character(ordering))
166
-    {
167
-        order_matrix <- t(mapply(function(x,dec) {
168
-            if( dec == FALSE)
169
-                new_value = c("ASC",x)
170
-            else
171
-                new_value = c("DESC",x)
172
-            matrix <- matrix(new_value)
173
-        }, ordering, decreasing))
174
-    }
175
-    else
176
-        stop("only list or character")
139
+    order_matrix <- do.call(rbind, ordering)
140
+    order_matrix
177 141
 }
178 142
 
179 143
 .check_option <- function(opt)
... ...
@@ -15,7 +15,8 @@
15 15
 #' @importFrom rJava .jnull
16 16
 #' @importFrom rJava .jarray
17 17
 #' 
18
-#' @param x GMQLDataset class object
18
+#' @param .data GMQLDataset class object
19
+#' 
19 20
 #' @param metadata vector of string made up by metadata attribute
20 21
 #' @param regions vector of string made up by schema field attribute
21 22
 #' @param all_but_reg logical value indicating which schema field attribute 
... ...
@@ -28,22 +29,25 @@
28 29
 #' in the output of the project operation, if TRUE the metadata 
29 30
 #' are all except ones include in region parameter.
30 31
 #' if metadata is not defined \emph{all_but_meta} is not considerd.
31
-#' @param regions_update list in the form of key = value generating 
32
-#' new genomic region attributes.
32
+#' @param regions_update list of updating rules in the form of 
33
+#' key = value generating new genomic region attributes.
33 34
 #' To specify the new values, the following options are available:
34 35
 #' \itemize{
35 36
 #' \item{All aggregation functions already defined by AGGREGATES object}
36 37
 #' \item{All basic mathematical operations (+, -, *, /), including parenthesis}
37
-#' \item{SQRT, META, NULLABLE constructor object defined by OPERATOR object}
38
+#' \item{SQRT, META, NIL constructor object defined by OPERATOR object}
38 39
 #' }
39
-#' @param metadata_update list in the form of key = value generating 
40
-#' new metadata.
40
+#' @param metadata_update list of updating rules in the form of 
41
+#' key = value generating new metadata.
41 42
 #' To specify the new values, the following options are available:
42 43
 #' \itemize{
43 44
 #' \item{All aggregation functions already defined by AGGREGATES object}
44 45
 #' \item{All basic mathematical operations (+, -, *, /), including parenthesis}
45 46
 #' \item{SQRT, META, NIL constructor object defined by OPERATOR object}
46 47
 #' }
48
+#' 
49
+#' @param ... Additional arguments for use in specific methods.
50
+#' 
47 51
 #' @return GMQLDataset class object. It contains the value to use as input 
48 52
 #' for the subsequent GMQL function
49 53
 #'
... ...
@@ -60,7 +64,7 @@
60 64
 #' init_gmql()
61 65
 #' test_path <- system.file("example", "DATASET", package = "RGMQL")
62 66
 #' input = read_dataset(test_path)
63
-#' CTCF_NORM_SCORE = subset(input, metadata_update = list(normalized = 1), 
67
+#' CTCF_NORM_SCORE = select(input, metadata_update = list(normalized = 1), 
64 68
 #' regions_update = list(new_score = (score / 1000.0) + 100), 
65 69
 #' regions = c("score"), all_but_reg = TRUE)
66 70
 #' 
... ...
@@ -78,21 +82,21 @@
78 82
 #' init_gmql()
79 83
 #' test_path <- system.file("example", "DATASET", package = "RGMQL")
80 84
 #' DS_in = read_dataset(test_path)
81
-#' DS_out = subset(DS_in, regions = c("variant_classification", 
85
+#' DS_out = select(DS_in, regions = c("variant_classification", 
82 86
 #' "variant_type"), metadata = c("manually_curated_tissue_status", 
83 87
 #' "manually_curated_tumor_tag"))
84 88
 #' 
85 89
 #' }
86 90
 #' 
87 91
 #'
88
-#' @aliases subset
92
+#' @aliases select, select-method
89 93
 #' @export
90
-setMethod("subset", "GMQLDataset",
91
-            function(x, metadata = NULL, metadata_update=NULL, 
94
+setMethod("select", "GMQLDataset",
95
+            function(.data, metadata = NULL, metadata_update = NULL, 
92 96
                         all_but_meta = FALSE, regions = NULL, 
93 97
                         regions_update = NULL, all_but_reg=FALSE)
94 98
             {
95
-                data = x@value
99
+                data = .data@value
96 100
                 r_update <- substitute(regions_update)
97 101
                 if(!is.null(r_update))
98 102
                 {
... ...
@@ -116,9 +120,8 @@ setMethod("subset", "GMQLDataset",
116 120
                                 reg_update, all_but_reg)
117 121
             })
118 122
 
119
-gmql_project <-function(input_data, metadata = NULL, metadata_update=NULL, 
120
-                    all_but_meta = FALSE, regions = NULL, 
121
-                    regions_update = NULL, all_but_reg=FALSE)
123
+gmql_project <-function(input_data, metadata, metadata_update, all_but_meta, 
124
+                            regions, regions_update, all_but_reg)
122 125
 {
123 126
     if(!is.null(metadata))
124 127
     {
... ...
@@ -163,9 +166,8 @@ gmql_project <-function(input_data, metadata = NULL, metadata_update=NULL,
163 166
     all_but_meta <- all_but_meta[1]
164 167
     
165 168
     WrappeR <- J("it/polimi/genomics/r/Wrapper")
166
-    response <- WrappeR$project(metadata,metadata_update,all_but_meta,
167
-                                regions,regions_update,
168
-                                all_but_reg,input_data)
169
+    response <- WrappeR$project(metadata, metadata_update, all_but_meta, 
170
+                    regions, regions_update, all_but_reg, input_data)
169 171
     error <- strtoi(response[1])
170 172
     data <- response[2]
171 173
     if(error!=0)
... ...
@@ -31,7 +31,7 @@
31 31
 #'
32 32
 #' ## initialize GMQL with local processing with sample files output format 
33 33
 #' ## as Tab delimited
34
-#' library(rJava)
34
+#' 
35 35
 #' init_gmql("tab", FALSE)
36 36
 #' 
37 37
 #' \dontrun{
... ...
@@ -123,7 +123,7 @@ init_gmql <- function(output_format = "gtf", remote_processing = FALSE,
123 123
 #' @export
124 124
 #'
125 125
 read_dataset <- function(dataset, parser = "CustomParser", is_local=TRUE, 
126
-                        is_GMQL=TRUE)
126
+                            is_GMQL=TRUE)
127 127
 {
128 128
     .check_input(dataset)
129 129
     .check_logical(is_local)
... ...
@@ -47,7 +47,7 @@
47 47
 #' their regions from the existing 'data' dataset such that:
48 48
 #' Each output sample has a metadata attribute called antibody_target 
49 49
 #' with value JUN.
50
-#' Each output sample also has not a metadata attribute called cell 
50
+#' Each output sample also has not a metadata attribute called "cell" 
51 51
 #' that has the same value of at least one of the values that a metadata 
52 52
 #' attribute equally called cell has in at least one sample 
53 53
 #' of the 'join_data' dataset.
... ...
@@ -94,10 +94,16 @@ setMethod("filter", "GMQLDataset",
94 94
                 gmql_select(val, predicate, region_predicate, semijoin)
95 95
             })
96 96
 
97
+
97 98
 gmql_select <- function(input_data, predicate, region_predicate, s_join)
98 99
 {
99
-    if("semijoin" %in% names(s_join))
100
-        semijoin_data <- s_join$semijoin
100
+    if(!is.null(s_join))
101
+    {
102
+        if("semijoin" %in% names(s_join))
103
+            semijoin_data <- s_join$semijoin
104
+        else
105
+            stop("use function semijoin()")
106
+    }
101 107
     else
102 108
         semijoin_data <- .jnull("java/lang/String")
103 109
     
... ...
@@ -115,6 +121,8 @@ gmql_select <- function(input_data, predicate, region_predicate, s_join)
115 121
 
116 122
 #' Semijoin Condtion
117 123
 #' 
124
+#' This function is use as support to filter method to define 
125
+#' semijoin conditions on metadata  
118 126
 #' 
119 127
 #' @param data GMQLDataset class object
120 128
 #' 
... ...
@@ -135,7 +143,7 @@ gmql_select <- function(input_data, predicate, region_predicate, s_join)
135 143
 #' if both end with value.}
136 144
 #' }
137 145
 #' 
138
-#' @return semijoin condition
146
+#' @return semijoin condition as matrix
139 147
 #' @export
140 148
 #' 
141 149
 semijoin <- function(data, not_in = FALSE, ...)
... ...
@@ -86,7 +86,7 @@ check.DISTAL <- function(value)
86 86
 #' # provided that such distance is lesser than 1200 bases and joined TSS 
87 87
 #' # and HM samples are obtained from the same provider (joinby clause).
88 88
 #' 
89
-#' join_data = join(TSS, HM, 
89
+#' join_data = merge(TSS, HM, 
90 90
 #' genometric_predicate = list(list(MD(1), DL(1200))), DF("provider"), 
91 91
 #' region_output = "RIGHT")
92 92
 #'
... ...
@@ -97,7 +97,7 @@ check.DISTAL <- function(value)
97 97
 #' # is greater than 12K bases and joined 'tss' and 'hm' samples are obtained 
98 98
 #' # from the same provider (joinby clause).
99 99
 #' 
100
-#' join_data = join(TSS, HM, 
100
+#' join_data = merge(TSS, HM, 
101 101
 #' genometric_predicate = list(list(MD(1), DGE(12000), DOWN())), 
102 102
 #' DF("provider"), region_output = "RIGHT")
103 103
 #'
... ...
@@ -71,7 +71,7 @@ as.character.OPERATOR <- function(obj) {
71 71
 #' ## The syntax for creating a new attribute with null value is 
72 72
 #' ## attribute_name = NULL(TYPE), where type may be INTEGER or DOUBLE.
73 73
 #' 
74
-#' out = subset(exp, regions_update = list(signal = NIL("INTEGER"), 
74
+#' out = select(exp, regions_update = list(signal = NIL("INTEGER"), 
75 75
 #' pvalue = NIL("DOUBLE")))
76 76
 #' 
77 77
 #' ## This statement allows to build an output dataset out such that all 
... ...
@@ -85,7 +85,8 @@ as.character.OPERATOR <- function(obj) {
85 85
 #' init_gmql()
86 86
 #' test_path <- system.file("example", "DATASET", package = "RGMQL")
87 87
 #' exp = read_dataset(test_path)
88
-#' out = subset(exp, metadata_update = list(concSq = SQRT("concentration")))
88
+#' out = select(exp, metadata_update = list(concSq = SQRT("concentration")))
89
+#' 
89 90
 #' @name OPERATORS
90 91
 #' @rdname operator-class
91 92
 #' @export
... ...
@@ -3,45 +3,17 @@
3 3
 ############################
4 4
 
5 5
 
6
-ORDER <- function(value)
7
-{
8
-    op_list <- list(value = value)
9
-    ## Set the name for the class
10
-    class(op_list) <- "ORDER"
11
-    return(op_list)
12
-}
13
-
14
-check.ORDER <- function(value)
15
-{
16
-    if(is.character(value) && length(value)>1)
17
-        stop("value: no multiple string")
18
-    
19
-    if(!is.character(value))
20
-        stop("value: is not a string")
21
-}
22
-
23
-print.ORDER <- function(obj) {
24
-    as.character(as.character.ORDER(obj))
25
-}
26
-
27
-as.character.ORDER <- function(obj) {
28
-    class <- class(obj)[1]
29
-    val <- obj$value
30
-    c(class,val)
31
-}
32
-
33
-
34
-#' ORDER object class constructor
6
+#' Ordering functions
35 7
 #'
36
-#' This class constructor is used to create instances of ORDER object,
37
-#' to be used in GMQL functions that require ordering on value.
8
+#' These functions is used to create a series of metadata as string
9
+#' that require ordering on value.
38 10
 #' 
39 11
 #' \itemize{
40 12
 #' \item{ASC: It defines a ascending order for input value}
41 13
 #' \item{DESC: It defines a descending order for input value}
42 14
 #' }
43 15
 #' 
44
-#' @param value string identifying name of metadata or region attribute
16
+#' @param ... Additional arguments for use in specific methods.
45 17
 #'
46 18
 #' @return ordering object
47 19
 #' 
... ...
@@ -54,10 +26,10 @@ as.character.ORDER <- function(obj) {
54 26
 #' ## It orders the samples according to the Region_count metadata attribute 
55 27
 #' ## and takes the two samples that have the highest count. 
56 28
 #'
57
-#' desc = sort(r,TRUE, c("Region_Count"), fetch_opt = "mtop", 
29
+#' desc = arrange(r,list(ASC("Region_Count")), fetch_opt = "mtop", 
58 30
 #' num_fetch = 2)
59 31
 #'  
60
-#' asc = sort(r,TRUE, list(ASC("Region_Count")),list(DESC("score")),
32
+#' asc = arrange(r, list(ASC("Region_Count")),list(DESC("score")),
61 33
 #' fetch_opt = "mtop", num_fetch = 5, reg_fetch_opt = "rtop", 
62 34
 #' reg_num_fetch = 7)
63 35
 #' 
... ...
@@ -65,24 +37,40 @@ as.character.ORDER <- function(obj) {
65 37
 #' @rdname ordering-class
66 38
 #' @export
67 39
 #'
68
-DESC <- function(value)
40
+DESC <- function(...)
69 41
 {
70
-    check.ORDER(value)
71
-    list <- list(value = value)
72
-    ## Set the name for the class
73
-    class(list) <- c("DESC","ORDER")
74
-    return(list)
42
+    ords <- c(...)
43
+    ords = ords[!ords %in% ""]
44
+    ords = ords[!duplicated(ords)]
45
+    if(length(ords)<=0)
46
+        order_matrix <- .jnull("java/lang/String")
47
+    else
48
+    {
49
+        order_matrix <- t(sapply(ords, function(x) {
50
+            new_value = c("DESC",x)
51
+            matrix <- matrix(new_value)
52
+        }))
53
+    }
54
+    order_matrix
75 55
 }
76 56
 
77 57
 #' @name ORDERING
78 58
 #' @rdname ordering-class
79 59
 #' @export
80 60
 #'
81
-ASC <- function(value)
61
+ASC <- function(...)
82 62
 {
83
-    check.ORDER(value)
84
-    list <- list(value = value)
85
-    ## Set the name for the class
86
-    class(list) <- c("ASC","ORDER")
87
-    return(list)
63
+    ords <- c(...)
64
+    ords = ords[!ords %in% ""]
65
+    ords = ords[!duplicated(ords)]
66
+    if(length(ords)<=0)
67
+        order_matrix <- .jnull("java/lang/String")
68
+    else
69
+    {
70
+        order_matrix <- t(sapply(ords, function(x) {
71
+            new_value = c("ASC",x)
72
+            matrix <- matrix(new_value)
73
+        }))
74
+    }
75
+    order_matrix
88 76
 }
... ...
@@ -23,3 +23,4 @@ output_type	peaks
23 23
 project	ENCODE
24 24
 read_length	36
25 25
 size	3566868
26
+patient_age	56
... ...
@@ -23,3 +23,4 @@ output_type	peaks
23 23
 project	ENCODE
24 24
 read_length	36
25 25
 size	3566868
26
+patient_age	34
26 27
\ No newline at end of file
... ...
@@ -23,3 +23,4 @@ output_type	peaks
23 23
 project	ENCODE
24 24
 read_length	36
25 25
 size	3566868
26
+patient_age	71
26 27
\ No newline at end of file
27 28
similarity index 100%
28 29
rename from inst/example/TEAD/files/TEAD.schema
29 30
rename to inst/example/TEAD/files/job_TEAD_HM_TF_ECC1_PROMonly.schema
30 31
similarity index 100%
31 32
rename from inst/example/TEAD/files/TEAD.txt
32 33
rename to inst/example/TEAD/files/job_TEAD_HM_TF_ECC1_PROMonly.vocabulary.txt
... ...
@@ -1,6 +1,6 @@
1 1
 ##gff-version 2
2 2
 ##source-version rtracklayer 1.36.6
3
-##date 2017-11-17
3
+##date 2017-11-19
4 4
 chr1	rtracklayer	sequence_feature	11873	12227	0	+	.	name "NR_046018"
5 5
 chr1	rtracklayer	sequence_feature	12612	12721	0	+	.	name "NR_046018"
6 6
 chr1	rtracklayer	sequence_feature	917444	917497	0	-	.	name "NM_001291366"
... ...
@@ -7,17 +7,16 @@
7 7
 \alias{aggregate-method}
8 8
 \title{Method aggregate}
9 9
 \usage{
10
-aggregate(data, ...)
10
+aggregate(x, ...)
11 11
 
12
-\S4method{aggregate}{GMQLDataset}(data, ...)
12
+\S4method{aggregate}{GMQLDataset}(x, ...)
13 13
 }
14 14
 \arguments{
15
-\item{data}{GMQLDataset class object}
15
+\item{x}{GMQLDataset class object}
16 16
 
17 17
 \item{...}{Additional arguments for use in specific methods.
18 18
 
19
-
20
-This method accept a function to define condition evaluation on metadata.
19
+list of evalation function to define condition evaluation on metadata:
21 20
 \itemize{
22 21
 \item{\code{\link{FN}}: Fullname evaluation, two attributes match 
23 22
 if they both end with value and, if they have a further prefixes,
... ...
@@ -29,29 +28,27 @@ if both end with value.}
29 28
 }}
30 29
 }
31 30
 \value{
32
-DataSet class object. It contains the value to use as input 
33
-for the subsequent GMQL function
31
+DataSet class object. It contains the value to use as input for the
32
+  subsequent GMQL function
34 33
 }
35 34
 \description{
36 35
 Wrapper to GMQL merge function
37 36
 
38
-It builds a dataset consisting of a single sample having as many regions
39
-as the number of regions of the input data and as many metadata 
40
-as the union of the 'attribute-value' tuples of the input samples.
41
-A groupby clause can be specified on metadata: the samples are then 
42
-partitioned in groups, each with a distinct value of the grouping
43
-metadata attributes.
44
-The operation is separately applied to each group, yielding one sample 
45
-in the result for each group.
46
-Samples whose names are not present in the grouping metadata parameter 
47
-are disregarded.
37
+It builds a dataset consisting of a single sample having as many regions as
38
+the number of regions of the input data and as many metadata as the union of
39
+the 'attribute-value' tuples of the input samples. A groupby clause can be
40
+specified on metadata: the samples are then partitioned in groups, each with
41
+a distinct value of the grouping metadata attributes. The operation is
42
+separately applied to each group, yielding one sample in the result for each
43
+group. Samples whose names are not present in the grouping metadata
44
+parameter are disregarded.
48 45
 }
49 46
 \examples{
50 47
 
51
-# It creates a dataset called merged which contains one sample for each 
52
-# antibody_target value found within the metadata of the exp dataset sample; 
53
-# each created sample contains all regions from all 'exp' samples 
54
-# with a specific value for their antibody_target and cell metadata 
48
+# It creates a dataset called merged which contains one sample for each
49
+# antibody_target value found within the metadata of the exp dataset sample;
50
+# each created sample contains all regions from all 'exp' samples
51
+# with a specific value for their antibody_target and cell metadata
55 52
 # attributes.
56 53
 
57 54
 init_gmql()
58 55
similarity index 75%
59 56
rename from man/sort-GMQLDataset-method.Rd
60 57
rename to man/arrange-GMQLDataset-method.Rd
... ...
@@ -1,22 +1,22 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/Order.R
2
+% Please edit documentation in R/GMQLDataset-class.R, R/Order.R
3 3
 \docType{methods}
4
-\name{sort,GMQLDataset-method}
5
-\alias{sort,GMQLDataset-method}
4
+\name{arrange}
5
+\alias{arrange}
6
+\alias{arrange,GMQLDataset-method}
6 7
 \alias{sort-method}
7
-\title{GMQL operation: ORDER}
8
+\title{Method arrange}
8 9
 \usage{
9
-\S4method{sort}{GMQLDataset}(x, decreasing = FALSE,
10
-  metadata_ordering = NULL, regions_ordering = NULL, fetch_opt = NULL,
11
-  num_fetch = 0, reg_fetch_opt = NULL, reg_num_fetch = 0)
10
+arrange(.data, metadata_ordering = NULL, regions_ordering = NULL,
11
+  fetch_opt = NULL, num_fetch = 0, reg_fetch_opt = NULL,
12
+  reg_num_fetch = 0, ...)
13
+
14
+\S4method{arrange}{GMQLDataset}(.data, metadata_ordering = NULL,
15
+  regions_ordering = NULL, fetch_opt = NULL, num_fetch = 0,
16
+  reg_fetch_opt = NULL, reg_num_fetch = 0, ...)
12 17
 }
13 18
 \arguments{
14
-\item{x}{GMQLDataset class object}
15
-
16
-\item{decreasing}{logical value indicating the sorting for both metadata
17
-and regions.
18
-if you define \emph{metadata_ordering} or \emph{regions_ordering} 
19
-defyinig order objects, this value is discarded}
19
+\item{.data}{GMQLDataset class object}
20 20
 
21 21
 \item{metadata_ordering}{list of order objects where every object 
22 22
 contains the name of metadata.
... ...
@@ -52,12 +52,16 @@ if NULL, \emph{reg_num_fetch} is not considered}
52 52
 
53 53
 \item{reg_num_fetch}{integer value identifying the number of region to fetch
54 54
 by default is 0, that's means all regions are fetched}
55
+
56
+\item{...}{Additional arguments for use in specific methods.}
55 57
 }
56 58
 \value{
57 59
 DataSet class object. It contains the value to use as input 
58 60
 for the subsequent GMQL function
59 61
 }
60 62
 \description{
63
+Wrapper to GMQL order function
64
+
61 65
 It is used to order either samples or sample regions or both, according to 
62 66
 a set of metadata and/or region attributes, and/or region coordinates.
63 67
 Order can be specified as ascending / descending for every attribute
... ...
@@ -80,16 +84,7 @@ or regions of each group
80 84
 init_gmql()
81 85
 test_path <- system.file("example","DATASET",package = "RGMQL")
82 86
 r = read_dataset(test_path)
83
-o = sort(r,TRUE, c("Region_Count"),fetch_opt= "mtop",num_fetch = 2)
87
+o = arrange(r, list(ASC("Region_Count")),fetch_opt = "mtop",num_fetch = 2)
84 88
 
85 89
 
86
-\dontrun{
87
-
88
-## the same result is obtained with using GMQL-syntax like:
89
-## in this case decreasing parameter TRUE is not considerd
90
-o = sort(r,TRUE, c(DESC("Region_Count")), fetch_opt = "mtop", 
91
-num_fetch = 2)
92
-
93
-}
94
-
95 90
 }
96 91
similarity index 72%
97 92
rename from man/materialize-GMQLDataset-method.Rd
98 93
rename to man/collect-GMQLDataset-method.Rd
... ...
@@ -1,23 +1,25 @@
1 1
 % Generated by roxygen2: do not edit by hand
2 2
 % Please edit documentation in R/GMQLDataset-class.R, R/Materialize.R
3 3
 \docType{methods}
4
-\name{materialize}
5
-\alias{materialize}
6
-\alias{materialize,GMQLDataset-method}
7
-\alias{materialize-method}
8
-\title{Method materialize}
4
+\name{collect}
5
+\alias{collect}
6
+\alias{collect,GMQLDataset-method}
7
+\alias{collect-method}
8
+\title{Method collect}
9 9
 \usage{
10
-materialize(data, ...)
10
+collect(x, dir_out = getwd(), name = "ds1", ...)
11 11
 
12
-\S4method{materialize}{GMQLDataset}(data, dir_out = getwd())
12
+\S4method{collect}{GMQLDataset}(x, dir_out = getwd(), name = "ds1")
13 13
 }
14 14
 \arguments{
15
-\item{data}{GMQLDataset class object}
16
-
17
-\item{...}{Additional arguments for use in specific methods}
15
+\item{x}{GMQLDataset class object}
18 16
 
19 17
 \item{dir_out}{destination folder path.
20 18
 by default is current working directory of the R process}
19
+
20
+\item{name}{name of the result dataset}
21
+
22
+\item{...}{Additional arguments for use in specific methods}
21 23
 }
22 24
 \value{
23 25
 None
... ...
@@ -39,6 +41,6 @@ test_path <- system.file("example","DATASET",package = "RGMQL")
39 41
 r = read_dataset(test_path)
40 42
 s = filter(r)
41 43
 m = aggregate(s, DF("antibody_targer","cell_karyotype"))
42
-materialize(m, dir_out = test_path)
44
+collect(m, dir_out = test_path)
43 45
 
44 46
 }
... ...
@@ -4,11 +4,11 @@
4 4
 \name{cover}
5 5
 \alias{cover}
6 6
 \alias{cover,GMQLDataset-method}
7
-\alias{cover,}
7
+\alias{cover}
8 8
 \alias{cover-method}
9 9
 \title{Method cover}
10 10
 \usage{
11
-cover(data, min_acc, max_acc, ...)
11
+cover(data, min_acc, max_acc, groupBy = NULL, variation = "cover", ...)
12 12
 
13 13
 \S4method{cover}{GMQLDataset}(data, min_acc, max_acc, groupBy = NULL,
14 14
   variation = "cover", ...)
... ...
@@ -40,25 +40,6 @@ considering any amount of overlapping.
40 40
 ALL() / K }
41 41
 }}
42 42
 
43
-\item{...}{Additional arguments for use in specific methods.
44
-
45
-In this case a series of element in the form \emph{key} = \emph{aggregate}.
46
-The \emph{aggregate} is an object of class AGGREGATES
47
-The aggregate functions available are: \code{\link{SUM}}, 
48
-\code{\link{COUNT}}, \code{\link{MIN}}, \code{\link{MAX}}, 
49
-\code{\link{AVG}}, \code{\link{MEDIAN}}, \code{\link{STD}}, 
50
-\code{\link{BAG}}, \code{\link{BAGD}}, \code{\link{Q1}}, 
51
-\code{\link{Q2}}, \code{\link{Q3}}.
52
-Every aggregate accepts a string value, execet for COUNT, which does not 
53
-have any value.
54
-Argument of 'aggregate function' must exist in schema, i.e. among region 
55
-attributes. Two style are allowed:
56
-\itemize{
57
-\item list of key-value pairs: e.g. sum = SUM("pvalue")
58
-\item list of values: e.g. SUM("pvalue")
59
-}
60
-"mixed style" is not allowed}
61
-
62 43
 \item{groupBy}{list of evalation function to define condition 
63 44
 evaluation on metadata:
64 45
 \itemize{
... ...
@@ -86,6 +67,25 @@ the cover, each with its accumulation index value, which is assigned to
86 67
 the AccIndex region attribute.}
87 68
 \item{cover: default value.}
88 69
 }}
70
+
71
+\item{...}{Additional arguments for use in specific methods.
72
+
73
+In this case a series of element in the form \emph{key} = \emph{aggregate}.
74
+The \emph{aggregate} is an object of class AGGREGATES
75
+The aggregate functions available are: \code{\link{SUM}}, 
76
+\code{\link{COUNT}}, \code{\link{MIN}}, \code{\link{MAX}}, 
77
+\code{\link{AVG}}, \code{\link{MEDIAN}}, \code{\link{STD}}, 
78
+\code{\link{BAG}}, \code{\link{BAGD}}, \code{\link{Q1}}, 
79
+\code{\link{Q2}}, \code{\link{Q3}}.
80
+Every aggregate accepts a string value, execet for COUNT, which does not 
81
+have any value.
82
+Argument of 'aggregate function' must exist in schema, i.e. among region 
83
+attributes. Two style are allowed:
84
+\itemize{
85
+\item list of key-value pairs: e.g. sum = SUM("pvalue")
86
+\item list of values: e.g. SUM("pvalue")
87
+}
88
+"mixed style" is not allowed}
89 89
 }
90 90
 \value{
91 91
 GMQLDataset class object. It contains the value to use as input 
... ...
@@ -91,7 +91,7 @@ HM = read_dataset(test_path2)
91 91
 # provided that such distance is lesser than 1200 bases and joined TSS 
92 92
 # and HM samples are obtained from the same provider (joinby clause).
93 93
 
94
-join_data = join(TSS, HM, 
94
+join_data = merge(TSS, HM, 
95 95
 genometric_predicate = list(list(MD(1), DL(1200))), DF("provider"), 
96 96
 region_output = "RIGHT")
97 97
 
... ...
@@ -102,7 +102,7 @@ region_output = "RIGHT")
102 102
 # is greater than 12K bases and joined 'tss' and 'hm' samples are obtained 
103 103
 # from the same provider (joinby clause).
104 104
 
105
-join_data = join(TSS, HM, 
105
+join_data = merge(TSS, HM, 
106 106
 genometric_predicate = list(list(MD(1), DGE(12000), DOWN())), 
107 107
 DF("provider"), region_output = "RIGHT")
108 108
 
... ...
@@ -20,7 +20,7 @@ test_path <- system.file("example","DATASET",package = "RGMQL")
20 20
 rd = read_dataset(test_path)
21 21
 filtered = filter(rd)
22 22
 aggr = aggregate(filtered, DF("antibody_targer","cell_karyotype"))
23
-materialize(aggr, dir_out = test_path)
23
+collect(aggr, dir_out = test_path)
24 24
 
25 25
 \dontrun{
26 26
 execute()
... ...
@@ -3,7 +3,6 @@
3 3
 \docType{methods}
4 4
 \name{extend}
5 5
 \alias{extend}
6
-\alias{extend,}
7 6
 \alias{GMQLDataset-method}
8 7
 \alias{extend,GMQLDataset-method}
9 8
 \alias{extend-method}
... ...
@@ -71,4 +70,5 @@ exp = read_dataset(test_path)
71 70
 res = extend(exp, RegionCount = COUNT(), MinP = MIN("pvalue"))
72 71
 
73 72
 }
73
+
74 74
 }
... ...
@@ -8,7 +8,8 @@
8 8
 \alias{filter-method}
9 9
 \title{Method filter}
10 10
 \usage{
11
-filter(.data, ...)
11
+filter(.data, m_predicate = NULL, r_predicate = NULL, semijoin = NULL,
12
+  ...)
12 13
 
13 14
 \S4method{filter}{GMQLDataset}(.data, m_predicate = NULL,
14 15
   r_predicate = NULL, semijoin = NULL, ...)
... ...
@@ -16,8 +17,6 @@ filter(.data, ...)
16 17
 \arguments{
17 18
 \item{.data}{GMQLDataset class object}
18 19
 
19
-\item{...}{Additional arguments for use in specific methods.}
20
-
21 20
 \item{m_predicate}{logical predicate made up by R logical operation 
22 21
 on metadata attribute. 
23 22
 Only !, |, ||, &, && are admitted.}
... ...
@@ -28,6 +27,8 @@ Only !, |, ||, &, && are admitted.}
28 27
 
29 28
 \item{semijoin}{\code{\link{semijoin}} function 
30 29
 to define filter method with semijoin condition (see examples).}
30
+
31
+\item{...}{Additional arguments for use in specific methods.}
31 32
 }
32 33
 \value{
33 34
 GMQLDataset class object. It contains the value to use as input 
... ...
@@ -62,7 +63,7 @@ It creates a new dataset called 'jun_tf' by selecting those samples and
62 63
 their regions from the existing 'data' dataset such that:
63 64
 Each output sample has a metadata attribute called antibody_target 
64 65
 with value JUN.
65
-Each output sample also has not a metadata attribute called cell 
66
+Each output sample also has not a metadata attribute called "cell" 
66 67
 that has the same value of at least one of the values that a metadata 
67 68
 attribute equally called cell has in at least one sample 
68 69
 of the 'join_data' dataset.
... ...
@@ -41,7 +41,7 @@ It is also perform a login to GMQL REST services suite if needed
41 41
 
42 42
 ## initialize GMQL with local processing with sample files output format 
43 43
 ## as Tab delimited
44
-library(rJava)
44
+
45 45
 init_gmql("tab", FALSE)
46 46
 
47 47
 \dontrun{
48 48
similarity index 92%
49 49
rename from man/join-GMQLDataset-method.Rd
50 50
rename to man/merge.Rd
... ...
@@ -1,15 +1,12 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/GMQLDataset-class.R, R/Join.R
2
+% Please edit documentation in R/Join.R
3 3
 \docType{methods}
4
-\name{join}
5
-\alias{join}
6
-\alias{join,GMQLDataset-method}
7
-\alias{join-method}
8
-\title{Method join}
4
+\name{merge}
5
+\alias{merge}
6
+\alias{merge,GMQLDataset,GMQLDataset-method}
7
+\title{Method merge}
9 8
 \usage{
10
-join(x, y, ...)
11
-
12
-\S4method{join}{GMQLDataset}(x, y, genometric_predicate = NULL,
9
+\S4method{merge}{GMQLDataset,GMQLDataset}(x, y, genometric_predicate = NULL,
13 10
   region_output = "contig", ...)
14 11
 }
15 12
 \arguments{
... ...
@@ -17,19 +14,6 @@ join(x, y, ...)
17 14
 
18 15
 \item{y}{GMQLDataset class object}
19 16
 
20
-\item{...}{Additional arguments for use in specific methods.
21
-
22
-This method accept a function to define condition evaluation on metadata.
23
-\itemize{
24
-\item{\code{\link{FN}}: Fullname evaluation, two attributes match 
25
-if they both end with value and, if they have a further prefixes,
26
-the two prefix sequence are identical}
27
-\item{\code{\link{EX}}: Exact evaluation, only attributes exactly 
28
-as value will match; no further prefixes are allowed. }
29
-\item{\code{\link{DF}}: Default evaluation, the two attributes match 
30
-if both end with value.}
31
-}}
32
-
33 17
 \item{genometric_predicate}{is a list of lists of DISTAL object
34 18
 For details of DISTAL objects see:
35 19
 \code{\link{DLE}}, \code{\link{DGE}}, \code{\link{DL}}, \code{\link{DG}},
... ...
@@ -54,6 +38,19 @@ equal to the minimum (maximum) of the corresponding coordinate values
54 38
 in the left_input_data and right_input_data regions satisfying 
55 39
 the genometric predicate)}
56 40
 }}
41
+
42
+\item{...}{Additional arguments for use in specific methods.
43
+
44
+This method accept a function to define condition evaluation on metadata.
45
+\itemize{
46
+\item{\code{\link{FN}}: Fullname evaluation, two attributes match 
47
+if they both end with value and, if they have a further prefixes,
48
+the two prefix sequence are identical}
49
+\item{\code{\link{EX}}: Exact evaluation, only attributes exactly 
50
+as value will match; no further prefixes are allowed. }
51
+\item{\code{\link{DF}}: Default evaluation, the two attributes match 
52
+if both end with value.}
53
+}}
57 54
 }
58 55
 \value{
59 56
 GMQLDataset class object. It contains the value to use as input 
... ...
@@ -61,7 +58,8 @@ for the subsequent GMQL function
61 58
 }
62 59
 \description{
63 60
 Wrapper to GMQL join function
64
-
61
+}
62
+\details{
65 63
 It takes in input two datasets, respectively known as nchor (left) 
66 64
 and experiment (right) and returns a dataset of samples consisting of 
67 65
 regions extracted from the operands according to the specified condition
... ...
@@ -86,8 +84,9 @@ test_path <- system.file("example", "DATASET", package = "RGMQL")
86 84
 test_path2 <- system.file("example", "DATASET_GDM", package = "RGMQL")
87 85
 TSS = read_dataset(test_path)
88 86
 HM = read_dataset(test_path2)
89
-join_data = join(TSS, HM, 
87
+join_data = merge(TSS, HM, 
90 88
 genometric_predicate = list(list(MD(1), DLE(120000))), DF("provider"), 
91 89
 region_output = "RIGHT")
92 90
 
91
+
93 92
 }
... ...
@@ -55,7 +55,7 @@ data = filter(exp, r_predicate = score > META("avg_score"))
55 55
 ## The syntax for creating a new attribute with null value is 
56 56
 ## attribute_name = NULL(TYPE), where type may be INTEGER or DOUBLE.
57 57
 
58
-out = subset(exp, regions_update = list(signal = NIL("INTEGER"), 
58
+out = select(exp, regions_update = list(signal = NIL("INTEGER"), 
59 59
 pvalue = NIL("DOUBLE")))
60 60
 
61 61
 ## This statement allows to build an output dataset out such that all 
... ...
@@ -69,5 +69,6 @@ pvalue = NIL("DOUBLE")))
69 69
 init_gmql()
70 70
 test_path <- system.file("example", "DATASET", package = "RGMQL")
71 71
 exp = read_dataset(test_path)
72
-out = subset(exp, metadata_update = list(concSq = SQRT("concentration")))
72
+out = select(exp, metadata_update = list(concSq = SQRT("concentration")))
73
+
73 74
 }
... ...
@@ -5,21 +5,21 @@
5 5
 \alias{DESC}
6 6
 \alias{ORDERING}
7 7
 \alias{ASC}
8
-\title{ORDER object class constructor}
8
+\title{Ordering functions}
9 9
 \usage{
10
-DESC(value)
10
+DESC(...)
11 11
 
12
-ASC(value)
12
+ASC(...)
13 13
 }
14 14
 \arguments{
15
-\item{value}{string identifying name of metadata or region attribute}
15
+\item{...}{Additional arguments for use in specific methods.}
16 16
 }
17 17
 \value{
18 18
 ordering object
19 19
 }
20 20
 \description{
21
-This class constructor is used to create instances of ORDER object,
22
-to be used in GMQL functions that require ordering on value.
21
+These functions is used to create a series of metadata as string
22
+that require ordering on value.
23 23
 }
24 24
 \details{
25 25
 \itemize{
... ...
@@ -36,10 +36,10 @@ r = read_dataset(test_path)
36 36
 ## It orders the samples according to the Region_count metadata attribute 
37 37
 ## and takes the two samples that have the highest count. 
38 38
 
39
-desc = sort(r,TRUE, c("Region_Count"), fetch_opt = "mtop", 
39
+desc = arrange(r,list(ASC("Region_Count")), fetch_opt = "mtop", 
40 40
 num_fetch = 2)
41 41
  
42
-asc = sort(r,TRUE, list(ASC("Region_Count")),list(DESC("score")),
42
+asc = arrange(r, list(ASC("Region_Count")),list(DESC("score")),
43 43
 fetch_opt = "mtop", num_fetch = 5, reg_fetch_opt = "rtop", 
44 44
 reg_num_fetch = 7)
45 45
 
46 46
similarity index 78%
47 47
rename from man/subset-GMQLDataset-method.Rd
48 48
rename to man/select-GMQLDataset-method.Rd
... ...
@@ -1,22 +1,28 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/Project.R
2
+% Please edit documentation in R/GMQLDataset-class.R, R/Project.R
3 3
 \docType{methods}
4
-\name{subset,GMQLDataset-method}
5
-\alias{subset,GMQLDataset-method}
6
-\alias{subset}
7
-\title{GMQL Operation: PROJECT}
4
+\name{select}
5
+\alias{select}
6
+\alias{select,GMQLDataset-method}
7
+\alias{select,}
8
+\alias{select-method}
9
+\title{Method select}
8 10
 \usage{
9
-\S4method{subset}{GMQLDataset}(x, metadata = NULL, metadata_update = NULL,
10
-  all_but_meta = FALSE, regions = NULL, regions_update = NULL,
11
-  all_but_reg = FALSE)
11
+select(.data, ...)
12
+
13
+\S4method{select}{GMQLDataset}(.data, metadata = NULL,
14
+  metadata_update = NULL, all_but_meta = FALSE, regions = NULL,
15
+  regions_update = NULL, all_but_reg = FALSE)
12 16
 }
13 17
 \arguments{
14
-\item{x}{GMQLDataset class object}
18
+\item{.data}{GMQLDataset class object}
19
+
20
+\item{...}{Additional arguments for use in specific methods.}
15 21
 
16 22
 \item{metadata}{vector of string made up by metadata attribute}
17 23
 
18
-\item{metadata_update}{list in the form of key = value generating 
19
-new metadata.
24
+\item{metadata_update}{list of updating rules in the form of 
25
+key = value generating new metadata.
20 26
 To specify the new values, the following options are available:
21 27
 \itemize{
22 28
 \item{All aggregation functions already defined by AGGREGATES object}
... ...
@@ -32,13 +38,13 @@ if metadata is not defined \emph{all_but_meta} is not considerd.}
32 38
 
33 39
 \item{regions}{vector of string made up by schema field attribute}
34 40
 
35
-\item{regions_update}{list in the form of key = value generating 
36
-new genomic region attributes.
41
+\item{regions_update}{list of updating rules in the form of 
42
+key = value generating new genomic region attributes.
37 43
 To specify the new values, the following options are available:
38 44
 \itemize{
39 45
 \item{All aggregation functions already defined by AGGREGATES object}
40 46
 \item{All basic mathematical operations (+, -, *, /), including parenthesis}
41
-\item{SQRT, META, NULLABLE constructor object defined by OPERATOR object}
47
+\item{SQRT, META, NIL constructor object defined by OPERATOR object}
42 48
 }}
43 49
 
44 50
 \item{all_but_reg}{logical value indicating which schema field attribute 
... ...
@@ -52,6 +58,8 @@ GMQLDataset class object. It contains the value to use as input
52 58
 for the subsequent GMQL function
53 59
 }
54 60
 \description{
61
+Wrapper to GMQL project function
62
+
55 63
 It creates, from an existing dataset, a new dataset with all the samples 
56 64
 from input dataset, but keeping for each sample in the input dataset 
57 65
 only those metadata and/or region attributes expressed in the operator 
... ...
@@ -76,7 +84,7 @@ those in the input dataset. It allows to:
76 84
 init_gmql()
77 85
 test_path <- system.file("example", "DATASET", package = "RGMQL")