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.36 5.74 0.586 0.579 EGFR
## 2 0.966 1.92 0.504 0.633 Hypoxia
## 3 -1.02 0.651 -1.57 0.167 JAK.STAT
## 4 2.25 1.45 1.56 0.170 MAPK
## 5 0.354 0.792 0.447 0.670 NFkB
## 6 -3.61 3.54 -1.02 0.346 PI3K
## 7 1.41 0.980 1.44 0.199 TGFb
## 8 0.841 0.685 1.23 0.265 TNFa
## 9 1.56 0.897 1.74 0.132 Trail
## 10 0.584 0.835 0.700 0.510 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.6.0 (2019-04-26)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.2 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.9-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.9-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.8.0 dbplyr_1.4.0
## [3] dplyr_0.8.0.1 progeny_1.6.0
## [5] biomaRt_2.40.0 DESeq2_1.24.0
## [7] airway_1.3.0 SummarizedExperiment_1.14.0
## [9] DelayedArray_0.10.0 BiocParallel_1.18.0
## [11] matrixStats_0.54.0 Biobase_2.44.0
## [13] GenomicRanges_1.36.0 GenomeInfoDb_1.20.0
## [15] IRanges_2.18.0 S4Vectors_0.22.0
## [17] BiocGenerics_0.30.0 knitr_1.22
##
## loaded via a namespace (and not attached):
## [1] nlme_3.1-139 bitops_1.0-6 bit64_0.9-7
## [4] RColorBrewer_1.1-2 progress_1.2.0 httr_1.4.0
## [7] tools_3.6.0 backports_1.1.4 utf8_1.1.4
## [10] R6_2.4.0 rpart_4.1-15 Hmisc_4.2-0
## [13] DBI_1.0.0 lazyeval_0.2.2 colorspace_1.4-1
## [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.6.0 cli_1.1.0 htmlTable_1.13.1
## [25] scales_1.0.0 checkmate_1.9.1 readr_1.3.1
## [28] genefilter_1.66.0 rappdirs_0.3.1 stringr_1.4.0
## [31] digest_0.6.18 foreign_0.8-71 rmarkdown_1.12
## [34] XVector_0.24.0 base64enc_0.1-3 pkgconfig_2.0.2
## [37] htmltools_0.3.6 readxl_1.3.1 htmlwidgets_1.3
## [40] rlang_0.3.4 rstudioapi_0.10 RSQLite_2.1.1
## [43] generics_0.0.2 acepack_1.4.1 RCurl_1.95-4.12
## [46] magrittr_1.5 GenomeInfoDbData_1.2.1 Formula_1.2-3
## [49] Matrix_1.2-17 Rcpp_1.0.1 munsell_0.5.0
## [52] fansi_0.4.0 stringi_1.4.3 yaml_2.2.0
## [55] zlibbioc_1.30.0 plyr_1.8.4 grid_3.6.0
## [58] blob_1.1.1 crayon_1.3.4 lattice_0.20-38
## [61] splines_3.6.0 annotate_1.62.0 hms_0.4.2
## [64] locfit_1.5-9.1 pillar_1.3.1 geneplotter_1.62.0
## [67] XML_3.98-1.19 glue_1.3.1 evaluate_0.13
## [70] latticeExtra_0.6-28 data.table_1.12.2 cellranger_1.1.0
## [73] gtable_0.3.0 purrr_0.3.2 tidyr_0.8.3
## [76] assertthat_0.2.1 ggplot2_3.1.1 xfun_0.6
## [79] xtable_1.8-4 broom_0.5.2 survival_2.44-1.1
## [82] tibble_2.1.1 AnnotationDbi_1.46.0 memoise_1.1.0
## [85] cluster_2.0.9