Loading count matrix

sgA = read.table(file = "raw/CRISPR_WG_libraryA.txt", row.names = 1, header = TRUE, sep = "\t")
control = filter(sgA, str_detect(Gene, 'NonTargeting')) %>% select(-Gene) %>% 
    summarise_each(function(z) sum(z > 5)/length(z)) %>% unlist()
sgRNA = filter(sgA, str_detect(Gene, 'NonTargeting', negate = TRUE)) %>% 
    select(-Gene) %>% 
    summarise_each(function(z) sum(z > 5)/length(z)) %>% unlist()
ATable =  data.frame(name = names(sgRNA), library = "A", sgRNA, control)

sgB = read.table(file = "raw/CRISPR_WG_libraryB.txt", row.names = 1, header = TRUE, sep = "\t")
control = filter(sgB, str_detect(Gene, 'NonTargeting')) %>% select(-Gene) %>% 
    summarise_each(function(z) sum(z > 5)/length(z)) %>% unlist()
sgRNA = filter(sgB, str_detect(Gene, 'NonTargeting', negate = TRUE)) %>% 
    select(-Gene) %>% 
    summarise_each(function(z) sum(z > 5)/length(z)) %>% unlist()
BTable =  data.frame(name = names(sgRNA), library = "B", sgRNA, control)

abTable = bind_rows(ATable, BTable)

group = rep("vivo", nrow(abTable))
group[grep("plasmid", abTable$name)] = "plasmid"
group[grep("Pre", abTable$name)] = "Pre"
group[grep("vitro", abTable$name)] = "vitro"

condition = rep("", nrow(abTable))
condition[grep("plasmid", abTable$name)] = "plasmid"
condition[grep("MA", abTable$name)] = "MA"
condition[grep("HM", abTable$name)] = "HM"

abTable = data.frame(abTable, group, condition)

head(abTable)
                     name library     sgRNA control   group condition
A_plasmid       A_plasmid       A 0.9780584   0.976 plasmid   plasmid
MA_A_Pre_1     MA_A_Pre_1       A 0.7477102   0.775     Pre        MA
MA_A_Pre_2     MA_A_Pre_2       A 0.7291897   0.760     Pre        MA
HM_A_Pre_1     HM_A_Pre_1       A 0.8899342   0.901     Pre        HM
HM_A_Pre_2     HM_A_Pre_2       A 0.8741350   0.882     Pre        HM
MA_A_vitro_1 MA_A_vitro_1       A 0.6501314   0.674   vitro        MA
table(condition, group)
         group
condition Pre plasmid vitro vivo
  HM        3       0     4   40
  MA        4       0     4   40
  plasmid   0       2     0    0

coverage

p <- ggplot(abTable, aes(x = group, y = sgRNA, color = condition))
p <- p + theme_bw() + labs(x = "condition", y = "Fraction of sgRNA covered\n(> 5x)", title = "targeting sgRNA")
p <- p + theme(plot.title = element_text(hjust = 0.5)) + geom_boxplot()
print(p)

p <- ggplot(abTable, aes(x = group, y = control, color = condition))
p <- p + theme_bw() + labs(x = "condition", y = "Fraction of sgRNA covered\n(> 5x)", title = "control sgRNA")
p <- p + theme(plot.title = element_text(hjust = 0.5)) + geom_boxplot()
print(p)

Given the limited coverage especially for in vivo condition, we pooled biological replicates to gain higher coverage.

sessionInfo

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.7 (Maipo)

Matrix products: default
BLAS: /sibcb2/bioinformatics/software/BcbioNG/anaconda/lib/R/lib/libRblas.so
LAPACK: /sibcb2/bioinformatics/software/BcbioNG/anaconda/lib/R/lib/libRlapack.so

locale:
[1] C

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

other attached packages:
 [1] stringr_1.4.0       viper_1.16.0        scales_1.1.0       
 [4] pheatmap_1.0.12     dplyr_1.0.5         survcomp_1.32.0    
 [7] prodlim_2019.11.13  RColorBrewer_1.1-2  gridExtra_2.3      
[10] survHD_0.99.1       survC1_1.0-2        Hmisc_4.3-0        
[13] Formula_1.2-3       lattice_0.20-38     penalized_0.9-51   
[16] survival_3.1-8      Biobase_2.42.0      BiocGenerics_0.28.0
[19] VennDiagram_1.6.20  futile.logger_1.4.3 ggrepel_0.8.1      
[22] ggplot2_3.2.1       rmarkdown_2.0      

loaded via a namespace (and not attached):
 [1] mixtools_1.1.0       splines_3.5.1        rmeta_3.0           
 [4] highr_0.8            latticeExtra_0.6-28  bootstrap_2019.6    
 [7] yaml_2.2.0           survivalROC_1.0.3    pillar_1.5.1        
[10] backports_1.1.5      glue_1.4.2           digest_0.6.23       
[13] checkmate_1.9.4      colorspace_1.4-1     htmltools_0.5.1.1   
[16] Matrix_1.2-18        pkgconfig_2.0.3      purrr_0.3.3         
[19] lava_1.6.7           htmlTable_1.13.3     tibble_3.1.0        
[22] generics_0.0.2       farver_2.0.1         ellipsis_0.3.0      
[25] withr_2.1.2          nnet_7.3-12          lazyeval_0.2.2      
[28] magrittr_1.5         crayon_1.3.4         evaluate_0.14       
[31] fansi_0.4.0          segmented_1.1-0      MASS_7.3-51.5       
[34] class_7.3-15         foreign_0.8-74       SuppDists_1.1-9.5   
[37] tools_3.5.1          data.table_1.12.8    formatR_1.7         
[40] lifecycle_1.0.0      munsell_0.5.0        cluster_2.1.0       
[43] lambda.r_1.2.4       e1071_1.7-3          compiler_3.5.1      
[46] rlang_0.4.10         rstudioapi_0.10      htmlwidgets_1.5.1   
[49] base64enc_0.1-3      labeling_0.3         gtable_0.3.0        
[52] DBI_1.1.0            R6_2.4.1             knitr_1.26          
[55] utf8_1.1.4           futile.options_1.0.1 KernSmooth_2.23-16  
[58] stringi_1.4.3        Rcpp_1.0.3           vctrs_0.3.7         
[61] rpart_4.1-15         acepack_1.4.1        tidyselect_1.1.0    
[64] xfun_0.18