Last updated: 2018-12-16

workflowr checks: (Click a bullet for more information)
  • R Markdown file: uncommitted changes The R Markdown is untracked by Git. 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.

  • Environment: empty

    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.

  • Seed: 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.

  • Session information: recorded

    Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

  • Repository version: 6b6ebde

    Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

    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:    .Rhistory
        Ignored:    .Rproj.user/
        Ignored:    analysis/Quality_metrics_cache/
        Ignored:    analysis/figure/
    
    Untracked files:
        Untracked:  analysis/DEseq2-LRT.Rmd
        Untracked:  analysis/DEseq2-standard.Rmd
        Untracked:  analysis/EdgeR-QLF.Rmd
        Untracked:  docs/figure/DEseq2-standard.Rmd/
        Untracked:  docs/figure/EdgeR-QLF.Rmd/
    
    Unstaged changes:
        Modified:   analysis/DE_analysis.Rmd
        Modified:   analysis/Quality_metrics.Rmd
        Modified:   analysis/index.Rmd
    
    
    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.

Load data

source("code/summary_functions.R")
library(dplyr)
load("data/DE_input.Rd")
glocus <- "VPS45"
dim(dm)[1]
NULL
gcount <- dm[1:(dim(dm)[1]-76), colnames(dm1dfagg)[dm1dfagg[glocus,] >0 & nlocus==1]]
# negative control cells defined as neg gRNA targeted cells
ncount <- dm[1:(dim(dm)[1]-76), colnames(dm1dfagg)[dm1dfagg["neg",] >0 & nlocus==1]]
coldata <- data.frame(row.names = c(colnames(gcount),colnames(ncount)),     
                      condition=c(rep('G',dim(gcount)[2]),rep('N',dim(ncount)[2])))
countall <- cbind(gcount,ncount)
totalcount <- apply(countall,1,sum)
cellpercent <-  apply(countall,1,function(x) length(x[x>0])/length(x))

run deseq2 standard function

library(DESeq2)
run_deseq2 <- function(dds) {
  dds = estimateSizeFactors(dds)
  ddsWARD = DESeq(dds)
  resWARD = results(ddsWARD)
  summ_pvalues(resWARD$pvalue[!is.na(resWARD$pvalue)])
  resSigWARD <- subset(resWARD, padj < 0.1)
  print(paste0("There are ",dim(resSigWARD)[1], " genes passed FDR <0.1 cutoff"))
  print(knitr::kable(signif(as.matrix(head(resWARD[order(resWARD$pvalue),])),digit=2)))
  return(resWARD)
}

Run DEseq2–No filtering

dds = DESeqDataSetFromMatrix(countData = countall, colData = coldata,design = ~condition)
res <- run_deseq2(dds)

Expand here to see past versions of deseq2-1.png:
Version Author Date
49ecf6e simingz 2018-12-16
[1] "There are 0 genes passed FDR <0.1 cutoff"

                      baseMean   log2FoldChange   lfcSE   stat    pvalue   padj
-------------------  ---------  ---------------  ------  -----  --------  -----
ENSG00000104722.13        2.60            -1.70   0.380   -4.5   7.4e-06   0.12
ENSG00000175899.14        0.88            -1.60   0.420   -3.8   1.5e-04   1.00
ENSG00000184900.15        3.90             0.43   0.120    3.6   3.7e-04   1.00
ENSG00000131669.9         0.99             0.82   0.230    3.5   4.3e-04   1.00
ENSG00000175390.13       16.00            -0.21   0.065   -3.3   1.1e-03   1.00
ENSG00000101198.14        1.80            -1.10   0.340   -3.2   1.3e-03   1.00

Run DEseq2–at least one cell UMI > 0

dds = DESeqDataSetFromMatrix(countData = countall[totalcount>0,], colData = coldata,design = ~condition)
res <- run_deseq2(dds)

[1] "There are 0 genes passed FDR <0.1 cutoff"

                      baseMean   log2FoldChange   lfcSE   stat    pvalue   padj
-------------------  ---------  ---------------  ------  -----  --------  -----
ENSG00000104722.13        2.60            -1.70   0.380   -4.5   7.4e-06   0.12
ENSG00000175899.14        0.88            -1.60   0.420   -3.8   1.5e-04   1.00
ENSG00000184900.15        3.90             0.43   0.120    3.6   3.7e-04   1.00
ENSG00000131669.9         0.99             0.82   0.230    3.5   4.3e-04   1.00
ENSG00000175390.13       16.00            -0.21   0.065   -3.3   1.1e-03   1.00
ENSG00000101198.14        1.80            -1.10   0.340   -3.2   1.3e-03   1.00

Run DEseq2–3% cells with UMI > 0

dds = DESeqDataSetFromMatrix(countData = countall[cellpercent > 0.03,], colData = coldata,design = ~condition)
res <- run_deseq2(dds)

[1] "There are 1 genes passed FDR <0.1 cutoff"

                      baseMean   log2FoldChange   lfcSE   stat    pvalue    padj
-------------------  ---------  ---------------  ------  -----  --------  ------
ENSG00000104722.13        2.60            -1.70   0.380   -4.5   7.4e-06   0.088
ENSG00000175899.14        0.88            -1.60   0.420   -3.9   1.1e-04   0.650
ENSG00000184900.15        3.90             0.43   0.120    3.5   3.9e-04   1.000
ENSG00000131669.9         0.99             0.82   0.240    3.4   6.3e-04   1.000
ENSG00000175390.13       16.00            -0.21   0.065   -3.3   1.0e-03   1.000
ENSG00000101198.14        1.80            -1.10   0.340   -3.3   1.1e-03   1.000

Run DEseq2–10% cells with UMI > 0

dds = DESeqDataSetFromMatrix(countData = countall[cellpercent > 0.1,], colData = coldata,design = ~condition)
res <- run_deseq2(dds)

[1] "There are 1 genes passed FDR <0.1 cutoff"

                      baseMean   log2FoldChange   lfcSE   stat    pvalue    padj
-------------------  ---------  ---------------  ------  -----  --------  ------
ENSG00000104722.13        2.60            -1.70   0.380   -4.5   7.4e-06   0.071
ENSG00000175899.14        0.88            -1.60   0.410   -3.9   9.0e-05   0.430
ENSG00000184900.15        3.90             0.43   0.120    3.5   3.9e-04   1.000
ENSG00000131669.9         0.99             0.82   0.240    3.4   5.9e-04   1.000
ENSG00000175390.13       16.00            -0.21   0.065   -3.3   1.1e-03   1.000
ENSG00000101198.14        1.80            -1.10   0.340   -3.2   1.3e-03   1.000

Run DEseq2–20% cells with UMI > 0

dds = DESeqDataSetFromMatrix(countData = countall[cellpercent > 0.2,], colData = coldata,design = ~condition)
res <- run_deseq2(dds)

[1] "There are 1 genes passed FDR <0.1 cutoff"

                      baseMean   log2FoldChange   lfcSE   stat    pvalue    padj
-------------------  ---------  ---------------  ------  -----  --------  ------
ENSG00000104722.13        2.60            -1.70   0.380   -4.5   7.4e-06   0.056
ENSG00000175899.14        0.88            -1.60   0.420   -3.8   1.5e-04   0.570
ENSG00000184900.15        3.90             0.43   0.120    3.5   3.9e-04   0.990
ENSG00000131669.9         0.99             0.82   0.240    3.5   5.6e-04   1.000
ENSG00000175390.13       16.00            -0.21   0.066   -3.3   1.1e-03   1.000
ENSG00000101198.14        1.80            -1.10   0.340   -3.2   1.3e-03   1.000

Parameters used

  • We used data processed after QC step here.
  • targeted locus, choose VPS45.

Session information

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin14.5.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.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] grid      parallel  stats4    stats     graphics  grDevices utils    
 [8] datasets  methods   base     

other attached packages:
 [1] gridExtra_2.3               lattice_0.20-35            
 [3] DESeq2_1.20.0               SummarizedExperiment_1.10.1
 [5] DelayedArray_0.6.6          BiocParallel_1.14.2        
 [7] matrixStats_0.54.0          Biobase_2.40.0             
 [9] GenomicRanges_1.32.7        GenomeInfoDb_1.16.0        
[11] IRanges_2.14.12             S4Vectors_0.18.3           
[13] BiocGenerics_0.26.0         Matrix_1.2-14              
[15] dplyr_0.7.6                

loaded via a namespace (and not attached):
 [1] bit64_0.9-7            splines_3.5.1          R.utils_2.7.0         
 [4] Formula_1.2-3          assertthat_0.2.0       highr_0.7             
 [7] latticeExtra_0.6-28    blob_1.1.1             GenomeInfoDbData_1.1.0
[10] yaml_2.2.0             RSQLite_2.1.1          pillar_1.3.0          
[13] backports_1.1.2        glue_1.3.0             digest_0.6.18         
[16] RColorBrewer_1.1-2     XVector_0.20.0         checkmate_1.8.5       
[19] colorspace_1.3-2       htmltools_0.3.6        R.oo_1.22.0           
[22] plyr_1.8.4             XML_3.98-1.16          pkgconfig_2.0.2       
[25] genefilter_1.62.0      zlibbioc_1.26.0        xtable_1.8-3          
[28] purrr_0.2.5            scales_1.0.0           whisker_0.3-2         
[31] annotate_1.58.0        git2r_0.23.0           tibble_1.4.2          
[34] htmlTable_1.12         ggplot2_3.1.0          nnet_7.3-12           
[37] lazyeval_0.2.1         survival_2.42-6        magrittr_1.5          
[40] crayon_1.3.4           memoise_1.1.0          evaluate_0.12         
[43] R.methodsS3_1.7.1      foreign_0.8-71         tools_3.5.1           
[46] data.table_1.11.6      stringr_1.3.1          locfit_1.5-9.1        
[49] munsell_0.5.0          cluster_2.0.7-1        AnnotationDbi_1.42.1  
[52] bindrcpp_0.2.2         compiler_3.5.1         rlang_0.3.0.1         
[55] RCurl_1.95-4.11        rstudioapi_0.8         htmlwidgets_1.2       
[58] bitops_1.0-6           base64enc_0.1-3        rmarkdown_1.10        
[61] gtable_0.2.0           DBI_1.0.0              R6_2.3.0              
[64] knitr_1.20             bit_1.1-12             bindr_0.1.1           
[67] Hmisc_4.1-1            workflowr_1.1.1        rprojroot_1.3-2       
[70] stringi_1.2.4          Rcpp_1.0.0             geneplotter_1.58.0    
[73] rpart_4.1-13           acepack_1.4.1          tidyselect_0.2.4      

This reproducible R Markdown analysis was created with workflowr 1.1.1