Last updated: 2022-01-10
Checks: 6 1
Knit directory: The-single-cell-epigenetic-and-transcriptional-landscape-of-immune-response-to-SARS-CoV-2-vaccine/
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(20211228)
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.
Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.
absolute | relative |
---|---|
/home/rongwang/The-single-cell-epigenetic-and-transcriptional-landscape-of-immune-response-to-SARS-CoV-2-vaccine/data/SAMPLE_INFORMATION.csv | data/SAMPLE_INFORMATION.csv |
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 02561e3. 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:
Untracked files:
Untracked: data/SAMPLE_INFORMATION.csv
Untracked: figure/
Untracked: site_libs/
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/scRNA-analysis.Rmd
) and HTML (docs/scRNA-analysis.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 | 02561e3 | WangRong423 | 2022-01-10 | Start my new project |
Raw gene expression matrices were generated for each sample by the Cell Ranger ARC(V.2.0) Pipeline coupled with human reference version GRCh38. The output filtered gene expression matrices were analyzed by R software (v.4.1.1) with the Seurat package (v.4.0.3). Low-quality cells were removed if they met the following criteria:
test<-read.csv('/home/rongwang/The-single-cell-epigenetic-and-transcriptional-landscape-of-immune-response-to-SARS-CoV-2-vaccine/data/SAMPLE_INFORMATION.csv',sep = ",",header = F)
kable(test)
V1 | V2 | V3 | V4 | V5 | V6 | V7 | V8 | V9 | V10 | V11 | V12 | V13 | V14 | V15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SAMPLE | BEFOR QC | AFTER QC | NOTE | |||||||||||
number of cells | Median fragments | Median genes | Median counts | Mean percent.mt | Multiplet Rate | number of cells | Median fragments | Median genes | Median counts | Mean percent.mt | Multiplet Rate | Multiplet Rate_another | Notes | |
M1-1 | 10,275 | 6264 | 1,940 | 4,648 | 7.795 | 0.40% | 9449 | 1974 | 4730 | 6.56 | 0.33% | 0.0924 | ||
M1-2 | 15,640 | 6,835 | 1,717 | 3,688 | 7.4278 | 0.43% | 13835 | 1808 | 3969 | 6.66 | 0.37% | 0.2559 | ||
M1-3 | 9,267 | 9,059 | 1,536 | 3,005 | 7.8122 | 0.51% | 8546 | 1558 | 3060 | 6.84 | 0.44% | 0.0396 | ||
M1-4 | 11,754 | 8,865 | 1,924 | 4,230 | 5.9942 | 0.31% | 11000 | 1951 | 4288 | 5.23 | 0.27% | 0.1223 | ||
M1-5 | 14,864 | 7,715 | 1,793 | 3,834 | 7.7757 | 0.43% | 14068 | 1810 | 3867 | 7.17 | 0.40% | 0.0388 | ||
M1-6 | 15,476 | 7,002 | 1,642 | 3,326 | 7.8021 | 0.48% | 14,793 | 1,656 | 3,356 | 7.38 | 0.45% | 0.3207 | ||
M1-7 | 14,087 | 7,326 | 1,677 | 3,628 | 8.6532 | 0.52% | 13,012 | 1,702 | 3,692 | 7.79 | 0.46% | 0.2925 | ||
M1-8 | 10,550 | 10,360 | 1,649 | 3,595 | 8.5636 | 0.52% | 9,649 | 1,741 | 3,666 | 7.94 | 0.46% | 0.2545 | ||
M1-9 | 10,083 | 12,573 | 1,686 | 3,797 | 8.552 | 0.51% | 9,387 | 1,707 | 3,851 | 7.74 | 0.45% | 0.217 | ||
M1-10 | 9,753 | 13,313 | 1,728 | 3,838 | 8.10695 | 0.47% | 9,022 | 1,752 | 3,896 | 7.29 | 0.42% | 0.1199 | ||
M2-1 | 16,381 | 6,163 | 1,469 | 2,837 | 7.665 | 0.52% | 12,899 | 1,607 | 3,217 | 7.04 | 0.44% | 0.2445 | ||
M2-4 | 12,007 | 13,874 | 1,913 | 4,401 | 7.44879 | 0.39% | 11,393 | 1,931 | 4,473 | 6.84 | 0.35% | 0.0256 | ||
M2-5 | 11,956 | 4,875 | 1,681 | 3,378 | 5.5161 | 0.33% | 11,471 | 1,701 | 3,425 | 5.32 | 0.31% | 0.0751 | ||
M2-6 | 10,588 | 11,901 | 1,815 | 3,981 | 6.969 | 0.38% | 10,121 | 1,832 | 4,037 | 6.5 | 0.35% | 0.4809 | ||
M2-7 | 9,378 | 11,028 | 1,925 | 4,394 | 7.4543 | 0.39% | 8,755 | 1,949 | 4,445 | 6.81 | 0.35% | 0.43068 | ||
M2-8 | 10,701 | 13,992 | 1,981 | 4,628 | 6.748 | 0.34% | 10,385 | 1,992 | 4,662 | 6.04 | 0.30% | 0.3683 | ||
M2-9 | 10,015 | 14,100 | 1,910 | 4,462 | 6.87455 | 0.36% | 9,558 | 1,930 | 4,513 | 6.36 | 0.33% | 0.209 | ||
M2-10 | 7,693 | 17,742 | 2,116 | 5,043 | 7.107 | 0.34% | 7,338 | 2,132 | 5,081 | 6.67 | 0.31% | 0.1968 | ||
M3-1 | 11,650 | 8,758 | 508 | 2804 | 37.2752 | 7.34% | 5,248 | 1730 | 3626 | 7.21 | 0.42% | 0.0897 | Different QC standards | |
M3-2 | 13,357 | 7,961 | 79 | 2956 | 52.3007 | 66.20% | 3,282 | 1840 | 3864 | 6.63 | 0.36% | 0.0393 | Different QC standards | |
M3-3 | 17,057 | 8,026 | 80 | 2191 | 56.6009 | 70.75% | 3,712 | 1671 | 3153 | 7.64 | 0.46% | 0.0657 | Different QC standards | |
M3-4 | 12,286 | 14,068 | 1,952 | 4,798 | 7.8076 | 0.40% | 11,050 | 2,003 | 4,923 | 6.63 | 0.33% | 0.0974 | ||
M3-5 | 10,969 | 13,019 | 2,067 | 5,581 | 6.8651 | 0.33% | 10,353 | 2,089 | 5,646 | 6.28 | 0.30% | 0.111 | ||
M3-6 | 9,701 | 14,269 | 2,063 | 5,232 | 7.14014 | 0.35% | 9,255 | 2,079 | 5,262 | 6.76 | 0.33% | 0.1192 | ||
M3-7 | 9,916 | 15,978 | 1,953 | 4,852 | 7.55251 | 0.39% | 9,383 | 1,971 | 4,894 | 7.08 | 0.36% | 0.1687 | ||
M3-8 | 9,558 | 17,508 | 1,800 | 4,327 | 8.333 | 0.46% | 8,360 | 1,858 | 4,531 | 7.46 | 0.40% | 0.039 | ||
M3-9 | 14,314 | 11,334 | 1,842 | 4,390 | 6.4114 | 0.35% | 13,580 | 1,862 | 4,418 | 6.1 | 0.33% | 0.1709 | ||
M3-10 | 14,032 | 8,338 | 1,431 | 2,793 | 7.1158 | 0.50% | 12,939 | 1,462 | 2,852 | 6 | 0.44% | 0.2094 | ||
M5-1 | 10,091 | 15,509 | 1,763 | 3,943 | 7.523 | 0.43% | 9,462 | 1,787 | 4,002 | 6.821 | 0.38% | 0.2221 | ||
M5-2 | 12,351 | 14,539 | 1,750 | 4,068 | 7.497 | 0.43% | 11,304 | 1,787 | 4,126 | 6.968 | 0.39% | 0.2539 | ||
M5-3 | 11,822 | 11,308 | 1,778 | 3,886 | 7.16 | 0.40% | 11,280 | 1,795 | 3,928 | 6.74 | 0.38% | 0.2545 | ||
M5-4 | 9,365 | 15,557 | 1,846 | 4,185 | 7.037 | 0.38% | 8,907 | 1,866 | 4,230 | 6.506 | 0.35% | 0.0348 | ||
M5-5 | 8,260 | 16,884 | 1,783 | 3,862 | 7.553 | 0.42% | 7,776 | 1,805 | 3,914 | 6.918 | 0.38% | 0.097 | ||
M5-6 | 9,450 | 14,950 | 1,742 | 3,823 | 7.18 | 0.41% | 9,040 | 1,757 | 3,862 | 6.76 | 0.38% | 0.3012 | ||
M5-7 | 10,577 | 15,797 | 1,896 | 4,198 | 7.219 | 0.38% | 10,228 | 1,905 | 4,219 | 6.92 | 0.36% | 0.1257 | ||
M5-8 | 11,070 | 13,300 | 1,664 | 3,459 | 8.4 | 0.50% | 10,285 | 1,689 | 3,516 | 7.77 | 0.46% | 0.0973 | ||
M5-9 | 12,161 | 12,826 | 1,423 | 2,758 | 7.659 | 0.54% | 11,444 | 1,442 | 2,786 | 7.27 | 0.50% | 0.1911 | ||
M5-10 | 15,301 | 8,844 | 1,384 | 2,603 | 7.644 | 0.55% | 13836 | 1439 | 2716 | 7.041 | 0.49% | 0.3791 | ||
sum | 443756 | 441760 | 385405 | |||||||||||
mean | 11,678 | 11625.26316 | 1,655 | 3879.526316 | 10.69841684 | 4.19% | 10142.23684 | 1804.473684 | 4018.315789 | 6.844052632 | 0.38% |
To remove potential doublets, for PBMC samples, cells with UMI counts above 25,000 and detected genes above 5,000 are filtered out. Additionally, we applied DoubletFinder to identify potential doublets. After quality control, a total of 384,765 cells were remained.
library('patchwork')
library('ggplot2')
library('dplyr')
library('Seurat')
library('Matrix')
library('fields')
library('KernSmooth')
library('ROCR')
library('parallel')
library('DoubletFinder')
people <- c('1','2', '3', '5')
for (person in people){
for (timepoint in 1:10) {
data_dir = paste('/database/Results/0712_ATAC+RNA/M', person, '-', timepoint, '/outs/filtered_feature_bc_matrix/', sep = "")
print (data_dir)
sample <- Read10X(data.dir = data_dir)
seu_sample <- CreateSeuratObject(counts = sample$`Gene Expression`)
seu_sample <- NormalizeData(seu_sample)
seu_sample <- FindVariableFeatures(seu_sample, selection.method = "vst", nfeatures = 2000)
seu_sample <- ScaleData(seu_sample)
seu_sample <- RunPCA(seu_sample)
seu_sample <- FindNeighbors(seu_sample)
seu_sample <- FindClusters(seu_sample)
seu_sample <- RunUMAP(seu_sample, dims = 1:10)
num_cell <- nrow(seu_sample@meta.data)
title1 <- paste('Num_Cell:', num_cell, seq = "")
p <- DimPlot(seu_sample, reduction = "umap", label = TRUE) + ggtitle(title1)
sweep.res.list_sample <- paramSweep_v3(seu_sample, PCs = 1:10, sct = FALSE)
sweep.stats_sample <- summarizeSweep(sweep.res.list_sample, GT = FALSE)
bcmvn_sample <- find.pK(sweep.stats_sample)
mpK <- as.numeric(as.vector(bcmvn_sample$pK[which.max(bcmvn_sample$BCmetric)]))
print(paste("The best pK value of sample is:", mpK))
annotations <- seu_sample@meta.data$seurat_clusters
homotypic.prop <- modelHomotypic(annotations)
doublet_rate <- 0.0008*num_cell*0.01
nExp_poi <- round(doublet_rate*num_cell)
nExp_poi.adj <- round(nExp_poi*(1-homotypic.prop))
seu_sample <- doubletFinder_v3(seu_sample, PCs = 1:10, pN = 0.25, pK = mpK, nExp = nExp_poi, reuse.pANN = FALSE, sct = FALSE)
reuse.pANN_path <- paste('pANN_0.25_', mpK, '_', nExp_poi, sep = "")
seu_sample <- doubletFinder_v3(seu_sample, PCs = 1:10, pN = 0.25, pK = mpK, nExp = nExp_poi.adj, reuse.pANN = reuse.pANN_path, sct = FALSE)
group.by_path <- paste('DF.classifications_0.25_', mpK, '_', nExp_poi.adj, sep = "")
title2 <- paste('Singlet:', num_cell - nExp_poi.adj, ' Doublet:', nExp_poi.adj, seq = "")
q <- DimPlot(seu_sample, reduction = "umap", group.by = group.by_path) + ggtitle(title2)
name = paste('DoubletFinder_M', person, '-', timepoint, '.pdf', sep = "")
pdf(file = name)
print(p)
print(q)
dev.off ()
print(paste('DoubletFinder_M', person, '-', timepoint, ' DONE!', sep = ""))
}
}
To integrate cells into a shared space from different datasets for unsupervised clustering, we used the harmony algorithm (Korsunsky et al., 2019) to do batch effect correction. Batch effect correction & Clustering and annotation
The cell type ratio is calculated by dividing the number of cells of a particular cell type at a given point in time by the number of cells at a given point in time in a given participant. Comparing immune cell proportion
Mashr is used to estimate the role of each gene at each time point, allowing cross-time sharing and gene specific expression at specific time points mashr
Through feature extraction, hierarchical clustering was carried out according to the slope, direction, zero percentage and cross-point slope of genes at ten timepoints.The degree of cohesion and separation were calculated for each clustering. Based on these genes, enriched GO terms and KEGG were then acquired for each genes using R package clusterProfiler following the default parameters. Annotation R package “org.Hs.eg.db” was used to map gene identifiers. clusterProfiler
sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
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] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rmarkdown_2.11 knitr_1.37 workflowr_1.7.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 highr_0.9 compiler_4.1.1 pillar_1.6.4
[5] bslib_0.3.1 later_1.2.0 git2r_0.29.0 jquerylib_0.1.4
[9] tools_4.1.1 getPass_0.2-2 digest_0.6.29 jsonlite_1.7.2
[13] evaluate_0.14 tibble_3.1.6 lifecycle_1.0.1 pkgconfig_2.0.3
[17] rlang_0.4.12 rstudioapi_0.13 yaml_2.2.1 xfun_0.29
[21] fastmap_1.1.0 httr_1.4.2 stringr_1.4.0 sass_0.4.0
[25] fs_1.5.2 vctrs_0.3.8 rprojroot_2.0.2 glue_1.4.2
[29] R6_2.5.1 processx_3.5.2 fansi_0.5.0 callr_3.7.0
[33] magrittr_2.0.1 whisker_0.4 ps_1.6.0 promises_1.2.0.1
[37] htmltools_0.5.2 ellipsis_0.3.2 httpuv_1.6.4 utf8_1.2.2
[41] stringi_1.7.6 crayon_1.4.2