Last updated: 2022-03-02

Checks: 5 2

Knit directory: BAUH_2020_MND-single-cell/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run 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.

The command set.seed(12345) 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
/mnt/beegfs/mccarthy/backed_up/general/cazodi/Projects/BAUH_2020_MND-single-cell/output/pilot3.0_MN/ ../output/pilot3.0_MN

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 3f19b81. 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:    .RData
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    .cache/
    Ignored:    .config/
    Ignored:    .nv/
    Ignored:    .snakemake/
    Ignored:    BAUH_2020_MND-single-cell.Rproj
    Ignored:    GRCh38_turboGFP-RFP_reference/
    Ignored:    Homo_sapiens.GRCh38.turboGFP/
    Ignored:    Rplots.pdf
    Ignored:    data/1-s2.0-S0002929720300781-main.pdf
    Ignored:    data/2103.11251.pdf
    Ignored:    data/3M-february-2018.txt
    Ignored:    data/737K-august-2016.txt
    Ignored:    data/STAR_index/
    Ignored:    data/STAR_output/
    Ignored:    data/genome1K.phase3.SNP_AF5e2.chr1toX.hg38.log
    Ignored:    data/genome1K.phase3.SNP_AF5e2.chr1toX.hg38.recode.sort.vcf.gz
    Ignored:    data/genome1K.phase3.SNP_AF5e2.chr1toX.hg38.recode.sort.vcf.gz.csi
    Ignored:    data/genome1K.phase3.SNP_AF5e2.chr1toX.hg38.recode.vcf.gz
    Ignored:    data/genome1K.phase3.SNP_AF5e2.chr1toX.hg38.sort.vcf.gz
    Ignored:    data/genome1K.phase3.SNP_AF5e2.chr1toX.hg38.sort.vcf.gz.csi
    Ignored:    data/genome1K.phase3.SNP_AF5e2.chr1toX.hg38.vcf.gz
    Ignored:    data/genome1k.chr22.log
    Ignored:    data/genome1k.chr22.recode.vcf
    Ignored:    data/pilot3_aggr-experiments.csv
    Ignored:    data/pilot3_donors.txt
    Ignored:    data/s41588-018-0268-8.pdf
    Ignored:    data/tr2g_hs.tsv
    Ignored:    logs/
    Ignored:    output/2021-04-27_pilot2_nCells-per-donor.pdf
    Ignored:    output/2021-08-03_pilot2_nCells-per-donor.pdf
    Ignored:    output/CB-scRNAv31-GEX-lib01_QC_metadata.txt
    Ignored:    output/CB-scRNAv31-GEX-lib02_QC_metadata.txt
    Ignored:    output/pilot1_starsoloED/
    Ignored:    output/pilot2.1_gex/
    Ignored:    output/pilot2_HTO-2/
    Ignored:    output/pilot2_HTO/
    Ignored:    output/pilot2_gex_MAF01-152/
    Ignored:    output/pilot2_gex_MAF01/
    Ignored:    output/pilot2_gex_starsolo/
    Ignored:    output/pilot2_gex_starsoloED/
    Ignored:    output/pilot2_gex_starsoloED_GFP/
    Ignored:    output/pilot2_testing/
    Ignored:    output/pilot3.0/
    Ignored:    output/pilot3.0_MN/
    Ignored:    output/pilot3.0_captures-separate/
    Ignored:    output/pilot3.0_iPSC/
    Ignored:    output/pilot3_Lenti/
    Ignored:    references/Homo_sapiens.GRCh38.turboGFP.bed
    Ignored:    references/Homo_sapiens.GRCh38.turboGFP.fa
    Ignored:    references/Homo_sapiens.GRCh38.turboGFP.fa.fai
    Ignored:    references/Homo_sapiens.GRCh38.turboGFP.filtered.gtf
    Ignored:    references/Homo_sapiens.GRCh38.turboGFP.gtf
    Ignored:    references/SAindex/
    Ignored:    references/geno_test.vcf.gz
    Ignored:    references/pilot3/
    Ignored:    references/test
    Ignored:    references/turboGFP.fa
    Ignored:    references/turboGFP.gtf
    Ignored:    references/turboRFP.fa
    Ignored:    testupset_plot.pdf
    Ignored:    testvenn_diagram.pdf
    Ignored:    workflow/rules/

Untracked files:
    Untracked:  Capture5-GEX/
    Untracked:  __Capture5-GEX.mro
    Untracked:  analysis/2022-03-02_pilot3_ensemble-cellcalling.Rmd
    Untracked:  cellbender.dockerfile
    Untracked:  hwe1e-05_maf05_vcf_stats.txt
    Untracked:  hwe1e-05_vcf_stats.txt
    Untracked:  testbarcodes.txt
    Untracked:  testcombination_matrix.rds

Unstaged changes:
    Modified:   analysis/2022-01-07_pilot3_Cell-Calling-Comparison.Rmd
    Modified:   analysis/2022-02-28_pilot3_Cell-demultiplexing-Lenti.Rmd
    Modified:   analysis/2022-03-01_pilot3_cellbender.Rmd
    Modified:   analysis/2022-03-01_pilot3_dropkick.Rmd
    Modified:   analysis/index.Rmd
    Modified:   code/get_barcodes_to_use.R
    Modified:   config/config_pilot3.0_MN.yml
    Modified:   config/config_pilot3.0_iPSC.yml
    Modified:   workflow/Snakefile
    Modified:   workflow/rules_cellcalling.smk
    Modified:   workflow/rules_demultiplexing.smk

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/2022-01-07_pilot3_Cell-Calling-Comparison.Rmd) and HTML (public/2022-01-07_pilot3_Cell-Calling-Comparison.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 799d504 cazodi 2022-02-04 updates since server crash
Rmd 88c5ba9 cazodi 2022-01-25 add picard
Rmd 8e5ef43 cazodi 2022-01-12 at2 analysis update
Rmd f75c7ba cazodi 2022-01-11 updated pipeline for pilot3

suppressPackageStartupMessages({
  library(ggplot2)
  library(ggvenn)
  library(ComplexHeatmap)
  library(Seurat)
})
rerun <- TRUE
wd <- "/mnt/beegfs/mccarthy/backed_up/general/cazodi/Projects/BAUH_2020_MND-single-cell/output/pilot3.0_MN/"
load_cells_from_list <- function(path){
  for (i in seq(1, 4)){
    tmp <- scan(paste0(wd, gsub("Capture1", paste0("Capture", i), path)), what="character")
    tmp <- paste0(tmp, "-c", i)
    if (i == 1){
      all <- tmp
    } else{ all <- c(all, tmp)}
  }
  return(all)
}

load_cells_from_dQC <- function(path, umi=1000){
  for (i in seq(1, 4)){
    df <- read.table(paste0(wd, gsub("Capture1", paste0("Capture", i), path)), sep=" ")
    df <- df[df$umi >= umi, ]
    tmp <- row.names(df)
    tmp <- paste0(tmp, "-c", i)
    if (i == 1){
      all <- tmp
    } else{ all <- c(all, tmp)}
  }
  return(all)
}


load_cells_with_turboGFP <- function(path, min=1, rerun=FALSE) {
  for (i in seq(1, 4)){
    message("Processing Capture", i)
    rawpath <- paste0(wd, gsub("Capture1", paste0("Capture", i), path))
    if(rerun) {
      rawCounts <- Seurat::Read10X(rawpath)
      gfpCounts <- as.data.frame(list(GFP = rawCounts["turboGFP", ]))
      rm(rawCounts)
      saveRDS(gfpCounts, paste0(rawpath, "TurboGFP-counts.rds"))
    } else{
      gfpCounts <- readRDS(paste0(rawpath, "TurboGFP-counts.rds"))
    }
    tmp <- row.names(gfpCounts)[which(gfpCounts$GFP >= min)]
    tmp <- paste0(tmp, "-c", i)
    if (i == 1){
      all <- tmp
    } else{ all <- c(all, tmp)}
  }
  return(all)
}

Compare cells called by different methods

Only looking at Sample 1 GEX: SI-TT-D6: Unfixed (HBSS) cells with TurboGFT tag (target 20k cells) results as the fixed cells were poor quality.

cellranger <- load_cells_from_list("01_cellcalling-cellRanger/Capture1-GEX/outs/filtered_feature_bc_matrix/barcodes.tsv.gz")
dropkick <- load_cells_from_list("01_cellcalling-dropkick/Capture1-GEX/raw_feature_bc_matrix_dropkick_barcodes.txt")
cellbender <- load_cells_from_list("01_cellcalling-cellbender/Capture1-GEX/matrix_cell_barcodes.csv")
dropletqc <- load_cells_from_dQC("01_cellcalling-dropletQC/Capture1-GEX/dropletQC_cell_barcodes.tsv")
turbogfp <- load_cells_with_turboGFP("01_cellcalling-cellRanger/Capture1-GEX/outs/raw_feature_bc_matrix/", rerun=FALSE)
Processing Capture1
Processing Capture2
Processing Capture3
Processing Capture4

Overlap in barcodes called as cells:

cellList <- list(CellRanger = cellranger,
                 dropkick = dropkick,
                 cellbender = cellbender,
                 DropletQC = dropletqc)

ggvenn(cellList, stroke_size = 0.5, set_name_size = 4, text_size = 3,
       fill_color = c("#0073C2FF", "#EFC000FF", "#868686FF", "#CD534CFF")) 
Venn diagram of overlap in barcodes called as cells by different methods.

Venn diagram of overlap in barcodes called as cells by different methods.

df <- as.data.frame(list(method=c("CellRanger", "dropkick", "DropletQC", "cellbender"),
                         nCells=c(length(cellranger), length(dropkick), 
                                  length(dropletqc), length(cellbender)),
                         nGFP=c(sum(cellranger %in% turbogfp),
                                sum(dropkick %in% turbogfp),
                                sum(dropletqc %in% turbogfp),
                                sum(cellbender %in% turbogfp))))
df$percent_with_GFP <- round(df$nGFP / df$nCells *100, 2)

df %>% arrange(-percent_with_GFP)
      method nCells nGFP percent_with_GFP
1  DropletQC  25961 1564             6.02
2   dropkick  12546  733             5.84
3 cellbender  45501 2118             4.65
4 CellRanger  47010 2092             4.45

Upset plots

m1 <- make_comb_mat(cellList)
UpSet(m1, set_order = c("CellRanger", "cellbender", "dropkick", "DropletQC"),
      comb_col = c("#B0DBF1", "#253DA1", "#1D2570", "#000137")[comb_degree(m1)])


sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux 8.5 (Ootpa)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.12.so

locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8   
 [7] LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] SeuratObject_4.0.4    Seurat_4.0.6          ComplexHeatmap_2.10.0
[4] ggvenn_0.1.9          dplyr_1.0.7           ggplot2_3.3.5        

loaded via a namespace (and not attached):
  [1] circlize_0.4.13       workflowr_1.6.2       plyr_1.8.6           
  [4] igraph_1.2.11         lazyeval_0.2.2        splines_4.1.1        
  [7] listenv_0.8.0         scattermore_0.7       digest_0.6.29        
 [10] foreach_1.5.1         htmltools_0.5.2       magick_2.7.3         
 [13] fansi_1.0.0           magrittr_2.0.1        tensor_1.5           
 [16] cluster_2.1.2         doParallel_1.0.16     ROCR_1.0-11          
 [19] globals_0.14.0        matrixStats_0.61.0    spatstat.sparse_2.1-0
 [22] colorspace_2.0-2      ggrepel_0.9.1         xfun_0.28            
 [25] crayon_1.4.2          jsonlite_1.7.2        spatstat.data_2.1-2  
 [28] survival_3.2-13       zoo_1.8-9             iterators_1.0.13     
 [31] glue_1.6.0            polyclip_1.10-0       gtable_0.3.0         
 [34] leiden_0.3.9          GetoptLong_1.0.5      future.apply_1.8.1   
 [37] shape_1.4.6           BiocGenerics_0.40.0   abind_1.4-5          
 [40] scales_1.1.1          DBI_1.1.1             miniUI_0.1.1.1       
 [43] Rcpp_1.0.7            viridisLite_0.4.0     xtable_1.8-4         
 [46] clue_0.3-60           reticulate_1.22       spatstat.core_2.3-2  
 [49] stats4_4.1.1          htmlwidgets_1.5.4     httr_1.4.2           
 [52] RColorBrewer_1.1-2    ellipsis_0.3.2        ica_1.0-2            
 [55] pkgconfig_2.0.3       farver_2.1.0          sass_0.4.0           
 [58] uwot_0.1.11           deldir_1.0-6          utf8_1.2.2           
 [61] tidyselect_1.1.1      labeling_0.4.2        rlang_0.4.12         
 [64] reshape2_1.4.4        later_1.3.0           munsell_0.5.0        
 [67] tools_4.1.1           generics_0.1.1        ggridges_0.5.3       
 [70] evaluate_0.14         stringr_1.4.0         fastmap_1.1.0        
 [73] yaml_2.2.1            goftest_1.2-3         knitr_1.36           
 [76] fs_1.5.2              fitdistrplus_1.1-6    purrr_0.3.4          
 [79] RANN_2.6.1            pbapply_1.5-0         future_1.23.0        
 [82] nlme_3.1-153          whisker_0.4           mime_0.12            
 [85] compiler_4.1.1        plotly_4.10.0         png_0.1-7            
 [88] spatstat.utils_2.3-0  tibble_3.1.6          bslib_0.3.1          
 [91] stringi_1.7.6         highr_0.9             lattice_0.20-45      
 [94] Matrix_1.4-0          vctrs_0.3.8           pillar_1.6.4         
 [97] lifecycle_1.0.1       spatstat.geom_2.3-1   lmtest_0.9-39        
[100] jquerylib_0.1.4       GlobalOptions_0.1.2   RcppAnnoy_0.0.19     
[103] data.table_1.14.2     cowplot_1.1.1         irlba_2.3.5          
[106] httpuv_1.6.5          patchwork_1.1.1       R6_2.5.1             
[109] promises_1.2.0.1      KernSmooth_2.23-20    gridExtra_2.3        
[112] IRanges_2.28.0        parallelly_1.30.0     codetools_0.2-18     
[115] MASS_7.3-54           assertthat_0.2.1      rprojroot_2.0.2      
[118] rjson_0.2.20          withr_2.4.3           sctransform_0.3.2    
[121] S4Vectors_0.32.3      mgcv_1.8-38           parallel_4.1.1       
[124] rpart_4.1-15          tidyr_1.1.4           rmarkdown_2.11       
[127] Rtsne_0.15            git2r_0.29.0          shiny_1.7.1