R/normalise_by_permutation.R
generate_permuted_scores.RdSimulate null distributions of perturbation scores for each pathway through sample permutation.
generate_permuted_scores(
logCPM,
numOfTreat,
NB = 1000,
gsTopology,
weight,
BPPARAM = BiocParallel::bpparam()
)Matrix of normaslised logCPM where rows are genes and columns are samples. Row names need to be gene entrez IDs.
Number of treatments (including control)
Number of permutations
List of pathway topology matrices generated using function retrieve_topology
A vector of gene-wise weights derived from function weight_ss_fc
The parallel back-end to uses, if not specified, it is defaulted to the one returned by BiocParallel::bpparam().
A list where each element is a vector of perturbation scores for a pathway.
This function firstly randomly permute sample labels NB times to generate permuted logFCs, which are then used to compute permuted perturbation scores for each pathway. The function outputs a list that is of the same length as the list storing pathway topology matrices. Each element of the output list is for a pathway and contains a vector of permuted perturbation score of length NB. It's assumed that the permuted perturbation scores can be used to estimate the null distributions of perturbation scores.
The input logCPM matrix should be identical to the input used for weight_ss_fc function. If the requested number of permutation (NB) is larger than the maximum number of permutations possible, NB will be set to the largest
number of permutations possible instead.
#compute weighted single sample logFCs
data(metadata_example)
data(logCPM_example)
ls <- weight_ss_fc(logCPM_example, metadata = metadata_example,
factor = "patient", control = "Vehicle")
# explore all species and databases supported by graphite
if (FALSE) {
load(system.file("extdata", "gsTopology.rda", package = "sSNAPPY"))
permutedScore <- generate_permuted_scores(logCPM_example, numOfTreat = 3,
NB = 1000, gsTopology = gsTopology, weight = ls$weight)
# To see what other parallel back-end can be used:
BiocParallel::registered()
}