% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AllGenerics.R, R/gmql_materialize.R
\docType{methods}
\name{take}
\alias{take}
\alias{take,GMQLDataset-method}
\alias{take-method}
\title{Method take}
\usage{
take(.data, ...)

\S4method{take}{GMQLDataset}(.data, rows = 0L)
}
\arguments{
\item{.data}{returned object from any GMQL function}

\item{...}{Additional arguments for use in other specific methods of the 
generic take function}

\item{rows}{number of regions rows for each sample that you want to 
retrieve and store in memory.
By default it is 0, that means take all rows for each sample}
}
\value{
GRangesList with associated metadata
}
\description{
Wrapper to TAKE operation

It saves the content of a dataset that contains samples metadata 
and regions as GRangesList.
It is normally used to store in memory the content of any dataset 
generated during a GMQL query. The operation can be very time-consuming.
If you invoked any materialization before take function, 
all those datasets are materialized as folders.
}
\examples{
## 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 folder "DATASET" in the subdirectory "example"
## of the package "RGMQL" and opens such folder as a GMQL dataset 
## named "rd" using CustomParser

init_gmql()
test_path <- system.file("example", "DATASET", package = "RGMQL")
rd = read_gmql(test_path)

## This statement creates a dataset called 'aggr' which contains one 
## sample for each antibody_target and cell value found within the metadata 
## of the 'rd' dataset sample; each created sample contains all regions 
## from all 'rd' samples with a specific value for their 
## antibody_target and cell metadata attributes.
 
aggr = aggregate(rd, conds(c("antibody_target", "cell")))

## This statement performs the query and returns the resulted dataset as 
## GRangesList named 'taken'. It returns only the first 45 regions of 
## each sample present into GRangesList and all the medatata associated 
## with each sample

taken <- take(aggr, rows = 45)

}