senstab: create a plottable table for eQTL sensitivity analysis...

Description Usage Arguments Details Value Examples

View source: R/senstab.R

Description

create a plottable table for eQTL sensitivity analysis visualization

Usage

1
2
3
senstab(x, filt = force)
## S3 method for class 'senstab'
plot(x, ...)

Arguments

x

a list generated by a process analogous to the sensitivity survey exhibited in the example below

filt

a function that operates on and returns a data.frame; typically will select rows based on values of fields 'MAF' and 'radius'

...

extra arguments passed to plot

Details

sensByProbe is a list structure; for information on this and other elements of sensitivity analysis workflow, see extensive non-executed code in example below

Value

an instance of the S3 class 'senstab', 'data.frame'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
## Not run: 
#
# illustration of sensitivity analysis using BatchJobs
#
# assume the following content in 'parms.R' (uncommented)
# MAFS = c(.03, .04, .05, .075, .10, .125, .15)
# dists = c(5000, 7500, 10000, 15000, 20000, 
#    25000, 50000, 100000, 250000, 500000, 750000, 1000000)
# parms = expand.grid(MAFS, dists)
library(BatchJobs)  # for bigStore manip
library(gQTLstats)

# could use multilevel parallelism here
# because it is a somewhat large, fragile job, BatchJobs
# is a relevant tool for iteration.  but storeToFDRByProbe is
# already using bplapply.  so register 3 cores for it 
# and specify 15 cpu for BatchJobs in .BatchJobs.R

sens1 = makeRegistry("sens1", file.dir="sens1", 
    packages=c("gQTLstats", "dplyr"),
    src.files="parms.R")  # note parms.R

sens4One = function(z) {
      load("../bigStore.rda")  # get a ciseStore instance
      ans = storeToFDRByProbe(bigStore, xprobs=seq(.01,.99,.01), # xprobs
                                          # needs to be chosen with care
      filter=function(x) x[which(x$MAF >= parms[z,1] & 
          x$mindist <= parms[z,2])])
      ans = setFDRfunc(ans, span=.35)  # span can be important
      list(fdrsupp=ans, parms=parms[z,])
 }

batchMap(sens1, sens4One, 1:nrow(parms))
submitJobs(sens1)

# now loadResult(sens1) or the equivalent can be the input to senstab()
# as in the example to continue here:

## End(Not run)
library(gQTLstats)
data(sensByProbe)
ptab = t(sapply(sensByProbe, function(x)as.numeric(x[[2]])))
unique(ptab[,1]) # MAFs used
unique(ptab[,2]) # radii used
# here we filter away some extreme values of the design space
tab = senstab(sensByProbe, filt=function(x) {
    x[ x$radius > 10000 & x$ radius < 500000 & x$MAF > .03, ]
    } )
plot(tab)

gQTLstats documentation built on Nov. 8, 2020, 7:53 p.m.