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") %>%
select(-term)
})
mutate(bind_rows(result), pathway=names(result))
## estimate std.error statistic p.value pathway
## 1 3.5242360 6.2963291 0.5597287 0.595925900 EGFR
## 2 0.9684490 1.9388917 0.4994859 0.635221193 Hypoxia
## 3 -1.0136631 0.6475826 -1.5653032 0.168549446 JAK.STAT
## 4 2.3439425 1.4663981 1.5984353 0.161061691 MAPK
## 5 0.3727587 0.7904909 0.4715535 0.653904224 NFkB
## 6 -2.6798154 3.4710112 -0.7720561 0.469388994 PI3K
## 7 1.7279408 1.2942359 1.3351050 0.230263175 TGFb
## 8 0.8612744 0.6793308 1.2678277 0.251835691 TNFa
## 9 1.7640411 0.9266713 1.9036319 0.105636529 Trail
## 10 0.5362758 0.8335053 0.6433982 0.543757746 VEGF
## 11 -4.4976904 0.7684032 -5.8532944 0.001097878 p53
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)
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$X__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)
We now have the pathway activity scores for the pathways defined in PROGENy:
head(pathways)
## EGFR Hypoxia JAK.STAT MAPK NFkB
## 906826 0.03030286 -0.09136142 -0.36490995 -0.1758001 -0.5793367
## 687983 -0.99125434 -1.32673898 -0.93152060 -0.4946866 -1.3799417
## 910927 -0.10673190 -0.78816420 -1.06002081 0.1370551 -0.5497209
## 1240138 -0.05592591 -0.74266270 -0.07989446 -0.8259452 0.3418629
## 1240139 -0.15157011 0.11136425 -0.58596025 -0.2583581 -0.7256043
## 906792 0.71386069 0.39667896 -0.50001888 1.1967197 -0.4005830
## PI3K TGFb TNFa Trail VEGF p53
## 906826 -0.1999210 -0.6198524 -0.4724567 -0.5891909 0.18688452 -1.1725585
## 687983 0.3824370 -0.6696468 -1.0229424 -0.6113840 -0.06262960 -1.0818725
## 910927 -0.2155790 0.6214328 -0.1737935 -0.9185408 0.24335159 0.8249120
## 1240138 0.5883394 1.8891349 1.0191163 0.1214765 -0.15953605 2.1774919
## 1240139 1.0191110 0.9312615 -0.4347272 -0.2985134 0.36720972 0.8348820
## 906792 -2.1897400 -0.3093659 -0.1523604 -0.1621503 0.08751554 -0.9558531
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)
##
## Call:
## lm(formula = trametinib ~ mapk)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.9965 -1.5286 0.3535 1.5446 6.8271
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.03670 0.07155 -14.49 <2e-16 ***
## mapk -1.31733 0.07095 -18.57 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.125 on 880 degrees of freedom
## (80 observations deleted due to missingness)
## Multiple R-squared: 0.2815, Adjusted R-squared: 0.2806
## F-statistic: 344.7 on 1 and 880 DF, p-value: < 2.2e-16
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.
## R version 3.4.2 (2017-09-28)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 16.04.3 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.6-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.6-bioc/R/lib/libRlapack.so
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] parallel stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] BiocFileCache_1.2.0 dbplyr_1.1.0
## [3] bindrcpp_0.2 dplyr_0.7.4
## [5] progeny_1.0.0 biomaRt_2.34.0
## [7] DESeq2_1.18.0 airway_0.111.1
## [9] SummarizedExperiment_1.8.0 DelayedArray_0.4.0
## [11] matrixStats_0.52.2 Biobase_2.38.0
## [13] GenomicRanges_1.30.0 GenomeInfoDb_1.14.0
## [15] IRanges_2.12.0 S4Vectors_0.16.0
## [17] BiocGenerics_0.24.0 knitr_1.17
##
## loaded via a namespace (and not attached):
## [1] nlme_3.1-131 bitops_1.0-6
## [3] bit64_0.9-7 RColorBrewer_1.1-2
## [5] progress_1.1.2 httr_1.3.1
## [7] rprojroot_1.2 tools_3.4.2
## [9] backports_1.1.1 R6_2.2.2
## [11] rpart_4.1-11 Hmisc_4.0-3
## [13] DBI_0.7 lazyeval_0.2.1
## [15] colorspace_1.3-2 nnet_7.3-12
## [17] gridExtra_2.3 prettyunits_1.0.2
## [19] mnormt_1.5-5 bit_1.1-12
## [21] curl_3.0 compiler_3.4.2
## [23] htmlTable_1.9 scales_0.5.0
## [25] checkmate_1.8.5 psych_1.7.8
## [27] readr_1.1.1 genefilter_1.60.0
## [29] rappdirs_0.3.1 stringr_1.2.0
## [31] digest_0.6.12 foreign_0.8-69
## [33] rmarkdown_1.6 XVector_0.18.0
## [35] base64enc_0.1-3 pkgconfig_2.0.1
## [37] htmltools_0.3.6 htmlwidgets_0.9
## [39] rlang_0.1.2 readxl_1.0.0
## [41] RSQLite_2.0 bindr_0.1
## [43] BiocParallel_1.12.0 acepack_1.4.1
## [45] RCurl_1.95-4.8 magrittr_1.5
## [47] GenomeInfoDbData_0.99.1 Formula_1.2-2
## [49] Matrix_1.2-11 Rcpp_0.12.13
## [51] munsell_0.4.3 stringi_1.1.5
## [53] yaml_2.1.14 zlibbioc_1.24.0
## [55] plyr_1.8.4 grid_3.4.2
## [57] blob_1.1.0 lattice_0.20-35
## [59] splines_3.4.2 annotate_1.56.0
## [61] hms_0.3 locfit_1.5-9.1
## [63] geneplotter_1.56.0 reshape2_1.4.2
## [65] XML_3.98-1.9 glue_1.2.0
## [67] evaluate_0.10.1 latticeExtra_0.6-28
## [69] data.table_1.10.4-3 cellranger_1.1.0
## [71] gtable_0.2.0 purrr_0.2.4
## [73] tidyr_0.7.2 assertthat_0.2.0
## [75] ggplot2_2.2.1 xtable_1.8-2
## [77] broom_0.4.2 survival_2.41-3
## [79] tibble_1.3.4 AnnotationDbi_1.40.0
## [81] memoise_1.1.0 cluster_2.0.6