storeToStats {gQTLstats} | R Documentation

## extract a vector from store results as ff (out of memory reference); support statistical reductions

### Description

extract a vector from store results as ff (out of memory reference); support statistical reductions

### Usage

    storeToQuantiles(store, field,
        probs=c(seq(0,.999,.001), 1-(c(1e-4,1e-5,1e-6,1e-7))),
        ids = NULL, ..., checkField = FALSE, filter=force)
    storeToHist(store, getter = function(x)
                 as.numeric(S4Vectors::as.matrix(mcols(x)[,
                 grep("permScore", names(mcols(x)))])), breaks, ids =
                 NULL, filter = force)
    storeToFDR(store, xprobs = c(seq(0, 0.999, 0.001), 1 - (c(1e-04,
                 1e-05, 1e-06, 1e-07))), xfield = "chisq", getter =
                 function(x) as.numeric(S4Vectors::as.matrix(mcols(x)[,
                 grep("permScore", names(mcols(x)))])), filter = force,
                .id4coln=1, ids=NULL)

### Arguments

`store` | instance of `ciseStore-class`
`field` | character tag, length one, must be name of a numeric field in the result set (typically something like 'chisq' in the GRanges generated by cisAssoc)
`xfield` | as `field`, for FDR computation, see Details.
`ids` | job ids to be used; if NULL, process all jobs
`breaks` | boundaries of histogram bins
`...` | supplied to makeRegistry for a temporary registry: typically will be a vector of package names if additional packages are needed to process results
`checkField` | if TRUE steps will be taken to verify that the tag to which 'field' evaluates is present in result in the first job
`probs` | numeric vector of probabilities with values in [0,1]. See `quantile.ff`.
`xprobs` | percentiles of the empirical distribution of the association statistic at which FDR estimates are recorded.
`getter` | function of a single argument that extracts a numeric vector of association scores obtained under permutation
`x` | instance of FDRsupp
`filter` | function accepting and returning GRanges instance, executed when cisAssoc result is loaded to modify that result, defaults to no-op
`.id4coln` | job id to be used for initial probe to determine names of fields in mcols of all jobs

### Details

uses current BatchJobs configuration to parallelize extraction; reduceResults could be used for a sequential solution

### Value

storeToQuantiles and storeToHist return objects analogous to those returned by stats::quantile and graphics::hist.

However, it should be noted that storeToQuantiles will use the `quantile.ff` of ffbase. For vectors of modest length, this can disagree with results of base::quantile by a few percent.

storeToFDR and storeToFDRByProbe return an instance of FDRsupp class

### Note

uses ffbase:::c.ff explicitly to concatenate outputs; there is no guarantee of order among elements

### Examples

    ## Not run:
     stopifnot(require(geuvStore2))
     require(BatchJobs)
     require(gQTLBase)
     store = makeGeuvStore2()
     library(doParallel)
     if (.Platform$OS.type == "windows") {
       registerDoSEQ()
       } else registerDoParallel(cores=max(c(detectCores()-1,1)))
     smchisq = storeToFf( store, "chisq", ids=store@validJobs[1:3])
     smchisq
     if (.Platform$OS.type != "windows") { # avoid timeout
      qs = storeToQuantiles( store, "chisq", ids = store@validJobs[1:5],
        probs=seq(.1,.9,.1) )
      qs
      hh = storeToHist( store, ids = store@validJobs[1:5], breaks=
        c(0,qs,1e9) )
      hh$counts
      fd = storeToFDR( store, xprobs=c(seq(.05,.95,.05),.99,.999) )
      tail(getTab(fd),4)
      sss = storeToFDRByProbe( store , xprobs=c(seq(.05,.95,.05),.99) )
      tail(getTab(sss),4)
      }

    ## End(Not run)

[Package gQTLstats version 1.21.3 Index]