Last updated: 2020-04-03

Checks: 7 0

Knit directory: duplex_sequencing_screen/

This reproducible R Markdown analysis was created with workflowr (version 1.6.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(20200402) 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.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

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:    .Rproj.user/

Untracked files:
    Untracked:  data/Combined_data_frame_IC_Mutprob_abundance.csv
    Untracked:  data/Twinstrand/
    Untracked:  data/heatmap_concat_data.csv
    Untracked:  grant_fig.pdf
    Untracked:  grant_fig_v2.pdf
    Untracked:  output/ic50data_all_conc.csv

Unstaged changes:
    Deleted:    data/README.md

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 R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view them.

File Version Author Date Message
html 6af2cdc haiderinam 2020-04-03 Build site.
html 0b9b87b haiderinam 2020-04-02 Build site.
Rmd fc5b9c0 haiderinam 2020-04-02 wflow_publish(“analysis/*.Rmd“)

Please change required directories this chunk if compiling in R rather than RmD

#Inputs:
conc_for_predictions=0.8
net_gr_wodrug=0.05
#Reading required tables
ic50data=read.csv("data/heatmap_concat_data.csv",header = T,stringsAsFactors = F)
# ic50data=read.csv("../data/heatmap_concat_data.csv",header = T,stringsAsFactors = F)

twinstrand_maf=read.table("data/Twinstrand/prj00053-2019-12-02.deliverables/all.mut",sep="\t",header = T,stringsAsFactors = F)
# twinstrand_maf=read.table("../data/Twinstrand/prj00053-2019-12-02.deliverables/all.mut",sep="\t",header = T,stringsAsFactors = F)

names=read.table("data/Twinstrand/prj00053-2019-12-02.deliverables/manifest.tsv",sep="\t",header = T,stringsAsFactors = F)
# names=read.table("../data/Twinstrand/prj00053-2019-12-02.deliverables/manifest.tsv",sep="\t",header = T,stringsAsFactors = F)

# twinstrand_maf_merge=read.csv("../output/twinstrand_maf_merge.csv",header = T,stringsAsFactors = F)
twinstrand_maf_merge=read.csv("output/twinstrand_maf_merge.csv",header = T,stringsAsFactors = F)

# twinstrand_simple_melt_merge=read.csv("../output/twinstrand_simple_melt_merge.csv",header = T,stringsAsFactors = F)
twinstrand_simple_melt_merge=read.csv("output/twinstrand_simple_melt_merge.csv",header = T,stringsAsFactors = F)

Plotting 1:1000 data

ggplot(twinstrand_simple_melt_merge%>%filter(experiment%in%c("M3","M5","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(mutant),label=mutant))+geom_text()+geom_abline()+facet_wrap(~"experiment")+cleanup
Warning: Removed 2 rows containing missing values (geom_text).

Version Author Date
0b9b87b haiderinam 2020-04-02
plotly=ggplot(twinstrand_simple_melt_merge%>%filter(experiment%in%c("M3","M5","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(experiment),label=factor(mutant)))+geom_text()+geom_abline()+cleanup
ggplotly(plotly)
#trying out the dotplot verison to show the individual datapoints
plotly=ggplot(twinstrand_simple_melt_merge%>%filter(experiment%in%c("M3","M5","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(mutant)))+geom_boxplot(position=position_dodge(1))+geom_jitter(shape=16, position=position_jitter())+geom_abline()+cleanup
ggplotly(plotly)
Warning: Removed 2 rows containing non-finite values (stat_boxplot).
###Replicate M5 seems to be a little underapproximative. Only M7 M3 look better.
plotly=ggplot(twinstrand_simple_melt_merge%>%filter(experiment%in%c("M3","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(mutant)))+geom_boxplot(position=position_dodge(1))+geom_jitter(shape=16, position=position_jitter())+geom_abline()+cleanup
ggplotly(plotly)
Warning: Removed 2 rows containing non-finite values (stat_boxplot).

Plotting 1 in 5,000

ggplot(twinstrand_simple_melt_merge%>%filter(experiment%in%c("M3","M4","M5","M6","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(mutant),label=mutant))+geom_text()+geom_abline()+facet_wrap(~"experiment")+cleanup
Warning: Removed 3 rows containing missing values (geom_text).

Version Author Date
0b9b87b haiderinam 2020-04-02
plotly=ggplot(twinstrand_simple_melt_merge%>%filter(experiment%in%c("M3","M4","M5","M6","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(experiment),label=factor(mutant)))+geom_text()+geom_abline()+cleanup
ggplotly(plotly)
#trying out the dotplot verison to show the individual datapoints
plotly=ggplot(twinstrand_simple_melt_merge%>%filter(experiment%in%c("M3","M4","M5","M6","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(mutant)))+geom_boxplot(position=position_dodge(1))+geom_jitter(shape=16, position=position_jitter())+geom_abline()+cleanup
ggplotly(plotly)
Warning: Removed 3 rows containing non-finite values (stat_boxplot).
#Removing M5 and M6 makes these look better. My assumption is that things were growing slower for the M5, M6 conditions because of culture conditions.
#This may look bad. But this also represents an opportunity: You don't need to estimate the approximate growth rate in the absence of drug because it is dynamic (changing culture conditions etc). You could use counts from a no-drug control but even that isn't the best control because of plate to plate variability in growth rates. You could just look at the most resistant mutants and see how fast they're growing. From their growth rates, you can back-calculate what the exact w/o drug growth rate is.
plotly=ggplot(twinstrand_simple_melt_merge%>%filter(experiment%in%c("M3","M4","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(mutant)))+geom_boxplot(position=position_dodge(1))+geom_jitter(shape=16, position=position_jitter())+geom_abline()+cleanup
ggplotly(plotly)
Warning: Removed 2 rows containing non-finite values (stat_boxplot).
#As suggested above, I will modify the observed growth rate so that the w/o drug growth rate essentially derives from the observed growth rate of the most resistant cell line. Please note that I am doing this in a very roundabout way here because I am looking at the growth rate of T315I in the slow-growing cell lines, comparing it to how slow it is growing vs the mean growth rate of T315I from the other experimental days, and adding that difference in growth rate to that slow-growing experimental day.
# library(dplyr)
a=twinstrand_simple_melt_merge%>%
  mutate(netgr_obs=case_when(experiment=="M6"~netgr_obs+.03,
                                   experiment=="M5"~netgr_obs+.015,
                                   experiment%in%c("M3","M5","M4","M7")~netgr_obs))

plotly=ggplot(a%>%filter(experiment%in%c("M3","M4","M5","M6","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(experiment),label=factor(mutant)))+geom_text()+geom_abline()+cleanup
ggplotly(plotly)
a_new=a%>%filter(experiment%in%c("M3"),duration%in%("d3d6"))
plotly=ggplot(a%>%filter(experiment%in%c("M3","M4","M5","M6","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(mutant)))+geom_boxplot(position=position_dodge(1))+geom_jitter(shape=16, position=position_jitter())+geom_abline()+cleanup
ggplotly(plotly)
Warning: Removed 3 rows containing non-finite values (stat_boxplot).
plotly=ggplot(a%>%filter(experiment%in%c("M3","M4","M5","M6","M7"),duration=="d3d6"),aes(x=netgr_pred,y=netgr_obs,color=factor(mutant)))+geom_boxplot(position=position_dodge(1))+geom_jitter(shape=16, position=position_jitter())+geom_abline()+cleanup
ggplotly(plotly)
Warning: Removed 3 rows containing non-finite values (stat_boxplot).

##Plotting 1 in 5000 data Note that this is somewhat similar to what twinstrand sent to us.

ggplot(twinstrand_maf_merge%>%filter(tki_resistant_mutation=="True",!mutant=="NA",Spike_in_freq==1000,!experiment%in%c("Enu_3","Enu_4")),aes(x=time_point,y=AltDepth,color=factor(experiment)))+geom_point()+facet_wrap(~mutant)+cleanup

Version Author Date
0b9b87b haiderinam 2020-04-02
ggplot(twinstrand_maf_merge%>%filter(tki_resistant_mutation=="True",!mutant=="NA",Spike_in_freq==1000,!experiment%in%c("Enu_3","Enu_4")),aes(x=time_point,y=totalmutant,color=factor(experiment)))+geom_point()+facet_wrap(~mutant)+scale_y_continuous(trans = "log10")+cleanup

Version Author Date
0b9b87b haiderinam 2020-04-02
ggplot(twinstrand_maf_merge%>%filter(tki_resistant_mutation=="True",!mutant=="NA",Spike_in_freq==1000,!experiment%in%c("Enu_3","Enu_4")),aes(x=time_point,y=totalmutant,color=factor(experiment)))+geom_point()+facet_wrap(~mutant)+cleanup

Version Author Date
0b9b87b haiderinam 2020-04-02
#Combining 1 to 1,000 and 1 to 5,000
ggplot(twinstrand_maf_merge%>%filter(tki_resistant_mutation=="True",!mutant=="NA",!experiment%in%c("Enu_3","Enu_4")),aes(x=time_point,y=totalmutant,color=factor(experiment),shape=factor(Spike_in_freq)))+geom_point()+facet_wrap(~mutant)+scale_y_continuous(trans = "log10")+cleanup

Version Author Date
0b9b87b haiderinam 2020-04-02
# Looking at why 1 in 5,000 mutants look a little undersampled
#Turns out they look different because they started off with 5x less cells. Duh.
# a=twinstrand_maf_merge%>%filter(tki_resistant_mutation=="True",Spike_in_freq=="5000",experiment=="M6",mutant%in%c("T315I","G250E"))

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.15.4

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.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] parallel  grid      stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] drc_3.0-1           MASS_7.3-51.5       BiocManager_1.30.10
 [4] plotly_4.9.1        ggsignif_0.6.0      devtools_2.2.1     
 [7] usethis_1.5.1       RColorBrewer_1.1-2  reshape2_1.4.3     
[10] ggplot2_3.2.1       doParallel_1.0.15   iterators_1.0.12   
[13] foreach_1.4.7       dplyr_0.8.4         VennDiagram_1.6.20 
[16] futile.logger_1.4.3 tictoc_1.0          knitr_1.27         
[19] workflowr_1.6.0    

loaded via a namespace (and not attached):
 [1] fs_1.3.1             httr_1.4.1           rprojroot_1.3-2     
 [4] tools_3.5.2          backports_1.1.5      R6_2.4.1            
 [7] lazyeval_0.2.2       colorspace_1.4-1     withr_2.1.2         
[10] tidyselect_1.0.0     prettyunits_1.1.1    processx_3.4.1      
[13] curl_4.3             compiler_3.5.2       git2r_0.26.1        
[16] cli_2.0.1            formatR_1.7          sandwich_2.5-1      
[19] desc_1.2.0           labeling_0.3         scales_1.1.0        
[22] mvtnorm_1.0-12       callr_3.4.1          stringr_1.4.0       
[25] digest_0.6.23        foreign_0.8-75       rmarkdown_2.1       
[28] rio_0.5.16           pkgconfig_2.0.3      htmltools_0.4.0     
[31] sessioninfo_1.1.1    plotrix_3.7-7        fastmap_1.0.1       
[34] htmlwidgets_1.5.1    rlang_0.4.4          readxl_1.3.1        
[37] shiny_1.4.0          farver_2.0.3         zoo_1.8-7           
[40] jsonlite_1.6         crosstalk_1.0.0      gtools_3.8.1        
[43] zip_2.0.4            car_3.0-6            magrittr_1.5        
[46] Matrix_1.2-18        Rcpp_1.0.3           munsell_0.5.0       
[49] fansi_0.4.1          abind_1.4-5          lifecycle_0.1.0     
[52] multcomp_1.4-12      stringi_1.4.5        whisker_0.4         
[55] yaml_2.2.1           carData_3.0-3        pkgbuild_1.0.6      
[58] plyr_1.8.5           promises_1.1.0       forcats_0.4.0       
[61] crayon_1.3.4         lattice_0.20-38      splines_3.5.2       
[64] haven_2.2.0          hms_0.5.3            ps_1.3.0            
[67] pillar_1.4.3         codetools_0.2-16     pkgload_1.0.2       
[70] futile.options_1.0.1 glue_1.3.1           evaluate_0.14       
[73] lambda.r_1.2.4       data.table_1.12.8    remotes_2.1.0       
[76] vctrs_0.2.2          httpuv_1.5.2         testthat_2.3.1      
[79] cellranger_1.1.0     gtable_0.3.0         purrr_0.3.3         
[82] tidyr_1.0.2          assertthat_0.2.1     xfun_0.12           
[85] openxlsx_4.1.4       mime_0.8             xtable_1.8-4        
[88] later_1.0.0          survival_3.1-8       viridisLite_0.3.0   
[91] tibble_2.1.3         memoise_1.1.0        TH.data_1.0-10      
[94] ellipsis_0.3.0