Last updated: 2021-02-04
Checks: 7 0
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.
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(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 20a1458. 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: ._.DS_Store
Ignored: code/.DS_Store
Ignored: code/._.DS_Store
Ignored: code/helper_functions/._findCommunity.R
Ignored: data/.DS_Store
Ignored: data/._.DS_Store
Ignored: data/._density_infiltration_BlockID.csv
Ignored: data/._layer_1_classification_rna.csv
Ignored: data/._manual_infiltration_scoring.csv
Ignored: data/._manual_infiltration_scoring_BlockID.csv
Ignored: data/._manual_infiltration_scoring_RC.csv
Ignored: data/._manual_infiltration_scoring_TH.csv
Ignored: data/._survdat_for_modelling.csv
Ignored: data/12plex_validation/
Ignored: data/200323_TMA_256_Hot Cold_Clinical Data_Updated Response Data_For Collaborators_latest updated_Mar_2020_for_Coxph_modeling.csv
Ignored: data/colour_vector.rds
Ignored: data/density_infiltration_BlockID.csv
Ignored: data/fraction_and_infiltration_scoring.csv
Ignored: data/layer_1_classification_protein.csv
Ignored: data/layer_1_classification_protein.rds
Ignored: data/layer_1_classification_rna.csv
Ignored: data/manual_infiltration_scoring.csv
Ignored: data/manual_infiltration_scoring_BlockID.csv
Ignored: data/manual_infiltration_scoring_RC.csv
Ignored: data/manual_infiltration_scoring_TH.csv
Ignored: data/protein/
Ignored: data/rna/
Ignored: data/safety_copy_SCE/
Ignored: data/sce_RNA.rds
Ignored: data/sce_protein.rds
Ignored: data/survdat_for_modelling.csv
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
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/02_Protein_annotations.rmd
) and HTML (docs/02_Protein_annotations.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 | 9442cb9 | toobiwankenobi | 2020-12-22 | add all new files |
Rmd | 1af3353 | toobiwankenobi | 2020-10-16 | add stuff |
Rmd | d8819f2 | toobiwankenobi | 2020-10-08 | read new data (nuclei expansion) and adapt scripts |
Rmd | b68b4c3 | SchulzDan | 2020-08-17 | added scores and coxph models. not finished |
Rmd | 2c11d5c | toobiwankenobi | 2020-08-05 | add new scripts |
Here, we add more metadata and colData annotations to the SCE object which are needed for downstream analyses.
library(SingleCellExperiment)
library(dplyr)
sce <- readRDS(file = "data/sce_protein.rds")
cur_sce <- data.frame(colData(sce))
cur_meta <- data.frame(metadata(sce))
cur_sce <- cur_sce %>%
left_join(., cur_meta[,c("ImageNumber", "Location", "Adjuvant", "E_I_D", "Mutation",
"Cancer_Stage", "Status_at_3m", "BlockID", "Description", "TissueType",
"MM_location", "Age_range", "Gender", "Internal_pat_ID")])
Joining, by = "ImageNumber"
colData(sce)$Location <- cur_sce$Location
colData(sce)$Adjuvant <- cur_sce$Adjuvant
colData(sce)$E_I_D <- cur_sce$E_I_D
colData(sce)$Mutation <- cur_sce$Mutation
colData(sce)$Cancer_Stage <- cur_sce$Cancer_Stage
colData(sce)$Status_at_3m <- cur_sce$Status_at_3m
colData(sce)$BlockID <- cur_sce$BlockID
colData(sce)$Description <- cur_sce$Description
colData(sce)$TissueType <- cur_sce$TissueType
colData(sce)$MM_location <- cur_sce$MM_location
colData(sce)$Age <- cur_sce$Age_range
colData(sce)$Gender <- cur_sce$Gender
colData(sce)$PatientID <- cur_sce$Internal_pat_ID
# create simplified location of biopsies
cur_sce$MM_location_simplified <- NA
cur_sce[grep("CTRL", cur_sce$Location), ]$MM_location_simplified <- "control"
cur_sce[grep("LN", cur_sce$MM_location), ]$MM_location_simplified <- "LN"
cur_sce[grep("skin", cur_sce$MM_location), ]$MM_location_simplified <- "skin"
cur_sce[is.na(cur_sce$MM_location_simplified) == TRUE, ]$MM_location_simplified <- "other"
# add to colData
colData(sce)$MM_location_simplified <- cur_sce$MM_location_simplified
# add to metadata
cur_meta <- left_join(cur_meta, distinct(cur_sce, MM_location_simplified, ImageNumber))
Joining, by = "ImageNumber"
# add summarized relapse info to cur_meta
cur_meta$relapse <- NA
cur_meta[is.na(cur_meta$Date_progression) & cur_meta$MM_location_simplified != "control",]$relapse <- "untreated/lost"
cur_meta[cur_meta$Date_progression %in% c("") & cur_meta$MM_location_simplified != "control" ,]$relapse <- "no relapse"
cur_meta[is.na(cur_meta$relapse) & cur_meta$MM_location_simplified != "control",]$relapse <- "relapse"
cur_meta[cur_meta$MM_location_simplified == "control",]$relapse <- "control"
# add relapse info to cur_sce
cur_sce <- left_join(cur_sce, cur_meta[,c("ImageNumber", "relapse")])
Joining, by = "ImageNumber"
# add relapse to SCE
colData(sce)$relapse <- cur_sce$relapse
# unique treatments
unique(cur_meta$Last_sys_treatment_before_surgery)
[1] "BRAFi + MEKi" "aPD1" "untreated"
[4] "aPD1 + aCTLA4 or aPD1" "aPD1 + aCTLA4" "chemotherapy"
[7] "aPD1 + aLAG3" NA ""
[10] "aCTLA4" "MEKi"
# group treatment types
cur_meta$treatment_group_before_surgery <- NA
cur_meta[cur_meta$MM_location_simplified == "control",]$treatment_group_before_surgery <- "control"
cur_meta[cur_meta$Last_sys_treatment_before_surgery %in% "untreated",]$treatment_group_before_surgery <- "untreated"
cur_meta[cur_meta$Last_sys_treatment_before_surgery %in% c("aPD1", "aPD1 + aCTLA4", "aCTLA4",
"aPD1 + aCTLA4 or aPD1", "aPD1 + aLAG3"),]$treatment_group_before_surgery <- "ICI"
cur_meta[cur_meta$Last_sys_treatment_before_surgery %in% c("BRAFi + MEKi", "MEKi"),]$treatment_group_before_surgery <- "Targeted"
cur_meta[cur_meta$Last_sys_treatment_before_surgery %in% c("chemotherapy"),]$treatment_group_before_surgery <- "Chemotherapy"
cur_meta[is.na(cur_meta$Last_sys_treatment_before_surgery),]$treatment_group_before_surgery <- "unknown"
# add treatment type to cur_sce
cur_sce <- left_join(cur_sce, cur_meta[,c("ImageNumber", "treatment_group_before_surgery")])
Joining, by = "ImageNumber"
# add relapse to SCE
colData(sce)$treatment_group_before_surgery <- cur_sce$treatment_group_before_surgery
# unique treatments
unique(cur_meta$Treatment_after_surgery)
[1] "BRAFi + MEKi" "aCTLA4" "BRAFi + MEKi +/- aPD1"
[4] "aPD1 + aCTLA4" "aPD1" "untreated"
[7] "chemotherapy" NA "MEKi"
[10] "" "BRAFi" "TVEC"
[13] "aPD1 + aLAG3" "PC"
# group treatment types
cur_meta$treatment_group_after_surgery <- NA
cur_meta[cur_meta$MM_location_simplified == "control",]$treatment_group_after_surgery <- "control"
cur_meta[cur_meta$Treatment_after_surgery %in% "untreated",]$treatment_group_after_surgery <- "untreated"
cur_meta[cur_meta$Treatment_after_surgery %in% c("aPD1 + aCTLA4", "aPD1", "aCTLA4", "aPD1 + aLAG3"),]$treatment_group_after_surgery <- "ICI"
cur_meta[cur_meta$Treatment_after_surgery %in% c("BRAFi + MEKi", "BRAFi", "MEKi", "BRAFi + MEKi +/- aPD1"),]$treatment_group_after_surgery <- "Targeted"
cur_meta[cur_meta$Treatment_after_surgery %in% c("chemotherapy"),]$treatment_group_after_surgery <- "Chemotherapy"
cur_meta[cur_meta$Treatment_after_surgery %in% c("TVEC"),]$treatment_group_after_surgery <- "TVEC"
cur_meta[cur_meta$Treatment_after_surgery %in% c("PC"),]$treatment_group_after_surgery <- "Palliative"
cur_meta[is.na(cur_meta$Treatment_after_surgery),]$treatment_group_after_surgery <- "unknown"
# add treatment type to cur_sce
cur_sce <- left_join(cur_sce, cur_meta[,c("ImageNumber", "treatment_group_after_surgery")])
Joining, by = "ImageNumber"
# add relapse to SCE
colData(sce)$treatment_group_after_surgery <- cur_sce$treatment_group_after_surgery
cur_meta$treatment_status_before_surgery <- NA
cur_meta[cur_meta$Location == "CTRL",]$treatment_status_before_surgery <- "control"
cur_meta[cur_meta$Location != "CTRL",]$treatment_status_before_surgery <- ifelse(cur_meta[cur_meta$Location != "CTRL",]$Nr_treatments_before_surgery == 0, "naive", "non-naive")
# add treatment type to cur_sce
cur_sce <- left_join(cur_sce, cur_meta[,c("ImageNumber", "treatment_status_before_surgery")])
Joining, by = "ImageNumber"
# add to SCE
colData(sce)$treatment_status_before_surgery <- cur_sce$treatment_status_before_surgery
Date_death <- metadata(sce)$Date_death
sce$Date_death <- Date_death[sce$ImageNumber]
#binarize death
sce$Death <- "no"
sce[,grepl("20",sce$Date_death)]$Death <- "yes"
metadata(sce) <- as.list(cur_meta)
saveRDS(sce,file = "data/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] dplyr_1.0.2 SingleCellExperiment_1.12.0
[3] SummarizedExperiment_1.20.0 Biobase_2.50.0
[5] GenomicRanges_1.42.0 GenomeInfoDb_1.26.2
[7] IRanges_2.24.1 S4Vectors_0.28.1
[9] BiocGenerics_0.36.0 MatrixGenerics_1.2.0
[11] matrixStats_0.57.0 workflowr_1.6.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 XVector_0.30.0 pillar_1.4.7
[4] compiler_4.0.3 later_1.1.0.1 git2r_0.28.0
[7] zlibbioc_1.36.0 bitops_1.0-6 tools_4.0.3
[10] digest_0.6.27 lattice_0.20-41 evaluate_0.14
[13] lifecycle_0.2.0 tibble_3.0.4 pkgconfig_2.0.3
[16] rlang_0.4.10 Matrix_1.3-2 DelayedArray_0.16.0
[19] rstudioapi_0.13 yaml_2.2.1 xfun_0.20
[22] GenomeInfoDbData_1.2.4 stringr_1.4.0 knitr_1.30
[25] generics_0.1.0 fs_1.5.0 vctrs_0.3.6
[28] tidyselect_1.1.0 grid_4.0.3 rprojroot_2.0.2
[31] glue_1.4.2 R6_2.5.0 rmarkdown_2.6
[34] purrr_0.3.4 magrittr_2.0.1 whisker_0.4
[37] promises_1.1.1 ellipsis_0.3.1 htmltools_0.5.0
[40] httpuv_1.5.4 stringi_1.5.3 RCurl_1.98-1.2
[43] crayon_1.3.4