Simone authored on 28/12/2017 14:43:57
Showing 13 changed files

... ...
@@ -28,7 +28,7 @@ export(SUM)
28 28
 export(UP)
29 29
 export(compile_query)
30 30
 export(compile_query_fromfile)
31
-export(condition_evaluation)
31
+export(conds)
32 32
 export(delete_dataset)
33 33
 export(download_as_GRangesList)
34 34
 export(download_dataset)
... ...
@@ -34,7 +34,7 @@
34 34
 #' @aliases condition_evaluation
35 35
 #' @rdname condition_eval_func
36 36
 #' @export
37
-condition_evaluation <- function(default = c(""), full = c(""), exact = c(""))
37
+conds <- function(default = c(""), full = c(""), exact = c(""))
38 38
 {
39 39
     df <- .condition("DEF",default)
40 40
     fn <- .condition("FULL",full)
... ...
@@ -43,6 +43,20 @@
43 43
 #' having left (right) coordinates equal to the minimum (maximum) of the 
44 44
 #' corresponding coordinate values in the 'x' and 'y' regions satisfying 
45 45
 #' the genometric predicate)}
46
+#' \item{LEFT_DISTINCT: It outputs the duplicate elimination of "x" output 
47
+#' regions with the same values, regardless the "y" paired region and its 
48
+#' values. In this case, the output regions attributes and their values are 
49
+#' all those of "x", and the output metadata are equal to the "x" metadata, 
50
+#' without additional prefixes}
51
+#' \item{RIGHT_DISTINCT: It outputs the duplicate elimination of "y" output 
52
+#' regions with the same values, regardless the "x" paired region and its 
53
+#' values. In this case, the output regions attributes and their values are 
54
+#' all those of "y", and the output metadata are equal to the "y" metadata, 
55
+#' without additional prefixes}
56
+#' \item{BOTH: It outputs the same regions as LEFT, but it adds in the output 
57
+#' region attributes the coordinates of the "y" dataset region that, 
58
+#' together with the output "x" dataset region, satisfies the equi predicate 
59
+#' and the genometric predicate}
46 60
 #' }
47 61
 #'
48 62
 #' @return GMQLDataset object. It contains the value to use as input 
... ...
@@ -85,13 +99,13 @@ setMethod("merge", c("GMQLDataset","GMQLDataset"),
85 99
                 {
86 100
                     ptr_data_x <- value(x)
87 101
                     ptr_data_y <- value(y)
88
-                    gmql_join(ptr_data_x, ptr_data_y, genometric_predicate, 
89
-                                joinBy, region_output, reg_attr)
102
+                    gmql_join(ptr_data_x, ptr_data_y, 
103
+                        genometric_predicate, joinBy, region_output, reg_attr)
90 104
                 })
91 105
 
92 106
 
93 107
 gmql_join <- function(left_data, right_data, genometric_predicate, joinBy, 
94
-                            region_output, reg_attributes)
108
+                        region_output, reg_attributes)
95 109
 {
96 110
     if(!is.null(genometric_predicate))
97 111
     {
... ...
@@ -49,6 +49,8 @@
49 49
 #' \item{ \code{\link{DF}}(value): Default evaluation, the two attributes match 
50 50
 #' if both end with \emph{value}.}
51 51
 #' }
52
+#' @param count_name string defining the metadata count name; if it is 
53
+#' not specifying the name is "count_left_right" 
52 54
 #' 
53 55
 #' @return GMQLDataset object. It contains the value to use as input 
54 56
 #' for the subsequent GMQLDataset method
... ...
@@ -84,16 +86,16 @@
84 86
 #' @aliases map-method
85 87
 #' @export
86 88
 setMethod("map", "GMQLDataset",
87
-            function(x, y, ..., joinBy = NULL)
89
+            function(x, y, ..., joinBy = NULL, count_name = NULL)
88 90
             {
89 91
                 left_data <- value(x)
90 92
                 right_data <- value(y)
91 93
                 aggregates = list(...)
92
-                gmql_map(left_data, right_data, aggregates, joinBy)
94
+                gmql_map(left_data, right_data,aggregates, joinBy, count_name)
93 95
             })
94 96
 
95 97
 
96
-gmql_map <- function(left_data, right_data, aggregates, joinBy)
98
+gmql_map <- function(left_data, right_data, aggregates, joinBy, count_name)
97 99
 {
98 100
     if(!is.null(aggregates) && length(aggregates))
99 101
     {
... ...
@@ -114,8 +116,17 @@ gmql_map <- function(left_data, right_data, aggregates, joinBy)
114 116
     else
115 117
         join_matrix <- .jnull("java/lang/String")
116 118
     
119
+    if(!is.null(count_name))
120
+    {
121
+        if(!is.character(count_name))
122
+            stop("count_name: must be string")
123
+    }
124
+    else
125
+        count_name <- .jnull("java/lang/String")
126
+    
117 127
     WrappeR <- J("it/polimi/genomics/r/Wrapper")
118
-    response<-WrappeR$map(join_matrix, metadata_matrix, left_data, right_data)
128
+    response<-WrappeR$map(join_matrix, metadata_matrix, count_name, left_data, 
129
+                            right_data)
119 130
     error <- strtoi(response[1])
120 131
     val <- response[2]
121 132
     if(error!=0)
... ...
@@ -32,8 +32,8 @@ arrange.GMQLDataset <- function(.data, metadata_ordering = NULL,
32 32
 #' first k samples; it can assume the values:
33 33
 #' \itemize{
34 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.}
35
+#' \item{mtopp: it fetches the first k percentage of samples.}
36
+#' \item{mtopg: it fetches the first k samples in each group.}
37 37
 #' 
38 38
 #' }
39 39
 #' if NULL, \emph{num_fetch} is not considered 
... ...
@@ -49,8 +49,8 @@ arrange.GMQLDataset <- function(.data, metadata_ordering = NULL,
49 49
 #' first k regions; it can assume the values:
50 50
 #' \itemize{
51 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.}
52
+#' \item{rtopp: it fetches the first k percentage of regions.}
53
+#' \item{rtopg: it fetches the first k regions in each group.}
54 54
 #' }
55 55
 #' if NULL, \emph{reg_num_fetch} is not considered 
56 56
 #' 
57 57
Binary files a/inst/java/GMQL.jar and b/inst/java/GMQL.jar differ
... ...
@@ -7,8 +7,8 @@
7 7
 \title{Method arrange}
8 8
 \usage{
9 9
 \S4method{arrange}{GMQLDataset}(.data, metadata_ordering = NULL,
10
-  regions_ordering = NULL, fetch_opt = NULL, num_fetch = 0,
11
-  reg_fetch_opt = NULL, reg_num_fetch = 0)
10
+  regions_ordering = NULL, fetch_opt = NULL, num_fetch = 0L,
11
+  reg_fetch_opt = NULL, reg_num_fetch = 0L)
12 12
 }
13 13
 \arguments{
14 14
 \item{.data}{GMQLDataset class object}
... ...
@@ -2,25 +2,26 @@
2 2
 % Please edit documentation in R/evaluation-functions.R
3 3
 \name{Evaluation-Function}
4 4
 \alias{Evaluation-Function}
5
+\alias{conds}
5 6
 \alias{condition_evaluation}
6 7
 \title{Condition evaluation functions}
7 8
 \usage{
8
-condition_evaluation(default = c(""), full = c(""), exact = c(""))
9
+conds(default = c(""), full = c(""), exact = c(""))
9 10
 }
10 11
 \arguments{
11
-\item{default}{series of string identifying a name of metadata attribute 
12
-to be evaluated.
13
-It defines a DEFAULT evaluation of the input values.
12
+\item{default}{concatenation of string identifying a name of metadata 
13
+attribute to be evaluated. 
14
+It defines a DEFAULT evaluation of the input values. 
14 15
 DEFAULT evaluation: the two attributes match if both end with value.}
15 16
 
16
-\item{full}{series of string identifying a name of metadata attribute 
17
-to be evaluated.
17
+\item{full}{concatenation of string identifying a name of metadata 
18
+attribute to be evaluated.
18 19
 It defines a FULL (FULLNAME) evaluation of the input values.
19 20
 FULL evaluation: two attributes match if they both end with value and,
20 21
 if they have further prefixes, the two prefix sequences are identical.}
21 22
 
22
-\item{exact}{series of string identifying a name of metadata attribute 
23
-to be evaluated.
23
+\item{exact}{concatenation of string identifying a name of metadata 
24
+attribute to be evaluated.
24 25
 It defines a EXACT evaluation of the input values.
25 26
 EXACT evaluation: only attributes exactly as value match; 
26 27
 no further prefixes are allowed.}
... ...
@@ -7,13 +7,13 @@
7 7
 \alias{cover,GMQLDataset-method}
8 8
 \title{Method cover}
9 9
 \usage{
10
-cover(data, ...)
10
+cover(.data, ...)
11 11
 
12
-\S4method{cover}{GMQLDataset}(data, min_acc, max_acc, groupBy = NULL,
12
+\S4method{cover}{GMQLDataset}(.data, min_acc, max_acc, groupBy = NULL,
13 13
   variation = "cover", ...)
14 14
 }
15 15
 \arguments{
16
-\item{data}{GMQLDataset class object}
16
+\item{.data}{GMQLDataset class object}
17 17
 
18 18
 \item{...}{a series of expressions separated by comma in the form 
19 19
 \emph{key} = \emph{aggregate}. The \emph{aggregate} is an object of 
... ...
@@ -10,7 +10,7 @@
10 10
 \usage{
11 11
 map(x, y, ...)
12 12
 
13
-\S4method{map}{GMQLDataset}(x, y, ..., joinBy = NULL)
13
+\S4method{map}{GMQLDataset}(x, y, ..., joinBy = NULL, count_name = NULL)
14 14
 }
15 15
 \arguments{
16 16
 \item{x}{GMQLDataset class object}
... ...
@@ -44,6 +44,9 @@ as \emph{value} match; no further prefixes are allowed.}
44 44
 \item{ \code{\link{DF}}(value): Default evaluation, the two attributes match 
45 45
 if both end with \emph{value}.}
46 46
 }}
47
+
48
+\item{count_name}{string defining the metadata count name; if it is 
49
+not specifying the name is "count_left_right"}
47 50
 }
48 51
 \value{
49 52
 GMQLDataset object. It contains the value to use as input 
... ...
@@ -7,7 +7,7 @@
7 7
 \title{Method merge}
8 8
 \usage{
9 9
 \S4method{merge}{GMQLDataset,GMQLDataset}(x, y, genometric_predicate = NULL,
10
-  region_output = "contig", joinBy = NULL)
10
+  region_output = "CAT", joinBy = NULL, reg_attr = NULL)
11 11
 }
12 12
 \arguments{
13 13
 \item{x}{GMQLDataset class object}
... ...
@@ -35,10 +35,26 @@ that satisfy the genometric predicate, (i.e. the output regionis defined as
35 35
 having left (right) coordinates equal to the minimum (maximum) of the 
36 36
 corresponding coordinate values in the 'x' and 'y' regions satisfying 
37 37
 the genometric predicate)}
38
+\item{LEFT_DISTINCT: It outputs the duplicate elimination of "x" output 
39
+regions with the same values, regardless the "y" paired region and its 
40
+values. In this case, the output regions attributes and their values are 
41
+all those of "x", and the output metadata are equal to the "x" metadata, 
42
+without additional prefixes}
43
+\item{RIGHT_DISTINCT: It outputs the duplicate elimination of "y" output 
44
+regions with the same values, regardless the "x" paired region and its 
45
+values. In this case, the output regions attributes and their values are 
46
+all those of "y", and the output metadata are equal to the "y" metadata, 
47
+without additional prefixes}
48
+\item{BOTH: outputs the same regions as LEFT, but it adds in the output 
49
+region attributes the coordinates of the "y" dataset region that, 
50
+together with the output "x" dataset region, satisfies the equi predicate 
51
+and the genometric predicate}
38 52
 }}
39 53
 
40 54
 \item{joinBy}{\code{\link{condition_evaluation}} function to support 
41 55
 methods with groupBy or JoinBy input paramter}
56
+
57
+\item{reg_attr}{vector of string made up by schema field attribute}
42 58
 }
43 59
 \value{
44 60
 GMQLDataset object. It contains the value to use as input 
... ...
@@ -4,10 +4,10 @@
4 4
 \alias{semijoin}
5 5
 \title{Semijoin condtion}
6 6
 \usage{
7
-semijoin(data, not_in = FALSE, groupBy = NULL)
7
+semijoin(.data, not_in = FALSE, groupBy = NULL)
8 8
 }
9 9
 \arguments{
10
-\item{data}{GMQLDataset class object}
10
+\item{.data}{GMQLDataset class object}
11 11
 
12 12
 \item{not_in}{logical value: TRUE => for a given sample of input dataset
13 13
 ".data" in \code{\link{filter}} method if and only if there exists at 
... ...
@@ -8,12 +8,12 @@
8 8
 \alias{take-method}
9 9
 \title{Method take}
10 10
 \usage{
11
-take(data, ...)
11
+take(.data, ...)
12 12
 
13
-\S4method{take}{GMQLDataset}(data, rows = 0L)
13
+\S4method{take}{GMQLDataset}(.data, rows = 0L)
14 14
 }
15 15
 \arguments{
16
-\item{data}{returned object from any GMQL function}
16
+\item{.data}{returned object from any GMQL function}
17 17
 
18 18
 \item{...}{Additional arguments for use in other specific methods of the 
19 19
 generic take function}