Last updated: 2022-02-22
Checks: 7 0
Knit directory: MelanomaIMC/
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.
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 d00a53f. 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: Table_S4.csv
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/
Untracked files:
Untracked: .gitignore.swp
Unstaged changes:
Deleted: analysis/.smbdeleteAAA16a00f1
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/Supp-Figure_10.rmd
) and HTML (docs/Supp-Figure_10.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 | 64e5fde | toobiwankenobi | 2022-02-16 | change order and naming of supp fig files |
Rmd | a2860df | toobiwankenobi | 2022-02-09 | adapt code |
Rmd | dfe5f09 | toobiwankenobi | 2022-02-09 | change Figure order |
Rmd | f9a3a83 | toobiwankenobi | 2022-02-08 | clean repo for release |
Rmd | fa0f601 | toobiwankenobi | 2022-02-06 | clean Supp Fig code |
Rmd | b20b6fb | toobiwankenobi | 2022-02-02 | update code for Supp Figures |
Rmd | 3da15db | toobiwankenobi | 2021-11-24 | changes for revision |
This script generates plots for Supplementary Figure 10.
library(SingleCellExperiment)
Loading required package: SummarizedExperiment
Loading required package: MatrixGenerics
Loading required package: matrixStats
Attaching package: 'MatrixGenerics'
The following objects are masked from 'package:matrixStats':
colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
colWeightedMeans, colWeightedMedians, colWeightedSds,
colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
rowWeightedSds, rowWeightedVars
Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
anyDuplicated, append, as.data.frame, basename, cbind, colnames,
dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
union, unique, unsplit, which.max, which.min
Loading required package: S4Vectors
Attaching package: 'S4Vectors'
The following objects are masked from 'package:base':
expand.grid, I, unname
Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Attaching package: 'Biobase'
The following object is masked from 'package:MatrixGenerics':
rowMedians
The following objects are masked from 'package:matrixStats':
anyMissing, rowMedians
library(ggplot2)
library(tidyverse)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
✓ tibble 3.1.6 ✓ dplyr 1.0.7
✓ tidyr 1.2.0 ✓ stringr 1.4.0
✓ readr 2.1.2 ✓ forcats 0.5.1
✓ purrr 0.3.4
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
x dplyr::collapse() masks IRanges::collapse()
x dplyr::combine() masks Biobase::combine(), BiocGenerics::combine()
x dplyr::count() masks matrixStats::count()
x dplyr::desc() masks IRanges::desc()
x tidyr::expand() masks S4Vectors::expand()
x dplyr::filter() masks stats::filter()
x dplyr::first() masks S4Vectors::first()
x dplyr::lag() masks stats::lag()
x ggplot2::Position() masks BiocGenerics::Position(), base::Position()
x purrr::reduce() masks GenomicRanges::reduce(), IRanges::reduce()
x dplyr::rename() masks S4Vectors::rename()
x dplyr::slice() masks IRanges::slice()
library(dplyr)
library(ggrastr)
sce_prot <- readRDS("data/data_for_analysis/sce_protein.rds")
sce_prot <- sce_prot[,sce_prot$Location != "CTRL"]
sce_rna <- readRDS("data/data_for_analysis/sce_RNA.rds")
sce_rna <- sce_rna[,sce_rna$Location != "CTRL"]
prot <- as.data.frame(colData(sce_prot)[,c("Center_X", "Center_Y", "Description", "celltype")])
rna <- as.data.frame(colData(sce_rna)[,c("Center_X", "Center_Y", "Description", "celltype")])
prot$dataSet <- "Protein only"
rna$dataSet <- "RNA&Protein"
full <- rbind(prot,rna)
full <- full %>%
mutate(celltype = ifelse(celltype %in% c("B cell", "HLA-DR"), "B cell", "Other"))
# show 10 images with the most B cells
max <- full %>%
filter(dataSet == "Protein only" & celltype == "B cell") %>%
group_by(Description) %>%
summarise(n=n()) %>%
slice_max(n, n=10)
full_sub <- full[full$Description %in% max$Description,]
ggplot(full_sub, aes(x=Center_X, y=Center_Y)) +
geom_point_rast(col=ifelse(full_sub$celltype == "B cell", "springgreen3", "grey"), size=.3,
alpha=ifelse(full_sub$celltype == "B cell", 0.5, 0.1)) +
facet_wrap(~Description+dataSet, ncol = 4, scales = "free") +
theme_bw() +
theme(text = element_text(size=9)) +
xlab("X Coordinate") +
ylab("Y Coordinate")
total_hladr <- ncol(sce_rna[,sce_rna$celltype == "HLA-DR"])
sub_hladr <- ncol(sce_rna[,sce_rna$celltype == "HLA-DR" &
sce_rna$Description %in% unique(max$Description)])
percentage <- sub_hladr / total_hladr * 100
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 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=en_US.UTF-8
[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] stats4 stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] ggrastr_1.0.1 forcats_0.5.1
[3] stringr_1.4.0 dplyr_1.0.7
[5] purrr_0.3.4 readr_2.1.2
[7] tidyr_1.2.0 tibble_3.1.6
[9] tidyverse_1.3.1 ggplot2_3.3.5
[11] SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0
[13] Biobase_2.54.0 GenomicRanges_1.46.1
[15] GenomeInfoDb_1.30.1 IRanges_2.28.0
[17] S4Vectors_0.32.3 BiocGenerics_0.40.0
[19] MatrixGenerics_1.6.0 matrixStats_0.61.0
[21] workflowr_1.7.0
loaded via a namespace (and not attached):
[1] bitops_1.0-7 fs_1.5.2 lubridate_1.8.0
[4] httr_1.4.2 rprojroot_2.0.2 tools_4.1.2
[7] backports_1.4.1 bslib_0.3.1 utf8_1.2.2
[10] R6_2.5.1 vipor_0.4.5 DBI_1.1.2
[13] colorspace_2.0-2 withr_2.4.3 tidyselect_1.1.1
[16] processx_3.5.2 compiler_4.1.2 git2r_0.29.0
[19] cli_3.1.1 rvest_1.0.2 Cairo_1.5-14
[22] xml2_1.3.3 DelayedArray_0.20.0 labeling_0.4.2
[25] sass_0.4.0 scales_1.1.1 callr_3.7.0
[28] digest_0.6.29 rmarkdown_2.11 XVector_0.34.0
[31] pkgconfig_2.0.3 htmltools_0.5.2 highr_0.9
[34] dbplyr_2.1.1 fastmap_1.1.0 rlang_1.0.0
[37] readxl_1.3.1 rstudioapi_0.13 farver_2.1.0
[40] jquerylib_0.1.4 generics_0.1.2 jsonlite_1.7.3
[43] RCurl_1.98-1.5 magrittr_2.0.2 GenomeInfoDbData_1.2.7
[46] Matrix_1.4-0 ggbeeswarm_0.6.0 Rcpp_1.0.8
[49] munsell_0.5.0 fansi_1.0.2 lifecycle_1.0.1
[52] stringi_1.7.6 whisker_0.4 yaml_2.2.2
[55] zlibbioc_1.40.0 grid_4.1.2 promises_1.2.0.1
[58] crayon_1.4.2 lattice_0.20-45 haven_2.4.3
[61] hms_1.1.1 knitr_1.37 ps_1.6.0
[64] pillar_1.7.0 reprex_2.0.1 glue_1.6.1
[67] evaluate_0.14 getPass_0.2-2 modelr_0.1.8
[70] vctrs_0.3.8 tzdb_0.2.0 httpuv_1.6.5
[73] cellranger_1.1.0 gtable_0.3.0 assertthat_0.2.1
[76] xfun_0.29 broom_0.7.12 later_1.3.0
[79] beeswarm_0.4.0 ellipsis_0.3.2