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.
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))
## # A tibble: 11 x 5
## estimate std.error statistic p.value pathway
## <dbl> <dbl> <dbl> <dbl> <chr>
## 1 3.52 6.30 0.560 0.596 EGFR
## 2 0.969 1.94 0.500 0.635 Hypoxia
## 3 -1.01 0.648 -1.57 0.169 JAK.STAT
## 4 2.25 1.45 1.56 0.170 MAPK
## 5 0.373 0.790 0.472 0.654 NFkB
## 6 -2.66 3.15 -0.845 0.430 PI3K
## 7 1.73 1.29 1.34 0.230 TGFb
## 8 0.844 0.681 1.24 0.262 TNFa
## 9 1.56 0.897 1.74 0.132 Trail
## 10 0.536 0.833 0.643 0.544 VEGF
## 11 -4.34 0.756 -5.74 0.00122 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$..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:
We now have the pathway activity scores for the pathways defined in PROGENy:
## 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.5.2 (2018-12-20)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 16.04.5 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.8-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.8-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.6.0 dbplyr_1.3.0
## [3] bindrcpp_0.2.2 dplyr_0.7.8
## [5] progeny_1.4.1 biomaRt_2.38.0
## [7] DESeq2_1.22.2 airway_1.2.0
## [9] SummarizedExperiment_1.12.0 DelayedArray_0.8.0
## [11] BiocParallel_1.16.5 matrixStats_0.54.0
## [13] Biobase_2.42.0 GenomicRanges_1.34.0
## [15] GenomeInfoDb_1.18.1 IRanges_2.16.0
## [17] S4Vectors_0.20.1 BiocGenerics_0.28.0
## [19] knitr_1.21
##
## loaded via a namespace (and not attached):
## [1] nlme_3.1-137 bitops_1.0-6 bit64_0.9-7
## [4] RColorBrewer_1.1-2 progress_1.2.0 httr_1.4.0
## [7] tools_3.5.2 backports_1.1.3 utf8_1.1.4
## [10] R6_2.3.0 rpart_4.1-13 Hmisc_4.1-1
## [13] DBI_1.0.0 lazyeval_0.2.1 colorspace_1.4-0
## [16] nnet_7.3-12 tidyselect_0.2.5 gridExtra_2.3
## [19] prettyunits_1.0.2 bit_1.1-14 curl_3.3
## [22] compiler_3.5.2 cli_1.0.1 htmlTable_1.13.1
## [25] scales_1.0.0 checkmate_1.9.1 readr_1.3.1
## [28] genefilter_1.64.0 rappdirs_0.3.1 stringr_1.3.1
## [31] digest_0.6.18 foreign_0.8-71 rmarkdown_1.11
## [34] XVector_0.22.0 base64enc_0.1-3 pkgconfig_2.0.2
## [37] htmltools_0.3.6 readxl_1.2.0 htmlwidgets_1.3
## [40] rlang_0.3.1 rstudioapi_0.9.0 RSQLite_2.1.1
## [43] bindr_0.1.1 generics_0.0.2 acepack_1.4.1
## [46] RCurl_1.95-4.11 magrittr_1.5 GenomeInfoDbData_1.2.0
## [49] Formula_1.2-3 Matrix_1.2-15 Rcpp_1.0.0
## [52] munsell_0.5.0 fansi_0.4.0 stringi_1.2.4
## [55] yaml_2.2.0 zlibbioc_1.28.0 plyr_1.8.4
## [58] grid_3.5.2 blob_1.1.1 crayon_1.3.4
## [61] lattice_0.20-38 splines_3.5.2 annotate_1.60.0
## [64] hms_0.4.2 locfit_1.5-9.1 pillar_1.3.1
## [67] geneplotter_1.60.0 XML_3.98-1.16 glue_1.3.0
## [70] evaluate_0.12 latticeExtra_0.6-28 data.table_1.12.0
## [73] cellranger_1.1.0 gtable_0.2.0 purrr_0.2.5
## [76] tidyr_0.8.2 assertthat_0.2.0 ggplot2_3.1.0
## [79] xfun_0.4 xtable_1.8-3 broom_0.5.1
## [82] survival_2.43-3 tibble_2.0.1 AnnotationDbi_1.44.0
## [85] memoise_1.1.0 cluster_2.0.7-1