generateNull.Rd
This function generates a number of random gene sets that
have the same number of genes as the scored gene set. It scores each random
gene set and returns a matrix of scores for all samples.
The empirical scores are used to calculate the empirical p-values and plot
the null distribution. The implementation uses BiocParallel::bplapply()
for easy access to parallel backends. Note that one should pass the same
values to the upSet
, downSet
, centerScore
and bidirectional
arguments as what they provide for the simpleScore()
function to generate
a proper null distribution.
generateNull(upSet, downSet = NULL, rankData, centerScore = TRUE, knownDirection = TRUE, B = 1000, ncores = 1, seed = sample.int(1e+06, 1), useBPPARAM = NULL) # S4 method for vector,missing generateNull(upSet, downSet = NULL, rankData, centerScore = TRUE, knownDirection = TRUE, B = 1000, ncores = 1, seed = sample.int(1e+06, 1), useBPPARAM = NULL) # S4 method for GeneSet,missing generateNull(upSet, downSet = NULL, rankData, centerScore = TRUE, knownDirection = TRUE, B = 1000, ncores = 1, seed = sample.int(1e+06, 1), useBPPARAM = NULL) # S4 method for vector,vector generateNull(upSet, downSet = NULL, rankData, centerScore = TRUE, knownDirection = TRUE, B = 1000, ncores = 1, seed = sample.int(1e+06, 1), useBPPARAM = NULL) # S4 method for GeneSet,GeneSet generateNull(upSet, downSet = NULL, rankData, centerScore = TRUE, knownDirection = TRUE, B = 1000, ncores = 1, seed = sample.int(1e+06, 1), useBPPARAM = NULL)
upSet | GeneSet object or a vector of gene Ids, up-regulated gene set |
---|---|
downSet | GeneSet object or a vector of gene Ids, down-regulated gene |
rankData | matrix, outcome of function |
centerScore | A Boolean, specifying whether scores should be centered around 0, default as TRUE |
knownDirection | A boolean flag, it deterimines whether the scoring method should derive the scores in a directional mannar when the gene signature only contains one set of gene set (passing the gene set via upSet). It is default as TRUE but one can set the argument to be FALSE to derive the score for a single gene set in a undirectional way. This parameter becomes irrelevant when both upSet and downSet are provided. |
B | integer, the number of permutation repeats or the number of random gene sets to be generated, default as 1000 |
ncores, | integer, the number of CPU cores the function can use |
seed | integer, set the seed for randomisation |
useBPPARAM, | the backend the function uses, if NULL is provided, the
function uses the default parallel backend which is the first on the list
returned by |
A matrix of empirical scores for all samples
ranked <- rankGenes(toy_expr_se) scoredf <- simpleScore(ranked, upSet = toy_gs_up, downSet = toy_gs_dn) # find out what backends can be registered on your machine BiocParallel::registered()#> $MulticoreParam #> class: MulticoreParam #> bpisup: FALSE; bpnworkers: 44; bptasks: 0; bpjobname: BPJOB #> bplog: FALSE; bpthreshold: INFO; bpstopOnError: TRUE #> bptimeout: 2592000; bpprogressbar: FALSE #> bpRNGseed: #> bplogdir: NA #> bpresultdir: NA #> cluster type: FORK #> #> $SnowParam #> class: SnowParam #> bpisup: FALSE; bpnworkers: 44; bptasks: 0; bpjobname: BPJOB #> bplog: FALSE; bpthreshold: INFO; bpstopOnError: TRUE #> bptimeout: 2592000; bpprogressbar: FALSE #> bpRNGseed: #> bplogdir: NA #> bpresultdir: NA #> cluster type: SOCK #> #> $SerialParam #> class: SerialParam #> bpisup: TRUE; bpnworkers: 1; bptasks: 0; bpjobname: BPJOB #> bplog: FALSE; bpthreshold: INFO; bpstopOnError: TRUE #> bptimeout: 2592000; bpprogressbar: FALSE #> bplogdir: NA #># the first one is the default backend # ncores = ncores <- parallel::detectCores() - 2 permuteResult = generateNull(upSet = toy_gs_up, downSet = toy_gs_dn, ranked, centerScore = TRUE, B =10, seed = 1, ncores = 1 )