Last updated: 2022-08-02
Checks: 7 0
Knit directory: scATACseq-topics/
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(20200729)
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 e5ff431. 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: analysis/site_libs/
Untracked files:
Untracked: analysis/motif_analysis_Buenrostro2018_v2.Rmd
Untracked: output/clustering-Cusanovich2018.rds
Untracked: paper/
Untracked: scripts/DA_Buenrostro2018_filteredpeaks.sbatch
Untracked: scripts/analysis_Cusanovich2018_filteredpeaks.sh
Untracked: scripts/fit_poisson_nmf_Buenrostro2018_filtered_HeLabExample.R
Untracked: scripts/postfit_Buenrostro2018_filteredpeaks.sbatch
Untracked: scripts/postfit_Buenrostro2018_v2.sbatch
Unstaged changes:
Modified: analysis/assess_fits_Buenrostro2018_Chen2019pipeline.Rmd
Modified: analysis/clusters_Cusanovich2018_k13.Rmd
Modified: analysis/gene_analysis_Buenrostro2018_Chen2019pipeline.Rmd
Modified: analysis/gene_analysis_Cusanovich2018.Rmd
Modified: analysis/motif_analysis_Buenrostro2018_Chen2019pipeline.Rmd
Modified: analysis/motif_analysis_Cusanovich2018.Rmd
Modified: analysis/plots_Cusanovich2018.Rmd
Modified: scripts/DA_analysis_Buenrostro2018_vsnull.R
Modified: scripts/analysis_Buenrostro2018_filteredpeaks.sh
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/process_data_Cusanovich2018.Rmd
) and HTML (docs/process_data_Cusanovich2018.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 | e5ff431 | kevinlkx | 2022-08-02 | filtered peaks for data by tissues |
html | c4ead99 | kevinlkx | 2022-02-24 | Build site. |
html | 7044d98 | kevinlkx | 2022-02-24 | Build site. |
Rmd | c08dcfc | kevinlkx | 2022-02-24 | wflow_publish("analysis/process_data_Cusanovich2018.Rmd") |
html | 5587790 | kevinlkx | 2021-02-01 | Build site. |
Rmd | 0e6a0a4 | kevinlkx | 2021-02-01 | minor change on the output name for endothelial cells |
html | 6d68feb | kevinlkx | 2021-01-29 | Build site. |
Rmd | c1e87ec | kevinlkx | 2021-01-29 | save data by tissues separately |
html | 0440e35 | kevinlkx | 2020-09-10 | Build site. |
Rmd | 7b8b36f | kevinlkx | 2020-09-10 | wflow_publish("analysis/process_data_Cusanovich2018.Rmd") |
html | edbd049 | kevinlkx | 2020-08-24 | Build site. |
Rmd | b836761 | kevinlkx | 2020-08-24 | wflow_publish("analysis/process_data_Cusanovich2018.Rmd") |
html | ceef630 | kevinlkx | 2020-08-21 | Build site. |
Rmd | d0bc60c | kevinlkx | 2020-08-21 | wflow_publish("analysis/process_data_Cusanovich2018.Rmd") |
Rmd | 0289508 | kevinlkx | 2020-08-21 | wflow_rename("analysis/scATACseq_analysis_Cusanovich2018.Rmd", |
html | 0289508 | kevinlkx | 2020-08-21 | wflow_rename("analysis/scATACseq_analysis_Cusanovich2018.Rmd", |
library(Matrix)
library(tools)
Reference: Cusanovich, D., Hill, A., Aghamirzaie, D., Daza, R., Pliner, H., Berletch, J., Filippova, G., Huang, X., Christiansen, L., DeWitt, W., Lee, C., Regalado, S., Read, D., Steemers, F., Disteche, C., Trapnell, C., Shendure, J. (2018). A Single-Cell Atlas of In Vivo Mammalian Chromatin Accessibility Cell 174(5), 1 35. https://dx.doi.org/10.1016/j.cell.2018.06.052
Data were downloaded from the website: https://atlas.gs.washington.edu/mouse-atac/data/. They also provided detail descriptions about these datasets.
RCC directory: /project2/mstephens/kevinluo/scATACseq-topics/data/Cusanovich_2018/
The authors included nice tutorials on how to get started with analysis of sci-ATAC-seq data: http://atlas.gs.washington.edu/mouse-atac/docs/
R/python scripts referenced in this tutorial are available on: https://github.com/shendurelab/mouse-atac and downloaded to /project2/mstephens/kevinluo/scATACseq-topics/data/Cusanovich_2018/code_from_authors/mouse-atac
on RCC.
Many of the initial steps of processing raw sci-ATAC-seq libraries used for this study are similar to their previous work of sci-ATAC-seq on Drosophila melanogaster embryos at 3 different stages of development. "Cusanovich, D., Reddington, J., Garfield, D. et al. The cis-regulatory dynamics of embryonic development at single-cell resolution. Nature 555, 538–542 (2018). https://doi.org/10.1038/nature25981". Code and documentation on processing sequencing data can be found on the Fly ATAC Github. Documentation on various downstream steps can be found in the Fly ATAC documentation.
Binarized peak by cell matrix: atac_matrix.binary.qc_filtered.rds
(only QC filtered cells are included).
The subset of peaks used as input to TFIDF: atac_matrix.tfidf.qc_filtered.peaks.txt
.
TFIDF normalized peak by cell matrix: atac_matrix.tfidf.qc_filtered.rds
. This dataset has rare peaks filtered out and is then normalized with TFIDF to allow for input to PCA/TSNE (only QC filtered cells are included).
cell_metadata.txt
: Metadata for cells in TSV format, including several features such as TSNE coordinates, cluster assignments, and cell type assignments. Columns in this data:cell_metadata <- read.table("/project2/mstephens/kevinluo/scATACseq-topics/data/Cusanovich_2018/metadata/cell_metadata.txt", header = TRUE, stringsAsFactors = TRUE, sep = "\t")
dim(cell_metadata)
cell_metadata[1:3,]
cell_metadata.tissue_freq_filtered.txt
: Same as cell_metadata.txt
, but removes cells in each tissue belonging to a cell_label that accounts for less than 0.5% of the cells in that tissue. These very low frequency labels are often not cell types expected their respective tissues and could be due to slight imperfections in clustering, for example. Provided matrices would need to be subsetted to match this set of cells if using this metadata.cell_metadata <- read.table("/project2/mstephens/kevinluo/scATACseq-topics/data/Cusanovich_2018/metadata/cell_metadata.tissue_freq_filtered.txt", header = TRUE, stringsAsFactors = TRUE, sep = "\t")
dim(cell_metadata)
cell_metadata[1:3,]
cell_type_assignments.xlsx
: Excel document with three tabs expected cell types, cell type markers, and Cell type assignments that contain a pairs of tissues and expected cell types, a list of positive markers for each cell type, and the table of cell type assignments with extra details about assignment criteria when applicable, respectively. This is meant to document justification for cell type assignments provided in cell_metadata.txt
above.
peak_promoter_intersections.txt
: Metadata for peaks-intersected TSS pairs in TSV format.
peak_promoter_intersections <- read.table("/project2/mstephens/kevinluo/scATACseq-topics/data/Cusanovich_2018/metadata/peak_promoter_intersections.txt", header = TRUE, stringsAsFactors = TRUE, sep = "\t")
dim(peak_promoter_intersections)
peak_promoter_intersections[1:3,]
atac_matrix.binary.qc_filtered.rds
(only QC filtered cells are included).## atac_matrix.binary.qc_filtered.rds: binarized peak by cell matrix in RDS format.
binarized_matrix <- readRDS("/project2/mstephens/kevinluo/scATACseq-topics/data/Cusanovich_2018/ATAC_matrices/atac_matrix.binary.qc_filtered.rds")
dim(binarized_matrix)
counts <- t(binarized_matrix)
## all peaks exist in all of the cells
length(which(colSums(counts > 0) == 0))
length(which(rowSums(counts > 0) == 0))
## all peaks are accessible in at least 40 cells.
range(colSums(counts))
cat(sprintf("Number of samples (cells): %d\n",nrow(counts)))
cat(sprintf("Number of peaks: %d\n",ncol(counts)))
cat(sprintf("Proportion of counts that are non-zero: %0.1f%%.\n",
100*mean(counts > 0)))
cell_metadata.txt
: Metadata for cells in TSV format, including several features such as TSNE coordinates, cluster assignments, and cell type assignments.samples <- read.table("/project2/mstephens/kevinluo/scATACseq-topics/data/Cusanovich_2018/metadata/cell_metadata.txt", header = TRUE, stringsAsFactors = FALSE, sep = "\t")
cat(sprintf("Number of samples: %d\n",nrow(samples)))
print(samples[1:3,])
This study measured single cell chromatin accessibility in 13 different tissues in mice:
table(samples$tissue)
Cells were labeled into the cell types:
table(samples$cell_label)
data.dir <- "/project2/mstephens/kevinluo/scATACseq-topics/data/Cusanovich_2018/processed_data/"
dir.create(data.dir, showWarnings = FALSE, recursive = TRUE)
# saveRDS(counts, file.path(data.dir, "counts_Cusanovich_2018.rds"))
save(list = c("samples","counts"), file = file.path(data.dir, "Cusanovich_2018.RData"))
resaveRdaFiles(file.path(data.dir, "Cusanovich_2018.RData"))
data.dir <- "/project2/mstephens/kevinluo/scATACseq-topics/data/Cusanovich_2018/processed_data/"
load(file.path(data.dir, "Cusanovich_2018.RData"))
cat(sprintf("Loaded %d x %d counts matrix.\n",nrow(counts),ncol(counts)))
cat(sprintf("Number of samples (cells): %d\n",nrow(counts)))
cat(sprintf("Number of peaks: %d\n",ncol(counts)))
cat(sprintf("Proportion of counts that are non-zero: %0.1f%%.\n",
100*mean(counts > 0)))
range(colSums(counts))
all_counts <- counts
all_samples <- samples
tissues <- unique(all_samples$tissue)
print(tissues)
for ( tissue in tissues ) {
cat(tissue, "\n")
rows <- which(all_samples$tissue == tissue)
cat(sprintf("%d cells in %s.\n",length(rows),tissue))
counts <- all_counts[rows,]
samples <- all_samples[rows,]
dim(counts)
if(any(colSums(counts) < 20)){
# Filtered out peaks with accessbility in fewer than 20 cells
cat("Filter out peaks with accessbility in fewer than 20 cells...\n")
i <- which(colSums(counts) >= 20)
counts <- counts[,i]
cat(sprintf("After filtering, we have %d rows and %d columns left. \n",nrow(counts),ncol(counts)))
save(list = c("samples","counts"), file = paste0(data.dir, "/", "Cusanovich_2018_", tissue,".RData"))
resaveRdaFiles(paste0(data.dir, "/", "Cusanovich_2018_", tissue,".RData"))
}else{
cat("All peaks with accessbility in more than 20 cells. No filtering needed.")
}
}
Heart, kidney and lung tissues combined.
rows <- which(all_samples$tissue %in% c("Heart", "Kidney", "Lung"))
cat(sprintf("%d cells in %s.\n",length(rows),tissue))
cat(sprintf("%d cells in heart, kidney and lung.\n",length(rows)))
counts <- all_counts[rows,]
samples <- all_samples[rows,]
save(list = c("samples","counts"), file = paste0(data.dir, "/", "Cusanovich_2018_HeartKidneyLung.RData"))
resaveRdaFiles(paste0(data.dir, "/", "Cusanovich_2018_HeartKidneyLung.RData")))
Endothelial cells.
rows <- grep("Endothelial",all_samples$cell_label)
cat(sprintf("%d endothelial cells. \n",length(rows)))
counts <- all_counts[rows,]
samples <- all_samples[rows,]
save(list = c("samples","counts"), file = paste0(data.dir, "/", "Cusanovich_2018_Endothelial.RData"))
resaveRdaFiles(paste0(data.dir, "/", "Cusanovich_2018_Endothelial.RData"))
sessionInfo()