library(knitr) opts_chunk$set( cache = FALSE, echo = TRUE, warning = FALSE, error = FALSE, message = FALSE )
This R package provides the model we inferred in the publication "Perturbation-response genes reveal signaling footprints in cancer gene expression" and a function to obtain pathway scores from a gene expression matrix. It is available on bioRxiv.
airway
package data for pathway scoresThis is to outline how to prepare expression data, in this case from the
airway
package for pathway activity analysis using PROGENy.
library(airway) library(DESeq2) data(airway) # import data to DESeq2 and variance stabilize dset = DESeqDataSetFromMatrix(assay(airway), colData=as.data.frame(colData(airway)), design=~dex) dset = estimateSizeFactors(dset) dset = estimateDispersions(dset) gene_expr = getVarianceStabilizedData(dset) # annotate matrix with HGNC symbols library(biomaRt) mart = useDataset("hsapiens_gene_ensembl", useMart("ensembl")) genes = getBM(attributes = c("ensembl_gene_id","hgnc_symbol"), values=rownames(gene_expr), mart=mart) matched = match(rownames(gene_expr), genes$ensembl_gene_id) rownames(gene_expr) = genes$hgnc_symbol[matched]
We can then use the progeny
function to score the expression matrix. Note
that we are scaling the pathway scores with respect to the controls only.
library(progeny) pathways = progeny(gene_expr, scale=FALSE) controls = airway$dex == "untrt" ctl_mean = apply(pathways[controls,], 2, mean) ctl_sd = apply(pathways[controls,], 2, sd) pathways = t(apply(pathways, 1, function(x) x - ctl_mean)) pathways = apply(pathways, 1, function(x) x / ctl_sd)
So now we might be interested how the treatment with dexamethasone affects signaling pathways. To do this, we check if the control is different to the perturbed condition using a linear model:
library(dplyr) result = apply(pathways, 1, function(x) { broom::tidy(lm(x ~ !controls)) %>% filter(term == "!controlsTRUE") %>% dplyr::select(-term) }) mutate(bind_rows(result), pathway=names(result))
What we see is that indeed the p53/DNA damage response pathway is less active after treatment than before.
Below is an example on how to calculate pathway scores for cell lines in the Genomics of Drug Sensitivity in Cancer (GDSC) panel, and to check for associations with drug response.
The code used for the analyses is available on Github.
This example shows how to use the GDSC gene expression data of multiple cell lines together with PROGENy to calculate pathway activity and then to check for associations with drug sensitivity.
First, we need the GDSC data for both gene expression and drug response. They are available on the GDSC1000 web site:
# set up a file cache so we download only once library(BiocFileCache) bfc = BiocFileCache(".") # gene expression and drug response base = "http://www.cancerrxgene.org/gdsc1000/GDSC1000_WebResources/Data/" paths = bfcrpath(bfc, paste0(base, c("suppData/TableS4A.xlsx", "preprocessed/Cell_line_RMA_proc_basalExp.txt.zip")))
You can also download the files manually (adjust the file names when loading):
First, we need to load the files we just downloaded into R to be able to perform the analysis:
# load the downloaded files drug_table <- readxl::read_excel(paths[1], skip=5, na="NA") drug_table <- replace(drug_table, is.na(drug_table), 0) gene_table <- readr::read_tsv(paths[2]) # we need drug response with COSMIC IDs drug_response <- data.matrix(drug_table[,3:ncol(drug_table)]) rownames(drug_response) <- drug_table[[1]] # we need genes in rows and samples in columns gene_expr <- data.matrix(gene_table[,3:ncol(gene_table)]) colnames(gene_expr) <- sub("DATA.", "", colnames(gene_expr), fixed=TRUE) rownames(gene_expr) <- gene_table$GENE_SYMBOLS
Activity inference is done using a weighted sum of the model genes. We can run this without worrying about the order of genes in the expression matrix using:
library(progeny) pathways <- progeny(gene_expr,scale = TRUE, organism = "Human", top = 100, perm = 1, verbose = FALSE)
To visualize the progeny result
library(pheatmap) myColor = colorRampPalette(c("Darkblue", "white","red"))(100) pheatmap(pathways,fontsize=14, show_rownames = FALSE, color=myColor, main = "PROGENy", angle_col = 45, treeheight_col = 0, border_color = NA)
We now have the pathway activity scores for the pathways defined in PROGENy:
head(pathways)
Trametinib is a MEK inhibitor, so we would assume that cell lines that have a higher MAPK activity are more sensitive to MEK inhibition.
We can test this the following way:
cell_lines = intersect(rownames(pathways), rownames(drug_response)) trametinib = drug_response[cell_lines, "Trametinib"] mapk = pathways[cell_lines, "MAPK"] associations = lm(trametinib ~ mapk) summary(associations)
And indeed we find that MAPK activity is strongly associated with sensitivity
to Trametinib: the Pr(>|t|)
is much smaller than the conventional threshold
of 0.05
.
The intercept is significant as well, but we're not really interested if the
mean drug response is above or below 0
in this case.
Note, however, that we tested all cell lines at once and did not adjust for the effect different tissues may have.
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.