Last updated: 2021-02-18

Checks: 6 1

Knit directory: melanoma_publication_old_data/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). 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(20200728) 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 ee1595d. 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:    .Rproj.user/
    Ignored:    ._.DS_Store
    Ignored:    analysis/._clinical metadata preparation.Rmd
    Ignored:    code/.DS_Store
    Ignored:    code/._.DS_Store
    Ignored:    data/.DS_Store
    Ignored:    data/._.DS_Store
    Ignored:    data/data_for_analysis/
    Ignored:    data/full_data/
    Ignored:    output/.DS_Store
    Ignored:    output/._.DS_Store
    Ignored:    output/._protein_neutrophil.png
    Ignored:    output/._rna_neutrophil.png
    Ignored:    output/PSOCKclusterOut/
    Ignored:    output/bcell_grouping.png
    Ignored:    output/dysfunction_correlation.pdf

Unstaged changes:
    Modified:   .gitignore
    Modified:   analysis/04_1_Protein_celltype_classification.rmd
    Modified:   analysis/04_1_RNA_celltype_classification.rmd
    Modified:   analysis/04_2_RNA_classification_subclustering.rmd
    Modified:   analysis/04_2_protein_classification_subclustering.rmd
    Modified:   analysis/07_TCF7_PD1_gating.rmd
    Modified:   analysis/08_color_vectors.rmd
    Modified:   analysis/09_Tcell_Score.Rmd
    Modified:   analysis/10_Dysfunction_Score.rmd
    Modified:   analysis/11_Bcell_Score.Rmd
    Modified:   analysis/Figure_1.rmd
    Modified:   analysis/Figure_2.rmd
    Modified:   analysis/Figure_3.rmd
    Modified:   analysis/Figure_4.rmd
    Modified:   analysis/Figure_5.rmd
    Modified:   analysis/Supp-Figure_1.rmd
    Modified:   analysis/Supp-Figure_2.rmd
    Modified:   analysis/Supp-Figure_3.rmd
    Modified:   analysis/Supp-Figure_4.rmd
    Modified:   analysis/Supp-Figure_5.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/07_TCF7_PD1_gating.rmd) and HTML (docs/07_TCF7_PD1_gating.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 ee1595d toobiwankenobi 2021-02-12 clean repo and adapt files
html ee1595d toobiwankenobi 2021-02-12 clean repo and adapt files
Rmd 2e443a5 toobiwankenobi 2021-02-09 remove files that are not needed

Introduction

Preparations

knitr::opts_chunk$set(echo = TRUE, message= FALSE)
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())

Load libraries

First, we will load the libraries needed for this part of the analysis.

sapply(list.files("code/helper_functions", full.names = TRUE), source)
        code/helper_functions/calculateSummary.R
value   ?                                       
visible FALSE                                   
        code/helper_functions/censor_dat.R
value   ?                                 
visible FALSE                             
        code/helper_functions/detect_mRNA_expression.R
value   ?                                             
visible FALSE                                         
        code/helper_functions/DistanceToClusterCenter.R
value   ?                                              
visible FALSE                                          
        code/helper_functions/findMilieu.R code/helper_functions/findPatch.R
value   ?                                  ?                                
visible FALSE                              FALSE                            
        code/helper_functions/getInfoFromString.R
value   ?                                        
visible FALSE                                    
        code/helper_functions/getSpotnumber.R
value   ?                                    
visible FALSE                                
        code/helper_functions/plotCellCounts.R
value   ?                                     
visible FALSE                                 
        code/helper_functions/plotCellFractions.R
value   ?                                        
visible FALSE                                    
        code/helper_functions/plotDist.R
value   ?                               
visible FALSE                           
        code/helper_functions/scatter_function.R
value   ?                                       
visible FALSE                                   
        code/helper_functions/sceChecks.R
value   ?                                
visible FALSE                            
        code/helper_functions/validityChecks.R
value   ?                                     
visible FALSE                                 
library(dplyr)
library(SingleCellExperiment)
library(ggplot2)
library(ggridges)

Read the data

sce_prot = readRDS(file = "data/data_for_analysis/sce_protein.rds")

TCF7 CD8 cells

y <- c(rep(1:10,16),rep(11,7))

# add the group information to the sce object
sce_prot$groups <- y[colData(sce_prot)$ImageNumber]

# now we use the function written by Nils
plotDist(sce_prot["TCF7", sce_prot$celltype == "CD8+ T cell"], plot_type = "ridges", 
         colour_by = "groups", split_by = "rows", 
         exprs_values = "asinh") +
  geom_vline(xintercept = 1.5)

# define positive cells
sce_prot$TCF7 <- ifelse(assay(sce_prot["TCF7",], "asinh") > 1.5, "TCF7+", "TCF7-")

PD1 CD8 cells

y <- c(rep(1:10,16),rep(11,7))

# add the group information to the sce object
sce_prot$groups <- y[colData(sce_prot)$ImageNumber]

# now we use the function written by Nils
plotDist(sce_prot["PD1", sce_prot$celltype == "CD8+ T cell"], plot_type = "ridges", 
         colour_by = "groups", split_by = "rows", 
         exprs_values = "asinh") +
  geom_vline(xintercept = 1.5)

# define positive cells
sce_prot$PD1 <- ifelse(assay(sce_prot["PD1",], "asinh") > 1.5, "PD1+", "PD1-")

Save SCE object

saveRDS(sce_prot, file = "data/data_for_analysis/sce_protein.rds")

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=C             
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] ggridges_0.5.3              ggplot2_3.3.3              
 [3] SingleCellExperiment_1.12.0 SummarizedExperiment_1.20.0
 [5] Biobase_2.50.0              GenomicRanges_1.42.0       
 [7] GenomeInfoDb_1.26.2         IRanges_2.24.1             
 [9] S4Vectors_0.28.1            BiocGenerics_0.36.0        
[11] MatrixGenerics_1.2.0        matrixStats_0.57.0         
[13] dplyr_1.0.2                 workflowr_1.6.2            

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.0       xfun_0.20              reshape2_1.4.4        
 [4] purrr_0.3.4            lattice_0.20-41        colorspace_2.0-0      
 [7] vctrs_0.3.6            generics_0.1.0         htmltools_0.5.0       
[10] yaml_2.2.1             rlang_0.4.10           later_1.1.0.1         
[13] pillar_1.4.7           withr_2.3.0            glue_1.4.2            
[16] plyr_1.8.6             GenomeInfoDbData_1.2.4 lifecycle_0.2.0       
[19] stringr_1.4.0          zlibbioc_1.36.0        munsell_0.5.0         
[22] gtable_0.3.0           evaluate_0.14          labeling_0.4.2        
[25] knitr_1.30             httpuv_1.5.4           Rcpp_1.0.5            
[28] promises_1.1.1         scales_1.1.1           DelayedArray_0.16.0   
[31] XVector_0.30.0         farver_2.0.3           fs_1.5.0              
[34] digest_0.6.27          stringi_1.5.3          rprojroot_2.0.2       
[37] grid_4.0.3             tools_4.0.3            bitops_1.0-6          
[40] magrittr_2.0.1         RCurl_1.98-1.2         tibble_3.0.4          
[43] crayon_1.3.4           whisker_0.4            pkgconfig_2.0.3       
[46] ellipsis_0.3.1         Matrix_1.3-2           rmarkdown_2.6         
[49] rstudioapi_0.13        R6_2.5.0               git2r_0.28.0          
[52] compiler_4.0.3