cTRAP: identifying candidate causal perturbations from differential gene expression data

Bernardo P. de Almeida & Nuno Saraiva-Agostinho

2019-10-29


Introduction

cTRAP is an R package designed to compare differential gene expression results with those from known cellular perturbations (such as gene knockdown, overexpression or small molecules) derived from the Connectivity Map (CMap; Subramanian et al., Cell 2017). Such analyses allow not only to infer the molecular causes of the observed difference in gene expression but also to identify small molecules that could drive or revert specific transcriptomic alterations.

To illustrate the package functionalities, we will use an example based on a gene knockdown dataset from the ENCODE project for which there is available RNA-seq data. After performing differential expression analyses to the matched-control sample, we will compare the respective transcriptomic changes with the ones caused by all CMap’s gene knockdown perturbations to identify which ones have similar or inverse transcriptomic changes to the observed ones. As a positive control, we expect to find the knock-down of the gene depleted in the ENCODE experiment as one of the most similar transcriptomic perturbations.

Getting started

To load the cTRAP package into your R environment type:

library(cTRAP)
## Registered S3 method overwritten by 'R.oo':
##   method        from       
##   throw.default R.methodsS3

Load ENCODE RNA-seq data and perform differential gene expression analysis

In this example, we will use the EIF4G1 shRNA knockdown followed by RNA-seq experiment in HepG2 cell line from the ENCODE project as the dataset of interest. The RNA-seq processed data (gene quantifications from RSEM method) for the EIF4G1 knock-down and respective controls (two replicates each) can be automatically downloaded and loaded by typing:

gene <- "EIF4G1"
cellLine <- "HepG2"

ENCODEmetadata <- downloadENCODEknockdownMetadata(cellLine, gene)
table(ENCODEmetadata$`Experiment target`)
length(unique(ENCODEmetadata$`Experiment target`))

ENCODEsamples <- loadENCODEsamples(ENCODEmetadata)[[1]]
counts <- prepareENCODEgeneExpression(ENCODEsamples)

Gene expression data (read counts) were quantile-normalized using voom and differential expression analysis was performed using the limma R package.

# Remove low coverage (at least 10 counts shared across two samples)
minReads   <- 10
minSamples <- 2
filter <- rowSums(counts[ , -c(1, 2)] >= minReads) >= minSamples
counts <- counts[filter, ]

# Convert ENSEMBL identifier to gene symbol
counts$gene_id <- convertENSEMBLtoGeneSymbols(counts$gene_id)

# Perform differential gene expression analysis
diffExpr <- performDifferentialExpression(counts)

For our metric of differential expression after EIF4G1 shRNA knock-down, we will use the respective t-statistic.

# Get t-statistics of differential expression with respective gene names 
# (expected input for downstream analyses)
diffExprStat <- diffExpr$t
names(diffExprStat) <- diffExpr$Gene_symbol
data("diffExprStat")

Load CMap perturbation data

We will use our differential gene expression metric to compare with CMap’s gene knock-down perturbations in the same cell line (HepG2). Note that this comparison can also be done to perturbations in a different cell line (or in all cell lines using the average result across cell lines).

To summarise conditions and check available data in CMap, we can use the following commands to download CMap metadata:

# Download CMap metadata (if not found in current directory)
cmapMetadata <- loadCMapData("cmapMetadata.txt", type="metadata")
## cmapMetadata.txt not found: downloading data...
## Extracting cmapMetadata.txt.gz...
## Loading data from cmapMetadata.txt...
# Summarise conditions for all CMap perturbations
getCMapConditions(cmapMetadata)
## $perturbationType
## [1] "Compound"                                               
## [2] "Peptides and other biological agents (e.g. cytokine)"   
## [3] "shRNA for loss of function (LoF) of gene"               
## [4] "Consensus signature from shRNAs targeting the same gene"
## [5] "cDNA for overexpression of wild-type gene"              
## [6] "cDNA for overexpression of mutated gene"                
## 
## $cellLine
##  [1] "A375"     "A549"     "A673"     "AGS"      "ASC"      "BT20"    
##  [7] "CD34"     "CL34"     "CORL23"   "COV644"   "DV90"     "EFO27"   
## [13] "FIBRNPC"  "H1299"    "HA1E"     "HCC15"    "HCC515"   "HCT116"  
## [19] "HEC108"   "HEK293T"  "HEKTE"    "HEPG2"    "HL60"     "HS27A"   
## [25] "HS578T"   "HT115"    "HT29"     "HUH7"     "JHUEM2"   "JURKAT"  
## [31] "LOVO"     "MCF10A"   "MCF7"     "MCH58"    "MDAMB231" "MDST8"   
## [37] "NCIH1694" "NCIH1836" "NCIH2073" "NCIH508"  "NCIH596"  "NCIH716" 
## [43] "NEU"      "NKDBA"    "NOMO1"    "NPC"      "OV7"      "PC3"     
## [49] "PHH"      "PL21"     "RKO"      "RMGI"     "RMUGS"    "SHSY5Y"  
## [55] "SKB"      "SKBR3"    "SKL"      "SKLU1"    "SKM1"     "SKMEL1"  
## [61] "SKMEL28"  "SNGM"     "SNU1040"  "SNUC4"    "SNUC5"    "SW480"   
## [67] "SW620"    "SW948"    "T3M10"    "THP1"     "TYKNU"    "U266"    
## [73] "U2OS"     "U937"     "VCAP"     "WSUDLCL2"
## 
## $dosage
##  [1] NA             "0.1 %"        "1 nM"         "10 nM"       
##  [5] "100 nM"       "500 nM"       "0.04 µM"      "0.12 µM"     
##  [9] "0.37 µM"      "0.41 µM"      "1 µM"         "1.11 µM"     
## [13] "1.23 µM"      "3 µM"         "3.33 µM"      "3.7 µM"      
## [17] "5 µM"         "10 µM"        "11.11 µM"     "20 µM"       
## [21] "30 µM"        "33.33 µM"     "40 µM"        "50 µM"       
## [25] "60 µM"        "70 µM"        "80 µM"        "90 µM"       
## [29] "100 µM"       "1 µL"         "1.5 µL"       "2 µL"        
## [33] "3 µL"         "4 µL"         "5 µL"         "6 µL"        
## [37] "10 µL"        "20 µL"        "150 ng"       "200 ng"      
## [41] "300 ng"       "0.1 ng/µL"    "1 ng/µL"      "3 ng/µL"     
## [45] "10 ng/µL"     "100 ng/µL"    "300 ng/µL"    "0 ng/mL"     
## [49] "0.01 ng/mL"   "0.03 ng/mL"   "0.1 ng/mL"    "0.15 ng/mL"  
## [53] "0.2 ng/mL"    "0.3 ng/mL"    "0.5 ng/mL"    "1 ng/mL"     
## [57] "1.65 ng/mL"   "2 ng/mL"      "5 ng/mL"      "10 ng/mL"    
## [61] "15 ng/mL"     "16 ng/mL"     "20 ng/mL"     "25 ng/mL"    
## [65] "30 ng/mL"     "40 ng/mL"     "45 ng/mL"     "50 ng/mL"    
## [69] "80 ng/mL"     "100 ng/mL"    "150 ng/mL"    "200 ng/mL"   
## [73] "250 ng/mL"    "400 ng/mL"    "500 ng/mL"    "800 ng/mL"   
## [77] "1000 ng/mL"   "2000 ng/mL"   "2500 ng/mL"   "3000 ng/mL"  
## [81] "5000 ng/mL"   "8300 ng/mL"   "10000 ng/mL"  "50000 ng/mL" 
## [85] "100000 ng/mL" "200000 ng/mL"
## 
## $timepoint
##  [1] "1 h"   "2 h"   "3 h"   "4 h"   "6 h"   "24 h"  "48 h"  "72 h" 
##  [9] "96 h"  "120 h" "144 h" "168 h"
# Summarise conditions for CMap perturbations in HepG2 cell line
getCMapConditions(cmapMetadata, cellLine="HepG2")
## $perturbationType
## [1] "Compound"                                               
## [2] "Peptides and other biological agents (e.g. cytokine)"   
## [3] "shRNA for loss of function (LoF) of gene"               
## [4] "Consensus signature from shRNAs targeting the same gene"
## [5] "cDNA for overexpression of wild-type gene"              
## 
## $cellLine
## [1] "HEPG2"
## 
## $dosage
##  [1] NA             "0.1 %"        "10 nM"        "100 nM"      
##  [5] "500 nM"       "0.04 µM"      "0.12 µM"      "0.37 µM"     
##  [9] "0.41 µM"      "1 µM"         "1.11 µM"      "1.23 µM"     
## [13] "3 µM"         "3.33 µM"      "3.7 µM"       "5 µM"        
## [17] "10 µM"        "11.11 µM"     "20 µM"        "30 µM"       
## [21] "33.33 µM"     "40 µM"        "50 µM"        "60 µM"       
## [25] "70 µM"        "80 µM"        "90 µM"        "100 µM"      
## [29] "1.5 µL"       "2 µL"         "0 ng/mL"      "0.01 ng/mL"  
## [33] "0.03 ng/mL"   "0.1 ng/mL"    "0.15 ng/mL"   "0.2 ng/mL"   
## [37] "0.3 ng/mL"    "0.5 ng/mL"    "1 ng/mL"      "1.65 ng/mL"  
## [41] "2 ng/mL"      "5 ng/mL"      "10 ng/mL"     "15 ng/mL"    
## [45] "16 ng/mL"     "20 ng/mL"     "25 ng/mL"     "30 ng/mL"    
## [49] "40 ng/mL"     "45 ng/mL"     "50 ng/mL"     "80 ng/mL"    
## [53] "100 ng/mL"    "150 ng/mL"    "200 ng/mL"    "250 ng/mL"   
## [57] "400 ng/mL"    "500 ng/mL"    "800 ng/mL"    "1000 ng/mL"  
## [61] "2000 ng/mL"   "2500 ng/mL"   "3000 ng/mL"   "5000 ng/mL"  
## [65] "8300 ng/mL"   "10000 ng/mL"  "50000 ng/mL"  "100000 ng/mL"
## [69] "200000 ng/mL"
## 
## $timepoint
## [1] "2 h"  "4 h"  "6 h"  "24 h" "96 h"
# Summarise conditions for a specific CMap perturbation in HepG2 cell line
getCMapConditions(
    cmapMetadata, cellLine="HepG2",
    perturbationType="Consensus signature from shRNAs targeting the same gene")
## $perturbationType
## [1] "Consensus signature from shRNAs targeting the same gene"
## 
## $cellLine
## [1] "HEPG2"
## 
## $dosage
## [1] "1.5 µL"
## 
## $timepoint
## [1] "96 h"

Now, we will filter the metadata to CMap gene knockdown perturbations in HepG2 cell line and load associated gene information and differential gene expression data. Data is loaded based on the given filename (if no file with the given filename is available, data will be first downloaded).

Differential gene expression data for each CMap perturbation are available in normalised z-score values (read Subramanian et al., Cell 2017 for more details). As this file’s size is big (around 20GB), a prompt will ask you to confirm whether to start downloading the file.

Alternatively, you can download the file from the following link (do not forget to give the correct filename): ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE92nnn/GSE92742/suppl/GSE92742_Broad_LINCS_Level5_COMPZ.MODZ_n473647x12328.gctx.gz

# Filter CMap gene knockdown HepG2 data to load afterwards
cmapMetadataKD <- filterCMapMetadata(
    cmapMetadata, cellLine="HepG2",
    perturbationType="Consensus signature from shRNAs targeting the same gene")

# Load filtered data (if data is not found, it will be downloaded)
cmapPerturbationsKD <- prepareCMapPerturbations(
    metadata=cmapMetadataKD, zscores="cmapZscores.gctx",
    geneInfo="cmapGeneInfo.txt")

If the interest is in small molecules, the differential gene expression z-scores from CMap can be downloaded for each small molecule perturbation:

# Filter CMap gene small molecule HepG2 data to load afterwards
cmapMetadataCompounds <- filterCMapMetadata(
    cmapMetadata, cellLine="HepG2", perturbationType="Compound")

# Load filtered data (if data is not found, it will be downloaded)
cmapPerturbationsCompounds <- prepareCMapPerturbations(
    metadata=cmapMetadataCompounds, zscores="cmapZscores.gctx",
    geneInfo="cmapGeneInfo.txt", compoundInfo="cmapCompoundInfo.txt")

Comparison with CMap perturbations

The rankSimilarPerturbations function compares the differential expression metric (the t-statistic, in this case) against the CMap perturbations’ z-scores using the available methods:

To compare against CMap knockdown perturbations using all the previous methods:

compareKD <- rankSimilarPerturbations(diffExprStat, cmapPerturbationsKD)

To compare against selected CMap small molecule perturbations:

compareCompounds <- rankSimilarPerturbations(diffExprStat, 
                                             cmapPerturbationsCompounds)

The output table contains the results of the comparison with each perturbation tested, including the test statistics (Spearman’s correlation coefficient, Pearson’s correlation coefficient and/or GSEA score), the respective p-value and the Benjamini-Hochberg-adjusted p-value (for correlation statistics only). When performing multiple methods, the rank product’s rank will be included to summarise other method’s rankings.

# Most positively associated perturbations (note that EIF4G1 knockdown is the
# 7th, 1st and 2nd most positively associated perturbation based on Spearman's
# correlation, Pearson's correlation and GSEA, respectively)
head(compareKD[order(spearman_rank, na.last=NA)], n=10)
##                 gene_perturbation spearman_coef spearman_pvalue
##  1:    CGS001_HEPG2_96H:MECP2:1.5     0.1930335    1.506067e-74
##  2: CGS001_HEPG2_96H:KIAA0196:1.5     0.1894301    8.237226e-72
##  3:    CGS001_HEPG2_96H:SQRDL:1.5     0.1883210    5.589838e-71
##  4:     CGS001_HEPG2_96H:PPIH:1.5     0.1863954    1.509735e-69
##  5:    CGS001_HEPG2_96H:STAT1:1.5     0.1833382    2.626628e-67
##  6:    CGS001_HEPG2_96H:COPS5:1.5     0.1775880    3.364592e-63
##  7:   CGS001_HEPG2_96H:EIF4G1:1.5     0.1770993    7.406639e-63
##  8:     CGS001_HEPG2_96H:MEST:1.5     0.1726479    8.816544e-60
##  9:   CGS001_HEPG2_96H:KIF20A:1.5     0.1665159    1.114839e-55
## 10:    CGS001_HEPG2_96H:TMEM5:1.5     0.1506335    8.936446e-46
##     spearman_qvalue pearson_coef pearson_pvalue pearson_qvalue      GSEA
##  1:    1.305258e-73    0.1756788   7.245930e-62   1.883942e-61 0.3903862
##  2:    5.354197e-71    0.1847352   2.514633e-68   9.340065e-68 0.3521034
##  3:    2.906716e-70    0.1718559   3.046859e-59   6.093718e-59 0.3998024
##  4:    6.542184e-69    0.1703630   3.104268e-58   5.380731e-58 0.4359134
##  5:    9.756048e-67    0.1894661   7.739198e-72   4.024383e-71 0.3765351
##  6:    1.093493e-62    0.1794790   1.553956e-64   5.050356e-64 0.4222756
##  7:    2.139696e-62    0.1915142   2.182595e-73   1.418686e-72 0.4861485
##  8:    2.292301e-59    0.1858475   3.830708e-69   1.659973e-68 0.4219693
##  9:    2.415485e-55    0.1786967   5.568601e-64   1.608707e-63 0.4566918
## 10:    1.452172e-45    0.1670226   5.177976e-56   8.414211e-56 0.4721782
##     spearman_rank pearson_rank GSEA_rank rankProduct_rank
##  1:             1            7        12                2
##  2:             2            4        14                4
##  3:             3            9        11                8
##  4:             4           10         8                9
##  5:             5            2        13                5
##  6:             6            5         9                7
##  7:             7            1         2                1
##  8:             8            3        10                6
##  9:             9            6         7               10
## 10:            10           11         6               12
head(compareKD[order(pearson_rank, na.last=NA)])
##                gene_perturbation spearman_coef spearman_pvalue
## 1:   CGS001_HEPG2_96H:EIF4G1:1.5     0.1770993    7.406639e-63
## 2:    CGS001_HEPG2_96H:STAT1:1.5     0.1833382    2.626628e-67
## 3:     CGS001_HEPG2_96H:MEST:1.5     0.1726479    8.816544e-60
## 4: CGS001_HEPG2_96H:KIAA0196:1.5     0.1894301    8.237226e-72
## 5:    CGS001_HEPG2_96H:COPS5:1.5     0.1775880    3.364592e-63
## 6:   CGS001_HEPG2_96H:KIF20A:1.5     0.1665159    1.114839e-55
##    spearman_qvalue pearson_coef pearson_pvalue pearson_qvalue      GSEA
## 1:    2.139696e-62    0.1915142   2.182595e-73   1.418686e-72 0.4861485
## 2:    9.756048e-67    0.1894661   7.739198e-72   4.024383e-71 0.3765351
## 3:    2.292301e-59    0.1858475   3.830708e-69   1.659973e-68 0.4219693
## 4:    5.354197e-71    0.1847352   2.514633e-68   9.340065e-68 0.3521034
## 5:    1.093493e-62    0.1794790   1.553956e-64   5.050356e-64 0.4222756
## 6:    2.415485e-55    0.1786967   5.568601e-64   1.608707e-63 0.4566918
##    spearman_rank pearson_rank GSEA_rank rankProduct_rank
## 1:             7            1         2                1
## 2:             5            2        13                5
## 3:             8            3        10                6
## 4:             2            4        14                4
## 5:             6            5         9                7
## 6:             9            6         7               10
head(compareKD[order(GSEA_rank, na.last=NA)])
##              gene_perturbation spearman_coef spearman_pvalue
## 1: CGS001_HEPG2_96H:SKIV2L:1.5     0.1423207    5.305914e-41
## 2: CGS001_HEPG2_96H:EIF4G1:1.5     0.1770993    7.406639e-63
## 3: CGS001_HEPG2_96H:GTPBP8:1.5     0.1190220    4.210973e-29
## 4:    CGS001_HEPG2_96H:HFE:1.5     0.1235293    3.098180e-31
## 5: CGS001_HEPG2_96H:UBAP2L:1.5     0.1309546    6.320554e-35
## 6:  CGS001_HEPG2_96H:TMEM5:1.5     0.1506335    8.936446e-46
##    spearman_qvalue pearson_coef pearson_pvalue pearson_qvalue      GSEA
## 1:    8.114927e-41    0.1755377   9.078490e-62   2.145825e-61 0.5070024
## 2:    2.139696e-62    0.1915142   2.182595e-73   1.418686e-72 0.4861485
## 3:    4.760230e-29    0.1390818   3.229116e-39   3.816228e-39 0.4813972
## 4:    3.661486e-31    0.1499527   2.252417e-45   2.788707e-45 0.4813046
## 5:    8.216721e-35    0.1517482   1.948821e-46   2.533468e-46 0.4722054
## 6:    1.452172e-45    0.1670226   5.177976e-56   8.414211e-56 0.4721782
##    spearman_rank pearson_rank GSEA_rank rankProduct_rank
## 1:            11            8         1                3
## 2:             7            1         2                1
## 3:            14           14         3               11
## 4:            13           13         4               13
## 5:            12           12         5               14
## 6:            10           11         6               12
head(compareKD[order(rankProduct_rank, na.last=NA)])
##                gene_perturbation spearman_coef spearman_pvalue
## 1:   CGS001_HEPG2_96H:EIF4G1:1.5     0.1770993    7.406639e-63
## 2:    CGS001_HEPG2_96H:MECP2:1.5     0.1930335    1.506067e-74
## 3:   CGS001_HEPG2_96H:SKIV2L:1.5     0.1423207    5.305914e-41
## 4: CGS001_HEPG2_96H:KIAA0196:1.5     0.1894301    8.237226e-72
## 5:    CGS001_HEPG2_96H:STAT1:1.5     0.1833382    2.626628e-67
## 6:     CGS001_HEPG2_96H:MEST:1.5     0.1726479    8.816544e-60
##    spearman_qvalue pearson_coef pearson_pvalue pearson_qvalue      GSEA
## 1:    2.139696e-62    0.1915142   2.182595e-73   1.418686e-72 0.4861485
## 2:    1.305258e-73    0.1756788   7.245930e-62   1.883942e-61 0.3903862
## 3:    8.114927e-41    0.1755377   9.078490e-62   2.145825e-61 0.5070024
## 4:    5.354197e-71    0.1847352   2.514633e-68   9.340065e-68 0.3521034
## 5:    9.756048e-67    0.1894661   7.739198e-72   4.024383e-71 0.3765351
## 6:    2.292301e-59    0.1858475   3.830708e-69   1.659973e-68 0.4219693
##    spearman_rank pearson_rank GSEA_rank rankProduct_rank
## 1:             7            1         2                1
## 2:             1            7        12                2
## 3:            11            8         1                3
## 4:             2            4        14                4
## 5:             5            2        13                5
## 6:             8            3        10                6
# Most negatively associated perturbations
tail(compareKD[order(spearman_rank, na.last=NA)])
##              gene_perturbation spearman_coef spearman_pvalue
## 1:    CGS001_HEPG2_96H:MAF:1.5    -0.1581847    2.351511e-50
## 2: CGS001_HEPG2_96H:ZBTB24:1.5    -0.1632375    1.500986e-53
## 3:  CGS001_HEPG2_96H:EHMT2:1.5    -0.1640525    4.479303e-54
## 4: CGS001_HEPG2_96H:NDUFB6:1.5    -0.1677880    1.618399e-56
## 5:  CGS001_HEPG2_96H:CDCA8:1.5    -0.1941862    1.951544e-75
## 6:   CGS001_HEPG2_96H:EYA1:1.5    -0.1993531    1.747554e-79
##    spearman_qvalue pearson_coef pearson_pvalue pearson_qvalue       GSEA
## 1:    4.075952e-50   -0.1717844   3.406704e-59   6.326737e-59  0.0000000
## 2:    2.787546e-53   -0.1948077   6.448588e-76   8.383165e-75  0.0000000
## 3:    8.958605e-54   -0.1590654   6.637816e-51   9.587957e-51 -0.3716818
## 4:    3.825307e-56   -0.1646057   1.964288e-54   3.004205e-54  0.0000000
## 5:    2.537007e-74   -0.1926944   2.740646e-74   2.375227e-73 -0.4739211
## 6:    4.543641e-78   -0.1952303   3.030978e-76   7.880542e-75 -0.3776731
##    spearman_rank pearson_rank GSEA_rank rankProduct_rank
## 1:            21           22        16               19
## 2:            22           25        16               22
## 3:            23           20        18               21
## 4:            24           21        16               20
## 5:            25           24        26               26
## 6:            26           26        19               25
tail(compareKD[order(pearson_rank, na.last=NA)])
##               gene_perturbation spearman_coef spearman_pvalue
## 1:  CGS001_HEPG2_96H:NDUFB6:1.5    -0.1677880    1.618399e-56
## 2:     CGS001_HEPG2_96H:MAF:1.5    -0.1581847    2.351511e-50
## 3: CGS001_HEPG2_96H:SULT1A2:1.5    -0.1414914    1.533416e-40
## 4:   CGS001_HEPG2_96H:CDCA8:1.5    -0.1941862    1.951544e-75
## 5:  CGS001_HEPG2_96H:ZBTB24:1.5    -0.1632375    1.500986e-53
## 6:    CGS001_HEPG2_96H:EYA1:1.5    -0.1993531    1.747554e-79
##    spearman_qvalue pearson_coef pearson_pvalue pearson_qvalue       GSEA
## 1:    3.825307e-56   -0.1646057   1.964288e-54   3.004205e-54  0.0000000
## 2:    4.075952e-50   -0.1717844   3.406704e-59   6.326737e-59  0.0000000
## 3:    2.214934e-40   -0.1742848   6.666242e-61   1.444352e-60 -0.4086520
## 4:    2.537007e-74   -0.1926944   2.740646e-74   2.375227e-73 -0.4739211
## 5:    2.787546e-53   -0.1948077   6.448588e-76   8.383165e-75  0.0000000
## 6:    4.543641e-78   -0.1952303   3.030978e-76   7.880542e-75 -0.3776731
##    spearman_rank pearson_rank GSEA_rank rankProduct_rank
## 1:            24           21        16               20
## 2:            21           22        16               19
## 3:            20           23        20               24
## 4:            25           24        26               26
## 5:            22           25        16               22
## 6:            26           26        19               25
tail(compareKD[order(GSEA_rank, na.last=NA)])
##             gene_perturbation spearman_coef spearman_pvalue
## 1: CGS001_HEPG2_96H:PLOD2:1.5   -0.12393601    1.970762e-31
## 2:   CGS001_HEPG2_96H:SHB:1.5   -0.11094246    1.768452e-25
## 3: CGS001_HEPG2_96H:GNAI2:1.5   -0.05956052    2.293513e-08
## 4: CGS001_HEPG2_96H:SIAH2:1.5   -0.07825242    2.030400e-13
## 5: CGS001_HEPG2_96H:DHX16:1.5   -0.14109904    2.527811e-40
## 6: CGS001_HEPG2_96H:CDCA8:1.5   -0.19418619    1.951544e-75
##    spearman_qvalue pearson_coef pearson_pvalue pearson_qvalue       GSEA
## 1:    2.439991e-31  -0.13259151   9.070613e-36   1.025374e-35 -0.4130739
## 2:    1.915823e-25  -0.12875045   8.300805e-34   8.992538e-34 -0.4131576
## 3:    2.293513e-08  -0.08923031   5.233713e-17   5.233713e-17 -0.4166373
## 4:    2.111616e-13  -0.11367900   1.119976e-26   1.164775e-26 -0.4224346
## 5:    3.459110e-40  -0.15642416   2.883756e-49   3.946193e-49 -0.4379221
## 6:    2.537007e-74  -0.19269443   2.740646e-74   2.375227e-73 -0.4739211
##    spearman_rank pearson_rank GSEA_rank rankProduct_rank
## 1:            18           18        21               18
## 2:            17           17        22               17
## 3:            15           15        23               15
## 4:            16           16        24               16
## 5:            19           19        25               23
## 6:            25           24        26               26
tail(compareKD[order(rankProduct_rank, na.last=NA)])
##               gene_perturbation spearman_coef spearman_pvalue
## 1:   CGS001_HEPG2_96H:EHMT2:1.5    -0.1640525    4.479303e-54
## 2:  CGS001_HEPG2_96H:ZBTB24:1.5    -0.1632375    1.500986e-53
## 3:   CGS001_HEPG2_96H:DHX16:1.5    -0.1410990    2.527811e-40
## 4: CGS001_HEPG2_96H:SULT1A2:1.5    -0.1414914    1.533416e-40
## 5:    CGS001_HEPG2_96H:EYA1:1.5    -0.1993531    1.747554e-79
## 6:   CGS001_HEPG2_96H:CDCA8:1.5    -0.1941862    1.951544e-75
##    spearman_qvalue pearson_coef pearson_pvalue pearson_qvalue       GSEA
## 1:    8.958605e-54   -0.1590654   6.637816e-51   9.587957e-51 -0.3716818
## 2:    2.787546e-53   -0.1948077   6.448588e-76   8.383165e-75  0.0000000
## 3:    3.459110e-40   -0.1564242   2.883756e-49   3.946193e-49 -0.4379221
## 4:    2.214934e-40   -0.1742848   6.666242e-61   1.444352e-60 -0.4086520
## 5:    4.543641e-78   -0.1952303   3.030978e-76   7.880542e-75 -0.3776731
## 6:    2.537007e-74   -0.1926944   2.740646e-74   2.375227e-73 -0.4739211
##    spearman_rank pearson_rank GSEA_rank rankProduct_rank
## 1:            23           20        18               21
## 2:            22           25        16               22
## 3:            19           19        25               23
## 4:            20           23        20               24
## 5:            26           26        19               25
## 6:            25           24        26               26
# Plot list of compared pertubations
plot(compareKD, "spearman", n=c(10, 3))

plot(compareKD, "pearson")

plot(compareKD, "gsea")

plot(compareKD, "rankProduct")

For small molecules:

# Most positively and negatively associated perturbations
compareCompounds[order(rankProduct_rank, na.last=NA)]
##                              compound_perturbation spearman_coef
##  1:    CVD001_HEPG2_24H:BRD-A14014306-001-01-1:4.1   0.225335666
##  2: CVD001_HEPG2_24H:BRD-K84595254-001-03-0:4.9444   0.085133810
##  3: CVD001_HEPG2_24H:BRD-K62810658-001-05-6:4.6768  -0.050201852
##  4:    CVD001_HEPG2_24H:BRD-K41172353-001-01-4:4.7   0.005161915
##  5: CVD001_HEPG2_24H:BRD-K60476892-001-02-1:4.1072  -0.077832390
##  6: CVD001_HEPG2_24H:BRD-K96188950-001-04-5:4.3967  -0.037174082
##  7:  CVD001_HEPG2_24H:BRD-K84389640-001-01-5:4.225  -0.078331814
##  8:  CVD001_HEPG2_24H:BRD-K77508012-001-01-9:6.025  -0.094208866
##  9:   CVD001_HEPG2_24H:BRD-K31030218-001-01-1:4.25  -0.125531451
## 10:    CVD001_HEPG2_24H:BRD-K94818765-001-01-0:4.8  -0.113418048
## 11:   CVD001_HEPG2_24H:BRD-A65142661-034-01-8:5.35  -0.164686339
##     spearman_pvalue spearman_qvalue pearson_coef pearson_pvalue
##  1:   1.361508e-101   1.497659e-100   0.22640668  1.442316e-102
##  2:    1.294659e-15    2.373541e-15   0.06834399   1.415829e-10
##  3:    2.489663e-06    3.042921e-06  -0.02551843   1.673267e-02
##  4:    6.284641e-01    6.284641e-01  -0.01267514   2.347404e-01
##  5:    2.727173e-13    3.749863e-13  -0.06254059   4.400100e-09
##  6:    4.903648e-04    5.394013e-04  -0.04580625   1.737439e-05
##  7:    1.919930e-13    3.017033e-13  -0.08264025   8.485519e-15
##  8:    8.674931e-19    1.908485e-18  -0.08283071   7.364690e-15
##  9:    3.293334e-32    1.207556e-31  -0.12054061   8.215231e-30
## 10:    1.461350e-26    4.018714e-26  -0.11053910   2.640853e-25
## 11:    1.741438e-54    9.577908e-54  -0.14797060   3.242185e-44
##     pearson_qvalue       GSEA spearman_rank pearson_rank GSEA_rank
##  1:  1.586548e-101  0.4932836             1            1       1.0
##  2:   2.224875e-10  0.2179143             2            2       3.0
##  3:   1.840594e-02  0.2304579             5            4       2.0
##  4:   2.347404e-01  0.0000000             3            3       5.5
##  5:   6.050137e-09  0.0000000             6            6       5.5
##  6:   2.123537e-05 -0.2821337             4            5      10.0
##  7:   1.555679e-14  0.0000000             7            7       5.5
##  8:   1.555679e-14 -0.2442628             8            8       8.0
##  9:   3.012251e-29  0.0000000            10           10       5.5
## 10:   7.262345e-25 -0.2621164             9            9       9.0
## 11:   1.783202e-43 -0.3381341            11           11      11.0
##     rankProduct_rank
##  1:                1
##  2:                2
##  3:                3
##  4:                4
##  5:                5
##  6:                6
##  7:                7
##  8:                8
##  9:                9
## 10:               10
## 11:               11
plot(compareCompounds, "rankProduct")

The Gene Set Enrichment Analysis (GSEA) score is based on the Weighted Connectivity Score (WTCS), a composite and bi-directional version of the weighted Kolmogorov-Smirnov enrichment statistic (ES) (Subramanian et al., Cell 2017).

To calculate the GSEA score, GSEA is run for the most up- and down-regulated genes fromthe user’s differential expression profile. The GSEA score is the mean between EStop and ESbottom (however, if EStop and ESbottom have the same sign, the GSEA score is 0).

If a perturbation has a similar differential expression profile to our data (higher GSEA score), we expect to see the most up-regulated (down-regulated) genes in the perturbation enriched in the top (bottom) n differentially expressed genes from our data.

Information on perturbations

To get associated information as made available from CMap:

# Information on the EIF4G1 knockdown perturbation
EIF4G1knockdown <- grep("EIF4G1", compareKD[[1]], value=TRUE)
print(compareKD, EIF4G1knockdown)
## $metadata
##                         sig_id     pert_id pert_iname  pert_type cell_id
## 1: CGS001_HEPG2_96H:EIF4G1:1.5 CGS001-1981     EIF4G1 trt_sh.cgs   HEPG2
##    pert_dose pert_dose_unit pert_idose pert_time pert_time_unit pert_itime
## 1:       1.5         microL 1.5 microL        96              h       96 h
##                                                                                                         distil_id
## 1: KDA004_HEPG2_96H:TRCN0000061769:-666|KDA004_HEPG2_96H:TRCN0000061770:-666|KDA004_HEPG2_96H:TRCN0000061772:-666
# Information on the most similar compound perturbation (based on Spearman's 
# correlation)
print(compareCompounds[order(rankProduct_rank, na.last=NA)], 1)
## $metadata
##                                         sig_id       pert_id    pert_iname
## 1: CVD001_HEPG2_24H:BRD-A14014306-001-01-1:4.1 BRD-A14014306 BRD-A14014306
##    pert_type cell_id pert_dose pert_dose_unit pert_idose pert_time
## 1:    trt_cp   HEPG2       4.1         microM   5 microM        24
##    pert_time_unit pert_itime
## 1:              h       24 h
##                                                                                                                     distil_id
## 1: CVD001_HEPG2_24H_X1_F1B3_DUO52HI53LO:J23|CVD001_HEPG2_24H_X2_F1B3_DUO52HI53LO:J23|CVD001_HEPG2_24H_X3_F1B3_DUO52HI53LO:J23
## 
## $compoundInfo
## Empty data.table (0 rows and 10 cols): pert_iname,clinical_phase,moa,target,disease_area,indication...

Relationship plots

To analyse the relationship between the user-provided differential expression profile with that associated with a specific perturbation, scatter plots (for Spearman and Pearson analyses) and GSEA plots are available.

For instance, let’s plot the relationship between ENCODE’s EIF4G1 shRNA knockdown with the perturbations of interest:

# Plot relationship with EIF4G1 knockdown from CMap
plot(cmapPerturbationsKD, EIF4G1knockdown, diffExprStat, "spearman")

plot(cmapPerturbationsKD, EIF4G1knockdown, diffExprStat, "pearson")

plot(cmapPerturbationsKD, EIF4G1knockdown, diffExprStat, "gsea")

# Plot relationship with most negatively associated perturbation
plot(cmapPerturbationsKD,
     tail(compareKD[order(spearman_rank, na.last=NA)], 1),
     diffExprStat, "spearman")

plot(cmapPerturbationsKD,
     tail(compareKD[order(pearson_rank, na.last=NA)], 1),
     diffExprStat, "pearson")

plot(cmapPerturbationsKD,
     tail(compareKD[order(GSEA_rank, na.last=NA)], 1),
     diffExprStat, "gsea")

By default, plot() plots both the up- and down-regulated genes based on the rankSimilarPerturbations() arguments.

For small molecules:

# Plot relationship with most positively associated perturbation
plot(cmapPerturbationsCompounds, 
     head(compareCompounds[order(spearman_rank, na.last=NA)], 1), 
     diffExprStat, "spearman")

plot(cmapPerturbationsCompounds, 
     head(compareCompounds[order(pearson_rank, na.last=NA)], 1), 
     diffExprStat,"pearson")

plot(cmapPerturbationsCompounds, 
     head(compareCompounds[order(GSEA_rank, na.last=NA)], 1), 
     diffExprStat, "gsea")

# Plot relationship with most negatively associated perturbation
plot(cmapPerturbationsCompounds,
     tail(compareCompounds[order(spearman_rank, na.last=NA)], 1),
     diffExprStat, "spearman")

plot(cmapPerturbationsCompounds, 
     tail(compareCompounds[order(pearson_rank, na.last=NA)], 1), 
     diffExprStat, "pearson")

plot(cmapPerturbationsCompounds, 
     tail(compareCompounds[order(GSEA_rank, na.last=NA)], 1), 
     diffExprStat, "gsea")

Predict targeting drugs

Compounds that target the phenotypes associated with the user-provided differential expression profile can be inferred by comparing against gene expression and drug sensitivity associations. The gene expression and drug sensitivity datasets derived from the following sources were correlated using Spearman’s correlation across the available cell lines.

Source Screened compounds Human cancer cell lines
NCI60 > 100 000 60
[GDSC 7][] 481 860
[CTRP 2.1][] 138 ~700

To use an expression and drug sensitivity association based on CTRP 2.1 (GDSC 7 and NCI60 could be used instead) to infer targeting drugs for the user’s differential expression profile:

gdsc      <- loadExpressionDrugSensitivityAssociation("CTRP 2.1")
## expressionDrugSensitivityCorCTRP_2.1.rds not found: downloading data...
## Loading data from expressionDrugSensitivityCorCTRP_2.1.rds...
predicted <- predictTargetingDrugs(diffExprStat, gdsc)
## Subsetting data based on 11227 intersecting genes (83% of the 13451 input genes)...
## Correlating against 545 CTRP 2.1 compounds (823 cell lines; Spearman's correlation)...
## Comparison against 545 CTRP 2.1 compounds using 'spearman' performed in 5.56 secs
## Correlating against 545 CTRP 2.1 compounds (823 cell lines; Pearson's correlation)...
## Comparison against 545 CTRP 2.1 compounds using 'pearson' performed in 1.36 secs
## Performing GSEA against 545 CTRP 2.1 compounds (823 cell lines)......
## Comparison against 545 CTRP 2.1 compounds using 'gsea' (gene size of 150) performed in 1.19 mins
plot(predicted, method="rankProduct")

Compounds are ranked by their relative targeting potential based on the input differential expression profile (i.e. the 1st-ranked compound has higher targeting potential than the 2nd-ranked one).

Candidate targeting drugs can be plotted against the similarity ranking of their perturbations towards the user’s differential expression profile. Note that the highlighted values are the same compounds for the following plots annotated with their name, gene target and mechanism of action (MOA), respectively.

# Label by compound name
plotTargetingDrugsVSsimilarPerturbations(
  predicted, compareCompounds, column="spearman_rank")

# Label by compound's gene target
plotTargetingDrugsVSsimilarPerturbations(
  predicted, compareCompounds, column="spearman_rank", labelBy="target")

# Label by compound's mechanism of action (MOA)
plotTargetingDrugsVSsimilarPerturbations(
  predicted, compareCompounds, column="spearman_rank", labelBy="moa")

Molecular descriptor enrichment analysis

Next, from our candidate targeting drugs, we will analyse the enrichment of 2D and 3D molecular descriptors based on CMap and NCI60 compounds. This allows to check if targeting drugs are particularly enriched in specific drug descriptors and may be useful to think about the relevance of these descriptors for targeting a phenotype of interest.

descriptors <- loadDrugDescriptors("CMap", "2D")
## molecular_descriptors_CMap_2D.rds not found: downloading data...
drugSets    <- prepareDrugSets(descriptors)
dsea        <- analyseDrugSetEnrichment(drugSets, predicted)
## Matching compounds with those available in drug sets...
## Performing enrichment analysis...
# Plot the 6 most significant drug set enrichment results
plotDrugSetEnrichment(drugSets, predicted, selectedSets=head(dsea$pathway, 6))
## Matching compounds with those available in drug sets...
## Plotting enrichment analysis...

Contact information

All feedback on the program, documentation and associated material (including this tutorial) is welcome. Please send any suggestions and comments to:

Nuno Saraiva-Agostinho (nunoagostinho@medicina.ulisboa.pt)

Bernardo P. de Almeida (bernardo.almeida94@gmail.com)

Disease Transcriptomics Lab, Instituto de Medicina Molecular (Portugal)