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.969     1.94      0.500 0.635   Hypoxia 
##  3   -1.01      0.649    -1.56  0.169   JAK.STAT
##  4    2.34      1.44      1.62  0.156   MAPK    
##  5    0.373     0.790     0.472 0.654   NFkB    
##  6   -2.41      2.91     -0.829 0.439   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.540     0.832     0.649 0.540   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_SYMBOLSActivity 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.1 (2019-07-05)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.3 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.10-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.10-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.10.0        dbplyr_1.4.2               
##  [3] dplyr_0.8.3                 progeny_1.8.0              
##  [5] biomaRt_2.42.0              DESeq2_1.26.0              
##  [7] airway_1.5.3                SummarizedExperiment_1.16.0
##  [9] DelayedArray_0.12.0         BiocParallel_1.20.0        
## [11] matrixStats_0.55.0          Biobase_2.46.0             
## [13] GenomicRanges_1.38.0        GenomeInfoDb_1.22.0        
## [15] IRanges_2.20.0              S4Vectors_0.24.0           
## [17] BiocGenerics_0.32.0         knitr_1.25                 
## 
## loaded via a namespace (and not attached):
##  [1] nlme_3.1-141           bitops_1.0-6           bit64_0.9-7           
##  [4] RColorBrewer_1.1-2     progress_1.2.2         httr_1.4.1            
##  [7] tools_3.6.1            backports_1.1.5        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_4.2              
## [22] compiler_3.6.1         cli_1.1.0              htmlTable_1.13.2      
## [25] scales_1.0.0           checkmate_1.9.4        readr_1.3.1           
## [28] genefilter_1.68.0      askpass_1.1            rappdirs_0.3.1        
## [31] stringr_1.4.0          digest_0.6.22          foreign_0.8-72        
## [34] rmarkdown_1.16         XVector_0.26.0         base64enc_0.1-3       
## [37] pkgconfig_2.0.3        htmltools_0.4.0        readxl_1.3.1          
## [40] htmlwidgets_1.5.1      rlang_0.4.1            rstudioapi_0.10       
## [43] RSQLite_2.1.2          generics_0.0.2         acepack_1.4.1         
## [46] RCurl_1.95-4.12        magrittr_1.5           GenomeInfoDbData_1.2.2
## [49] Formula_1.2-3          Matrix_1.2-17          fansi_0.4.0           
## [52] Rcpp_1.0.2             munsell_0.5.0          lifecycle_0.1.0       
## [55] stringi_1.4.3          yaml_2.2.0             zlibbioc_1.32.0       
## [58] grid_3.6.1             blob_1.2.0             crayon_1.3.4          
## [61] lattice_0.20-38        splines_3.6.1          annotate_1.64.0       
## [64] hms_0.5.1              locfit_1.5-9.1         zeallot_0.1.0         
## [67] pillar_1.4.2           geneplotter_1.64.0     XML_3.98-1.20         
## [70] glue_1.3.1             evaluate_0.14          latticeExtra_0.6-28   
## [73] data.table_1.12.6      vctrs_0.2.0            cellranger_1.1.0      
## [76] tidyr_1.0.0            gtable_0.3.0           openssl_1.4.1         
## [79] purrr_0.3.3            assertthat_0.2.1       ggplot2_3.2.1         
## [82] xfun_0.10              xtable_1.8-4           broom_0.5.2           
## [85] survival_2.44-1.1      tibble_2.1.3           AnnotationDbi_1.48.0  
## [88] memoise_1.1.0          cluster_2.1.0