Last updated: 2024-08-22

Checks: 7 0

Knit directory: CCL19_FRCs_lung_cancer/

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


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

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(20240808) 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 7246b50. 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:    analysis/.DS_Store
    Ignored:    data/Human/
    Ignored:    data/Mouse/
    Ignored:    output/GSEA_AdvFB_SULF1/
    Ignored:    output/GSEA_AdvFB_TLS/
    Ignored:    output/GSEA_CCR7_T/
    Ignored:    output/GSEA_CD8_T/
    Ignored:    output/GSEA_CYCL_T/
    Ignored:    output/GSEA_EXH_T/
    Ignored:    output/GSEA_SMC_PRC/

Untracked files:
    Untracked:  README.html
    Untracked:  analysis/Compare_tumors.Rmd
    Untracked:  analysis/NSCLC_PDAC_CAFs.Rmd
    Untracked:  analysis/Seurat_to_SCE.Rmd
    Untracked:  analysis/Total_CD8_DTR_Tetra.Rmd
    Untracked:  analysis/index_hidden.Rmd
    Untracked:  analysis/mcov_R.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.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/NSCLC_trajectory_analysis.Rmd) and HTML (docs/NSCLC_trajectory_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
Rmd 7246b50 Pchryssa 2024-08-22 NSCLC differentiation
html 6857394 Pchryssa 2024-08-22 Build site.
Rmd d9b3536 Pchryssa 2024-08-22 trajectory analysis

Load packages

suppressPackageStartupMessages({
  library(here)
  library(purrr)
  library(dplyr)
  library(stringr)
  library(patchwork)
  library(Seurat)
  library(Matrix)
  library(ggsci)
  library(monocle3)
  library(SeuratWrappers)
  library(ggplot2)
  library(scCustomize)
})

Trajectory analysis in NSCLC

Set directory

basedir <- here()

Read CCL19⁺ FRC data

NSCLC_CCL19_data <- readRDS(paste0(basedir,"/data/Human/NSCLC_CCL19_FRCs_CAFs.rds"))

Color palette per celltype

palet_CCL19_FRC <- c("#1B9E77", "#54B0E4","#E3BE00", "#E41A1C")
names(palet_CCL19_FRC) <- c("CAF2/TRC","CAF1/PRC","AdvFB" ,"SMC/PC")

CCL19⁺ fibroblasts

palet_region <- c("#C77CFF","#B79F00","#F8766D")
names(palet_region) <- c("Central Margin","Subpleural Margin","Lung (unaffected)")

DimPlot(NSCLC_CCL19_data, reduction = "umap", group.by = "group",cols = palet_region)+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(),
        panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2") + ggtitle(paste0("CCL19", "\U207A ", "fibroblasts"))

Differentiation trajectories on NSCLC CCL19⁺ cells based on Monocle3

Monocle3 preparation

sceSub <-as.SingleCellExperiment(NSCLC_CCL19_data)

sce_list <- list("all" = sceSub)
sce_names <- names(sce_list)

test = rownames(rowData(sce_list$all))
test_new = as.data.frame(test)

test_new <- gsub("^.*\\.", "", test)

cds_list <- lapply(sce_names, prep_sce) %>% set_names(sce_names)

Visulaize partitions

for (sce_nam in sce_names) {
  p <-plot_cells(cds_list[[sce_nam]], color_cells_by = "partition")
  print(p)
}

Learn graph

cds_list <- lapply(cds_list, function(cds){
  cds <- learn_graph(cds, learn_graph_control = list(minimal_branch_len = 30,
                                                   L1.gamma = 0.08,
                                                   L1.sigma = 0.01,
                                                   nn.n_trees = 20
                                                   )) 
  })

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%

Learn pseudotime

# Written by Almut Lütge
cds_list <- lapply(cds_list, function(cds){
  mu_start <- get_earliest_principal_node(cds, "SMC/PC")
  lu_start <- get_earliest_principal_node(cds, "AdvFB")
  cds <- order_cells(cds, root_pr_nodes=c(mu_start, lu_start))
}) %>% set_names(sce_names)

Visualize trajectories

Origin (Figure 4A)

for (sce_nam in sce_names) {
  p <- plot_trajectory(col_var = "group", cds = cds_list[[sce_nam]], palet_region)
  print(p)
}

Visualize pseudotime (Figure 4B)

for (sce_nam in sce_names) {
  p <- plot_pseudo(cds_list[[sce_nam]])
  print(p)
}

Celltype

for (sce_nam in sce_names) {
  p <- plot_trajectory(col_var = "cell_type", cds = cds_list[[sce_nam]], palet_CCL19_FRC)
  print(p)
}

Visualize genes along pseudotime

DES MYH11 (Figure 4C)

for (sce_nam in sce_names) {
  p <- plot_top_de(sce_nam, "1", gene_list = c("DES", "MYH11"))
  print(p)
}

RGS5 NOTCH3 ACTA2 (Figure 4E)

for (sce_nam in sce_names) {
  p <- plot_top_de(sce_nam, "1", gene_list = c("RGS5","NOTCH3","ACTA2"))
  print(p)
}

TNC CCL21 CXCL12 (Figure 4G)

for (sce_nam in sce_names) {
  p <- plot_top_de(sce_nam, "1", gene_list = c("TNC","CCL21","CXCL12"))
  print(p)
}

CLU POSTN SULF1 (Figure 4I)

for (sce_nam in sce_names) {
  p <- plot_top_de(sce_nam, "1", gene_list = c("CLU","POSTN","SULF1"))
  print(p)
}

Unaffected Lung vs Tumor (Supplementary Figure 5A)

Umap

DimPlot(NSCLC_CCL19_data, reduction = "umap", group.by = "type", split.by = "type")+
  theme_bw() +
  theme(axis.text = element_blank(), axis.ticks = element_blank(),
        panel.grid.minor = element_blank(),
        panel.grid.major = element_blank()) +
  xlab("UMAP1") +
  ylab("UMAP2")

DES

FeaturePlot(NSCLC_CCL19_data, reduction = "umap", split.by = "type",
          features = get_full_gene_name('DES',NSCLC_CCL19_data),raster=FALSE,
          cols=c("lightgrey", "darkred"), min.cutoff = 0, max.cutoff = 4.5)

Signatures (Supplementary Figure 5B)

CD34

FeaturePlot(NSCLC_CCL19_data, reduction = "umap", 
          features = get_full_gene_name('CD34',NSCLC_CCL19_data),raster=FALSE,
          cols=c("lightgrey", "darkred"), min.cutoff = 0, max.cutoff = 4.5) + ggtitle("CD34")

LEPR

FeaturePlot(NSCLC_CCL19_data, reduction = "umap", 
          features = get_full_gene_name('LEPR',NSCLC_CCL19_data),raster=FALSE,
          cols=c("lightgrey", "darkred"), min.cutoff = 0, max.cutoff = 4.5) + ggtitle("LEPR")

Session info

sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.6.7

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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

time zone: Europe/Zurich
tzcode source: internal

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

other attached packages:
 [1] scCustomize_1.1.3           ggplot2_3.4.2              
 [3] SeuratWrappers_0.2.0        monocle3_1.3.7             
 [5] SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.2
 [7] GenomicRanges_1.52.0        GenomeInfoDb_1.36.1        
 [9] IRanges_2.34.1              S4Vectors_0.38.1           
[11] MatrixGenerics_1.12.3       matrixStats_1.0.0          
[13] Biobase_2.60.0              BiocGenerics_0.46.0        
[15] ggsci_3.0.0                 Matrix_1.6-0               
[17] SeuratObject_4.1.3          Seurat_4.3.0.1             
[19] patchwork_1.1.2             stringr_1.5.0              
[21] dplyr_1.1.2                 purrr_1.0.1                
[23] here_1.0.1                  magrittr_2.0.3             
[25] circlize_0.4.15             tidyr_1.3.0                
[27] tibble_3.2.1                workflowr_1.7.1            

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.21        splines_4.3.1           later_1.3.1            
  [4] bitops_1.0-7            polyclip_1.10-4         janitor_2.2.0          
  [7] lifecycle_1.0.3         rprojroot_2.0.3         globals_0.16.2         
 [10] processx_3.8.2          lattice_0.21-8          MASS_7.3-60            
 [13] plotly_4.10.2           sass_0.4.7              rmarkdown_2.23         
 [16] jquerylib_0.1.4         yaml_2.3.7              remotes_2.4.2.1        
 [19] httpuv_1.6.11           sctransform_0.3.5       sp_2.0-0               
 [22] spatstat.sparse_3.0-2   reticulate_1.36.1       cowplot_1.1.1          
 [25] pbapply_1.7-2           minqa_1.2.5             RColorBrewer_1.1-3     
 [28] lubridate_1.9.2         abind_1.4-5             zlibbioc_1.46.0        
 [31] Rtsne_0.16              RCurl_1.98-1.12         git2r_0.33.0           
 [34] GenomeInfoDbData_1.2.10 ggrepel_0.9.3           irlba_2.3.5.1          
 [37] listenv_0.9.0           spatstat.utils_3.1-0    goftest_1.2-3          
 [40] spatstat.random_3.1-5   fitdistrplus_1.1-11     parallelly_1.36.0      
 [43] leiden_0.4.3            codetools_0.2-19        DelayedArray_0.28.0    
 [46] tidyselect_1.2.0        shape_1.4.6             farver_2.1.1           
 [49] viridis_0.6.4           lme4_1.1-34             spatstat.explore_3.2-1 
 [52] jsonlite_1.8.7          ellipsis_0.3.2          progressr_0.13.0       
 [55] ggridges_0.5.4          survival_3.5-5          systemfonts_1.0.4      
 [58] tools_4.3.1             ragg_1.2.5              ica_1.0-3              
 [61] Rcpp_1.0.11             glue_1.6.2              gridExtra_2.3          
 [64] SparseArray_1.2.4       xfun_0.39               withr_2.5.0            
 [67] BiocManager_1.30.21.1   fastmap_1.1.1           boot_1.3-28.1          
 [70] fansi_1.0.4             callr_3.7.3             digest_0.6.33          
 [73] rsvd_1.0.5              timechange_0.2.0        R6_2.5.1               
 [76] mime_0.12               textshaping_0.3.6       ggprism_1.0.4          
 [79] colorspace_2.1-0        scattermore_1.2         tensor_1.5             
 [82] spatstat.data_3.0-1     utf8_1.2.3              generics_0.1.3         
 [85] data.table_1.14.8       httr_1.4.6              htmlwidgets_1.6.2      
 [88] S4Arrays_1.2.1          whisker_0.4.1           uwot_0.1.16            
 [91] pkgconfig_2.0.3         gtable_0.3.3            lmtest_0.9-40          
 [94] XVector_0.40.0          htmltools_0.5.5         scales_1.2.1           
 [97] png_0.1-8               snakecase_0.11.1        knitr_1.43             
[100] rstudioapi_0.15.0       reshape2_1.4.4          nlme_3.1-162           
[103] nloptr_2.0.3            proxy_0.4-27            cachem_1.0.8           
[106] zoo_1.8-12              GlobalOptions_0.1.2     KernSmooth_2.23-22     
[109] vipor_0.4.5             parallel_4.3.1          miniUI_0.1.1.1         
[112] ggrastr_1.0.2           pillar_1.9.0            grid_4.3.1             
[115] vctrs_0.6.3             RANN_2.6.1              promises_1.2.0.1       
[118] xtable_1.8-4            cluster_2.1.4           paletteer_1.5.0        
[121] beeswarm_0.4.0          evaluate_0.21           cli_3.6.1              
[124] compiler_4.3.1          rlang_1.1.1             crayon_1.5.2           
[127] future.apply_1.11.0     labeling_0.4.2          rematch2_2.1.2         
[130] ps_1.7.5                forcats_1.0.0           getPass_0.2-4          
[133] plyr_1.8.8              fs_1.6.3                ggbeeswarm_0.7.2       
[136] stringi_1.7.12          viridisLite_0.4.2       deldir_1.0-9           
[139] assertthat_0.2.1        munsell_0.5.0           lazyeval_0.2.2         
[142] spatstat.geom_3.2-4     future_1.33.0           shiny_1.7.4.1          
[145] highr_0.10              ROCR_1.0-11             igraph_1.5.0.1         
[148] bslib_0.5.0            
date()
[1] "Thu Aug 22 23:23:25 2024"

sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.6.7

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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

time zone: Europe/Zurich
tzcode source: internal

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

other attached packages:
 [1] scCustomize_1.1.3           ggplot2_3.4.2              
 [3] SeuratWrappers_0.2.0        monocle3_1.3.7             
 [5] SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.2
 [7] GenomicRanges_1.52.0        GenomeInfoDb_1.36.1        
 [9] IRanges_2.34.1              S4Vectors_0.38.1           
[11] MatrixGenerics_1.12.3       matrixStats_1.0.0          
[13] Biobase_2.60.0              BiocGenerics_0.46.0        
[15] ggsci_3.0.0                 Matrix_1.6-0               
[17] SeuratObject_4.1.3          Seurat_4.3.0.1             
[19] patchwork_1.1.2             stringr_1.5.0              
[21] dplyr_1.1.2                 purrr_1.0.1                
[23] here_1.0.1                  magrittr_2.0.3             
[25] circlize_0.4.15             tidyr_1.3.0                
[27] tibble_3.2.1                workflowr_1.7.1            

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.21        splines_4.3.1           later_1.3.1            
  [4] bitops_1.0-7            polyclip_1.10-4         janitor_2.2.0          
  [7] lifecycle_1.0.3         rprojroot_2.0.3         globals_0.16.2         
 [10] processx_3.8.2          lattice_0.21-8          MASS_7.3-60            
 [13] plotly_4.10.2           sass_0.4.7              rmarkdown_2.23         
 [16] jquerylib_0.1.4         yaml_2.3.7              remotes_2.4.2.1        
 [19] httpuv_1.6.11           sctransform_0.3.5       sp_2.0-0               
 [22] spatstat.sparse_3.0-2   reticulate_1.36.1       cowplot_1.1.1          
 [25] pbapply_1.7-2           minqa_1.2.5             RColorBrewer_1.1-3     
 [28] lubridate_1.9.2         abind_1.4-5             zlibbioc_1.46.0        
 [31] Rtsne_0.16              RCurl_1.98-1.12         git2r_0.33.0           
 [34] GenomeInfoDbData_1.2.10 ggrepel_0.9.3           irlba_2.3.5.1          
 [37] listenv_0.9.0           spatstat.utils_3.1-0    goftest_1.2-3          
 [40] spatstat.random_3.1-5   fitdistrplus_1.1-11     parallelly_1.36.0      
 [43] leiden_0.4.3            codetools_0.2-19        DelayedArray_0.28.0    
 [46] tidyselect_1.2.0        shape_1.4.6             farver_2.1.1           
 [49] viridis_0.6.4           lme4_1.1-34             spatstat.explore_3.2-1 
 [52] jsonlite_1.8.7          ellipsis_0.3.2          progressr_0.13.0       
 [55] ggridges_0.5.4          survival_3.5-5          systemfonts_1.0.4      
 [58] tools_4.3.1             ragg_1.2.5              ica_1.0-3              
 [61] Rcpp_1.0.11             glue_1.6.2              gridExtra_2.3          
 [64] SparseArray_1.2.4       xfun_0.39               withr_2.5.0            
 [67] BiocManager_1.30.21.1   fastmap_1.1.1           boot_1.3-28.1          
 [70] fansi_1.0.4             callr_3.7.3             digest_0.6.33          
 [73] rsvd_1.0.5              timechange_0.2.0        R6_2.5.1               
 [76] mime_0.12               textshaping_0.3.6       ggprism_1.0.4          
 [79] colorspace_2.1-0        scattermore_1.2         tensor_1.5             
 [82] spatstat.data_3.0-1     utf8_1.2.3              generics_0.1.3         
 [85] data.table_1.14.8       httr_1.4.6              htmlwidgets_1.6.2      
 [88] S4Arrays_1.2.1          whisker_0.4.1           uwot_0.1.16            
 [91] pkgconfig_2.0.3         gtable_0.3.3            lmtest_0.9-40          
 [94] XVector_0.40.0          htmltools_0.5.5         scales_1.2.1           
 [97] png_0.1-8               snakecase_0.11.1        knitr_1.43             
[100] rstudioapi_0.15.0       reshape2_1.4.4          nlme_3.1-162           
[103] nloptr_2.0.3            proxy_0.4-27            cachem_1.0.8           
[106] zoo_1.8-12              GlobalOptions_0.1.2     KernSmooth_2.23-22     
[109] vipor_0.4.5             parallel_4.3.1          miniUI_0.1.1.1         
[112] ggrastr_1.0.2           pillar_1.9.0            grid_4.3.1             
[115] vctrs_0.6.3             RANN_2.6.1              promises_1.2.0.1       
[118] xtable_1.8-4            cluster_2.1.4           paletteer_1.5.0        
[121] beeswarm_0.4.0          evaluate_0.21           cli_3.6.1              
[124] compiler_4.3.1          rlang_1.1.1             crayon_1.5.2           
[127] future.apply_1.11.0     labeling_0.4.2          rematch2_2.1.2         
[130] ps_1.7.5                forcats_1.0.0           getPass_0.2-4          
[133] plyr_1.8.8              fs_1.6.3                ggbeeswarm_0.7.2       
[136] stringi_1.7.12          viridisLite_0.4.2       deldir_1.0-9           
[139] assertthat_0.2.1        munsell_0.5.0           lazyeval_0.2.2         
[142] spatstat.geom_3.2-4     future_1.33.0           shiny_1.7.4.1          
[145] highr_0.10              ROCR_1.0-11             igraph_1.5.0.1         
[148] bslib_0.5.0