Last updated: 2019-10-31
Checks: 6 0
Knit directory: Porello-heart-snRNAseq/
This reproducible R Markdown analysis was created with workflowr (version 1.3.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(20190603)
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! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.
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/
Untracked files:
Untracked: analysis/07b-DECardioFYA.Rmd
Untracked: analysis/PBapproachMarker-cardio.Rmd
Untracked: analysis/doublet-detection.Rmd
Untracked: broad_props.csv
Untracked: code/ReadDataObjects.R
Untracked: code/getTransformedProps.R
Untracked: data/adult-clust.txt
Untracked: data/dcm-clust.txt
Untracked: data/fetal-clust.txt
Untracked: data/gstlist-adult.Rdata
Untracked: data/gstlist-dcm-res03.Rdata
Untracked: data/gstlist-dcm.Rdata
Untracked: data/gstlist-fetal.Rdata
Untracked: data/gstlist-young.Rdata
Untracked: data/heart-markers-long.txt
Untracked: data/immune-markers-long.txt
Untracked: data/pseudobulk-pool.Rds
Untracked: data/pseudobulk.Rds
Untracked: data/targets_pools.txt
Untracked: data/young-clust.txt
Untracked: output/AllAdult-clustermarkers-v2.csv
Untracked: output/AllAdult-clustermarkers.csv
Untracked: output/AllFetal-clustermarkers.csv
Untracked: output/AllYoung-clustermarkers.csv
Untracked: output/Alldcm-clustermarkers.csv
Untracked: output/DEAnalysis/
Untracked: output/Figures/
Untracked: output/MarkerAnalysis/
Untracked: output/RDataObjects/
Untracked: output/cardio-numcells-clusters.csv
Untracked: output/cardio-numcells-clusters.txt
Untracked: output/fetal1-clustermarkers.csv
Untracked: output/fetal2-clustermarkers.csv
Untracked: output/fetal3-clustermarkers.csv
Untracked: output/heatmap-top10-adultmarkergenes.pdf
Untracked: output/young1-clustermarkers.csv
Unstaged changes:
Modified: analysis/01-QualityControl.Rmd
Modified: analysis/01a-DEpseudobulk.Rmd
Modified: analysis/02-ClusterFetal.Rmd
Modified: analysis/02c-ClusterFetal3.Rmd
Modified: analysis/03-ClusterYoung.Rmd
Modified: analysis/04-ClusterAdult.Rmd
Modified: analysis/07a-ClustCardioFYA.Rmd
Modified: analysis/index.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 R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view them.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 286b88b | Belinda Phipson | 2019-10-31 | immune, endo, smc reclustering |
html | 603b51b | Belinda Phipson | 2019-10-31 | Build site. |
Rmd | 36f15a6 | Belinda Phipson | 2019-10-30 | add endothelial reclustering, fixed smc clustering |
html | 878c13c | Belinda Phipson | 2019-10-30 | Build site. |
html | 604f664 | Belinda Phipson | 2019-10-29 | Build site. |
Rmd | 4352989 | Belinda Phipson | 2019-10-29 | add reclustering of smooth muscle cells |
library(edgeR)
library(RColorBrewer)
library(org.Hs.eg.db)
library(limma)
library(Seurat)
library(monocle)
library(cowplot)
library(DelayedArray)
library(scran)
library(NMF)
library(workflowr)
library(ggplot2)
library(clustree)
library(dplyr)
source("/misc/card2-single_cell_nuclei_rnaseq/Porello-heart-snRNAseq/code/normCounts.R")
source("/misc/card2-single_cell_nuclei_rnaseq/Porello-heart-snRNAseq/code/findModes.R")
source("/misc/card2-single_cell_nuclei_rnaseq/Porello-heart-snRNAseq/code/ggplotColors.R")
targets <- read.delim("/misc/card2-single_cell_nuclei_rnaseq/Porello-heart-snRNAseq/data/targets.txt",header=TRUE, stringsAsFactors = FALSE)
targets$FileName2 <- paste(targets$FileName,"/",sep="")
targets$Group_ID2 <- gsub("LV_","",targets$Group_ID)
group <- c("Fetal_1","Fetal_2","Fetal_3",
"Young_1","Young_2","Young_3",
"Adult_1","Adult_2","Adult_3",
"Diseased_1","Diseased_2",
"Diseased_3","Diseased_4")
m <- match(group, targets$Group_ID2)
targets <- targets[m,]
fetal.integrated <- readRDS(file="./output/RDataObjects/fetal-int.Rds")
load(file="./output/RDataObjects/fetalObjs.Rdata")
young.integrated <- readRDS(file="./output/RDataObjects/young-int.Rds")
load(file="./output/RDataObjects/youngObjs.Rdata")
adult.integrated <- readRDS(file="./output/RDataObjects/adult-int.Rds")
load(file="./output/RDataObjects/adultObjs.Rdata")
# Default 0.3
Idents(fetal.integrated) <- fetal.integrated$integrated_snn_res.0.3
DimPlot(fetal.integrated, reduction = "tsne",label=TRUE,label.size = 6)+NoLegend()
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
# Default 0.3
DimPlot(young.integrated, reduction = "tsne",label=TRUE,label.size = 6)+NoLegend()
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
# Default 0.6
DimPlot(adult.integrated, reduction = "tsne",label=TRUE,label.size = 6)+NoLegend()
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
heart <- merge(fetal.integrated, y = c(young.integrated, adult.integrated), project = "heart")
table(heart$orig.ident)
adult fetal young
9416 27760 16964
DefaultAssay(object = heart) <- "RNA"
smc <- subset(heart,subset = Broad_celltype == "Smooth muscle cells")
dim(smc)
[1] 17926 430
Check for cells with very low number of uniquely detected genes.
par(mfrow=c(1,2))
plot(density(smc$nFeature_RNA),main="Number of genes detected")
abline(v=500,col=2)
plot(density(smc$nCount_RNA),main="Library size")
abline(v=2500,col=2)
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
#smc <- subset(smc, subset = nFeature_RNA > 500 & nCount_RNA > 2500)
dim(smc)
[1] 17926 430
table(smc$biorep)
a1 a2 a3 f1 f2 f3 y1 y2 y3
22 49 13 54 20 136 59 28 49
There are very few cells for each biological replicate, so I will normalise and integrate the data by group rather than biological replicate.
smc.list <- SplitObject(smc, split.by = "orig.ident")
for (i in 1:length(smc.list)) {
smc.list[[i]] <- SCTransform(smc.list[[i]], verbose = FALSE)
}
kf <- min(sapply(smc.list, ncol))
smc.anchors <- FindIntegrationAnchors(object.list = smc.list, dims=1:30,anchor.features = 3000,k.filter=kf)
smc.integrated <- IntegrateData(anchorset = smc.anchors,dims=1:30)
DefaultAssay(object = smc.integrated) <- "integrated"
smc.integrated <- ScaleData(smc.integrated, verbose = FALSE)
smc.integrated <- RunPCA(smc.integrated, npcs = 50, verbose = FALSE)
ElbowPlot(smc.integrated,ndims=50)
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
VizDimLoadings(smc.integrated, dims = 1:4, reduction = "pca")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
DimPlot(smc.integrated, reduction = "pca",group.by="orig.ident")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
DimPlot(smc.integrated, reduction = "pca",group.by="biorep")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
DimPlot(smc.integrated, reduction = "pca",group.by="sex")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
DimPlot(smc.integrated, reduction = "pca",group.by="batch")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
DimHeatmap(smc.integrated, dims = 1:15, cells = 500, balanced = TRUE)
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
#DimHeatmap(smc.integrated, dims = 16:30, cells = 500, balanced = TRUE)
#DimHeatmap(smc.integrated, dims = 31:45, cells = 500, balanced = TRUE)
smc.integrated <- FindNeighbors(smc.integrated, dims = 1:10)
smc.integrated <- FindClusters(smc.integrated, resolution = 0.1)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.9233
Number of communities: 3
Elapsed time: 0 seconds
table(Idents(smc.integrated))
0 1 2
232 174 24
par(mfrow=c(1,1))
par(mar=c(5,4,2,2))
barplot(table(Idents(smc.integrated)),ylab="Number of cells",xlab="Clusters")
title("Number of cells in each cluster")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
set.seed(10)
smc.integrated <- RunTSNE(smc.integrated, reduction = "pca", dims = 1:10)
DimPlot(smc.integrated, reduction = "tsne",label=TRUE,label.size = 6,pt.size = 0.5)+NoLegend()
pdf(file="./output/Figures/tsne-smcALL-res01.pdf",width=10,height=8,onefile = FALSE)
DimPlot(smc.integrated, reduction = "tsne",label=TRUE,label.size = 6,pt.size = 0.5)+NoLegend()
dev.off()
png
2
DimPlot(smc.integrated, reduction = "tsne", group.by = "orig.ident")
DimPlot(smc.integrated, reduction = "tsne", split.by = "orig.ident")
DimPlot(smc.integrated, reduction = "tsne", group.by = "biorep")
DimPlot(smc.integrated, reduction = "tsne", group.by = "sex")
DimPlot(smc.integrated, reduction = "tsne", split.by = "sex")
DimPlot(smc.integrated, reduction = "tsne", group.by = "batch")
par(mfrow=c(1,1))
par(mar=c(4,4,2,2))
tab <- table(Idents(smc.integrated),smc.integrated$biorep)
barplot(t(tab/rowSums(tab)),beside=TRUE,col=ggplotColors(9),legend=TRUE)
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
par(mfrow=c(1,1))
par(mar=c(4,4,2,2))
tab <- table(Idents(smc.integrated),smc.integrated$orig.ident)
barplot(t(tab/rowSums(tab)),beside=TRUE,col=ggplotColors(3))
legend("topleft",legend=colnames(tab),fill=ggplotColors(3))
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
clusres <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.1,1.2)
for(i in 1:length(clusres)){
smc.integrated <- FindClusters(smc.integrated,
resolution = clusres[i])
}
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.9233
Number of communities: 3
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.8775
Number of communities: 3
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.8400
Number of communities: 4
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.8063
Number of communities: 4
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.7766
Number of communities: 5
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.7518
Number of communities: 5
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.7269
Number of communities: 6
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.7072
Number of communities: 7
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.6889
Number of communities: 7
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.6707
Number of communities: 8
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.6536
Number of communities: 8
Elapsed time: 0 seconds
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 430
Number of edges: 13189
Running Louvain algorithm...
Maximum modularity in 10 random starts: 0.6366
Number of communities: 8
Elapsed time: 0 seconds
pct.male <- function(x) {mean(x=="m")}
pct.female <- function(x) {mean(x=="f")}
pct.fetal <- function(x) {mean(x=="fetal")}
pct.young <- function(x) {mean(x=="young")}
pct.adult <- function(x) {mean(x=="adult")}
clustree(smc.integrated, prefix = "integrated_snn_res.")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
clustree(smc.integrated, prefix = "integrated_snn_res.",
node_colour = "sex", node_colour_aggr = "pct.female",assay="RNA")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
clustree(smc.integrated, prefix = "integrated_snn_res.",
node_colour = "sex", node_colour_aggr = "pct.male",assay="RNA")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
clustree(smc.integrated, prefix = "integrated_snn_res.",
node_colour = "orig.ident", node_colour_aggr = "pct.fetal",assay="RNA")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
clustree(smc.integrated, prefix = "integrated_snn_res.",
node_colour = "orig.ident", node_colour_aggr = "pct.young",assay="RNA")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
clustree(smc.integrated, prefix = "integrated_snn_res.",
node_colour = "orig.ident", node_colour_aggr = "pct.adult",assay="RNA")
Version | Author | Date |
---|---|---|
604f664 | Belinda Phipson | 2019-10-29 |
DefaultAssay(smc.integrated) <- "RNA"
Idents(smc.integrated) <- smc.integrated$integrated_snn_res.0.1
saveRDS(smc.integrated,file="./output/RDataObjects/smc-int-FYA-filtered.Rds")
#smc.integrated <- readRDS(file="./output/RDataObjects/smc-int-FYA.Rds")
# Load unfiltered counts matrix for every sample (object all)
load("./output/RDataObjects/all-counts.Rdata")
sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.7 (Final)
Matrix products: default
BLAS: /usr/local/installed/R/3.6.0/lib64/R/lib/libRblas.so
LAPACK: /usr/local/installed/R/3.6.0/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
[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] splines parallel stats4 stats graphics grDevices utils
[8] datasets methods base
other attached packages:
[1] dplyr_0.8.3 clustree_0.4.0
[3] ggraph_1.0.2 workflowr_1.3.0
[5] NMF_0.21.0 bigmemory_4.5.33
[7] cluster_2.1.0 rngtools_1.4
[9] pkgmaker_0.27 registry_0.5-1
[11] scran_1.12.0 SingleCellExperiment_1.6.0
[13] SummarizedExperiment_1.14.1 GenomicRanges_1.36.0
[15] GenomeInfoDb_1.20.0 DelayedArray_0.10.0
[17] BiocParallel_1.18.1 matrixStats_0.55.0
[19] cowplot_1.0.0 monocle_2.12.0
[21] DDRTree_0.1.5 irlba_2.3.3
[23] VGAM_1.1-1 ggplot2_3.2.1
[25] Matrix_1.2-17 Seurat_3.0.3.9019
[27] org.Hs.eg.db_3.8.2 AnnotationDbi_1.46.1
[29] IRanges_2.18.1 S4Vectors_0.22.0
[31] Biobase_2.44.0 BiocGenerics_0.30.0
[33] RColorBrewer_1.1-2 edgeR_3.26.3
[35] limma_3.40.2
loaded via a namespace (and not attached):
[1] reticulate_1.13 R.utils_2.9.0
[3] tidyselect_0.2.5 RSQLite_2.1.2
[5] htmlwidgets_1.5 grid_3.6.0
[7] combinat_0.0-8 docopt_0.6.1
[9] Rtsne_0.15 munsell_0.5.0
[11] codetools_0.2-16 ica_1.0-2
[13] statmod_1.4.30 future_1.14.0
[15] withr_2.1.2 colorspace_1.4-1
[17] fastICA_1.2-2 knitr_1.25
[19] ROCR_1.0-7 gbRd_0.4-11
[21] listenv_0.7.0 labeling_0.3
[23] Rdpack_0.11-0 git2r_0.26.1
[25] slam_0.1-45 GenomeInfoDbData_1.2.1
[27] polyclip_1.10-0 farver_1.1.0
[29] bit64_0.9-7 pheatmap_1.0.12
[31] rprojroot_1.3-2 vctrs_0.2.0
[33] xfun_0.10 R6_2.4.0
[35] doParallel_1.0.15 ggbeeswarm_0.6.0
[37] rsvd_1.0.2 locfit_1.5-9.1
[39] bitops_1.0-6 assertthat_0.2.1
[41] SDMTools_1.1-221.1 scales_1.0.0
[43] beeswarm_0.2.3 gtable_0.3.0
[45] npsurv_0.4-0 globals_0.12.4
[47] tidygraph_1.1.2 rlang_0.4.0
[49] zeallot_0.1.0 lazyeval_0.2.2
[51] checkmate_1.9.4 yaml_2.2.0
[53] reshape2_1.4.3 backports_1.1.5
[55] tools_3.6.0 gridBase_0.4-7
[57] gplots_3.0.1.1 dynamicTreeCut_1.63-1
[59] ggridges_0.5.1 Rcpp_1.0.2
[61] plyr_1.8.4 zlibbioc_1.30.0
[63] purrr_0.3.2 RCurl_1.95-4.12
[65] densityClust_0.3 pbapply_1.4-1
[67] viridis_0.5.1 zoo_1.8-6
[69] ggrepel_0.8.1 fs_1.3.1
[71] magrittr_1.5 data.table_1.12.4
[73] lmtest_0.9-37 RANN_2.6.1
[75] whisker_0.3-2 fitdistrplus_1.0-14
[77] lsei_1.2-0 evaluate_0.14
[79] xtable_1.8-4 sparsesvd_0.1-4
[81] gridExtra_2.3 HSMMSingleCell_1.4.0
[83] compiler_3.6.0 scater_1.12.2
[85] tibble_2.1.3 KernSmooth_2.23-15
[87] crayon_1.3.4 R.oo_1.22.0
[89] htmltools_0.4.0 tidyr_0.8.3
[91] DBI_1.0.0 tweenr_1.0.1
[93] MASS_7.3-51.4 R.methodsS3_1.7.1
[95] gdata_2.18.0 metap_1.1
[97] igraph_1.2.4.1 pkgconfig_2.0.3
[99] bigmemory.sri_0.1.3 plotly_4.9.0
[101] foreach_1.4.7 vipor_0.4.5
[103] dqrng_0.2.1 XVector_0.24.0
[105] bibtex_0.4.2 stringr_1.4.0
[107] digest_0.6.21 sctransform_0.2.0
[109] RcppAnnoy_0.0.12 tsne_0.1-3
[111] rmarkdown_1.14 DelayedMatrixStats_1.6.0
[113] gtools_3.8.1 nlme_3.1-141
[115] jsonlite_1.6 BiocNeighbors_1.2.0
[117] viridisLite_0.3.0 pillar_1.4.2
[119] lattice_0.20-38 httr_1.4.1
[121] survival_2.44-1.1 glue_1.3.1
[123] qlcMatrix_0.9.7 FNN_1.1.3
[125] png_0.1-7 iterators_1.0.12
[127] bit_1.1-14 ggforce_0.3.0
[129] stringi_1.4.3 blob_1.2.0
[131] BiocSingular_1.0.0 caTools_1.17.1.2
[133] memoise_1.1.0 future.apply_1.3.0
[135] ape_5.3