% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AllGenerics.R, R/gmql_map.R
\title{Method map}
map(x, y, ...)

\S4method{map}{GMQLDataset}(x, y, ..., joinBy = conds(),
  count_name = "")
\item{x}{GMQLDataset class object}

\item{y}{GMQLDataset class object}

\item{...}{a series of expressions separated by comma in the form 
\emph{key} = \emph{aggregate}. The \emph{aggregate} is an object of 
class AGGREGATES. The aggregate functions available are: \code{\link{SUM}}, 
\code{\link{COUNT}}, \code{\link{MIN}}, \code{\link{MAX}}, 
\code{\link{AVG}}, \code{\link{MEDIAN}}, \code{\link{STD}}, 
\code{\link{BAG}}, \code{\link{BAGD}}, \code{\link{Q1}}, 
\code{\link{Q2}}, \code{\link{Q3}}.
Every aggregate accepts a string value, except for COUNT, which does not 
have any value.
Argument of 'aggregate function' must exist in schema, i.e. among region 
attributes. Two styles are allowed:
\item list of key-value pairs: e.g. sum = SUM("pvalue")
\item list of values: e.g. SUM("pvalue")
"mixed style" is not allowed}

\item{joinBy}{\code{\link{conds}} function to support methods with 
groupBy or JoinBy input parameter}

\item{count_name}{string defining the metadata count name; if it is 
not specified the name is "count_left_right"}
GMQLDataset object. It contains the value to use as input 
for the subsequent GMQLDataset method
Wrapper to GMQL MAP operator

It computes, for each sample in the right dataset, aggregates over the 
values of the right dataset regions that intersect with a region in a left 
dataset sample, for each region of each sample in the left dataset.
The number of generated output samples is the Cartesian product 
of the samples in the two input datasets;
each output sample has the same regions as the related input left dataset 
sample, with their attributes and values, plus the attributes computed as 
aggregates over right region values.
Output sample metadata are the union of the related input sample metadata,
whose attribute names are prefixed with 'left' or 'right' respectively.
When the joinby clause is present, only pairs of samples of x dataset
and of y dataset with metadata M1 and M2, respectively, that satisfy 
the joinby condition are considered.

The clause consists of a list of metadata attribute names that must be
present with equal values in both M1 and  M2

## This statement initializes and runs the GMQL server for local execution 
## and creation of results on disk. Then, with system.file() it defines 
## the path to the folders "DATASET" and "DATASET_GDM" in the subdirectory 
## "example" of the package "RGMQL", and opens such folders as a GMQL 
## dataset named "exp" and "ref", respectively, using CustomParser

test_path <- system.file("example", "DATASET", package = "RGMQL")
test_path2 <- system.file("example", "DATASET_GDM", package = "RGMQL")
exp = read_gmql(test_path)
ref = read_gmql(test_path2)

## This statement counts the number of regions in each sample from exp 
## dataset that overlap with a ref dataset region, and for each ref region 
## it computes the minimum score of all the regions in each exp sample that 
## overlap with it. The MAP joinBy option ensures that only the exp samples 
## referring to the same 'cell_tissue' of a ref sample are mapped on such 
## ref sample; exp samples with no cell_tissue metadata attribute, or with 
## such metadata attribute, but with a different value from the one(s) 
## of ref sample(s), are disregarded.

out = map(ref, exp, minScore = MIN("score"), joinBy = conds("cell_tissue"))