take {RGMQL} | R Documentation

## Method take

### 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.

### Usage

    take(.data, ...)

    ## S4 method for signature 'GMQLDataset'
    take(.data, rows = 0L)

### Arguments

`.data` | returned object from any GMQL function
`...` | Additional arguments for use in other specific methods of the generic take function
`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

### 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)

[Package RGMQL version 1.8.0 Index]