Last updated: 2020-06-02

Checks: 7 0

Knit directory: duplex_sequencing_screen/

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.


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 results in this page were generated with repository version 2d4b7d0. 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:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  analysis/enrichment_simulations.Rmd
    Untracked:  analysis/multinomial_sims.Rmd
    Untracked:  clinicalabundancepredictions_BMES_abstract_51320.pdf
    Untracked:  data/Combined_data_frame_IC_Mutprob_abundance.csv
    Untracked:  data/IC50HeatMap.csv
    Untracked:  data/Twinstrand/
    Untracked:  data/gfpenrichmentdata.csv
    Untracked:  data/heatmap_concat_data.csv
    Untracked:  output/archive/
    Untracked:  output/bmes_abstract_51220.pdf
    Untracked:  output/clinicalabundancepredictions_BMES_abstract_51320.pdf
    Untracked:  output/clinicalabundancepredictions_BMES_abstract_52020.pdf
    Untracked:  output/enrichment_simulations_3mutants_52020.pdf
    Untracked:  output/grant_fig.pdf
    Untracked:  output/grant_fig_v2.pdf
    Untracked:  output/grant_fig_v2updated.pdf
    Untracked:  output/ic50data_all_conc.csv
    Untracked:  shinyapp/

Unstaged changes:
    Modified:   analysis/clinical_abundance_predictions.Rmd
    Modified:   analysis/index.Rmd
    Modified:   analysis/misc.Rmd
    Modified:   analysis/nonlinear_growth_analysis.Rmd
    Modified:   analysis/spikeins_depthofcoverages.Rmd
    Deleted:    data/README.md
    Modified:   output/twinstrand_maf_merge.csv
    Modified:   output/twinstrand_simple_melt_merge.csv

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/E255K_alphas_figure.Rmd) and HTML (docs/E255K_alphas_figure.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 2d4b7d0 haiderinam 2020-06-02 wflow_publish(“analysis/E255K_alphas_figure.Rmd”)

# rm(list=ls())

conc_for_predictions=0.8
net_gr_wodrug=0.05

# 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)

# 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)

# ic50data_long=read.csv("../output/ic50data_all_conc.csv",header = T,stringsAsFactors = F)
ic50data_long=read.csv("output/ic50data_all_conc.csv",header = T,stringsAsFactors = F)
ic50data_long$netgr_pred=net_gr_wodrug-ic50data_long$drug_effect

gfpdata=read.table("data/gfpenrichmentdata.csv",stringsAsFactors = F,header = T,sep=',')
# gfpdata=read.table("../data/gfpenrichmentdata.csv",stringsAsFactors = F,header = T,sep=',')


# ic50_heatmap=read.csv("../data/IC50HeatMap.csv",header = T,stringsAsFactors = F)
ic50_heatmap=read.csv("data/IC50HeatMap.csv",header = T,stringsAsFactors = F)

cleanup=theme_bw() +
  theme(plot.title = element_text(hjust=.5),
        panel.grid.major = element_blank(),
        panel.grid.major.y = element_blank(),
        panel.background = element_blank(),
        axis.line = element_line(color = "black"),
        axis.text = element_text(face="bold",color="black",size="11"),
        text=element_text(size=11,face="bold"),
        axis.title=element_text(face="bold",size="11"))

This boxplot will compare the net growth rates of E255K observed across IC50s, FACs studies, and pooled studies

###########Netgr from pooled approach###########
pooled_data=twinstrand_simple_melt_merge%>%filter(mutant=="E255K",!netgr_obs%in%NA,duration%in%c("d0d3","d0d6"))%>%dplyr::select(mutant,experiment,netgr=netgr_obs,Spike_in_freq)%>%mutate(measurement="Pooled")
pooled_data=pooled_data%>%dplyr::select(measurement,netgr)
# pooled_data=twinstrand_simple_melt_merge%>%filter(mutant=="E255K",!netgr_obs%in%NA)
#Why does the GFP FACs data seem to have the same growth rates?

###########Netgr from IC50s###########
ic50_data=ic50_heatmap%>%filter(species=="E255K")%>%dplyr::select(mutant=species,y=X1.25)
ic50_data=ic50_data%>%mutate(alpha=-log(y)/72)
ic50_data=ic50_data%>%mutate(netgr=net_gr_wodrug-alpha,measurement="IC50s")
ic50_data=ic50_data%>%dplyr::select(measurement,netgr)

###########Netgr from FACs experiment###########
#This data originally sits in the FACs entries in the "Mixing Experiment 4, 8/20/18, directory on benchling"
#These are for both 1:1000 and 1:100 data. Growth rates looked similar at low frequencies with and without WT effects but there was a slowering of growth without WT spike-ins. We haven't focused on that here though
facs_data=data.frame(c(0.046483696,0.0450497374,0.0197837978,0.0437170827,0.04520188,0.0440885505))
colnames(facs_data)="netgr"
facs_data=facs_data%>%mutate(mutant="E255K",Spike_in_freq=c(1000,1000,1000,10000,10000,10000),measurement="FACS")
facs_data=facs_data%>%dplyr::select(measurement,netgr)


###########Plotting###########
###Please note that 625nM imatinib was used in all conditions
e255k_gr=rbind(facs_data,pooled_data,ic50_data)
ggplot(e255k_gr,aes(x=factor(measurement),y=netgr,fill=factor(measurement)))+geom_boxplot()+scale_fill_manual(values = c("#63A088","#1CCE16","#206A36"))+cleanup+scale_y_continuous(name="Net Grwoth Rate Observed")

ggplot(e255k_gr,aes(x=factor(measurement),y=log(2)/netgr,fill=factor(measurement)))+geom_boxplot()+scale_fill_manual(values = c("#63A088","#1CCE16","#206A36"))+cleanup+scale_y_continuous(limits=c(0,30),name="Doubling Time")
Warning: Removed 1 rows containing non-finite values (stat_boxplot).

a=twinstrand_simple_melt_merge%>%filter(mutant=="E255K",!netgr_obs%in%NA)

#There seems to be a bit of a signal with the growth rates from D0 to D3 and D3 to D6. D0D3 seems to be a little higher. Will look at that discrepancy later.
gfpdata$ttotal_sequenced=c(0,3,6)
gfpdata$xtotal_sequenced=c(129,3323,37023)
# gfpdata_simple=gfpdata%>%dplyr::select(ttotal_4,xtotal_4_e255k)
# e255k=twinstrand_maf_merge%>%filter(mutant=="E255K",experiment=="M3")

gfpplotlog=ggplot(gfpdata)+
  geom_line(aes(x=t_out_4,y=log10(x_out_4_e255k)),color="#1cce16",size=1.5)+geom_ribbon(aes(x = t_out_4_conintub,ymax=log10(x_out_4_e255k_ciub),ymin=log10(x_out_4_e255k_cilb)),fill="#1cce16",alpha=.3)+
  geom_line(aes(x=t_out_3,y=log10(x_out_3_e255k)),color="#206A36",size=1.5)+geom_ribbon(aes(x = t_out_3_conintub,ymax=log10(x_out_3_e255k_ciub),ymin=log10(x_out_3_e255k_cilb)),fill="#206A36",alpha=.3)+
  geom_point(aes(x=ttotal_4,y=log10(xtotal_4_e255k)),size=3)+
  geom_point(aes(x=ttotal_3,y=log10(xtotal_3_e255k)),size=3)+
  geom_point(aes(x=ttotal_sequenced,y=log10(xtotal_sequenced)),size=3,shape="square",color="blue")+
  theme_bw()+theme(plot.title = element_text(hjust=.5),text = element_text(size=24),axis.title = element_text(face="bold",size="19"),axis.text=element_text(face="bold",size="19"))+
  xlim(0,7)+
  scale_y_continuous(labels=parse(text = c("10^3","10^5")),limits = c(2,6.5),breaks = c(3,5))+
  # scale_y_continuous(labels = function(x) format(x, scientific = TRUE), limits = c(1e2,5e6),trans='log10',labels=parse(text = c("10^3","10^5"))+
  # scale_y_continuous(labels = parse(text = c("10^3","10^5")), limits = c(1e2,5e6),trans='log10')+
  ylab('Resistant Population')+
  xlab('Time (Days)')
gfpplotlog
Warning: Removed 13 row(s) containing missing values (geom_path).

Warning: Removed 13 row(s) containing missing values (geom_path).
Warning: Removed 40 rows containing missing values (geom_point).

Warning: Removed 40 rows containing missing values (geom_point).

Looking at the growth rate changes with dates

a=twinstrand_simple_melt_merge%>%filter(duration%in%c("d0d3","d3d6"),experiment%in%c("M3","M6"))
plotly=ggplot(a,aes(x=factor(mutant),y=netgr_obs,fill=duration))+geom_col(position="dodge",stat="identity")+facet_wrap(~experiment)
Warning: Ignoring unknown parameters: stat
ggplotly(plotly)
#Realizing that the signal I'm seeing here might be confounded by erroneous flow cytometry counts... 

sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.4

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

other attached packages:
 [1] reshape2_1.4.4      plotly_4.9.2.1      dplyr_0.8.5        
 [4] boot_1.3-24         lme4_1.1-23         Matrix_1.2-18      
 [7] fitdistrplus_1.0-14 npsurv_0.4-0.1      lsei_1.2-0.1       
[10] survival_3.1-12     MASS_7.3-51.5       ggplot2_3.3.0      
[13] lmtest_0.9-37       zoo_1.8-8           workflowr_1.6.2    

loaded via a namespace (and not attached):
 [1] statmod_1.4.34    tidyselect_1.1.0  xfun_0.13         purrr_0.3.4      
 [5] splines_4.0.0     lattice_0.20-41   colorspace_1.4-1  vctrs_0.3.0      
 [9] viridisLite_0.3.0 htmltools_0.4.0   yaml_2.2.1        rlang_0.4.6      
[13] later_1.0.0       pillar_1.4.4      nloptr_1.2.2.1    glue_1.4.1       
[17] withr_2.2.0       plyr_1.8.6        lifecycle_0.2.0   stringr_1.4.0    
[21] munsell_0.5.0     gtable_0.3.0      htmlwidgets_1.5.1 evaluate_0.14    
[25] labeling_0.3      knitr_1.28        crosstalk_1.1.0.1 httpuv_1.5.2     
[29] Rcpp_1.0.4.6      promises_1.1.0    scales_1.1.1      backports_1.1.7  
[33] jsonlite_1.6.1    farver_2.0.3      fs_1.4.1          digest_0.6.25    
[37] stringi_1.4.6     grid_4.0.0        rprojroot_1.3-2   tools_4.0.0      
[41] magrittr_1.5      lazyeval_0.2.2    tibble_3.0.1      tidyr_1.0.3      
[45] crayon_1.3.4      whisker_0.4       pkgconfig_2.0.3   ellipsis_0.3.1   
[49] data.table_1.12.8 httr_1.4.1        assertthat_0.2.1  minqa_1.2.4      
[53] rmarkdown_2.1     R6_2.4.1          nlme_3.1-147      git2r_0.27.1     
[57] compiler_4.0.0