Dr. Gabriel J. Odom1 Department of Public Health Sciences, Miller School of Medicine, The University of Miami, Miami, FL (gabriel.odom@med.miami.edu)
Dr. Yuguang James Ban2 Sylvester Comprehensive Cancer Center, The University of Miami, Miami, FL (Yuguang.ban@med.miami.edu)
Lizhong Liu3 Department of Public Health Sciences, Miller School of Medicine, The University of Miami, Miami, FL (lxl816@miami.edu)
Prof. Lily Wang4 Department of Public Health Sciences, Miller School of Medicine; McDonald Foundation Department of Human Genetics; The University of Miami, Miami, FL (lily.wang@med.miami.edu)
Prof. Steven Chen5 Department of Public Health Sciences, Miller School of Medicine; Sylvester Comprehensive Cancer Center; The University of Miami, Miami, FL (steven.chen@med.miami.edu)
1.2 Workshop Description
With the advance in high-throughput technology for molecular assays, multi-omics datasets have become increasingly available. In this workshop, we will demonstrate using the pathwayPCA package to perform integrative pathway-based analyses of multi-omics datasets. In particular, we will demonstrate through three case studies the capabilities of pathwayPCA to
perform pathway analysis with gene selection,
estimate and visualize sample-specific pathway activities in ovarian cancer,
integrate multi-omics datasets to identify driver genes, and
identify pathways with sex-specific effects in kidney cancer.
We also strongly recommend the RStudio11https://www.rstudio.com/products/rstudio/download/ integrated development environment as a user-friendly graphical wrapper for R. We require R version 3.6 or later.
1.2.3.1 Package descriptions
This workshop package, Bioc2019pathwayPCA, depends on two packages:
The tidyverse package suite is a collection of utility packages for data science: ggplot2, dplyr, tidyr, readr, purrr, tibble, stringr, and forcats. We will make use of some data constructs and ideas from these packages, but we do not expect users to be intimately familiar with them.
Because we are currently in the development phase for version 2 of this package, you can install the package from GitHub. In order to install a package from GitHub, you will need the devtools::16https://github.com/r-lib/devtools package and either Rtools17https://cran.r-project.org/bin/windows/Rtools/ (for Windows) or Xcode18https://developer.apple.com/xcode/ (for Mac). Then you can install the development version of the pathwayPCA package from GitHub via:
Test pathway association with binary, continuous, or survival phenotypes.
Compute principal components (PCs) based on selected genes. These estimated latent variables represent pathway activities for individual subjects, which can then be used to perform integrative pathway analysis, such as multi-omics analysis.
Extract relevant genes that drive pathway significance (as well as data corresponding to these relevant genes) using the SuperPCA and AESPCA approaches for additional in-depth analysis.
Analyze studies with complex experimental designs, with multiple covariates, and with interaction effects, e.g., testing whether pathway association with clinical phenotype is different between male and female subjects.
How does pathwayPCA fit into the plethora of pathway analysis tools available?
pathwayPCA tests the self-contained null hypothesis (Q1) (PMID: 2156526522https://doi.org/10.1016/j.ygeno.2011.04.006); that is, the features (e.g. genes) in a pathway are not associated with the disease phenotype.
When the “real” causal genes are fully contained in one particular pathway, testing Q1 and Q2 are approximately the same. However, when genes in multiple pathways are associated with the disease (as in many cancer studies) or when causal genes are shared by multiple gene sets, using competitive tests that compare pathway association signals with the rest of the genome may result in loss of power.
pathwayPCA models correlations within pathways when constructing PCA scores.
Many tools, including globaltest,27https://doi.org/10.18129/B9.bioc.globaltest ignore expert-based biological information and fail to consider gene-gene correlations contained in biological pathways.
Missing values in -omics data need to be imputed prior to analysis.
In general, PCA is a poor choice for binary data. Therefore, pathwayPCA is a poor choice for GISTIC calls (copy number data) or mutation data.
1.4.2 Main functions
pathwayPCA uses four main groups of functions: data import and wrangling, object creation, object analysis, and analysis inspection. The main function groups are
Data:
read_gmt() imports a .gmt file as a pathway collection.
TransposeAssay() is a variant of the base t() function designed specifcially for data frames and tibbles. It preserves row and column names after transposition.
Omics* Objects:
CreateOmics() takes in a collection of pathways, a single -omics assay, and a clinical response data frame and creates a data object of class Omics*.
SubsetPathwayData() can extract the pathway-specific assay values and responses for a given pathway from an Omics* object.
Methods:
AESPCA_pVals() takes in an Omics* object and calculates pathway \(p\)-values (parametrically or non-parametrically), principal components, and loadings via AESPCA. This returns an object of class aespcOut.
SuperPCA_pVals() takes in an Omics* object with valid response information and calculates pathway parametric \(p\)-values, principal components, and loadings via SuperPCA. This returns an object of class superpcOut.
Results:
getPathPCLs() takes in an object of class aespcOut or superpcOut and the TERMSname of a pathway. This function extracts 1) the data frame of principal components and subject IDs for the given pathway, and 2) a data frame of sparse loadings and feature names for the given pathway.
getPathpVals() takes in an object of class aespcOut or superpcOut and returns a table of the \(p\)-values and false discovery rates for each pathway.
1.4.3pathwayPCA inputs
1.4.3.1 Assay data
We define our assay data format in R as follows:
Let \(\textbf{X} \in \mathbb{R}_{n \times p}\) be the observed single-omics data (gene expression, protein expression, copy-number variation, etc.).
We follow Tidy Data design33Wickham, 2014 and record subjects in the rows and -ome features in the columns.
Use the two utility functions, TransposeAssay() or SE2Tidy(), to wrangle your assay data into appropriate form for further analysis. Here is an example of “tidying” the first assay from a SummarizedExperiment object:
# DONT RUN
library(SummarizedExperiment)
data(airway, package = "airway")
airway_df <- SE2Tidy(airway, whichAssay = 1)
1.4.3.2 Pathway collections
Based on expert knowledge of the problem at hand, curate a set of biological pathways \(1, \ldots, K\), where pathway \(k\) contains \(p_k\) -ome measurements. These pathway collections are often stored in a .gmt file, a text file with each row corresponding to one pathway. Each row contains an ID (column TERMS), an optional description (column description), and the genes in the pathway (all subsequent columns). This file format is independently defined by the Broad Institute.34http://software.broadinstitute.org/cancer/software/gsea/wiki/index.php/Data_formats Pathway collections in .gmt form can be downloaded from the MSigDB database.35http://software.broadinstitute.org/gsea/msigdb/collections.jsp
# DONT RUN
library(rWikiPathways)
# library(XML) # necessary if you encounter an error with readHTMLTable
downloadPathwayArchive(
organism = "Homo sapiens", format = "gmt"
)
Pathway-based Adaptive, Elastic-net, Sparse PCA (AESPCA)39Chen (2011) combines the following methods into a single objective function: Elastic-Net40Zou and Hastie, 2005, Adaptive Lasso41Zou, 2012, and Sparse PCA42Zou, Hastie, and Tibshirani, 2012. AESPCA extracts principal components from pathway \(k\) which minimize this composite objective function. These extracted PCs represent activities within each pathway. The estimated latent variables are then tested against phenotypes using either a parametric or permutation test (permuting the sample responses). Note that the AESPCA approach does not use the response information to estimate pathway PCs, so it is an unsupervised approach.
Pathway-based Supervised PCA (SuperPCA):43Chen et al. (2008)44Chen et al. (2010) ranks each feature in pathway \(k\) by its univariate relationship with the outcome of interest (survival time, tumor size, cancer subtype, etc.), then extracts principal components from the features most related to the outcome. Because of this gene selection step, this method is “supervised”. Therefore, test statistics from the SuperPCA model can no longer be approximated using the Student’s \(t\)-distribution. To account for the gene selection step, SuperPCA as implemented in pathwayPCA estimates \(p\)-values from a two-component mixture of Gumbel extreme value distributions instead.
1.5 Case Study 1: Identifying Significant Pathways in Protein Expressions Associated with Survival Outcome in Ovarian Cancer
1.5.1 Ovarian cancer dataset
For this example, we will use the mass spectrometry based global proteomics data for ovarian cancer recently generated by the Clinical Proteomic Tumor Analysis Consortium (CPTAC).45https://proteomics.cancer.gov/programs/cptac The gene-level, log-ratio normalized protein abundance expression dataset for tumor samples can be obtained from the LinkedOmics database.46http://linkedomics.org/data_download/TCGA-OV/ We used the dataset “Proteome (PNNL, Gene level)” which was generated by the Pacific Northwest National Laboratory (PNNL).47https://www.pnnl.gov/ One subject was removed due to missing survival outcome. Proteins with greater than 20% missingness were removed from the assay. The remaining missing values were imputed using the Bioconductor package impute under default settings. The final dataset consisted of 5162 protein expression values for 83 samples.
1.5.2 Creating an Omics data object for pathway analysis
First, we need to create an Omics-class data object that stores
the expression dataset
phenotype information for the samples
a collection of pathways
1.5.2.1 Expression and phenotype data
We can obtain protein expression and phenotype datasets for the TCGA ovarian cancer dataset by downloading the raw files from the LinkedOmics website. However, for ease and to save time, we include cleaned and imputed versions of these datasets within this package (for the cleaning process, please see the clean_multi_omics.R file in inst/scripts).
The ovProteome_df dataset is a data frame with protein expression levels and TCGA sample IDs. The variables (columns) include expression data for 4763 proteins for each of the 83 primary tumour samples.
Now that we have these three data components (pathway collection, proteomics, and clinical responses), we create an OmicsSurv data container. Note that when assayData_df and response are supplied from two different files, the user must match and merge these data sets by sample IDs. The assay and response must have matching row names, otherwise the function will error.
ov_OmicsSurv <- CreateOmics(
# protein expression data
assayData_df = ovProteome_df,
# pathway collection
pathwayCollection_ls = wikipathways_PC,
# survival phenotypes
response = ovPheno_df,
# phenotype is survival data
respType = "survival",
# retain pathways with > 5 proteins
minPathSize = 5
)
There are 83 samples shared by the assay and phenotype data.
====== Creating object of class OmicsSurv =======
The input pathway database included 5831 unique features.
The input assay dataset included 4763 features.
Only pathways with at least 5 or more features included in the assay dataset are
tested (specified by minPathSize parameter). There are 312 pathways which meet
this criterion.
Because pathwayPCA is a self-contained test (PMID: 17303618), only features in
both assay data and pathway database are considered for analysis. There are 1936
such features shared by the input assay and pathway database.
To see a summary of the Omics data object we just created, simply type the name of the object:
Once we have a valid Omics object, we can perform pathway analysis using the AESPCA or SuperPCA methodology as described above. Because the syntax for performing SuperPCA is nearly identical to the AESPCA syntax, we will illustrate only the AESPCA workflow below.
1.5.3.1 Implementation
We estimate pathway significance via the following model: phenotype ~ intercept + PC1. Pathway \(p\)-values are estimated based on a likelihood ratio test that compares this model to the null model phenotype ~ intercept. Note that when the value supplied to the numReps argument is greater than 0, the AESPCA_pvals() function employs a non-parametric, permutation-based test to assign the statistical significance of this model.
ovarian_aespcOut <- AESPCA_pVals(
# The Omics data container
object = ov_OmicsSurv,
# One principal component per pathway
numPCs = 1,
# Use parallel computing with 2 cores
parallel = TRUE,
numCores = 2,
# # Use serial computing
# parallel = FALSE,
# Estimate the p-values parametrically (AESPCA only)
numReps = 0,
# Control FDR via Benjamini-Hochberg
adjustment = "BH"
)
Part 1: Calculate Pathway AES-PCs
Initializing Computing Cluster: DONE
Extracting Pathway PCs in Parallel: DONE
Part 2: Calculate Pathway p-Values
Initializing Computing Cluster: DONE
Extracting Pathway p-Values in Parallel: DONE
Part 3: Adjusting p-Values and Sorting Pathway p-Value Data Frame
DONE
This ovarian_aespcOut object contains 3 components: a table of pathway \(p\)-values, AESPCA-estimated PCs of each sample from each pathway, and the loadings of each protein onto the AESPCs.
We haven’t yet added a print() method for these analysis outputs, so be careful: use the two accessor functions, getPathpVals() and getPathPCLs() instead. We will show examples of these functions next.
1.5.3.2 Table of pathway analysis results
For this ovarian cancer dataset, the top 20 most significant pathways identified by AESPCA are:
getPathpVals(ovarian_aespcOut)
terms
description
rawp
FDR_BH
WP2036
TNF related weak inducer of apoptosis (TWEAK) Signaling Pathway
0.0019066
0.3301101
WP363
Wnt Signaling Pathway
0.0046961
0.3301101
WP3850
Factors and pathways affecting insulin-like growth factor (IGF1)-Akt signaling
0.0079715
0.3301101
WP2447
Amyotrophic lateral sclerosis (ALS)
0.0082310
0.3301101
WP262
EBV LMP1 signaling
0.0116029
0.3301101
WP2795
Cardiac Hypertrophic Response
0.0116402
0.3301101
WP2840
Hair Follicle Development: Cytodifferentiation (Part 3 of 3)
1.5.3.3 (OPTIONAL) Column chart of significant pathways
Before constructing a graph of the \(p\)-values, we extract the top 10 pathways (the default value for numPaths is 20). The score = TRUE returns the negative natural logarithm of the unadjusted \(p\)-values for each pathway (to enhance graphical display of the top pathways).
Now we plot the pathway significance level for the top 20 pathways.
ggplot(ovOutGather_df) +
# set overall appearance of the plot
theme_bw() +
# Define the dependent and independent variables
aes(x = reorder(terms, score), y = score) +
# From the defined variables, create a vertical bar chart
geom_col(position = "dodge", fill = "#005030", width = 0.7) +
# Add a line showing the alpha = 0.0001 level
geom_hline(yintercept = -log10(0.0001), size = 1, color = "#f47321") +
# Add pathway labels
geom_text(
aes(x = reorder(terms, score), label = reorder(description, score), y = 0.1),
color = "white",
size = 4,
hjust = 0
) +
# Set main and axis titles
ggtitle("AESPCA Significant Pathways: Ovarian Cancer") +
xlab("Pathways") +
ylab("Negative Log10 (p-Value)") +
# Flip the x and y axes
coord_flip()
1.5.3.4 Extract relevant genes from significant pathways
Because pathways are defined a priori, typically only a subset of genes within each pathway are relevant to the phenotype and contribute to pathway significance. In AESPCA, these relevant genes are the genes with nonzero loadings in the first PC of AESPCs.
1.5.3.5 (OPTIONAL) Plot protein loadings for a single pathway
We can also prepare these loadings for graphics:
wp195Loadings_df <-
wp195Loadings_df %>%
# Sort Loading from Strongest to Weakest
arrange(desc(abs(PC1))) %>%
# Order the Genes by Loading Strength
mutate(featureID = factor(featureID, levels = featureID)) %>%
# Add Directional Indicator (for Colour)
mutate(Direction = factor(ifelse(PC1 > 0, "Up", "Down")))
Now we will construct a column chart with ggplot2’s geom_col() function.
ggplot(data = wp195Loadings_df) +
# Set overall appearance
theme_bw() +
# Define the dependent and independent variables
aes(x = featureID, y = PC1, fill = Direction) +
# From the defined variables, create a vertical bar chart
geom_col(width = 0.5, fill = "#005030", color = "#f47321") +
# Set main and axis titles
labs(
title = "Gene Loadings on IL-1 Signaling Pathway",
x = "Protein",
y = "Loadings of PC1"
) +
# Remove the legend
guides(fill = FALSE)
In the study of complex diseases, there is often considerable heterogeneity among different subjects with regard to underlying causes of disease and benefit of particular treatment. Therefore, in addition to identifying disease-relevant pathways for the entire patient group, successful (personalized) treatment regimens will also depend upon knowing if a particular pathway is dysregulated for an individual patient.
To this end, we can also assess subject-specific pathway activity. As we saw earlier, the getPathPCLs() function also returns subject-specific estimates for the individual pathway PCs. We can plot these as follows.
ggplot(data = wp195PCLs_ls$PCs) +
# Set overall appearance
theme_classic() +
# Define the independent variable
aes(x = V1) +
# Add the histogram layer
geom_histogram(bins = 10, color = "#005030", fill = "#f47321") +
# Set main and axis titles
labs(
title = "Distribution of Sample-specific Estimate of Pathway Activities",
subtitle = paste0(wp195PCLs_ls$pathway, ": ", wp195PCLs_ls$description),
x = "PC1 Score for Each Sample",
y = "Count"
)
This graph shows there can be considerable heterogeneity in pathway activities between the patients.
1.5.3.7 Extract analysis dataset for entire pathway
Users are often also interested in examining the actual data used for analysis of the top pathways, especially for the relevant genes with the pathway. To extract this dataset, we can use the SubsetPathwayData() function. These commands extract data for the IL-1 signaling pathway:
Now we inspect the output from the Cox PH model (we’ve included the pretty version using the prettify() function from the papeR package51https://CRAN.R-project.org/package=papeR):
summary(wp195_mod)
coef
Hazard Ratio
CI (lower)
CI (upper)
se(coef)
z
Pr(>|z|)
NFKB1
0.4606061
1.585034
1.176442
2.135536
0.1521005
3.028302
0.002
**
1.5.3.9 (OPTIONAL) Gene-specific survival curves
Additionally, we can estimate Kaplan-Meier survival curves for patients with high or low expression values for individual genes:
NFKB1_df <-
NFKB1_df %>%
# Group subjects by gene expression
mutate(NFKB1_Expr = ifelse(NFKB1 > median(NFKB1), "High", "Low")) %>%
# Re-code time to years
mutate(EventTime = EventTime / 365.25) %>%
# Ignore any events past 10 years
filter(EventTime <= 10)
# Fit the survival model
NFKB1_fit <- survfit(
Surv(EventTime, EventObs) ~ NFKB1_Expr,
data = NFKB1_df
)
Finally, we can plot these K-M curves over NFKB1 protein expression.
ggsurvplot(
NFKB1_fit,
# No confidence intervals; add the p-value
conf.int = FALSE, pval = TRUE,
# Show times to median survival
surv.median.line = "hv",
xlab = "Time in Years",
palette = c("#f47321", "#005030")
)
1.6 Case study 2: An Integrative Multi-Omics Pathway Analysis of Ovarian Cancer Survival
While copy number alterations are common genomic aberrations in ovarian carcer, recent studies have shown these changes do not necessarily lead to concordant changes in protein expression. In Section 1.5.3 above, we illustrated testing pathway activities in protein expression against survival outcome. In this section, we will additionally test pathway activities in copy number against survival outcome. Moreover, we will perform integrative analysis to identify those survival-associated protein pathways, genes, and samples driven by copy number alterations.
1.6.1 Creating copy number Omics data object
We can identify copy number (CNV) pathways significantly associated with survival in the same way as we did for protein expressions. This gene-level CNV data was downloaded from the same LinkedOmics database.
And now we create an Omics data container. (Note: because these analysis steps take a little longer than the steps shown previously–3 minutes over 20 cores, we include the AESPCA output directly. You don’t need to execute the code in the next two chunks.)
1230 gene name(s) are invalid. Invalid name(s) are: ...
There are 549 samples shared by the assay and phenotype data.
====== Creating object of class OmicsSurv =======
The input pathway database included 5831 unique features.
The input assay dataset included 24776 features.
Only pathways with at least 5 or more features included in the assay dataset are
tested (specified by minPathSize parameter). There are 424 pathways which meet
this criterion.
Because pathwayPCA is a self-contained test (PMID: 17303618), only features in
both assay data and pathway database are considered for analysis. There are 5637
such features shared by the input assay and pathway database.
1.6.1.1 AESPCA pathway analysis for copy-number data
Finally, we can apply the AESPCA method to this copy-number data container. Due to the large sample size, this will take a few moments.
Part 1: Calculate Pathway AES-PCs
Initializing Computing Cluster: DONE
Extracting Pathway PCs in Parallel: DONE
Part 2: Calculate Pathway p-Values
Initializing Computing Cluster: DONE
Extracting Pathway p-Values in Parallel: DONE
Part 3: Adjusting p-Values and Sorting Pathway p-Value Data Frame
DONE
Rather than execute this code yourself, we have included the output object with this package:
data(ovCNV_aespcOut)
1.6.2 Combine significant pathways from CNV and protein analyses
Next, we identify the intersection of significant pathways based on both CNV and protein data. First, we will create a data frame of the pathway \(p\)-values from both CNV and proteomics.
# Copy Number
CNVpvals_df <-
getPathpVals(ovCNV_aespcOut, alpha = 0.05) %>%
mutate(rawp_CNV = rawp) %>%
select(description, rawp_CNV)
# Proteomics
PROTpvals_df <-
getPathpVals(ovarian_aespcOut, alpha = 0.05) %>%
mutate(rawp_PROT = rawp) %>%
select(description, rawp_PROT)
# Intersection
SigBoth_df <- inner_join(PROTpvals_df, CNVpvals_df, by = "description")
# WnT Signaling Pathway is listed as WP363 and WP428
The results showed there are 32 pathways significantly associated with survival in both CNV and protein data, which is significantly more than expected by chance (p-value = 0.00065; Fisher’s Exact Test; shown in multi_pathway_overlap_fishers.R). Here are the top-10 most significant pathways (sorted by protein data significance):
SigBoth_df[1:10, ]
description
rawp_PROT
rawp_CNV
TNF related weak inducer of apoptosis (TWEAK) Signaling Pathway
0.0019066
0.0128430
Wnt Signaling Pathway
0.0046961
0.0303257
Wnt Signaling Pathway
0.0046961
0.0371408
Factors and pathways affecting insulin-like growth factor (IGF1)-Akt signaling
0.0079715
0.0272851
EBV LMP1 signaling
0.0116029
0.0498388
Cardiac Hypertrophic Response
0.0116402
0.0274414
Hair Follicle Development: Cytodifferentiation (Part 3 of 3)
0.0120476
0.0006223
IL-1 signaling pathway
0.0144856
0.0141512
RANKL/RANK (Receptor activator of NFKB (ligand)) Signaling Pathway
Similar to the protein pathway analysis shown in Section 1.5.3, we can also identify relevant genes with nonzero loadings that drives pathway significance in CNV. The “IL-1 signaling pathway” (WP195) is significant in both CNV and protein data, so we look for genes with non-zero loadings in both.
The result showed that NFKB1, IKBKB, and other genes are selected by AESPCA when testing IL-1 signaling pathway (WP195) against survival outcome in both CNV and protein pathway analysis.
Also in Section 1.5.3, we have seen that there can be considerable heterogeneity in pathway activities between patients. One possible reason could be that copy number changes might not directly result in changes in protein expression for some of the patients. pathwayPCA can be used to estimate pathway activities for each patient, for copy number, gene, and protein expressions separately. These estimates can then be viewed jointly using a Circos plot.
The accompanying Circos plot shown normalized copy number (inner circle) and protein expression (outer circle) pathway activities for the IL-1 signaling pathway in the ovarian cancer dataset samples. Each bar corresponds to a patient sample. Red bars indicate lower expression values and negative pathway activity for the sample, while blue color bars indicate higher expression values and stronger pathway activity for the sample. Note that only some patients have concordant changes in copy number and protein expression. The code to make this plot is included in inst/scripts/circle_plot.R.
1.7 (OPTIONAL) Case Study 3: Analysis of Studies with Complex Designs
pathwayPCA is capable of analyzing studies with multiple experimental factors. In this section, we illustrate using pathwayPCA to test differential association of pathway expression with survival outcome in male and female subjects.
1.7.1 Data setup and AESPCA analysis
For this example, we used IlluminaHiSeq gene expression RNAseq data from the TCGA KIRP cohort, which we downloaded from the Xena browser datahub.52https://xenabrowser.net/datapages/ (This process is described in inst/scripts/explore_KIRP.R.) First, we load the KIRP data, create an Omics data container, and extract first AESPC from each pathway.
data("kirpPheno_df")
data("kirpRNAseq_df")
Once again, this will take a few moments (on my machine, this takes 1.9 minutes over 20 cores). (You can skip the next two chunks and load the results directly.)
# DONT RUN
kidney_Omics <- CreateOmics(
assayData_df = kirpRNAseq_df,
pathwayCollection_ls = wikipathways_PC,
# Exclude the gender indicator for now
response = kirpPheno_df[, 1:3],
respType = "surv",
minPathSize = 5
)
317 genes have variance < epsilon and will be removed. These gene(s) are: ...
30 gene name(s) are invalid. Invalid name(s) are: ...
There are 320 samples shared by the assay and phenotype data.
====== Creating object of class OmicsSurv =======
The input pathway database included 5831 unique features.
The input assay dataset included 20213 features.
Only pathways with at least 5 or more features included in the assay dataset are
tested (specified by minPathSize parameter). There are 423 pathways which meet
this criterion.
Because pathwayPCA is a self-contained test (PMID: 17303618), only features in
both assay data and pathway database are considered for analysis. There are 5566
such features shared by the input assay and pathway database.
Part 1: Calculate Pathway AES-PCs
Initializing Computing Cluster: DONE
Extracting Pathway PCs in Parallel: DONE
Part 2: Calculate Pathway p-Values
Initializing Computing Cluster: DONE
Extracting Pathway p-Values in Parallel: DONE
Part 3: Adjusting p-Values and Sorting Pathway p-Value Data Frame
DONE
Rather than execute this code yourself, we have included the output object with this package:
data("kirpRNAseq_aespcOut")
1.7.2 Test for sex interaction with first PC
Next we can test whether there is differential pathway association with survival outcome for males and females by the following model,
\[
h(t) = h_0(t) \exp\left[ \beta_1\text{PC}_1 + \beta_2\text{male} + \beta_3(\text{PC}_1 \times \text{male}) \right].
\]
In this model, \(h(t)\) is expected hazard at time \(t\), \(h_0 (t)\) is baseline hazard when all predictors are zero, variable \(male\) is an indicator variable for male samples, and \(PC_1\) is a pathway’s estimated first principal component based on AESPCA.
In order to test the sex interaction effect for all pathways, we will write a function which tests the interaction effect for one pathway.
TestIntxn <- function(pathway, pcaOut, resp_df){
# For the given pathway, extract the PCs and loadings from the pcaOut list
PCL_ls <- getPathPCLs(pcaOut, pathway)
# Select and rename the PC
PC_df <- PCL_ls$PCs %>% rename(PC1 = V1)
# Join the phenotype data to this PC
data_df <- inner_join(resp_df, PC_df, by = c("Sample" = "sampleID"))
# Construct a survival model with sex interaction
sex_mod <- coxph(
Surv(time, status) ~ PC1 + male + PC1 * male, data = data_df
)
# Extract the model fit statistics for the interaction
modStats_mat <- t(
coef(summary(sex_mod))["PC1:maleTRUE", ]
)
colnames(modStats_mat) <- c("coef", "exp_coef", "se_coef", "z", "pVal")
# Return a data frame of the pathway and model statistics
list(
statistics = data.frame(
terms = pathway,
description = PCL_ls$description,
modStats_mat,
stringsAsFactors = FALSE
),
model = sex_mod
)
}
As an example, we can test it on pathway WP195,
TestIntxn("WP195", kirpRNAseq_aespcOut, kirpPheno_df)$model
#> Call:
#> coxph(formula = Surv(time, status) ~ PC1 + male + PC1 * male,
#> data = data_df)
#>
#> coef exp(coef) se(coef) z p
#> PC1 0.03278 1.03332 0.08206 0.399 0.690
#> maleTRUE -0.38822 0.67826 0.32827 -1.183 0.237
#> PC1:maleTRUE 0.05649 1.05812 0.10438 0.541 0.588
#>
#> Likelihood ratio test=3.97 on 3 df, p=0.2652
#> n= 320, number of events= 51
We can also apply this function to our list of pathways.
# List of pathways
paths_char <- kirpRNAseq_aespcOut$pVals_df$terms
# Apply over this list
interactions_ls <- sapply(
paths_char,
FUN = TestIntxn,
pcaOut = kirpRNAseq_aespcOut,
resp_df = kirpPheno_df,
simplify = FALSE
)
We will tabulate this list and sort the pathways by significance:
interactions_df <-
# Take list of interactions
interactions_ls %>%
# select the first element (the data frame of model stats)
lapply(`[[`, 1) %>%
# stack these data frames
bind_rows() %>%
as_tibble() %>%
# sort the rows by significance
arrange(pVal)
Now, we can inspect the pathways with significant gender-PC1 interaction (note that we have not adjusted these pathway results for false discovery rate; these examples are only to show functionality of the package).
interactions_df %>%
filter(pVal < 0.05)
terms
description
coef
exp_coef
se_coef
z
pVal
WP1559
TFs Regulate miRNAs related to cardiac hypertrophy
-0.5974123
0.5502336
0.2162150
-2.763048
0.0057264
WP453
Inflammatory Response Pathway
-0.2721135
0.7617678
0.1090278
-2.495817
0.0125667
WP3893
Development and heterogeneity of the ILC family
-0.3293713
0.7193758
0.1374713
-2.395928
0.0165783
WP3929
Chemokine signaling pathway
-0.2517367
0.7774494
0.1086949
-2.315995
0.0205586
WP2849
Hematopoietic Stem Cell Differentiation
-0.2782097
0.7571380
0.1286124
-2.163165
0.0305285
WP1423
Ganglio Sphingolipid Metabolism
-0.4868302
0.6145714
0.2303461
-2.113473
0.0345603
WP3892
Development of pulmonary dendritic cells and macrophage subsets
-0.3162134
0.7289039
0.1508071
-2.096807
0.0360107
WP3678
Amplification and Expansion of Oncogenic Pathways as Metastatic Traits
-0.3569601
0.6998004
0.1705141
-2.093434
0.0363104
WP4141
PI3K/AKT/mTOR - VitD3 Signalling
0.3137007
1.3684801
0.1533151
2.046117
0.0407448
WP3941
Oxidative Damage
-0.3536377
0.7021293
0.1757314
-2.012376
0.0441803
WP3863
T-Cell antigen Receptor (TCR) pathway during Staphylococcus aureus infection
-0.2327905
0.7923196
0.1167679
-1.993616
0.0461940
WP3872
Regulation of Apoptosis by Parathyroid Hormone-related Protein
0.2670302
1.3060799
0.1345790
1.984188
0.0472348
WP3672
LncRNA-mediated mechanisms of therapeutic resistance
-0.3923992
0.6754344
0.1979623
-1.982191
0.0474578
WP3967
miR-509-3p alteration of YAP1/ECM axis
-0.2994116
0.7412542
0.1514701
-1.976705
0.0480750
The results showed the most significant pathway is WP1559 (“TFs Regulate miRNAs related to cardiac hypertrophy”). We can inspect the model results for this pathway directly.
The results showed that although sex is not significantly associated with survival outcome, the association of pathway gene expression (PC1) with survival is highly dependent on sex of the samples.
1.7.3 Survival curves by sex interaction
For visualization, we first match the PC expression to survival outcome.
# Bind the Pheno Data to WP1559's First PC
kidneyWP1559_df <- inner_join(
kirpPheno_df,
getPathPCLs(kirpRNAseq_aespcOut, "WP1559")$PCs,
by = c("Sample" = "sampleID")
)
Now we divide subjects according to sex and high or low PC-expression, and add a group indicator for the four groups.
# Add Grouping Feature
kidneySurvWP1559grouped_df <-
kidneyWP1559_df %>%
rename(PC1 = V1) %>%
# add strength indicator
mutate(direction = ifelse(PC1 > median(PC1), "High", "Low")) %>%
# group by interaction of sex and strength on PC
mutate(group = paste0(direction, ifelse(male, "_Male", "_Female"))) %>%
# recode time in years
mutate(time = time / 365.25) %>%
# remove summarized columns
select(-male, -PC1, -direction)
Now we can plot survival curves for the four groups.
# Fit the survival model
fit <- survfit(
Surv(time, status) ~ group,
data = kidneySurvWP1559grouped_df
)
ggsurvplot(
fit, conf.int = FALSE,
xlab = "Time in Years",
ylim = c(0.4, 1),
xlim = c(0, 10)
)
These Kaplan-Meier curves show that while high or low pathway activities were not significantly associated with survival in male subjects (green and purple curves, respectively), female subjects with high pathway activities (red) had significantly worse survival outcomes than those with low pathway activities (blue).
1.8 Further Reading
For addtional information on pathwayPCA, each of our supplementary vignette chapters contain detailed tutorials on the topics discussed above. These vignettes are:
Chen, X., Wang, L., Smith, J.D. and Zhang, B. (2008) Supervised principal component analysis for gene set enrichment of microarray data with continuous or survival outcomes. Bioinformatics, 24, 2474-2481.
Chen, X., Wang, L., Hu, B., Guo, M., Barnard, J. and Zhu, X. (2010) Pathway-based analysis for genome-wide association studies using supervised principal components. Genetic epidemiology, 34, 716-724.
Chen, X. (2011) Adaptive elastic-net sparse principal component analysis for pathway association testing. Statistical applications in genetics and molecular biology, 10.