Last updated: 2020-09-26
Checks: 7 0
Knit directory: single-cell-topics/analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2.9000). 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(1)
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 f9fe3eb. 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: analysis/figure/
Ignored: data/droplet.RData
Ignored: data/pbmc_68k.RData
Ignored: data/pbmc_purified.RData
Ignored: data/pulseseq.RData
Ignored: output/droplet/diff-count-droplet.RData
Ignored: output/droplet/fits-droplet.RData
Ignored: output/droplet/rds/
Ignored: output/pbmc-68k/fits-pbmc-68k.RData
Ignored: output/pbmc-68k/rds/
Ignored: output/pbmc-purified/fits-pbmc-purified.RData
Ignored: output/pbmc-purified/rds/
Ignored: output/pulseseq/fits-pulseseq.RData
Ignored: output/pulseseq/rds/
Untracked files:
Untracked: output/pulseseq/diff-count-pulseseq.RData
Unstaged changes:
Modified: code/plots.R
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/plots_tracheal_epithelium.Rmd
) and HTML (docs/plots_tracheal_epithelium.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 | f9fe3eb | Peter Carbonetto | 2020-09-26 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”) |
Rmd | 95f91d4 | Peter Carbonetto | 2020-09-26 | Improved functions logfoldchange_scatterplot and zscores_scatterplot in plots.R. |
Rmd | 73ef439 | Peter Carbonetto | 2020-09-26 | Made some improvements to zscore_scatterplot in plots.R. |
Rmd | 56bb5fd | Peter Carbonetto | 2020-09-24 | Adding some scatterplots and volcano plots to plots_tracheal_epithelium analysis. |
html | 6a9691b | Peter Carbonetto | 2020-09-24 | Added volcano plots for T+N celels to plots_tracheal_epithelium |
Rmd | 7262a96 | Peter Carbonetto | 2020-09-24 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”, verbose = TRUE) |
html | 30194ad | Peter Carbonetto | 2020-09-24 | Added volcano plots and scatterplot for goblet cells. |
Rmd | 9e59003 | Peter Carbonetto | 2020-09-24 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”, verbose = TRUE) |
html | c0fa2db | Peter Carbonetto | 2020-09-24 | Revised plots for ionocytes cluster in plots_tracheal_epithelium |
Rmd | 81506fb | Peter Carbonetto | 2020-09-24 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”, verbose = TRUE) |
html | 78d64e9 | Peter Carbonetto | 2020-09-23 | Added ionocytes volcano plot to plots_tracheal_epithelium. |
Rmd | f0bdbda | Peter Carbonetto | 2020-09-23 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”, verbose = TRUE) |
html | 361eded | Peter Carbonetto | 2020-09-23 | Added text to accompany ciliated cells volcano plots. |
Rmd | 8198c07 | Peter Carbonetto | 2020-09-23 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”, verbose = TRUE) |
html | 23f87bb | Peter Carbonetto | 2020-09-23 | Improved volcano plots for ciliated cell type in |
Rmd | 516a32e | Peter Carbonetto | 2020-09-23 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”, verbose = TRUE) |
html | 0ed5061 | Peter Carbonetto | 2020-09-22 | Added some rough, first-draft volcano plots to |
Rmd | 6ccf998 | Peter Carbonetto | 2020-09-22 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”, verbose = TRUE) |
Rmd | de36d31 | Peter Carbonetto | 2020-09-22 | Added volcano plots for ciliated cells to plots_tracheal_epithelium analysis. |
Rmd | 082352a | Peter Carbonetto | 2020-09-22 | Added steps to plots_tracheal_epithelium analysis to compute differential expression statistics. |
html | 06d0b30 | Peter Carbonetto | 2020-09-22 | I’m starting to revamp the plots_tracheal_epithelium analysis. |
Rmd | 0877a1f | Peter Carbonetto | 2020-09-22 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”) |
Rmd | 5af46f1 | Peter Carbonetto | 2020-09-20 | Working on Structure plot for droplet data. |
Rmd | c072577 | Peter Carbonetto | 2020-09-19 | Re-created structure plot for pulseseq data. |
Rmd | 942486b | Peter Carbonetto | 2020-09-18 | Fixing merge issue. |
Rmd | 8cf758e | Peter Carbonetto | 2020-09-12 | Working on improvements to clustering of pulse-seq data. |
Rmd | a128de5 | Peter Carbonetto | 2020-09-12 | Revamping the analysis of the pulseseq data in plots_tracheal_epithelium. |
Rmd | 3ab7da1 | Peter Carbonetto | 2020-08-25 | A few minor edits. |
html | f2e0b23 | Peter Carbonetto | 2020-08-25 | Fixed dimensions of PCA plots in plots_tracheal_epithelium analysis. |
Rmd | 7b59815 | Peter Carbonetto | 2020-08-25 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | 5589611 | Peter Carbonetto | 2020-08-25 | Added PCA plots and structure plots from pulseseq data. |
Rmd | b731a4a | Peter Carbonetto | 2020-08-25 | workflowr::wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | c3c1b12 | Peter Carbonetto | 2020-08-25 | Build site. |
Rmd | 2defe6d | Peter Carbonetto | 2020-08-25 | Added crosstab plot to plots_tracheal_epithelium analysis. |
html | 97c13c2 | Peter Carbonetto | 2020-08-25 | Build site. |
Rmd | e11855b | Peter Carbonetto | 2020-08-25 | Working on revised analysis of droplet and pulse-seq data sets. |
html | e11855b | Peter Carbonetto | 2020-08-25 | Working on revised analysis of droplet and pulse-seq data sets. |
Rmd | bf23ca0 | Peter Carbonetto | 2020-08-20 | Added manual labeling of purified PBMC data to plots_pbmc analysis. |
Rmd | 077d3d5 | Peter Carbonetto | 2020-08-20 | Added k=9 and k=11 pulseseq fits to plots_tracheal_epithelium analysis. |
html | 0ce9604 | Peter Carbonetto | 2020-08-20 | Re-built plots_tracheal_epithelium with fastTopics 0.3-162. |
Rmd | 961570e | Peter Carbonetto | 2020-08-20 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | b17bfa4 | Peter Carbonetto | 2020-08-19 | Added pulseseq PCA plots to plots_tracheal_epithelium analysis. |
Rmd | 76dc0c6 | Peter Carbonetto | 2020-08-19 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
Rmd | c70612f | Peter Carbonetto | 2020-08-19 | Revised structure plot settings for abundant droplet samples in plots_tracheal_epithelium. |
html | adda33f | Peter Carbonetto | 2020-08-19 | Fixed another structure plot in plots_tracheal_epithelium analysis. |
Rmd | 29a9258 | Peter Carbonetto | 2020-08-19 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | 0a16b60 | Peter Carbonetto | 2020-08-19 | Fixed structure plot in plots_tracheal_epithelium analysis. |
Rmd | 3a7bd74 | Peter Carbonetto | 2020-08-19 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | f4bdf19 | Peter Carbonetto | 2020-08-19 | Added explanatory text and improved PC-based manual clustering of |
Rmd | c7b77ee | Peter Carbonetto | 2020-08-19 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
Rmd | 70a4a60 | Peter Carbonetto | 2020-08-19 | Added note to plots_tracheal_epithelium.Rmd. |
html | fb21b3b | Peter Carbonetto | 2020-08-19 | Added very initial Structure plots to plots_tracheal_epithelium analysis. |
Rmd | d35cb03 | Peter Carbonetto | 2020-08-19 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | 368a74a | Peter Carbonetto | 2020-08-19 | Added some text to plots_tracheal_epithelium analysis. |
Rmd | 223406b | Peter Carbonetto | 2020-08-19 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | aca46cc | Peter Carbonetto | 2020-08-19 | Added manual clustering of droplet samples based on PCs. |
Rmd | 38f811b | Peter Carbonetto | 2020-08-19 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
Rmd | 343747e | Peter Carbonetto | 2020-08-19 | Small edit to figure dimensions. |
html | 5a35bbd | Peter Carbonetto | 2020-08-19 | Added labeled PCA plot; adjusted plot dimensions in |
Rmd | fb91075 | Peter Carbonetto | 2020-08-19 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | 8b9b528 | Peter Carbonetto | 2020-08-19 | Added more PCA plots to plots_tracheal_epithelium analysis. |
Rmd | ee7cbf1 | Peter Carbonetto | 2020-08-19 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | c517ea2 | Peter Carbonetto | 2020-08-18 | Small fix to one of the PCA plots in plots_tracheal_epithelium. |
Rmd | 8f5c210 | Peter Carbonetto | 2020-08-18 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | 01afbd2 | Peter Carbonetto | 2020-08-18 | Added some PC plots to the plots_tracheal_epithelium analysis. |
Rmd | f1c7d02 | Peter Carbonetto | 2020-08-18 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
html | 0a04fc1 | Peter Carbonetto | 2020-08-18 | Added abundance plots to plots_tracheal_epithelium analysis. |
Rmd | f914f7e | Peter Carbonetto | 2020-08-18 | wflow_publish(“plots_tracheal_epithelium.Rmd”) |
Rmd | 61917ad | Peter Carbonetto | 2020-08-18 | Working on new analysis, plots_tracheal_epithelium.Rmd. |
Add introductory text here.
Load the packages used in the analysis below, as well as additional functions that we will use to generate some of the plots.
library(Matrix)
library(dplyr)
library(fastTopics)
library(ggplot2)
library(ggrepel)
library(cowplot)
source("../code/plots.R")
Load the smaller “droplet” data set, the \(k = 7\) Poisson NMF model fit for these data, the 8 clusters identified in the clustering analysis, and the results of the differential expression analysis.
load("../data/droplet.RData")
load("../output/droplet/diff-count-droplet.RData")
counts_droplet <- counts
samples_droplet <- readRDS("../output/droplet/clustering-droplet.rds")
fit_droplet <- readRDS("../output/droplet/rds/fit-droplet-scd-ex-k=7.rds")$fit
diff_count_droplet <- diff_count_topics
diff_count_clusters_droplet <- diff_count_clusters
diff_count_merge_droplet <- diff_count_merge_club
rm(samples,counts)
rm(diff_count_topics,diff_count_clusters,diff_count_merge_club)
For reference, we show here the Structure plot from the clustering analysis of the droplet data. This Structure plot summarizes the topic proportions in each of the 8 subsets.
Next, load the larger “pulse-seq” data set, the \(k = 11\) Poisson NMF model fit for these data, and the 7 clusters identified in the clustering analysis.
load("../data/pulseseq.RData")
load("../output/pulseseq/diff-count-pulseseq.RData")
counts_pulseseq <- counts
samples_pulseseq <- readRDS("../output/pulseseq/clustering-pulseseq.rds")
fit_pulseseq <- readRDS("../output/pulseseq/rds/fit-pulseseq-scd-ex-k=11.rds")$fit
diff_count_pulseseq <- diff_count_topics
diff_count_clusters_pulseseq <- diff_count_clusters
diff_count_merge_pulseseq <- diff_count_merge_bc
rm(samples,counts)
rm(diff_count_topics,diff_count_clusters,diff_count_merge_bc)
For reference, we show here the Structure plot from the clustering analysis of the pulse-seq data. This Structure plot summarizes the topic proportions in each of the 7 subsets:
We begin with the cluster that captures ciliated cells in the droplet data. This cluster is one of the most distinctive in both the droplet and pulse-seq data sets. Ciliated cells are abundant, although not nearly as much as basal and club cells. While gene expression in ciliated cells is largely captured by a single topic, this topic is not attributed only to ciliated cells, so we interpret the cluster only.
cilitated_genes <- c("Ccdc113","Ccdc153","Cdhr3","Foxj1","Lztfl1","Mlf1")
p1 <- volcano_plot_with_highlighted_genes(diff_count_clusters_droplet,"Cil",
cilitated_genes,
label_above_quantile = 0.998)
print(p1)
In this volcano plot, marker genes and transcription factors identified in Montoro et al (2018) are highlighted in black, and other top differentially expressed genes are shown with gray labels.
We obtain similar top differentially expressed genes in the pulse-seq data:
p2 <- volcano_plot_with_highlighted_genes(diff_count_clusters_pulseseq,"Cil",
cilitated_genes,
label_above_quantile = 0.998)
print(p2)
In the pulse-seq data, we identify a distinctive cluster for the newly discovered—and very rare—ionocyte cell type. Gene expression in these cells is not fully captured by any single topic, yet the mixture of topics forms a distinctive cluster in the embedding formed by the pulse-seq topic proportions.
ionocyte_genes <- c("Ascl3","Asgr1","Atp6v0d2","Atp6v1c2","Cftr","Foxi1",
"Moxd1","P2ry14","Stap1")
p3 <- volcano_plot_with_highlighted_genes(diff_count_clusters_pulseseq,"I",
ionocyte_genes,
label_above_quantile = 0.998)
print(p3)
We do not identify a cluster for ionocytes in the droplet data. This is not surprising in light of the fact that only a very small number of cells in the droplet data set appear to be ionocytes, at least judging by expression of the Foxi1 ionocyte marker gene:
p4 <- pca_plot_with_counts(fit_droplet,counts_droplet[,"Foxi1"],1:2)
print(p4)
Consistent with Montoro et al (2018), we identify a cluster of Goblet cells in the droplet data, but not in the pulse-seq data.
goblet_genes <- "Gp2"
p5 <- volcano_plot_with_highlighted_genes(diff_count_clusters_droplet,"G",
goblet_genes,
label_above_quantile = 0.998)
print(p5)
Topic \(k = 1\) is unique to this cluster suggesting that the this topic characterizes the goblet cell type.
goblet_genes <- "Gp2"
p6 <- volcano_plot_with_highlighted_genes(diff_count_droplet,"k1",
goblet_genes,
label_above_quantile = 0.998)
print(p6)
Indeed, there is a very close correspondence between the topic and cluster, with several characteristic genes (e.g. Gp2) showing somewhat stronger enrichment in the topic.
p7 <- zscores_scatterplot(diff_count_clusters_droplet,
diff_count_droplet,"G","k1",goblet_genes,
label_above_score = 200,zmax = 800) +
labs(x = "cluster G",y = "topic 1",title = "z-scores")
p8 <- beta_scatterplot(diff_count_clusters_droplet,diff_count_droplet,
"G","k1",goblet_genes,label_above_score = Inf) +
labs(x = "cluster G",y = "topic 1",title = "log-fold change (beta)")
plot_grid(p7,p8)
In both data sets, we identify clusters for tuft and pulmonary neuroendocrine cells. The topic models do not clearly distinguish between these two rare cell types; we identify them in a single cluster.
tuft_neuroendocrine_genes <- c("Ascl1","Ascl2","Ascl3","Chga","Dclk1","Rgs13")
p8 <- volcano_plot_with_highlighted_genes(diff_count_clusters_droplet,"T+N",
tuft_neuroendocrine_genes,
label_above_quantile = 0.998)
print(p8)
Version | Author | Date |
---|---|---|
6a9691b | Peter Carbonetto | 2020-09-24 |
Here is the volcano plot from the pulse-seq data:
p9 <- volcano_plot_with_highlighted_genes(diff_count_clusters_pulseseq,"T+N",
tuft_neuroendocrine_genes,
label_above_quantile = 0.998)
print(p9)
Version | Author | Date |
---|---|---|
6a9691b | Peter Carbonetto | 2020-09-24 |
We end our exploration with the large subset of cells that does not decompose to form distinct clusters.
Abundant basal cells:
basal_genes <- c("Aqp3","Krt5","Dapl1","Hspa1a","Trp63")
p10 <- volcano_plot_with_highlighted_genes(diff_count_clusters_droplet,"B",
basal_genes,
label_above_quantile = 0.995)
print(p10)
p11 <- volcano_plot_with_highlighted_genes(diff_count_droplet,"k2",
basal_genes,
label_above_quantile = 0.995)
print(p11)
p12 <- logfoldchange_scatterplot(diff_count_clusters_droplet$beta[rows,"B"],
diff_count_droplet$beta[rows,2],
diff_count_droplet$colmeans[rows])
print(p12)
Hillock cells:
hillock_genes <- c("Krt4","Krt13","Ecm1","S100a11","Cldn3","Lgals3","Anxa1")
p10 <- volcano_plot_with_highlighted_genes(diff_count_clusters_droplet,"H",
hillock_genes,
label_above_quantile = 0.998)
print(p10)
p11 <- volcano_plot_with_highlighted_genes(diff_count_droplet,"k4",
hillock_genes,
label_above_quantile = 0.998)
print(p11)
p12 <- zscores_scatterplot(diff_count_clusters_droplet$Z[,"H"],
diff_count_droplet$Z[,4],
diff_count_droplet$colmeans,
colnames(counts_droplet),
label_above_score = 100,
zmax = 400) +
labs(x = "cluster H",y = "topic 4",title = "z-scores")
print(p12)
rows <- which(abs(diff_count_clusters_droplet$Z[,"H"] > 2) |
abs(diff_count_droplet$Z[,4]) > 2)
rows <- is.element(rownames(diff_count_droplet$Z),hillock_genes)
p12b <- logfoldchange_scatterplot(diff_count_clusters_droplet$beta[rows,"H"],
diff_count_droplet$beta[rows,4],
diff_count_droplet$colmeans[rows])
print(p12b)
p13 <- volcano_plot_with_highlighted_genes(diff_count_pulseseq,"k1",
hillock_genes,
label_above_quantile = 0.995)
print(p13)
TO DO:
Add volcano plots for B (basal) and C (club) clusters.
Add volcano plot for P cluster (proliferating cells).
Add plots for hillock cells.
sessionInfo()
# R version 3.6.2 (2019-12-12)
# Platform: x86_64-apple-darwin15.6.0 (64-bit)
# Running under: macOS Catalina 10.15.6
#
# Matrix products: default
# BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
# LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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] stats graphics grDevices utils datasets methods base
#
# other attached packages:
# [1] cowplot_1.0.0 ggrepel_0.9.0 ggplot2_3.3.0 fastTopics_0.3-177
# [5] dplyr_0.8.3 Matrix_1.2-18
#
# loaded via a namespace (and not attached):
# [1] Rcpp_1.0.5 lattice_0.20-38 tidyr_1.0.0
# [4] prettyunits_1.1.1 assertthat_0.2.1 zeallot_0.1.0
# [7] rprojroot_1.3-2 digest_0.6.23 R6_2.4.1
# [10] backports_1.1.5 MatrixModels_0.4-1 evaluate_0.14
# [13] coda_0.19-3 httr_1.4.1 pillar_1.4.3
# [16] rlang_0.4.5 progress_1.2.2 lazyeval_0.2.2
# [19] data.table_1.12.8 irlba_2.3.3 SparseM_1.78
# [22] whisker_0.4 rmarkdown_2.3 labeling_0.3
# [25] Rtsne_0.15 stringr_1.4.0 htmlwidgets_1.5.1
# [28] munsell_0.5.0 compiler_3.6.2 httpuv_1.5.2
# [31] xfun_0.11 pkgconfig_2.0.3 mcmc_0.9-6
# [34] htmltools_0.4.0 tidyselect_0.2.5 tibble_2.1.3
# [37] workflowr_1.6.2.9000 quadprog_1.5-8 viridisLite_0.3.0
# [40] crayon_1.3.4 withr_2.1.2 later_1.0.0
# [43] MASS_7.3-51.4 grid_3.6.2 jsonlite_1.6
# [46] gtable_0.3.0 lifecycle_0.1.0 git2r_0.26.1
# [49] magrittr_1.5 scales_1.1.0 RcppParallel_4.4.2
# [52] stringi_1.4.3 farver_2.0.1 fs_1.3.1
# [55] promises_1.1.0 vctrs_0.2.1 tools_3.6.2
# [58] glue_1.3.1 purrr_0.3.3 hms_0.5.2
# [61] yaml_2.2.0 colorspace_1.4-1 plotly_4.9.2
# [64] knitr_1.26 quantreg_5.54 MCMCpack_1.4-5