Last updated: 2022-05-11

Checks: 6 1

Knit directory: EMBL2016/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


The R Markdown is untracked by Git. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210512) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 12d1722. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    analysis/.DS_Store
    Ignored:    analysis/.Rhistory
    Ignored:    analysis/boxplot_AUC.png
    Ignored:    analysis/consensus_clustering_CPS_cache/
    Ignored:    analysis/consensus_clustering_noFit_cache/
    Ignored:    analysis/dose_curve.png
    Ignored:    analysis/targetDist.png
    Ignored:    analysis/toxivity_box.png
    Ignored:    analysis/volcano.png
    Ignored:    data/.DS_Store
    Ignored:    output/.DS_Store

Untracked files:
    Untracked:  analysis/AUC_CLL_IC50/
    Untracked:  analysis/BRAF_analysis.Rmd
    Untracked:  analysis/GSVA_analysis.Rmd
    Untracked:  analysis/NOTCH1_signature.Rmd
    Untracked:  analysis/autoluminescence.Rmd
    Untracked:  analysis/bar_plot_mixed.pdf
    Untracked:  analysis/bar_plot_mixed_noU1.pdf
    Untracked:  analysis/beatAML/
    Untracked:  analysis/cohortComposition_CLLsamples.pdf
    Untracked:  analysis/cohortComposition_allSamples.pdf
    Untracked:  analysis/consensus_clustering.Rmd
    Untracked:  analysis/consensus_clustering_CPS.Rmd
    Untracked:  analysis/consensus_clustering_IC50.Rmd
    Untracked:  analysis/consensus_clustering_beatAML.Rmd
    Untracked:  analysis/consensus_clustering_noFit.Rmd
    Untracked:  analysis/consensus_clusters.pdf
    Untracked:  analysis/disease_specific.Rmd
    Untracked:  analysis/dose_curve_selected.pdf
    Untracked:  analysis/genomic_association.Rmd
    Untracked:  analysis/genomic_association_allDisease.Rmd
    Untracked:  analysis/mean_autoluminescence_val.csv
    Untracked:  analysis/mean_autoluminescence_val.xlsx
    Untracked:  analysis/noFit_CLL/
    Untracked:  analysis/number_associations.pdf
    Untracked:  analysis/overview.Rmd
    Untracked:  analysis/plotCohort.Rmd
    Untracked:  analysis/preprocess.Rmd
    Untracked:  analysis/volcano_noBlocking.pdf
    Untracked:  code/utils.R
    Untracked:  data/BeatAML_Waves1_2/
    Untracked:  data/ic50Tab.RData
    Untracked:  data/newEMBL_20210806.RData
    Untracked:  data/patMeta.RData
    Untracked:  data/targetAnnotation_all.csv
    Untracked:  force_sync.sh
    Untracked:  output/gene_associations/
    Untracked:  output/resConsClust.RData
    Untracked:  output/resConsClust_aucFit.RData
    Untracked:  output/resConsClust_beatAML.RData
    Untracked:  output/resConsClust_cps.RData
    Untracked:  output/resConsClust_ic50.RData
    Untracked:  output/resConsClust_noFit.RData
    Untracked:  output/screenData.RData
    Untracked:  sync.sh

Unstaged changes:
    Modified:   _workflowr.yml
    Modified:   analysis/_site.yml
    Deleted:    analysis/about.Rmd
    Modified:   analysis/index.Rmd
    Deleted:    analysis/license.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


There are no past versions. Publish this analysis with wflow_publish() to start tracking its development.


In this analysis, sample-specific pathway scores were firstly assigned to each sample by using ssGSEA method. The 1/viabilities after drug treatment were considered as gene expressions and pathway memberships of the targets were considered as gene sets. The sample-specific pathways scores can be considered as some kind of dependencies on the pathways, i.e, the samples that have higher scores are the samples that are in general more sensitive to the drugs from that pathways. Then the samples-specific pathway scores can be associated to disease types or genomic as in other analyses.

Load libraries and dataset

Load datasets

Prepare data for ssGSEA

Drug response matrix

viabMat <- screenData %>% select(patientID, viab.auc, Drug) %>%
  group_by(patientID, Drug) %>% summarise(viab = 1/mean(viab.auc)) %>%
  pivot_wider(names_from = patientID, values_from = viab) %>%
  data.frame() %>% column_to_rownames("Drug") %>%
  as.matrix()

Prepare pathway sets

pathwaySet <- lapply(unique(targetAnno$pathway), function(x) {
  filter(targetAnno, pathway == x)$nameEMBL2016
})
names(pathwaySet) <- unique(targetAnno$pathway)

Perform ssGSEA

res <- gsva(viabMat, pathwaySet, method ="ssgsea", verbose = FALSE, min.sz=2)

Overview of the sample-specific pathway scores

Heatmap and hierarchical clustering

All entities

Only CLL

TSNE

UMAP (alternative for T-SNE)

#Calculate UMAP layout, which can better retain global structure
plotTab <- smallvis(t(res), method = "umap", perplexity = 30, 
                    eta = 0.01, epoch_callback = FALSE, verbose = FALSE)
colnames(plotTab) <- c("x","y")

plotTab <- plotTab %>% as.tibble() %>% mutate(Patient.ID = colnames(viabMat)) %>%
  left_join(select(patMeta, Patient.ID, diagnosis, IGHV.status, project), by = "Patient.ID") %>%
  mutate(diagnosis = as.character(diagnosis), project = as.character(project)) %>%
  mutate(diagnosis = ifelse(diagnosis == "CLL" & IGHV.status == "U", "U-CLL",diagnosis)) %>%
  filter(!is.na(diagnosis))

UMAP plot (better retain global structure)

Disease-specific pathway dependence

[1] "AML"
[1] "MCL"
[1] "T-PLL"
[1] "B-NHL"
[1] "B-PLL"

p value heatmap

Associations with genomic within CLL

Without blocking for IGHV

Only mutations occurred at least 5 times will be included in the test

Number of significant associations per gene (10% FDR)

A table of significant associations

filter(pTab, p.adj <=0.1) %>% mutate_if(is.numeric, formatC, digits=2) %>%
  DT::datatable()

Volcano plots

#filter genes with significant assocaitions
useGene <- unique(filter(pTab, p.adj <=0.05)$gene)

plotList <- lapply(useGene, function(n) {
  eachTab <- filter(pTab, gene %in% n, !is.na(p)) %>%
    mutate(direction = ifelse(p.adj > 0.05, "n.s.",
                              ifelse(logFC>0, "resistant","sensitive"))) %>%
    mutate(drugLabel = ifelse(direction == "n.s.","",drug))

  #pCut <- -log10(max(filter(eachTab, p.adj <=0.1)$p))
  pCut <- -log10(0.05)
  ggplot(eachTab, aes(x=logFC, y = -log10(p.adj))) +
    geom_point(aes(col = direction)) +
    ggrepel::geom_text_repel(aes(label = drugLabel), max.overlaps = Inf) +
    scale_color_manual(values = c("n.s."="grey60","resistant" = "red","sensitive" = "blue")) +
    geom_hline(yintercept = pCut, linetype = "dashed", color = "orange") +
    ylab("-log10(adjusted P value)") + xlab("log2(fold change)") +
    ggtitle(sprintf("%s (mutated vs unmutated)", n)) +
    theme_bw() +
    theme(plot.title = element_text(hjust=0.5, size=15, face ="bold"),
          legend.position = "bottom",
          axis.text = element_text(size=14),
          axis.title = element_text(size=14))
})
plot_grid(plotlist = plotList, ncol=2)

Blocking for IGHV

Number of significant associations per gene (10% FDR)

Associations pass 10% FDR are colored by genes.

Volcano plots

#filter genes with significant assocaitions
useGene <- unique(filter(pTab.block, p.adj <=0.05)$gene)


plotList <- lapply(useGene, function(n) {
  eachTab <- filter(pTab.block, gene %in% n, !is.na(p)) %>%
    mutate(direction = ifelse(p.adj > 0.05, "n.s.",
                              ifelse(logFC>0, "resistant","sensitive"))) %>%
    mutate(drugLabel = ifelse(direction == "n.s.","",drug))
  
  #pCut <- -log10(max(filter(eachTab, p.adj <=0.1)$p))
  pCut <- -log10(0.05)
  ggplot(eachTab, aes(x=logFC, y = -log10(p.adj))) +
    geom_point(aes(col = direction)) +
    ggrepel::geom_text_repel(aes(label = drugLabel), max.overlaps = Inf) +
    scale_color_manual(values = c("n.s."="grey60","resistant" = "red","sensitive" = "blue")) +
    geom_hline(yintercept = pCut, linetype = "dashed", color = "orange") +
    ylab("-log10(adjusted P value)") + xlab("log2(fold change)") +
    ggtitle(sprintf("%s (mutated vs unmutated)", n)) +
    theme_bw() +
    theme(plot.title = element_text(hjust=0.5, size=15, face ="bold"),
          legend.position = "bottom",
          axis.text = element_text(size=14),
          axis.title = element_text(size=14))
})
plot_grid(plotlist = plotList, ncol=2)

PDF version: volcano_withBlocking.pdf

A table of significant associations

filter(pTab.block, p.adj <=0.1) %>% mutate_if(is.numeric, formatC, digits=2) %>%
  DT::datatable()

sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] forcats_0.5.1       stringr_1.4.0       dplyr_1.0.7        
 [4] purrr_0.3.4         readr_2.1.1         tidyr_1.1.4        
 [7] tibble_3.1.6        ggplot2_3.3.5       tidyverse_1.3.1    
[10] cowplot_1.1.1       smallvis_0.0.0.9000 limma_3.50.0       
[13] Rtsne_0.15          RColorBrewer_1.1-2  pheatmap_1.0.12    
[16] GSVA_1.42.0        

loaded via a namespace (and not attached):
  [1] colorspace_2.0-2            ellipsis_0.3.2             
  [3] rprojroot_2.0.2             XVector_0.34.0             
  [5] GenomicRanges_1.46.1        fs_1.5.2                   
  [7] rstudioapi_0.13             farver_2.1.0               
  [9] ggrepel_0.9.1               DT_0.20                    
 [11] bit64_4.0.5                 AnnotationDbi_1.56.2       
 [13] fansi_1.0.2                 lubridate_1.8.0            
 [15] xml2_1.3.3                  sparseMatrixStats_1.6.0    
 [17] cachem_1.0.6                knitr_1.37                 
 [19] jsonlite_1.7.3              workflowr_1.7.0            
 [21] broom_0.7.11                annotate_1.72.0            
 [23] dbplyr_2.1.1                png_0.1-7                  
 [25] graph_1.72.0                HDF5Array_1.22.1           
 [27] BiocManager_1.30.16         compiler_4.1.2             
 [29] httr_1.4.2                  backports_1.4.1            
 [31] assertthat_0.2.1            Matrix_1.4-0               
 [33] fastmap_1.1.0               cli_3.1.1                  
 [35] later_1.3.0                 BiocSingular_1.10.0        
 [37] htmltools_0.5.2             tools_4.1.2                
 [39] rsvd_1.0.5                  gtable_0.3.0               
 [41] glue_1.6.1                  GenomeInfoDbData_1.2.7     
 [43] Rcpp_1.0.8                  Biobase_2.54.0             
 [45] cellranger_1.1.0            jquerylib_0.1.4            
 [47] vctrs_0.3.8                 Biostrings_2.62.0          
 [49] rhdf5filters_1.6.0          crosstalk_1.2.0            
 [51] DelayedMatrixStats_1.16.0   xfun_0.29                  
 [53] rvest_1.0.2                 beachmat_2.10.0            
 [55] lifecycle_1.0.1             irlba_2.3.5                
 [57] XML_3.99-0.8                zlibbioc_1.40.0            
 [59] scales_1.1.1                vroom_1.5.7                
 [61] BiocStyle_2.22.0            hms_1.1.1                  
 [63] promises_1.2.0.1            MatrixGenerics_1.6.0       
 [65] parallel_4.1.2              SummarizedExperiment_1.24.0
 [67] rhdf5_2.38.0                SingleCellExperiment_1.16.0
 [69] yaml_2.2.1                  memoise_2.0.1              
 [71] sass_0.4.0                  stringi_1.7.6              
 [73] RSQLite_2.2.9               highr_0.9                  
 [75] S4Vectors_0.32.3            ScaledMatrix_1.2.0         
 [77] BiocGenerics_0.40.0         BiocParallel_1.28.3        
 [79] GenomeInfoDb_1.30.0         rlang_0.4.12               
 [81] pkgconfig_2.0.3             matrixStats_0.61.0         
 [83] bitops_1.0-7                evaluate_0.14              
 [85] lattice_0.20-45             Rhdf5lib_1.16.0            
 [87] htmlwidgets_1.5.4           labeling_0.4.2             
 [89] bit_4.0.4                   tidyselect_1.1.1           
 [91] GSEABase_1.56.0             magrittr_2.0.1             
 [93] R6_2.5.1                    IRanges_2.28.0             
 [95] generics_0.1.1              DelayedArray_0.20.0        
 [97] DBI_1.1.2                   withr_2.4.3                
 [99] pillar_1.6.5                haven_2.4.3                
[101] KEGGREST_1.34.0             RCurl_1.98-1.5             
[103] modelr_0.1.8                crayon_1.4.2               
[105] utf8_1.2.2                  tzdb_0.2.0                 
[107] rmarkdown_2.11              readxl_1.3.1               
[109] grid_4.1.2                  FNN_1.1.3                  
[111] blob_1.2.2                  git2r_0.29.0               
[113] reprex_2.0.1                digest_0.6.29              
[115] xtable_1.8-4                httpuv_1.6.5               
[117] stats4_4.1.2                munsell_0.5.0              
[119] bslib_0.3.1