Rank genes by gene-wise raw perturbation scores within each sample to compare genes' contributions to pathway perturbations.

rank_gene_pert(genePertScore, gsTopology)

Arguments

genePertScore

List of gene-wise raw perturbation score matrices generated using function raw_gene_pert()

gsTopology

List of pathway topology matrices generated using function retrieve_topology()

Value

A list where each element is a matrix corresponding to a pathway. Each column of an element corresponds to a sample, and each row corresponds to a pathway gene.

Details

Ranking is performed within each sample each pathway. If in a given pathway, both positive and negative gene-wise perturbation scores exist, positive and negative scores are ranked separately, where the larger a positive rank, the more the gene contributed to the pathway's activation, and the smaller a negative rank, the more the gene contributed to the pathways' inhibition. When there's a tie in two gene's perturbation score within a sample, the mean of the indices is used.

Examples

#compute weighted single sample logFCs
data(metadata_example)
data(logCPM_example)
metadata_example <- dplyr::mutate(metadata_example, treatment = factor(
   treatment, levels = c("Vehicle", "E2+R5020", "R5020")))
ls <- weight_ss_fc(logCPM_example, metadata = metadata_example,
groupBy = "patient", treatColumn = "treatment", sampleColumn = "sample")
# extract all the KEGG pathways
gsTopology <- retrieve_topology(database = "kegg", species = "hsapiens")
# compute raw gene-wise perturbation scores
genePertScore <- raw_gene_pert(ls$logFC, gsTopology)
# rank genes by gene-wise perturbation scores within each sample
# to compare their contributions to pathway perturbation
geneRank <- rank_gene_pert(genePertScore, gsTopology)