Browse code

start new build

Simone authored on 14/11/2017 17:42:59
Showing 25 changed files

... ...
@@ -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.29
4
+Version: 0.99.30
5 5
 Author: Simone Pallotta, Marco Masseroli
6 6
 Maintainer: Simone Pallotta <simonepallotta@hotmail.com>
7 7
 Description: This RGMQL package brings the GenoMetric Query Language (GMQL)
... ...
@@ -53,7 +53,8 @@ LazyData: true
53 53
 RoxygenNote: 6.0.1
54 54
 Imports:
55 55
     httr,
56
-    rJava,GenomicRanges,
56
+    rJava,
57
+    GenomicRanges,
57 58
     rtracklayer,
58 59
     data.table,
59 60
     utils,
... ...
@@ -70,4 +71,4 @@ Suggests:
70 71
     BiocStyle,
71 72
     knitr,
72 73
     rmarkdown
73
-biocViews: Software,Infrastructure,DataImport,Network
74
+biocViews: Software,Infrastructure,DataImport,Network,SingleCell
... ...
@@ -30,7 +30,6 @@ export(SUM)
30 30
 export(UP)
31 31
 export(compile_query)
32 32
 export(compile_query_fromfile)
33
-export(cover)
34 33
 export(delete_dataset)
35 34
 export(download_as_GRangesList)
36 35
 export(download_dataset)
... ...
@@ -39,7 +38,6 @@ export(export_gmql)
39 38
 export(filter_and_extract)
40 39
 export(import_gmql)
41 40
 export(init_gmql)
42
-export(join)
43 41
 export(login_gmql)
44 42
 export(logout_gmql)
45 43
 export(map)
... ...
@@ -83,6 +81,8 @@ importFrom(S4Vectors,metadata)
83 81
 importFrom(data.table,fread)
84 82
 importFrom(dplyr,bind_cols)
85 83
 importFrom(methods,is)
84
+importFrom(methods,isClass)
85
+importFrom(methods,new)
86 86
 importFrom(plyr,revalue)
87 87
 importFrom(rJava,.jarray)
88 88
 importFrom(rJava,.jevalArray)
... ...
@@ -1,9 +1,6 @@
1
-#' @name cover
2
-#' @rdname cover-methods
3
-#' @aliases cover
4
-#' @export
5
-setGeneric("cover", function(data, minAcc, maxAcc, ...) 
6
-                                standardGeneric("cover"))
1
+
2
+
3
+
7 4
 
8 5
 #' GMQL Operation: COVER
9 6
 #'
... ...
@@ -135,34 +132,46 @@ setGeneric("cover", function(data, minAcc, maxAcc, ...)
135 132
 #' exp = read_dataset(test_path)
136 133
 #' res = cover(exp, 2, 3, c("cell"), list(min_pValue = MIN("pvalue")))
137 134
 #' }
135
+#' 
136
+#' 
138 137
 #' @name cover
139 138
 #' @rdname cover-methods
140
-#' @aliases cover, GMQLDataset-methods
139
+#' @aliases cover, cover-methods
140
+#' 
141
+#' @exportMethod cover
142
+#' 
143
+setGeneric("cover", function(data, minAcc, maxAcc, ...)
144
+{
145
+    minAcc <- .trasform_cover(deparse(substitute(minAcc)))
146
+    maxAcc <- .trasform_cover(deparse(substitute(maxAcc)))
147
+    
148
+    min <- .check_cover_param(minAcc,TRUE)
149
+    max <- .check_cover_param(maxAcc,FALSE)
150
+    
151
+    gmql_cover(data,minAcc,maxAcc)
152
+})
153
+
154
+#' @name cover
155
+#' @rdname cover-methods
156
+#' @aliases cover, cover-methods
141 157
 #' @export
142 158
 setMethod("cover", "GMQLDataset",
143 159
             function(data, minAcc, maxAcc, groupBy = NULL, aggregates = NULL, 
144 160
                         variation = "cover")
145 161
             {
162
+                minAcc <- .trasform_cover(deparse(substitute(minAcc)))
163
+                maxAcc <- .trasform_cover(deparse(substitute(maxAcc)))
164
+                
165
+                min <- .check_cover_param(minAcc,TRUE)
166
+                max <- .check_cover_param(maxAcc,FALSE)
167
+                flag = toupper(variation)
168
+                
146 169
                 gmql_cover(data@value, minAcc, maxAcc, groupBy, aggregates, 
147
-                            variation)
170
+                                flag)
148 171
             })
149 172
 
150
-
151 173
 gmql_cover <- function(input_data, minAcc, maxAcc, groupBy = NULL, 
152
-                            aggregates = NULL, variation)
153
-{
154
-    minAcc <- .trasform_cover(deparse(substitute(minAcc)))
155
-    maxAcc <- .trasform_cover(deparse(substitute(maxAcc)))
156
-    
157
-    min <- .check_cover_param(minAcc,TRUE)
158
-    max <- .check_cover_param(maxAcc,FALSE)
159
-    
160
-    vary = toupper(variation)
161
-    
162
-    .doVariant(vary, minAcc, maxAcc, groupBy, aggregates, input_data)
163
-}
164
-
165
-.doVariant <- function(flag,minAcc,maxAcc,groupBy,aggregates,input_data)
174
+                        aggregates = NULL, flag = "cover")
166 175
 {
167 176
     if(!is.null(groupBy))
168 177
         join_condition_matrix <- .jarray(.join_condition(groupBy),
... ...
@@ -1,8 +1,9 @@
1
-#'
2
-#' Abstract class representing GMQL dataset
1
+#' Class GMQLDataset
3 2
 #' 
3
+#' Abstract class representing GMQL dataset
4
+#'
4 5
 #' @importClassesFrom S4Vectors DataTable
5
-#' 
6
+#' @slot value value associated to GMQL dataset
6 7
 #' @name GMQLDataset-class
7 8
 #' @rdname GMQLDataset-class
8 9
 #' 
... ...
@@ -10,13 +11,17 @@ setClass("GMQLDataset",
10 11
             contains = c("DataTable"),
11 12
             representation(value = "character"))
12 13
 
13
-# Constructor GMQLDataset
14
+#' @name GMQLDataset
15
+#' @importFrom methods new
16
+#' 
17
+#' @param value value associated to GMQL dataset
18
+#' @rdname GMQLDataset-class
19
+#' 
14 20
 GMQLDataset <- function(value) {
15 21
     dataset <- new("GMQLDataset",value = value)
16 22
     return(dataset)
17 23
 }
18
-    
19
-    
24
+
20 25
 setMethod("show", "GMQLDataset",
21 26
             function(object)
22 27
             {
... ...
@@ -24,13 +29,14 @@ setMethod("show", "GMQLDataset",
24 29
                 cat(" value :",paste(object@value))
25 30
             })
26 31
 
27
-## insted of GMQL select
28
-setGeneric("filter", function(data, m_predicate = NULL, r_predicate = NULL, 
29
-                                semi_join = NULL, semi_join_negation = FALSE, 
30
-                                semi_join_dataset = NULL) 
31
-                            standardGeneric("filter"))
32 32
 
33
-## insted of GMQL extend
33
+#' Method mutate
34
+#' 
35
+#' Wrapper to GMQL extend function
36
+#' 
37
+#' @name mutate
38
+#' @rdname mutate-methods
39
+#' 
34 40
 setGeneric("mutate", function(.data, metadata = NULL) 
35 41
                                 standardGeneric("mutate"))
36 42
 
... ...
@@ -40,8 +46,25 @@ setGeneric("mutate", function(.data, metadata = NULL)
40 46
 # num_fetch = 0, reg_fetch_opt = NULL, 
41 47
 # reg_num_fetch = 0) standardGeneric("sort"))
42 48
 
43
-## insted of GMQL merge
49
+#' Method mutate
50
+#' 
51
+#' Wrapper to GMQL merge function
52
+#' 
53
+#' @name aggregate
54
+#' @rdname aggregate-methods
55
+#' 
44 56
 setGeneric("aggregate", function(data, groupBy = NULL) 
45 57
                                     standardGeneric("aggregate"))
46 58
 
47 59
 
60
+#' Method join
61
+#' 
62
+#' Wrapper to GMQL join function
63
+#' 
64
+#' @name join
65
+#' @rdname join-methods
66
+#' @aliases join
67
+#' 
68
+setGeneric("join", function(x, y, by = NULL, ...) standardGeneric("join"))
69
+
70
+
... ...
@@ -74,7 +74,7 @@
74 74
 #' }
75 75
 #'
76 76
 #' @rdname setdiff-methods
77
-#' @aliases setdiff, GMQLDataset-methods
77
+#' @aliases setdiff, setdiff-methods
78 78
 #' @export
79 79
 setMethod("setdiff", c("GMQLDataset","GMQLDataset"),
80 80
             function(x, y, joinBy = NULL, is_exact = FALSE)
... ...
@@ -57,7 +57,7 @@
57 57
 #' 
58 58
 #' @name mutate
59 59
 #' @rdname mutate-methods
60
-#' @aliases mutate, GMQLDataset-methods
60
+#' @aliases mutate, mutate-methods
61 61
 #' @export
62 62
 setMethod("mutate", "GMQLDataset",
63 63
             function(.data, metadata = NULL)
... ...
@@ -1,8 +1,3 @@
1
-#' @name join
2
-#' @rdname join-methods
3
-#' @aliases join
4
-#' @export
5
-setGeneric("join", function(x, y, by = NULL, ...) standardGeneric("join"))
6 1
 
7 2
 
8 3
 #' GMQL Operation: JOIN
... ...
@@ -87,10 +82,11 @@ setGeneric("join", function(x, y, by = NULL, ...) standardGeneric("join"))
87 82
 #' join_data = join(TSS, HM, 
88 83
 #' genometric_predicate = list(list(MD(1), DLE(120000))), by = c("provider"), 
89 84
 #' region_output="RIGHT")
90
-#'
85
+#' 
86
+
91 87
 #' @name join
92 88
 #' @rdname join-methods
93
-#' @aliases join, GMQLDataset-methods
89
+#' @aliases join, join-methods
94 90
 #' @export
95 91
 setMethod("join", "GMQLDataset",
96 92
                 function(x, y, by = NULL, genometric_predicate = NULL, 
... ...
@@ -98,7 +94,7 @@ setMethod("join", "GMQLDataset",
98 94
                 {
99 95
                     r_data <- x@value
100 96
                     l_data <- y@value
101
-                    gmql_join(r_data, l_data, genometric_predicate, joinBy, 
97
+                    gmql_join(x, y, genometric_predicate, by, 
102 98
                             region_output="contig")
103 99
                 })
104 100
 
... ...
@@ -153,8 +149,7 @@ gmql_join <- function(right_data, left_data, genometric_predicate, joinBy,
153 149
     
154 150
     WrappeR <- J("it/polimi/genomics/r/Wrapper")
155 151
     response <- WrappeR$join(genomatrix,join_condition_matrix, 
156
-                                ouput,right_input_data$value,
157
-                                left_input_data$value)
152
+                                ouput,right_data, left_data)
158 153
     error <- strtoi(response[1])
159 154
     data <- response[2]
160 155
     if(error!=0)
... ...
@@ -100,7 +100,7 @@ setGeneric("materialize", function(data, ...) standardGeneric("materialize"))
100 100
 #' 
101 101
 #' @name materialize
102 102
 #' @rdname materialize-methods
103
-#' @aliases materialize, GMQLDataset-methods
103
+#' @aliases materialize, materialize-methods
104 104
 #' @export
105 105
 setMethod("materialize", "GMQLDataset",
106 106
             function(data, dir_out = getwd())
... ...
@@ -50,13 +50,13 @@
50 50
 #' 
51 51
 #' @name aggregate
52 52
 #' @rdname aggregate-methods
53
-#' @aliases aggregate, GMQLDataset-methods
53
+#' @aliases aggregate, aggregate-methods
54 54
 #' @export
55 55
 #' 
56 56
 setMethod("aggregate", "GMQLDataset",
57 57
             function(data, groupBy = NULL)
58 58
             {
59
-                val = .data@value
59
+                val = data@value
60 60
                 gmql_merge(val, metadata)
61 61
             })
62 62
 
... ...
@@ -83,7 +83,7 @@
83 83
 #' }
84 84
 #' @name sort
85 85
 #' @rdname sort-methods
86
-#' @aliases sort, GMQLDataset-methods
86
+#' @aliases sort, sort-methods
87 87
 #' @export
88 88
 setMethod("sort", "GMQLDataset",
89 89
             function(x, decreasing = FALSE, metadata_ordering = NULL, 
... ...
@@ -88,7 +88,7 @@
88 88
 #'
89 89
 #' @name subset
90 90
 #' @rdname subset-methods
91
-#' @aliases subset, GMQLDataset-methods
91
+#' @aliases subset, subset-methods
92 92
 #' @export
93 93
 setMethod("subset", "GMQLDataset",
94 94
             function(x, metadata = NULL, metadata_update=NULL, 
... ...
@@ -13,12 +13,13 @@
13 13
 #' @importFrom rJava J
14 14
 #' @importFrom rJava .jnull
15 15
 #' @importFrom rJava .jarray
16
+#' @importFrom methods isClass
16 17
 #'
17 18
 #' @param x GMQLDataset class object
18
-#' @param predicate logical predicate made up by R logical operation 
19
+#' @param m_predicate logical predicate made up by R logical operation 
19 20
 #' on metadata attribute. 
20 21
 #' Only !, |, ||, &, && are admitted.
21
-#' @param region_predicate logical predicate made up by R logical operation 
22
+#' @param r_predicate logical predicate made up by R logical operation 
22 23
 #' on chema region values. 
23 24
 #' Only !, |, ||, &, && are admitted.
24 25
 #' @param semi_join list of CONDITION objects where every object contains 
... ...
@@ -82,9 +83,19 @@
82 83
 #' TRUE, semi_join_dataset = join_data )
83 84
 #' 
84 85
 #' }
86
+#' 
87
+#' @name filter
88
+#' @rdname GMQLDataset-class
89
+#' @aliases filter, filter-methods
90
+#' 
91
+setGeneric("filter", function(data, m_predicate = NULL, r_predicate = NULL, 
92
+                    semi_join = NULL, semi_join_negation = FALSE, 
93
+                    semi_join_dataset = NULL) 
94
+    standardGeneric("filter"))
95
+
85 96
 #' @name filter
86 97
 #' @rdname filter-methods
87
-#' @aliases filter, GMQLDataset-methods
98
+#' @aliases filter, filter-methods
88 99
 #' @export
89 100
 setMethod("filter", "GMQLDataset",
90 101
             function(data, m_predicate = NULL, r_predicate = NULL, 
... ...
@@ -42,9 +42,8 @@
42 42
 #' 
43 43
 #' res <- union(data1, data2)
44 44
 #' 
45
-#' @name union
46
-#' @rdname union-methods
47
-#' @aliases union, GMQLDataset-methods
45
+#' @rdname GMQLDataset-class
46
+#' @aliases union, GMQLDataset-method
48 47
 #' @export
49 48
 setMethod("union", c("GMQLDataset","GMQLDataset"),
50 49
             function(x, y)
... ...
@@ -1,9 +1,157 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/Dataset-class.R
2
+% Please edit documentation in R/Dataset-class.R, R/Select.R, R/Union.R
3 3
 \docType{class}
4 4
 \name{GMQLDataset-class}
5 5
 \alias{GMQLDataset-class}
6
-\title{Abstract class representing GMQL dataset}
6
+\alias{GMQLDataset}
7
+\alias{filter}
8
+\alias{filter,}
9
+\alias{filter-methods}
10
+\alias{union}
11
+\alias{union,}
12
+\alias{GMQLDataset-method}
13
+\title{Class GMQLDataset}
14
+\usage{
15
+GMQLDataset(value)
16
+
17
+filter(data, m_predicate = NULL, r_predicate = NULL, semi_join = NULL,
18
+  semi_join_negation = FALSE, semi_join_dataset = NULL)
19
+
20
+\S4method{union}{GMQLDataset,GMQLDataset}(x, y)
21
+}
22
+\arguments{
23
+\item{value}{value associated to GMQL dataset}
24
+
25
+\item{m_predicate}{logical predicate made up by R logical operation 
26
+on metadata attribute. 
27
+Only !, |, ||, &, && are admitted.}
28
+
29
+\item{r_predicate}{logical predicate made up by R logical operation 
30
+on chema region values. 
31
+Only !, |, ||, &, && are admitted.}
32
+
33
+\item{semi_join}{list of CONDITION objects where every object contains 
34
+the name of metadata to be used in semijoin, or simple string concatenation 
35
+of name of metadata, e.g. c("cell_type", "attribute_tag", "size") 
36
+without declaring condition.
37
+The CONDITION's available are:
38
+\itemize{
39
+\item{\code{\link{FULL}}: Fullname evaluation, two attributes match 
40
+if they both end with value and, if they have a further prefixes,
41
+the two prefix sequence are identical}
42
+\item{\code{\link{EXACT}}: Exact evaluation, only attributes exactly 
43
+as value will match; no further prefixes are allowed. }
44
+}
45
+Every condition accepts only one string value. (e.g. FULL("cell_type") )
46
+In case of single concatenation with no CONDITION or list with some value 
47
+without conditon, the metadata are considered having default 
48
+evaluation: the two attributes match if both end with value.}
49
+
50
+\item{semi_join_negation}{logical value: T => semijoin is perfomed 
51
+considering semi_join NOT IN semi_join_dataset, F => semijoin is performed 
52
+considering semi_join IN semi_join_dataset}
53
+
54
+\item{semi_join_dataset}{GMQLDataset class object}
55
+
56
+\item{x}{GMQLDataset class object}
57
+
58
+\item{y}{GMQLDataset class object}
59
+
60
+\item{x}{GMQLDataset class object}
61
+}
62
+\value{
63
+GMQLDataset class object. It contains the value to use as input 
64
+for the subsequent GMQL function
65
+
66
+GMQLDataset class object. It contains the value to use as input 
67
+for the subsequent GMQL function
68
+}
7 69
 \description{
8 70
 Abstract class representing GMQL dataset
71
+
72
+It returns all the samples satisfying the predicate on metadata.
73
+If regions are specified, returns regions satisfying the predicate 
74
+on regions.
75
+If semijoin clauses are specified they are applied, too.
76
+When semijoin is defined, it extracts those samples containing all metadata 
77
+attribute defined in semijoin clause with at least one metadata value 
78
+in common with semi join dataset.
79
+If no metadata in common between input dataset and semi join dataset, 
80
+no sample is extracted.
81
+
82
+It is used to integrate homogeneous or heterogeneous samples of two datasets 
83
+within a single dataset; for each sample of either input dataset, 
84
+a result sample is created as follows:
85
+\itemize{
86
+\item {Metadata are the same as in the original sample.}
87
+\item {Resulting schema is obtained by projecting the schema 
88
+of the right dataset over the schema of the left one
89
+(more properly, it will be performed by adding to the schema of the 
90
+left dataset the region attributes of the right dataset which are not 
91
+identical to those of the left dataset)}
92
+\item {Regions are the same (in coordinates and attribute values) 
93
+as in the original sample.
94
+Region attributes which are missing in an input dataset sample 
95
+w.r.t. the merged schema are set to null.}
96
+}
97
+For what concerns metadata, attributes of samples from the left (right) 
98
+input dataset are prefixed with the strings LEFT (RIGHT), so as to trace 
99
+the dataset to which they originally belonged.
100
+}
101
+\section{Slots}{
102
+
103
+\describe{
104
+\item{\code{value}}{value associated to GMQL dataset}
105
+}}
106
+
107
+\examples{
108
+
109
+## It selects from input data samples of patients younger than 70 years old, 
110
+## based on filtering on sample metadata attribute Patient_age
111
+
112
+init_gmql()
113
+test_path <- system.file("example", "DATASET", package = "RGMQL")
114
+input <- read_dataset(test_path)
115
+s <- subset(input, Patient_age < 70)
116
+
117
+
118
+\dontrun{
119
+
120
+It creates a new dataset called 'jun_tf' by selecting those samples and 
121
+their regions from the existing 'data' dataset such that:
122
+Each output sample has a metadata attribute called antibody_target 
123
+with value JUN.
124
+Each output sample also has not a metadata attribute called cell 
125
+that has the same value of at least one of the values that a metadata 
126
+attribute equally called cell has in at least one sample 
127
+of the 'join_data' dataset.
128
+For each sample satisfying previous condition,only its regions that 
129
+have a region attribute called pValue with the associated value 
130
+less than 0.01 are conserved in output
131
+
132
+
133
+init_gmql()
134
+test_path <- system.file("example", "DATASET", package = "RGMQL")
135
+test_path2 <- system.file("example", "DATASET_GDM", package = "RGMQL")
136
+data <- read_dataset(test_path)
137
+join_data <-  read_dataset(test_path2)
138
+jun_tf <- filter(data, antibody_target == 'JUN', pValue < 0.01, c("cell"), 
139
+TRUE, semi_join_dataset = join_data )
140
+
141
+}
142
+
143
+
144
+## It creates a dataset called full which contains all samples from the 
145
+## datasets data1 and data2 whose schema is defined by merging the two 
146
+## dataset schemas.
147
+## (union of all the attributes present in the two input datasets).
148
+
149
+init_gmql()
150
+test_path <- system.file("example", "DATASET", package = "RGMQL")
151
+test_path2 <- system.file("example", "DATASET_GDM", package = "RGMQL")
152
+data1 <- read_dataset(test_path)
153
+data2 <- read_dataset(test_path2)
154
+
155
+res <- union(data1, data2)
156
+
9 157
 }
... ...
@@ -1,12 +1,15 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/Merge.R
2
+% Please edit documentation in R/Dataset-class.R, R/Merge.R
3 3
 \docType{methods}
4 4
 \name{aggregate}
5 5
 \alias{aggregate}
6
+\alias{aggregate}
6 7
 \alias{aggregate,}
7
-\alias{GMQLDataset-methods}
8
-\title{GMQL Operation: MERGE}
8
+\alias{aggregate-methods}
9
+\title{Method mutate}
9 10
 \usage{
11
+aggregate(data, groupBy = NULL)
12
+
10 13
 \S4method{aggregate}{GMQLDataset}(data, groupBy = NULL)
11 14
 }
12 15
 \arguments{
... ...
@@ -34,6 +37,8 @@ DataSet class object. It contains the value to use as input
34 37
 for the subsequent GMQL function
35 38
 }
36 39
 \description{
40
+Wrapper to GMQL merge function
41
+
37 42
 It builds a dataset consisting of a single sample having as many regions
38 43
 as the number of regions of the input data and as many metadata 
39 44
 as the union of the 'attribute-value' tuples of the input samples.
... ...
@@ -3,9 +3,11 @@
3 3
 \docType{methods}
4 4
 \name{cover}
5 5
 \alias{cover}
6
+\alias{cover,}
7
+\alias{cover-methods}
6 8
 \alias{cover}
7 9
 \alias{cover,}
8
-\alias{GMQLDataset-methods}
10
+\alias{cover-methods}
9 11
 \title{GMQL Operation: COVER}
10 12
 \usage{
11 13
 cover(data, minAcc, maxAcc, ...)
... ...
@@ -142,4 +144,6 @@ test_path <- system.file("example", "DATASET", package = "RGMQL")
142 144
 exp = read_dataset(test_path)
143 145
 res = cover(exp, 2, 3, c("cell"), list(min_pValue = MIN("pvalue")))
144 146
 }
147
+
148
+
145 149
 }
146 150
deleted file mode 100644
... ...
@@ -1,97 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/Select.R
3
-\docType{methods}
4
-\name{filter}
5
-\alias{filter}
6
-\alias{filter,}
7
-\alias{GMQLDataset-methods}
8
-\title{GMQL Operation: SELECT}
9
-\usage{
10
-\S4method{filter}{GMQLDataset}(data, m_predicate = NULL, r_predicate = NULL,
11
-  semi_join = NULL, semi_join_negation = FALSE, semi_join_dataset = NULL)
12
-}
13
-\arguments{
14
-\item{semi_join}{list of CONDITION objects where every object contains 
15
-the name of metadata to be used in semijoin, or simple string concatenation 
16
-of name of metadata, e.g. c("cell_type", "attribute_tag", "size") 
17
-without declaring condition.
18
-The CONDITION's available are:
19
-\itemize{
20
-\item{\code{\link{FULL}}: 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{EXACT}}: Exact evaluation, only attributes exactly 
24
-as value will match; no further prefixes are allowed. }
25
-}
26
-Every condition accepts only one string value. (e.g. FULL("cell_type") )
27
-In case of single concatenation with no CONDITION or list with some value 
28
-without conditon, the metadata are considered having default 
29
-evaluation: the two attributes match if both end with value.}
30
-
31
-\item{semi_join_negation}{logical value: T => semijoin is perfomed 
32
-considering semi_join NOT IN semi_join_dataset, F => semijoin is performed 
33
-considering semi_join IN semi_join_dataset}
34
-
35
-\item{semi_join_dataset}{GMQLDataset class object}
36
-
37
-\item{x}{GMQLDataset class object}
38
-
39
-\item{predicate}{logical predicate made up by R logical operation 
40
-on metadata attribute. 
41
-Only !, |, ||, &, && are admitted.}
42
-
43
-\item{region_predicate}{logical predicate made up by R logical operation 
44
-on chema region values. 
45
-Only !, |, ||, &, && are admitted.}
46
-}
47
-\value{
48
-GMQLDataset class object. It contains the value to use as input 
49
-for the subsequent GMQL function
50
-}
51
-\description{
52
-It returns all the samples satisfying the predicate on metadata.
53
-If regions are specified, returns regions satisfying the predicate 
54
-on regions.
55
-If semijoin clauses are specified they are applied, too.
56
-When semijoin is defined, it extracts those samples containing all metadata 
57
-attribute defined in semijoin clause with at least one metadata value 
58
-in common with semi join dataset.
59
-If no metadata in common between input dataset and semi join dataset, 
60
-no sample is extracted.
61
-}
62
-\examples{
63
-
64
-## It selects from input data samples of patients younger than 70 years old, 
65
-## based on filtering on sample metadata attribute Patient_age
66
-
67
-init_gmql()
68
-test_path <- system.file("example", "DATASET", package = "RGMQL")
69
-input <- read_dataset(test_path)
70
-s <- subset(input, Patient_age < 70)
71
-
72
-
73
-\dontrun{
74
-
75
-It creates a new dataset called 'jun_tf' by selecting those samples and 
76
-their regions from the existing 'data' dataset such that:
77
-Each output sample has a metadata attribute called antibody_target 
78
-with value JUN.
79
-Each output sample also has not a metadata attribute called cell 
80
-that has the same value of at least one of the values that a metadata 
81
-attribute equally called cell has in at least one sample 
82
-of the 'join_data' dataset.
83
-For each sample satisfying previous condition,only its regions that 
84
-have a region attribute called pValue with the associated value 
85
-less than 0.01 are conserved in output
86
-
87
-
88
-init_gmql()
89
-test_path <- system.file("example", "DATASET", package = "RGMQL")
90
-test_path2 <- system.file("example", "DATASET_GDM", package = "RGMQL")
91
-data <- read_dataset(test_path)
92
-join_data <-  read_dataset(test_path2)
93
-jun_tf <- filter(data, antibody_target == 'JUN', pValue < 0.01, c("cell"), 
94
-TRUE, semi_join_dataset = join_data )
95
-
96
-}
97
-}
... ...
@@ -1,12 +1,12 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/Join.R
2
+% Please edit documentation in R/Dataset-class.R, R/Join.R
3 3
 \docType{methods}
4 4
 \name{join}
5 5
 \alias{join}
6 6
 \alias{join}
7 7
 \alias{join,}
8
-\alias{GMQLDataset-methods}
9
-\title{GMQL Operation: JOIN}
8
+\alias{join-methods}
9
+\title{Method join}
10 10
 \usage{
11 11
 join(x, y, by = NULL, ...)
12 12
 
... ...
@@ -65,6 +65,8 @@ GMQLDataset class object. It contains the value to use as input
65 65
 for the subsequent GMQL function
66 66
 }
67 67
 \description{
68
+Wrapper to GMQL join function
69
+
68 70
 It takes in input two datasets, respectively known as nchor (left) 
69 71
 and experiment (right) and returns a dataset of samples consisting of 
70 72
 regions extracted from the operands according to the specified condition
... ...
@@ -5,7 +5,7 @@
5 5
 \alias{materialize}
6 6
 \alias{materialize}
7 7
 \alias{materialize,}
8
-\alias{GMQLDataset-methods}
8
+\alias{materialize-methods}
9 9
 \title{GMQL Operation: MATERIALIZE}
10 10
 \usage{
11 11
 materialize(data, ...)
... ...
@@ -1,12 +1,15 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/Extend.R
2
+% Please edit documentation in R/Dataset-class.R, R/Extend.R
3 3
 \docType{methods}
4 4
 \name{mutate}
5 5
 \alias{mutate}
6
+\alias{mutate}
6 7
 \alias{mutate,}
7
-\alias{GMQLDataset-methods}
8
-\title{GMQL Operation: EXTEND}
8
+\alias{mutate-methods}
9
+\title{Method mutate}
9 10
 \usage{
11
+mutate(.data, metadata = NULL)
12
+
10 13
 \S4method{mutate}{GMQLDataset}(.data, metadata = NULL)
11 14
 }
12 15
 \arguments{
... ...
@@ -34,6 +37,8 @@ DataSet class object. It contains the value to use as input
34 37
 for the subsequent GMQL function
35 38
 }
36 39
 \description{
40
+Wrapper to GMQL extend function
41
+
37 42
 It generates new metadata attributes as result of aggregate functions 
38 43
 applied to sample region attributes and adds them to the existing metadata 
39 44
 attributes of the sample.
... ...
@@ -4,7 +4,7 @@
4 4
 \name{setdiff,GMQLDataset,GMQLDataset-method}
5 5
 \alias{setdiff,GMQLDataset,GMQLDataset-method}
6 6
 \alias{setdiff,}
7
-\alias{GMQLDataset-methods}
7
+\alias{setdiff-methods}
8 8
 \title{GMQL Operation: DIFFERENCE}
9 9
 \usage{
10 10
 \S4method{setdiff}{GMQLDataset,GMQLDataset}(x, y, joinBy = NULL,
... ...
@@ -4,7 +4,7 @@
4 4
 \name{sort}
5 5
 \alias{sort}
6 6
 \alias{sort,}
7
-\alias{GMQLDataset-methods}
7
+\alias{sort-methods}
8 8
 \title{GMQL operation: ORDER}
9 9
 \usage{
10 10
 \S4method{sort}{GMQLDataset}(x, decreasing = FALSE,
... ...
@@ -4,7 +4,7 @@
4 4
 \name{subset}
5 5
 \alias{subset}
6 6
 \alias{subset,}
7
-\alias{GMQLDataset-methods}
7
+\alias{subset-methods}
8 8
 \title{GMQL Operation: PROJECT}
9 9
 \usage{
10 10
 \S4method{subset}{GMQLDataset}(x, metadata = NULL, metadata_update = NULL,
11 11
deleted file mode 100644
... ...
@@ -1,56 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/Union.R
3
-\docType{methods}
4
-\name{union}
5
-\alias{union}
6
-\alias{union,}
7
-\alias{GMQLDataset-methods}
8
-\title{GMQL Operation: UNION}
9
-\usage{
10
-\S4method{union}{GMQLDataset,GMQLDataset}(x, y)
11
-}
12
-\arguments{
13
-\item{x}{GMQLDataset class object}
14
-
15
-\item{y}{GMQLDataset class object}
16
-}
17
-\value{
18
-GMQLDataset class object. It contains the value to use as input 
19
-for the subsequent GMQL function
20
-}
21
-\description{
22
-It is used to integrate homogeneous or heterogeneous samples of two datasets 
23
-within a single dataset; for each sample of either input dataset, 
24
-a result sample is created as follows:
25
-\itemize{
26
-\item {Metadata are the same as in the original sample.}
27
-\item {Resulting schema is obtained by projecting the schema 
28
-of the right dataset over the schema of the left one
29
-(more properly, it will be performed by adding to the schema of the 
30
-left dataset the region attributes of the right dataset which are not 
31
-identical to those of the left dataset)}
32
-\item {Regions are the same (in coordinates and attribute values) 
33
-as in the original sample.
34
-Region attributes which are missing in an input dataset sample 
35
-w.r.t. the merged schema are set to null.}
36
-}
37
-For what concerns metadata, attributes of samples from the left (right) 
38
-input dataset are prefixed with the strings LEFT (RIGHT), so as to trace 
39
-the dataset to which they originally belonged.
40
-}
41
-\examples{
42
-
43
-## It creates a dataset called full which contains all samples from the 
44
-## datasets data1 and data2 whose schema is defined by merging the two 
45
-## dataset schemas.
46
-## (union of all the attributes present in the two input datasets).
47
-
48
-init_gmql()
49
-test_path <- system.file("example", "DATASET", package = "RGMQL")
50
-test_path2 <- system.file("example", "DATASET_GDM", package = "RGMQL")
51
-data1 <- read_dataset(test_path)
52
-data2 <- read_dataset(test_path2)
53
-
54
-res <- union(data1, data2)
55
-
56
-}
57 0
new file mode 100644
... ...
@@ -0,0 +1,22 @@
1
+## ---- initialization, eval = TRUE----------------------------------------
2
+library('RGMQL')
3
+
4
+## ---- init, eval = TRUE--------------------------------------------------
5
+init_gmql()
6
+
7
+## ---- read GMQL dataset, eval = TRUE-------------------------------------
8
+gmql_dataset_path <- system.file("example", "EXON", package = "RGMQL")
9
+data_out = read_dataset(gmql_dataset_path)
10
+
11
+## ---- read GRangesList, eval = TRUE--------------------------------------
12
+library("GenomicRanges")
13
+gr1 <- GRanges(seqnames = "chr2",
14
+ranges = IRanges(103, 106), strand = "+",score = 5L, GC = 0.45)
15
+
16
+gr2 <- GRanges(seqnames = c("chr1", "chr1"),
17
+ranges = IRanges(c(107, 113), width = 3),strand = c("+", "-"),
18
+score = 3:4, GC = c(0.3, 0.5))
19
+
20
+grl <- GRangesList("txA" = gr1, "txB" = gr2)
21
+data_out <- read(grl)
22
+