knitr::opts_chunk$set(echo = TRUE)
GSEMA is a package designed to perform gene set enrichment meta-analysis.
The gene set enrichment meta-analysis allows for obtaining the differentially
regulated gene sets or pathways that are shared across various studies.
Specifically, GSEMA applies a meta-analysis based on the combination of
effect sizes obtained from single sample enrichment (SSE) analysis applied to
individual the different studies. The different effect sizes of each study for
each of the gene sets are calculated using a difference of means based on the
enrichment scores obtained from SSE analysis. GSEMA offers various methods to
obtain the statistics for the difference of means.
Subsequently, GSEMA allows for applying the various steps typical of a meta-analysis, in a similar way to the gene expression meta-analysis (@Toro_2020), although different adjustments to the calculated statistics are performed in order to correct the possible existence of false positive bias.
This vignette provides a tutorial-style introduction to all the steps necessary to properly conduct gene set enrichment meta-analysis using the GSEMA package.
GSEMA uses a specific object as input, which is a list of nested lists where each nested list corresponds to a study. This object can be created directly by the users or they can use createObjectMApath() function to create it.
For the examples that are going to be shown, synthetic data will be used. We load the sample data into our R session.
library(GSEMA) data("simulatedData")
As previously stated, the meta-analysis input in GSEMA is a list of nested lists. Each nested list contains two elements:
This object can be created directly by the user or we can make use of createObjectMApath() function, which creates the objectMApath after indicating:
createObjectMApath() function allows to create the object needed to perform meta-analysis. In this case, it is necessary to indicate as input of the function the variables that contain the experimental and reference groups:
#List of expression matrices listMatrices <- list(study1Ex, study2Ex)
listPhenodata <- list(study1Pheno, study2Pheno)
It is important to note that if any element does not belong to the experimental or the reference group, that sample is not taken into account in the creation of meta-analysis object.
Here, we have included an example to show how exactly the function is used:
Since this function can be a bit complicated if there are many datasets, we recommend creating a vector to keep the column names of the phenodatas that contains the variable that identifies the groups to compare (namePheno argument). Moreover, we should create two others lits to indicate how to identify experimental (cases) and reference (controls) groups in these variables (expGroups and refGroups arguments).
If we look at the example phenodatas we can observed that the groups variable is "condition". Experimental group is named as "Case" and reference group as "Healthy".
study1Pheno$Condition
head(names(GeneSets)) GeneSets[[1]]
In parallelization, several aspects must be considered. "n.cores" refers to the parallelization of studies or datasets. Therefore, if we have 3 studies, the maximum number for "n.cores" will be 3. internal.n.cores refers to the parallelization of single sample enrichment methods. This is especially recommended for the ssGSEA method. For Singscore and GSVA, it may also be advisable. The process is parallelized based on the samples in each study. Therefore, the larger the number of samples, the slower the process will be. The number of cores that the computer will use is the multiplication of both parameters n.cores * internal.n.cores = total cores.
We all this information we can create the vector for namePheno argument and the two list for expGroups and refGroups:
listMatrices <- list(study1Ex, study2Ex) listPhenodata <- list(study1Pheno, study2Pheno) phenoGroups <- c("Condition","Condition", "Condition") phenoCases <- list("Case", "Case", "Case") phenoControls <- list("Healthy", "Healthy", "Healthy") objectMApathSim <- createObjectMApath( listEX = listMatrices, listPheno = listPhenodata, namePheno = phenoGroups, expGroups = phenoCases, refGroups = phenoControls, geneSets = GeneSets, pathMethod = "Zscore", n.cores = 1, internal.n.cores = 1, minSize = 7)
The result obtained is the proper object to perform meta-analysis (objectMApath).
GSEMA package has implemented gene set enrichment meta-analysis techniques based on the combination of effect sizes in the metaAnalysisDEpath() function. Although this function can be applied directly, it is advisable to consider some previous steps.
Before performing the meta-analysis, it is important to filter out those pathways with low expression in the datasets. This is because the results of the meta-analysis could be biased by the presence of pathways with low expression, which may lead to an increase in the number of false positives. GSEMA provides a function called *filterPaths() that allows to filter out those pathways with low expression. The inputs of this function are:
objectMApathSim <- filteringPaths(objectMApathSim, threshold = 0.65)
GSEMA has implemented three different estimator for calculating the effect sizes in each study:
The metaAnalysisDEpath() function allows to perform a meta-analysis in only one step, needing only the meta-analysis object created previously.
This function has as input:
In the following example, we have applied a Random Effect model to the GSEMA object ("objectMApathSim") we have been working with so far. In addition we have applied the "limma" method to calculate the effect size. Finally, we have allowed a 0.3 proportion of missing values in a sample and a gene set must have been contained in all studies:
results <- metaAnalysisESpath(objectMApath = objectMApathSim, measure = "limma", typeMethod = "REM", missAllow = 0.3, numData = length(objectMApathSim))
The output of this function is a dataframe with the results of the meta-analysis where rows are the genes and columns are the different variables provided by the meta-analysis:
results[1,]
results[nrow(results),]
The results are provided in a dataframe with the variables:
Finally, we can represent in a heatmap the significant gene sets in order to observe how they are regulated in each of the studies. In heatmapPaths() function we have to include both the object that has been used in the meta-analysis, the result of it and the applied method. In addition, this package offers three different scaling approaches (scaling) in order to compare properly the gene set enrichment scores of the studies in the heatmap:
Moreover, in regulation argument, we can choose if we want to represent the over regulated or under regulated gene sets:
We can choose the number of significant gene sets (numSig) that we want to be shown on the graph and the adjusted p-value from which a gene set is considered as significant (fdrSig). In addition, the gene sets that are not presented in one sample are represented in gray.
Here we present an example of the heatmap which have been obtained from the result of applying a random effects model to the object "objectMApathSim" and making use of a "zscor" scaling approach.
res <- heatmapPaths(objectMA=objectMApathSim, results, scaling = "zscor", regulation = "all",breaks=c(-2,2), fdrSig = 0.05, comES_Sig = 1, numSig=20, fontsize = 5)
The calculateESpath() function returns the effects size in each of the studies. Moreover, it calculates the variance of each of the effects.
#Effects <- calculateESpath(objectMApath = objectMApathSim, measure = "limma") #Effects[[1]]["Simulated_Pathway",] #Effects[[2]]["Simulated_Pathway",]
sessionInfo()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.