#'Simulate the Fisher's test p-values.
#'
#'Given the incidence table for selected features (i.e. pinmat generated by \code{findpins}),
#'compute the Fisher's test p-values for pairwise comparisons. Also perform permutations on the incidence table and
#'compute a set of Fisher's test p-values for each permutation.
#'@param pins The pin generated by \code{findpins}. The bin information for the selected feature set.
#'@param pinmat The incidence table generated by \code{findpins}.
#'@param sim_round An integer. The number of permutations/simulations. Default value: 500.
#'@return A list of two numeric vector objects. The Fisher's test p-values for the observation (true_fisherPV) and for
#'the permutations (sim_fisherPV).
#'@export
simFisher_parallel <- function(pins, pinmat, sim_round = 500){
m <- vector(mode = "list", length = length(unique(pins[,"sign"])))
for(i in 1:length(unique(pins[,"sign"])))
{m[[i]] <- pinmat[pins[,"sign"] == unique(pins[,"sign"])[i],,drop = F]}
usecores <- parallel::detectCores() - 4
true_fisherPV <- simFisher(m, nsim = 1, nsweep = 0, seedme = 123,
distrib = "Rparallel", njobs = usecores, combo = "Fisher")
sim_fisherPV <- simFisher(m, nsim = sim_round, nsweep = 200, seedme = 123,
distrib = "Rparallel", njobs = usecores, combo = "Fisher")
return(list(true_fisherPV = true_fisherPV, sim_fisherPV = sim_fisherPV))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.