Last updated: 2019-02-14
workflowr checks: (Click a bullet for more information)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.
set.seed(20181119)
The command set.seed(20181119)
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.
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/enrichment.Rmd
Untracked: data/SNP_200000.txt
Untracked: data/SNP_50000.txt
Untracked: data/SNP_500000.txt
Unstaged changes:
Modified: .gitignore
Modified: analysis/DEseq2-LRT.Rmd
Modified: analysis/Quality_metrics.Rmd
Modified: analysis/index.Rmd
Modified: code/summary_functions.R
Modified: cropseq.Rproj
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. File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 49ecf6e | simingz | 2018-12-16 | explore filtering |
Rmd | 6b6ebde | simingz | 2018-12-14 | fix Xin’s comment for qc |
html | 6b6ebde | simingz | 2018-12-14 | fix Xin’s comment for qc |
Rmd | 8ce79ed | simingz | 2018-12-05 | de_anlysis |
html | 8ce79ed | simingz | 2018-12-05 | de_anlysis |
Rmd | 275d5d8 | simingz | 2018-12-02 | qc |
html | 275d5d8 | simingz | 2018-12-02 | qc |
Rmd | f5dda86 | simingz | 2018-12-02 | qc |
html | f5dda86 | simingz | 2018-12-02 | qc |
Rmd | 8754cad | szhao06 | 2018-12-02 | qc |
html | 8754cad | szhao06 | 2018-12-02 | qc |
Rmd | c206c9d | szhao06 | 2018-12-01 | qc |
Rmd | fdd5647 | szhao06 | 2018-12-01 | qc |
html | fdd5647 | szhao06 | 2018-12-01 | qc |
library(Matrix)
matrix_dir = "/project2/xinhe/simingz/CROP-seq/data_from_Siwei/Xin_scRNA_seq_05Nov2018/filtered_gene_bc_matrices/CellRanger_index/"
matrix.path <- paste0(matrix_dir, "matrix.mtx")
dm <- readMM(file = matrix.path)
dm1 <- tail(dm,n=76)
length(colSums(dm1)[colSums(dm1)==1])
[1] 440
From Alan’s cellranger run:
matrix_dir1 = "/project2/xinhe/simingz/CROP-seq/NSC0507_cellranger/outs/filtered_gene_bc_matrices/cellranger_ref/"
matrix.path1 <- paste0(matrix_dir1, "matrix.mtx")
mattemp1 <- readMM(file = matrix.path1)
mattemp11 <- tail(mattemp1,n=76)
length(colSums(mattemp11)[colSums(mattemp11)==1])
[1] 266
matrix_dir2 = "/project2/xinhe/simingz/CROP-seq/NSC08_cellranger/outs/filtered_gene_bc_matrices/cellranger_ref/"
matrix.path2 <- paste0(matrix_dir2, "matrix.mtx")
mattemp2 <- readMM(file = matrix.path2)
mattemp21 <- tail(mattemp2,n=76)
length(colSums(mattemp21)[colSums(mattemp21)==1])
[1] 190
Note: in Alan’s original analysis conversion from h5 to csv step didn’t seem to work properly. if starting from matrix.mtx files. Siwei and Alan’s analyses gave the same results. So from now on, we will always start from Siwei’s matrix.mtx file.
barcode.path <- paste0(matrix_dir, "barcodes.tsv")
features.path <- paste0(matrix_dir, "genes.tsv")
feature.names = read.delim(features.path, header = FALSE,
stringsAsFactors = FALSE)
barcode.names = read.delim(barcode.path, header = FALSE,
stringsAsFactors = FALSE)
colnames(dm) = barcode.names$V1
rownames(dm) = feature.names$V2
dm1 <- tail(dm,n=76)
hist(apply(dm1, 2, function(x) length(x[x>0])),breaks=300,xlim=c(0,15),ylim=c(0,2500), main="Distribution of number of gRNA types per cell", xlab= "# gRNA type per cell")
library(dplyr)
dm1df <- as.data.frame(as.matrix(dm1))
dm1df$label = sapply(strsplit(rownames(dm1),split = '_'), function(x){x[1]})
dm1dfagg = as.data.frame(dm1df %>% group_by(label) %>% summarise_all(funs(sum)))
row.names(dm1dfagg) =dm1dfagg$label
dm1dfagg$label =NULL
ncell <- apply(dm1dfagg,1, function (x) length(x[x>=1]))
barplot(ncell,las=2,cex.lab=1, main= "# cells targted for each locus")
Version | Author | Date |
---|---|---|
8754cad | szhao06 | 2018-12-02 |
fdd5647 | szhao06 | 2018-12-01 |
# Singletons (cells with only 1 gRNA)
nlocus <- apply(dm1dfagg, 2, function (x) length(x[x>=1]))
hist(nlocus,breaks=100, main="number of targeted locus each cell")
Version | Author | Date |
---|---|---|
8754cad | szhao06 | 2018-12-02 |
dm1dfagg.uni= dm1dfagg[,nlocus==1]
ncell.uni <- apply(dm1dfagg.uni,1, function (x) length(x[x>=1]))
barplot(ncell.uni,las=2,cex.lab=1,main= "# cells uniquely targted for each locus")
Version | Author | Date |
---|---|---|
8754cad | szhao06 | 2018-12-02 |
# Singletons (cells with only 1 targeted locus)
dm.uni <- dm[,nlocus==1]
nUMI <- colSums(dm.uni)
hist(nUMI,breaks=100,xlim=c(0,1e5))
Version | Author | Date |
---|---|---|
8754cad | szhao06 | 2018-12-02 |
# Singletons (cells with only 1 targeted locus)
nUMIgRNA <- colSums(tail(dm.uni,76))
hist(nUMIgRNA,breaks=500,xlim=c(0,20), main = "Histogram of nUMI for gRNAs")
Version | Author | Date |
---|---|---|
6b6ebde | simingz | 2018-12-14 |
save(dm,dm1dfagg,nlocus, file="data/DE_input.Rd")
Parameters used:
for a cell to be considered targeted uniquely at a locus: total read counts for the 3 gRNAs targeting that locus >1, total read counts for gRNA of other locus=0.
negative control: neg_EGFP and neg_CTRL are pooled together.
cells to be exluded due to low total UMI count: no filtering
sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)
Matrix products: default
BLAS/LAPACK: /software/openblas-0.2.19-el7-x86_64/lib/libopenblas_haswellp-r0.2.19.so
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] dplyr_0.7.8 Matrix_1.2-15
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 bindr_0.1.1 knitr_1.20
[4] whisker_0.3-2 magrittr_1.5 workflowr_1.1.1
[7] tidyselect_0.2.5 lattice_0.20-38 R6_2.3.0
[10] rlang_0.3.1 stringr_1.4.0 tools_3.5.1
[13] grid_3.5.1 R.oo_1.22.0 git2r_0.23.0
[16] htmltools_0.3.6 yaml_2.2.0 rprojroot_1.3-2
[19] digest_0.6.18 assertthat_0.2.0 tibble_2.0.1
[22] crayon_1.3.4 bindrcpp_0.2.2 purrr_0.2.5
[25] R.utils_2.7.0 codetools_0.2-15 glue_1.3.0
[28] evaluate_0.12 rmarkdown_1.10 stringi_1.3.1
[31] pillar_1.3.1 compiler_3.5.1 backports_1.1.2
[34] R.methodsS3_1.7.1 pkgconfig_2.0.2
This reproducible R Markdown analysis was created with workflowr 1.1.1