Last updated: 2023-06-29

Checks: 6 1

Knit directory: mi_spatialomics/

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 file has unstaged changes. 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(20230612) 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 430aac1. 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:    .Rproj.user/
    Ignored:    analysis/.DS_Store
    Ignored:    data/.DS_Store
    Ignored:    data/.Rapp.history
    Ignored:    data/140623.calcagno_et_al.seurat_object.rds
    Ignored:    renv/.DS_Store
    Ignored:    renv/library/
    Ignored:    renv/staging/

Untracked files:
    Untracked:  analysis/figures.figure_5.Rmd
    Untracked:  analysis/figures.supplementary_figure_X.proteomics_qc.Rmd
    Untracked:  code/functions.R
    Untracked:  figures/Supplementary_figure_X.proteomics.eps
    Untracked:  figures/Supplementary_figure_X.proteomics.png
    Untracked:  omnipathr-log/
    Untracked:  output/limma.full_statistics.tsv
    Untracked:  output/limma.mi_iz_specific_proteins.tsv
    Untracked:  output/proteomics.pathway_results.MIiz_MIremote.tsv
    Untracked:  output/proteomics.pca_res.rds
    Untracked:  output/proteomics.protein_missing_stats.tsv
    Untracked:  output/proteomics.snRNAseq_comp.tsv
    Untracked:  output/proteomics.vsn_norm_proteins.tsv
    Untracked:  references/

Unstaged changes:
    Modified:   analysis/data_analysis.Rmd
    Modified:   analysis/figures.supplementary_Figure_3.Rmd
    Modified:   analysis/proteomics.bulk_de_analysis.Rmd
    Modified:   analysis/proteomics.filter_proteomic_data.Rmd
    Modified:   analysis/proteomics.pathway_enrichment_analysis.Rmd
    Modified:   analysis/proteomics.scRNAseq_comparison.Rmd
    Deleted:    code/params_R.R
    Modified:   figures/Supplementary_figure_3.eps
    Modified:   figures/Supplementary_figure_3.png
    Modified:   output/mi_iz_specific_proteins.tsv
    Modified:   renv.lock

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.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/proteomics.pathway_enrichment_analysis.Rmd) and HTML (docs/proteomics.pathway_enrichment_analysis.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
html 5f927dc FloWuenne 2023-06-20 Build site.
Rmd f29aea6 FloWuenne 2023-06-20 Commented out Omnipath for the moment.
html c1395e6 FloWuenne 2023-06-20 Build site.
Rmd 236130c FloWuenne 2023-06-20 Updating proteomic analysis.
html 236130c FloWuenne 2023-06-20 Updating proteomic analysis.

Introduction

Here, we are going to perform pathway analysis on the limma results from the proteomic analysis.

Load limma DE results

First, we load our results from the limma differential expression analysis that we calculated in DEP analysis.

limma_res <- fread("./output/limma.full_statistics.tsv")

## groups : "MI_IZ_vs_control"     "MI_remote_vs_control" "MI_IZ_vs_MI_remote"

## MI_IZ vs MI_remote
mi_signature <- subset(limma_res,analysis == "MI_IZ_vs_MI_remote")
mi_signature <- mi_signature %>%
  dplyr::select(t,gene) %>%
  filter(!is.na(t)) %>% 
  arrange(desc(t)) %>%
  column_to_rownames(var = "gene") %>%
  as.matrix()

Pathway activity analysis using decoupler

Load sigmd get sets

We will use Msigdb databases to perform pathway analysis

mh_gsea <- import_gmt(gmtfile = "./references/mh.all.v2023.1.Mm.symbols.gmt")

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |====================                                                  |  28%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |======================================================================| 100%
m2_all_gsea <- import_gmt(gmtfile = "./references/m2.all.v2023.1.Mm.symbols.gmt")

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |                                                                      |   1%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |==                                                                    |   4%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |===                                                                   |   5%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |=====                                                                 |   8%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |=======                                                               |  11%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |=========                                                             |  12%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |=========                                                             |  14%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |===========                                                           |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  16%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |============                                                          |  18%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |==============                                                        |  19%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |==============                                                        |  21%
  |                                                                            
  |===============                                                       |  21%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |================                                                      |  22%
  |                                                                            
  |================                                                      |  23%
  |                                                                            
  |================                                                      |  24%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |=================                                                     |  25%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |===================                                                   |  26%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |===================                                                   |  28%
  |                                                                            
  |====================                                                  |  28%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  29%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |=====================                                                 |  31%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |=======================                                               |  32%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |=======================                                               |  34%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |=========================                                             |  35%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |==========================                                            |  36%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |==========================                                            |  38%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |===========================                                           |  39%
  |                                                                            
  |============================                                          |  39%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |============================                                          |  41%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |==============================                                        |  42%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |==============================                                        |  44%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |===============================                                       |  45%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |=================================                                     |  46%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |=================================                                     |  48%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |==================================                                    |  49%
  |                                                                            
  |===================================                                   |  49%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |===================================                                   |  51%
  |                                                                            
  |====================================                                  |  51%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=====================================                                 |  52%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |=====================================                                 |  54%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=======================================                               |  55%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |========================================                              |  56%
  |                                                                            
  |========================================                              |  57%
  |                                                                            
  |========================================                              |  58%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |==========================================                            |  59%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |==========================================                            |  61%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |============================================                          |  62%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |============================================                          |  64%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |=============================================                         |  65%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |===============================================                       |  66%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |===============================================                       |  68%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |================================================                      |  69%
  |                                                                            
  |=================================================                     |  69%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |=================================================                     |  71%
  |                                                                            
  |==================================================                    |  71%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |===================================================                   |  72%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |===================================================                   |  74%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |=====================================================                 |  75%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  76%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |========================================================              |  79%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |========================================================              |  81%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |==========================================================            |  82%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |==========================================================            |  84%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |===========================================================           |  85%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |=============================================================         |  86%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |=============================================================         |  88%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |===============================================================       |  89%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |===============================================================       |  91%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |=================================================================     |  92%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |=================================================================     |  94%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |===================================================================   |  95%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |====================================================================  |  96%
  |                                                                            
  |====================================================================  |  97%
  |                                                                            
  |====================================================================  |  98%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |===================================================================== |  99%
  |                                                                            
  |======================================================================|  99%
  |                                                                            
  |======================================================================| 100%
mh_gsea_net <- rename_net(mh_gsea, term, gene, .mor= NULL)
saveRDS(mh_gsea_net,"references/mh.all.v2023.1.Mm.symbols.sets.rds")
mh_gsea_sets <- extract_sets(mh_gsea_net)

MI_IZ vs MI_remote pathways

We will focus on the comparison between the MI_IZ region versus the MI_remote region, as this comparison should capture the local differences of the endocardial layer close to the infarct versus those far away. As we have seen in the PCA and differential expression analysis, there are also not a lot of strong differences between MI_remote and MI_control, meaning that most changes we would identify comparing to the control, will also be captured in the MI_IZ vs MI_remote comparison.

Msigdb

## Run decoupler based on limma statistics
mi_ulm <- run_ulm(mat=mi_signature, .target = gene , .source = term, .mor= NULL,
                         net=mh_gsea, minsize = 3)
sig_pathways_mi <- subset(mi_ulm,p_value <= 0.05) %>%
  arrange(desc(score)) %>%
  dplyr::select(-statistic,-condition)

write.table(mi_ulm,
            file = "./output/proteomics.pathway_results.MIiz_MIremote.tsv",
            sep = "\t",
            col.names = TRUE,
            row.names = FALSE,
            quote = FALSE)
# Plot
ggplot(sig_pathways_mi, aes(x = reorder(source, score), y = score)) + 
    geom_bar(aes(fill = score), stat = "identity") +
    scale_fill_gradient2(low = proteome_palette[['MI_remote']], high = proteome_palette[['MI_IZ']], 
        mid = "whitesmoke", midpoint = 0) + 
    theme_minimal() +
    theme(axis.title = element_text(face = "bold", size = 12),
        axis.text.x = 
            element_text(angle = 45, hjust = 1, size =10, face= "bold"),
        axis.text.y = element_text(size =10, face= "bold"),
        panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank()) +
    xlab("Pathways") +
    coord_flip()

pathway <- 'HALLMARK_COAGULATION'

df <- mh_gsea_net %>%
  filter(source == pathway) %>%
  arrange(target)

inter <- sort(intersect(rownames(mi_signature),df$target))

sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/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] stats4    stats     graphics  grDevices datasets  utils     methods  
[8] base     

other attached packages:
 [1] ggsci_3.0.0          cowplot_1.1.1        lubridate_1.9.2     
 [4] forcats_1.0.0        stringr_1.5.0        dplyr_1.1.2         
 [7] purrr_1.0.1          readr_2.1.4          tidyr_1.3.0         
[10] tibble_3.2.1         ggplot2_3.4.2        tidyverse_2.0.0     
[13] pheatmap_1.0.12      data.table_1.14.8    GSEABase_1.60.0     
[16] graph_1.76.0         annotate_1.76.0      XML_3.99-0.14       
[19] AnnotationDbi_1.60.2 IRanges_2.32.0       S4Vectors_0.36.2    
[22] Biobase_2.58.0       BiocGenerics_0.44.0  here_1.0.1          
[25] OmnipathR_3.9.6      decoupleR_2.5.2      workflowr_1.7.0     

loaded via a namespace (and not attached):
 [1] colorspace_2.1-0       rprojroot_2.0.3        XVector_0.38.0        
 [4] fs_1.6.2               rstudioapi_0.14        farver_2.1.1          
 [7] bit64_4.0.5            fansi_1.0.4            xml2_1.3.4            
[10] cachem_1.0.8           knitr_1.42             jsonlite_1.8.4        
[13] png_0.1-8              BiocManager_1.30.21    compiler_4.2.3        
[16] httr_1.4.6             backports_1.4.1        Matrix_1.5-3          
[19] fastmap_1.1.1          cli_3.6.1              later_1.3.1           
[22] htmltools_0.5.5        prettyunits_1.1.1      tools_4.2.3           
[25] igraph_1.4.3           gtable_0.3.3           glue_1.6.2            
[28] GenomeInfoDbData_1.2.9 reshape2_1.4.4         rappdirs_0.3.3        
[31] Rcpp_1.0.10            cellranger_1.1.0       jquerylib_0.1.4       
[34] vctrs_0.6.2            Biostrings_2.66.0      xfun_0.39             
[37] ps_1.7.4               rvest_1.0.3            timechange_0.2.0      
[40] lifecycle_1.0.3        renv_0.17.3            getPass_0.2-2         
[43] zlibbioc_1.44.0        scales_1.2.1           hms_1.1.3             
[46] promises_1.2.0.1       parallel_4.2.3         RColorBrewer_1.1-3    
[49] yaml_2.3.7             curl_5.0.0             memoise_2.0.1         
[52] sass_0.4.6             stringi_1.7.12         RSQLite_2.3.1         
[55] highr_0.10             checkmate_2.2.0        GenomeInfoDb_1.34.9   
[58] rlang_1.1.1            pkgconfig_2.0.3        bitops_1.0-7          
[61] evaluate_0.21          lattice_0.20-45        labeling_0.4.2        
[64] bit_4.0.5              processx_3.8.0         tidyselect_1.2.0      
[67] parallelly_1.36.0      plyr_1.8.8             logger_0.2.2          
[70] magrittr_2.0.3         R6_2.5.1               generics_0.1.3        
[73] DBI_1.1.3              pillar_1.9.0           whisker_0.4.1         
[76] withr_2.5.0            KEGGREST_1.38.0        RCurl_1.98-1.12       
[79] crayon_1.5.2           utf8_1.2.3             tzdb_0.4.0            
[82] rmarkdown_2.21         progress_1.2.2         grid_4.2.3            
[85] readxl_1.4.2           blob_1.2.4             callr_3.7.3           
[88] git2r_0.32.0           digest_0.6.31          xtable_1.8-4          
[91] httpuv_1.6.11          munsell_0.5.0          bslib_0.4.2