Last updated: 2021-09-23
Checks: 6 1
Knit directory: humanCardiacFibroblasts/
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(20210903) 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 8706140. 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: .Rhistory
Ignored: .Rproj.user/
Ignored: data/humanFibroblast/
Unstaged changes:
Modified: analysis/mergeHumanSamples.Rmd
Modified: metadata.txt
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/mergeHumanSamples.Rmd) and HTML (docs/mergeHumanSamples.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 | cf82798 | mluetge | 2021-09-03 | first merge |
| html | cf82798 | mluetge | 2021-09-03 | first merge |
suppressPackageStartupMessages({
library(SingleCellExperiment)
library(tidyverse)
library(Seurat)
library(magrittr)
library(dplyr)
library(purrr)
library(ggplot2)
library(here)
library(runSeurat3)
library(ggsci)
library(ggpubr)
library(pheatmap)
})
basedir <- here()
metaDat <- read_tsv(paste0(basedir, "/metadata.txt"), col_names = T)
assignSamples <- function(smpNam, basedirSmp, smpTec, smpBatch, smpLoc, smpOri,
smpIso, smpCol){
smpNamFull <- list.files(path = paste0(basedirSmp, "/data/humanFibroblast/"),
pattern = paste0(smpNam, ".*_seurat.rds"))
seuratSmp <- readRDS(paste0(basedirSmp, "/data/humanFibroblast/", smpNamFull))
seuratSmp$technique <- smpTec
seuratSmp$batch <- smpBatch
seuratSmp$location <- smpLoc
seuratSmp$origin <- smpOri
seuratSmp$isolation <- smpIso
seuratSmp$collagenase <- smpCol
return(seuratSmp)
}
####################################################################
for(i in 1:length(metaDat$Sample)){
seuratX <- assignSamples(smpNam = metaDat$Sample[i],
basedirSmp = basedir,
smpTec = metaDat$technique[i],
smpBatch = metaDat$batch[i],
smpLoc = metaDat$location[i],
smpOri = metaDat$origin[i],
smpIso = metaDat$isolation[i],
smpCol = metaDat$collagenase[i])
if(exists("seurat")){
seurat <- merge(x = seurat, y = seuratX, project = "humanCardiacFibro")
}else{
seurat <- seuratX
}
}
remove(seuratX)
seurat <- rerunSeurat3(seurat)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 16563
Number of edges: 630925
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.9643
Number of communities: 18
Elapsed time: 2 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 16563
Number of edges: 630925
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.9364
Number of communities: 24
Elapsed time: 2 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 16563
Number of edges: 630925
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.9223
Number of communities: 24
Elapsed time: 2 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 16563
Number of edges: 630925
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.9517
Number of communities: 20
Elapsed time: 1 seconds
#seuratSub <- subset(seurat1, subset = `MGP-BALBcJ-G0026271.Grem1` >0) ## 5 cells
#seuratSub <- subset(seurat1, subset = `MGP-BALBcJ-G0026527.Bmp2` >0) ## 14104 cells
dat <- data.frame(table(seurat$dataset))
colnames(dat) <- c("dataset", "all")
knitr::kable(dat)
| dataset | all |
|---|---|
| 1_20210811_Hu_nucleoi_seq_ECMO_Heart01_Myocardium_NextGEM | 4041 |
| 10_20210817_Hu_nucleoi_seq_ECMO_Heart04_Myocardium_NextGEM | 1549 |
| 11_20210819_Hu_nucleoi_seq_ECMO_Heart01_Myocardium_Frozen_NG | 3162 |
| 12_20210819_Hu_nucleoi_seq_ECMO_Heart03_Myocardium_Frozen_NG | 1469 |
| 13_20210819_Hu_nucleoi_seq_ECMO_Heart04_Myocardium_Frozen_NG | 1819 |
| 2_20210811_Hu_nucleoi_seq_ECMO_Heart01_Septum_NextGEM | 1895 |
| 3_20210811_Hu_cells_seq_ECMO_Heart01_Myocardium_NextGEM | 395 |
| 4_20210811_Hu_cell_seq_ECMO_Heart01_Septum_NextGEM | 244 |
| 8_20210813_Hu_cells_seq_ECMO_Heart03_Myocardium_collagenase_NG | 668 |
| 9_20210817_Hu_nucleoi_seq_cardiac_transplant_Heart17_biopsy_NG | 1321 |
colPal <- pal_igv()(length(levels(seurat)))
colTec <- pal_jama()(length(unique(seurat$technique)))
colSmp <- c(pal_uchicago()(8), pal_npg()(8))[1:length(unique(seurat$dataset))]
colLoc <- pal_npg()(length(unique(seurat$location)))
colBatch <- pal_jco()(length(unique(seurat$batch)))
colOrig <- pal_futurama()(length(unique(seurat$origin)))
colIso <- pal_nejm()(length(unique(seurat$isolation)))
colColl <- pal_aaas()(length(unique(seurat$collagenase)))
names(colPal) <- levels(seurat)
names(colTec) <- unique(seurat$technique)
names(colSmp) <- unique(seurat$dataset)
names(colLoc) <- unique(seurat$location)
names(colBatch) <- unique(seurat$batch)
names(colOrig) <- unique(seurat$origin)
names(colIso) <- unique(seurat$isolation)
names(colColl) <- unique(seurat$collagenase)
DimPlot(seurat, reduction = "umap", cols=colPal)+
theme_bw() +
theme(axis.text = element_blank(), axis.ticks = element_blank(),
panel.grid.minor = element_blank()) +
xlab("UMAP1") +
ylab("UMAP2")

| Version | Author | Date |
|---|---|---|
| cf82798 | mluetge | 2021-09-03 |
DimPlot(seurat, reduction = "umap", group.by = "technique", cols=colTec)+
theme_bw() +
theme(axis.text = element_blank(), axis.ticks = element_blank(),
panel.grid.minor = element_blank()) +
xlab("UMAP1") +
ylab("UMAP2")

| Version | Author | Date |
|---|---|---|
| cf82798 | mluetge | 2021-09-03 |
DimPlot(seurat, reduction = "umap", group.by = "dataset", cols=colSmp)+
theme_bw() +
theme(axis.text = element_blank(), axis.ticks = element_blank(),
panel.grid.minor = element_blank()) +
xlab("UMAP1") +
ylab("UMAP2")

| Version | Author | Date |
|---|---|---|
| cf82798 | mluetge | 2021-09-03 |
DimPlot(seurat, reduction = "umap", group.by = "batch", cols=colBatch)+
theme_bw() +
theme(axis.text = element_blank(), axis.ticks = element_blank(),
panel.grid.minor = element_blank()) +
xlab("UMAP1") +
ylab("UMAP2")

| Version | Author | Date |
|---|---|---|
| cf82798 | mluetge | 2021-09-03 |
DimPlot(seurat, reduction = "umap", group.by = "origin", cols=colOrig)+
theme_bw() +
theme(axis.text = element_blank(), axis.ticks = element_blank(),
panel.grid.minor = element_blank()) +
xlab("UMAP1") +
ylab("UMAP2")

| Version | Author | Date |
|---|---|---|
| cf82798 | mluetge | 2021-09-03 |
DimPlot(seurat, reduction = "umap", group.by = "isolation", cols=colIso)+
theme_bw() +
theme(axis.text = element_blank(), axis.ticks = element_blank(),
panel.grid.minor = element_blank()) +
xlab("UMAP1") +
ylab("UMAP2")

| Version | Author | Date |
|---|---|---|
| cf82798 | mluetge | 2021-09-03 |
DimPlot(seurat, reduction = "umap", group.by = "location", cols=colLoc)+
theme_bw() +
theme(axis.text = element_blank(), axis.ticks = element_blank(),
panel.grid.minor = element_blank()) +
xlab("UMAP1") +
ylab("UMAP2")

| Version | Author | Date |
|---|---|---|
| cf82798 | mluetge | 2021-09-03 |
DimPlot(seurat, reduction = "umap", group.by = "collagenase", cols=colColl)+
theme_bw() +
theme(axis.text = element_blank(), axis.ticks = element_blank(),
panel.grid.minor = element_blank()) +
xlab("UMAP1") +
ylab("UMAP2")

seurat_markers_all <- FindAllMarkers(object = seurat, assay ="RNA",
only.pos = TRUE, min.pct = 0.25,
logfc.threshold = 0.25,
test.use = "wilcox")
cluster <- levels(seurat)
selGenesAll <- seurat_markers_all %>% group_by(cluster) %>%
top_n(-15, p_val_adj) %>%
top_n(15, avg_log2FC)
selGenesAll <- selGenesAll %>% mutate(geneIDval=gsub("^.*\\.", "", gene)) %>% filter(nchar(geneIDval)>1)
template_hm <- c(
"#### {{cl}}\n",
"```{r top marker {{cl}}, fig.height=8, fig.width=6, echo = FALSE}\n",
"selGenes <- selGenesAll %>% filter(cluster=='{{cl}}')",
"pOut <- avgHeatmap(seurat = seurat, selGenes = selGenes,
colVecIdent = colPal,
ordVec=levels(seurat),
gapVecR=NULL, gapVecC=NULL,cc=FALSE,
cr=T, condCol=F)\n",
"```\n",
"\n"
)
plots_gp <- lapply(cluster,
function(cl) knitr::knit_expand(text = template_hm)
)






Idents(seurat) <- seurat$seurat_clusters
saveRDS(seurat, file = paste0(basedir,
"/data/humanHearts_merged_seurat.rds"))
write.table(seurat_markers_all,
file=paste0(basedir, "/data/humanHearts_merged_markerGenes.txt"),
row.names = FALSE, col.names = TRUE, quote = FALSE, sep = "\t")
sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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] parallel stats4 stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] pheatmap_1.0.12 ggpubr_0.4.0
[3] ggsci_2.9 runSeurat3_0.1.0
[5] here_1.0.1 magrittr_2.0.1
[7] SeuratObject_4.0.2 Seurat_4.0.4
[9] forcats_0.5.1 stringr_1.4.0
[11] dplyr_1.0.7 purrr_0.3.4
[13] readr_2.0.1 tidyr_1.1.3
[15] tibble_3.1.4 ggplot2_3.3.5
[17] tidyverse_1.3.1 SingleCellExperiment_1.14.1
[19] SummarizedExperiment_1.22.0 Biobase_2.52.0
[21] GenomicRanges_1.44.0 GenomeInfoDb_1.28.4
[23] IRanges_2.26.0 S4Vectors_0.30.0
[25] BiocGenerics_0.38.0 MatrixGenerics_1.4.3
[27] matrixStats_0.60.1
loaded via a namespace (and not attached):
[1] utf8_1.2.2 reticulate_1.20 tidyselect_1.1.1
[4] htmlwidgets_1.5.4 grid_4.1.0 Rtsne_0.15
[7] munsell_0.5.0 codetools_0.2-18 ica_1.0-2
[10] future_1.22.1 miniUI_0.1.1.1 withr_2.4.2
[13] colorspace_2.0-2 highr_0.9 knitr_1.34
[16] rstudioapi_0.13 ROCR_1.0-11 ggsignif_0.6.3
[19] tensor_1.5 listenv_0.8.0 labeling_0.4.2
[22] git2r_0.28.0 GenomeInfoDbData_1.2.6 polyclip_1.10-0
[25] farver_2.1.0 bit64_4.0.5 rprojroot_2.0.2
[28] parallelly_1.28.1 vctrs_0.3.8 generics_0.1.0
[31] xfun_0.26 R6_2.5.1 bitops_1.0-7
[34] spatstat.utils_2.2-0 DelayedArray_0.18.0 assertthat_0.2.1
[37] promises_1.2.0.1 scales_1.1.1 vroom_1.5.4
[40] gtable_0.3.0 globals_0.14.0 goftest_1.2-2
[43] workflowr_1.6.2 rlang_0.4.11 splines_4.1.0
[46] rstatix_0.7.0 lazyeval_0.2.2 spatstat.geom_2.2-2
[49] broom_0.7.9 yaml_2.2.1 reshape2_1.4.4
[52] abind_1.4-5 modelr_0.1.8 backports_1.2.1
[55] httpuv_1.6.3 tools_4.1.0 ellipsis_0.3.2
[58] spatstat.core_2.3-0 jquerylib_0.1.4 RColorBrewer_1.1-2
[61] ggridges_0.5.3 Rcpp_1.0.7 plyr_1.8.6
[64] zlibbioc_1.38.0 RCurl_1.98-1.4 rpart_4.1-15
[67] deldir_0.2-10 pbapply_1.4-3 cowplot_1.1.1
[70] zoo_1.8-9 haven_2.4.3 ggrepel_0.9.1
[73] cluster_2.1.2 fs_1.5.0 RSpectra_0.16-0
[76] data.table_1.14.0 scattermore_0.7 openxlsx_4.2.4
[79] lmtest_0.9-38 reprex_2.0.1 RANN_2.6.1
[82] whisker_0.4 fitdistrplus_1.1-5 hms_1.1.0
[85] patchwork_1.1.1 mime_0.11 evaluate_0.14
[88] xtable_1.8-4 rio_0.5.27 readxl_1.3.1
[91] gridExtra_2.3 compiler_4.1.0 KernSmooth_2.23-20
[94] crayon_1.4.1 htmltools_0.5.2 mgcv_1.8-36
[97] later_1.3.0 tzdb_0.1.2 lubridate_1.7.10
[100] DBI_1.1.1 dbplyr_2.1.1 MASS_7.3-54
[103] Matrix_1.3-4 car_3.0-11 cli_3.0.1
[106] igraph_1.2.6 pkgconfig_2.0.3 foreign_0.8-81
[109] plotly_4.9.4.1 spatstat.sparse_2.0-0 xml2_1.3.2
[112] bslib_0.3.0 XVector_0.32.0 rvest_1.0.1
[115] digest_0.6.27 sctransform_0.3.2 RcppAnnoy_0.0.19
[118] spatstat.data_2.1-0 rmarkdown_2.10 cellranger_1.1.0
[121] leiden_0.3.9 uwot_0.1.10 curl_4.3.2
[124] shiny_1.6.0 lifecycle_1.0.0 nlme_3.1-153
[127] jsonlite_1.7.2 carData_3.0-4 limma_3.48.3
[130] viridisLite_0.4.0 fansi_0.5.0 pillar_1.6.2
[133] lattice_0.20-44 fastmap_1.1.0 httr_1.4.2
[136] survival_3.2-13 glue_1.4.2 zip_2.2.0
[139] png_0.1-7 bit_4.0.4 stringi_1.7.4
[142] sass_0.4.0 irlba_2.3.3 future.apply_1.8.1
date()
[1] "Thu Sep 23 15:13:22 2021"
sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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] parallel stats4 stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] pheatmap_1.0.12 ggpubr_0.4.0
[3] ggsci_2.9 runSeurat3_0.1.0
[5] here_1.0.1 magrittr_2.0.1
[7] SeuratObject_4.0.2 Seurat_4.0.4
[9] forcats_0.5.1 stringr_1.4.0
[11] dplyr_1.0.7 purrr_0.3.4
[13] readr_2.0.1 tidyr_1.1.3
[15] tibble_3.1.4 ggplot2_3.3.5
[17] tidyverse_1.3.1 SingleCellExperiment_1.14.1
[19] SummarizedExperiment_1.22.0 Biobase_2.52.0
[21] GenomicRanges_1.44.0 GenomeInfoDb_1.28.4
[23] IRanges_2.26.0 S4Vectors_0.30.0
[25] BiocGenerics_0.38.0 MatrixGenerics_1.4.3
[27] matrixStats_0.60.1
loaded via a namespace (and not attached):
[1] utf8_1.2.2 reticulate_1.20 tidyselect_1.1.1
[4] htmlwidgets_1.5.4 grid_4.1.0 Rtsne_0.15
[7] munsell_0.5.0 codetools_0.2-18 ica_1.0-2
[10] future_1.22.1 miniUI_0.1.1.1 withr_2.4.2
[13] colorspace_2.0-2 highr_0.9 knitr_1.34
[16] rstudioapi_0.13 ROCR_1.0-11 ggsignif_0.6.3
[19] tensor_1.5 listenv_0.8.0 labeling_0.4.2
[22] git2r_0.28.0 GenomeInfoDbData_1.2.6 polyclip_1.10-0
[25] farver_2.1.0 bit64_4.0.5 rprojroot_2.0.2
[28] parallelly_1.28.1 vctrs_0.3.8 generics_0.1.0
[31] xfun_0.26 R6_2.5.1 bitops_1.0-7
[34] spatstat.utils_2.2-0 DelayedArray_0.18.0 assertthat_0.2.1
[37] promises_1.2.0.1 scales_1.1.1 vroom_1.5.4
[40] gtable_0.3.0 globals_0.14.0 goftest_1.2-2
[43] workflowr_1.6.2 rlang_0.4.11 splines_4.1.0
[46] rstatix_0.7.0 lazyeval_0.2.2 spatstat.geom_2.2-2
[49] broom_0.7.9 yaml_2.2.1 reshape2_1.4.4
[52] abind_1.4-5 modelr_0.1.8 backports_1.2.1
[55] httpuv_1.6.3 tools_4.1.0 ellipsis_0.3.2
[58] spatstat.core_2.3-0 jquerylib_0.1.4 RColorBrewer_1.1-2
[61] ggridges_0.5.3 Rcpp_1.0.7 plyr_1.8.6
[64] zlibbioc_1.38.0 RCurl_1.98-1.4 rpart_4.1-15
[67] deldir_0.2-10 pbapply_1.4-3 cowplot_1.1.1
[70] zoo_1.8-9 haven_2.4.3 ggrepel_0.9.1
[73] cluster_2.1.2 fs_1.5.0 RSpectra_0.16-0
[76] data.table_1.14.0 scattermore_0.7 openxlsx_4.2.4
[79] lmtest_0.9-38 reprex_2.0.1 RANN_2.6.1
[82] whisker_0.4 fitdistrplus_1.1-5 hms_1.1.0
[85] patchwork_1.1.1 mime_0.11 evaluate_0.14
[88] xtable_1.8-4 rio_0.5.27 readxl_1.3.1
[91] gridExtra_2.3 compiler_4.1.0 KernSmooth_2.23-20
[94] crayon_1.4.1 htmltools_0.5.2 mgcv_1.8-36
[97] later_1.3.0 tzdb_0.1.2 lubridate_1.7.10
[100] DBI_1.1.1 dbplyr_2.1.1 MASS_7.3-54
[103] Matrix_1.3-4 car_3.0-11 cli_3.0.1
[106] igraph_1.2.6 pkgconfig_2.0.3 foreign_0.8-81
[109] plotly_4.9.4.1 spatstat.sparse_2.0-0 xml2_1.3.2
[112] bslib_0.3.0 XVector_0.32.0 rvest_1.0.1
[115] digest_0.6.27 sctransform_0.3.2 RcppAnnoy_0.0.19
[118] spatstat.data_2.1-0 rmarkdown_2.10 cellranger_1.1.0
[121] leiden_0.3.9 uwot_0.1.10 curl_4.3.2
[124] shiny_1.6.0 lifecycle_1.0.0 nlme_3.1-153
[127] jsonlite_1.7.2 carData_3.0-4 limma_3.48.3
[130] viridisLite_0.4.0 fansi_0.5.0 pillar_1.6.2
[133] lattice_0.20-44 fastmap_1.1.0 httr_1.4.2
[136] survival_3.2-13 glue_1.4.2 zip_2.2.0
[139] png_0.1-7 bit_4.0.4 stringi_1.7.4
[142] sass_0.4.0 irlba_2.3.3 future.apply_1.8.1