Last updated: 2023-09-26

Checks: 7 0

Knit directory: Cardiotoxicity/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). 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(20230109) 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 6fefb5a. 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:    data/41588_2018_171_MOESM3_ESMeQTL_ST2_for paper.csv
    Ignored:    data/Arr_GWAS.txt
    Ignored:    data/Arr_geneset.RDS
    Ignored:    data/BC_cell_lines.csv
    Ignored:    data/BurridgeDOXTOX.RDS
    Ignored:    data/CADGWASgene_table.csv
    Ignored:    data/CAD_geneset.RDS
    Ignored:    data/CALIMA_Data/
    Ignored:    data/Clamp_Summary.csv
    Ignored:    data/Cormotif_24_k1-5_raw.RDS
    Ignored:    data/Counts_RNA_ERMatthews.txt
    Ignored:    data/DAgostres24.RDS
    Ignored:    data/DAtable1.csv
    Ignored:    data/DDEMresp_list.csv
    Ignored:    data/DDE_reQTL.txt
    Ignored:    data/DDEresp_list.csv
    Ignored:    data/DEG-GO/
    Ignored:    data/DEG_cormotif.RDS
    Ignored:    data/DF_Plate_Peak.csv
    Ignored:    data/DRC48hoursdata.csv
    Ignored:    data/Da24counts.txt
    Ignored:    data/Dx24counts.txt
    Ignored:    data/Dx_reQTL_specific.txt
    Ignored:    data/EPIstorelist24.RDS
    Ignored:    data/Ep24counts.txt
    Ignored:    data/Full_LD_rep.csv
    Ignored:    data/GOIsig.csv
    Ignored:    data/GOplots.R
    Ignored:    data/GTEX_setsimple.csv
    Ignored:    data/GTEX_sig24.RDS
    Ignored:    data/GTEx_gene_list.csv
    Ignored:    data/HFGWASgene_table.csv
    Ignored:    data/HF_geneset.RDS
    Ignored:    data/Heart_Left_Ventricle.v8.egenes.txt
    Ignored:    data/Heatmap_mat.RDS
    Ignored:    data/Heatmap_sig.RDS
    Ignored:    data/Hf_GWAS.txt
    Ignored:    data/K_cluster
    Ignored:    data/K_cluster_kisthree.csv
    Ignored:    data/K_cluster_kistwo.csv
    Ignored:    data/LD50_05via.csv
    Ignored:    data/LDH48hoursdata.csv
    Ignored:    data/Mt24counts.txt
    Ignored:    data/NoRespDEG_final.csv
    Ignored:    data/RINsamplelist.txt
    Ignored:    data/Seonane2019supp1.txt
    Ignored:    data/TMMnormed_x.RDS
    Ignored:    data/TOP2Bi-24hoursGO_analysis.csv
    Ignored:    data/TR24counts.txt
    Ignored:    data/TableS10.csv
    Ignored:    data/TableS11.csv
    Ignored:    data/TableS9.csv
    Ignored:    data/Top2biresp_cluster24h.csv
    Ignored:    data/Var_test_list.RDS
    Ignored:    data/Var_test_list24.RDS
    Ignored:    data/Var_test_list24alt.RDS
    Ignored:    data/Var_test_list3.RDS
    Ignored:    data/Vargenes.RDS
    Ignored:    data/Viabilitylistfull.csv
    Ignored:    data/allexpressedgenes.txt
    Ignored:    data/allfinal3hour.RDS
    Ignored:    data/allgenes.txt
    Ignored:    data/allmatrix.RDS
    Ignored:    data/allmymatrix.RDS
    Ignored:    data/annotation_data_frame.RDS
    Ignored:    data/averageviabilitytable.RDS
    Ignored:    data/avgLD50.RDS
    Ignored:    data/avg_LD50.RDS
    Ignored:    data/backGL.txt
    Ignored:    data/burr_genes.RDS
    Ignored:    data/calcium_data.RDS
    Ignored:    data/clamp_summary.RDS
    Ignored:    data/cormotif_3hk1-8.RDS
    Ignored:    data/cormotif_initalK5.RDS
    Ignored:    data/cormotif_initialK5.RDS
    Ignored:    data/cormotif_initialall.RDS
    Ignored:    data/cormotifprobs.csv
    Ignored:    data/counts24hours.RDS
    Ignored:    data/cpmcount.RDS
    Ignored:    data/cpmnorm_counts.csv
    Ignored:    data/crispr_genes.csv
    Ignored:    data/ctnnt_results.txt
    Ignored:    data/cvd_GWAS.txt
    Ignored:    data/dat_cpm.RDS
    Ignored:    data/data_outline.txt
    Ignored:    data/drug_noveh1.csv
    Ignored:    data/efit2.RDS
    Ignored:    data/efit2_final.RDS
    Ignored:    data/efit2results.RDS
    Ignored:    data/ensembl_backup.RDS
    Ignored:    data/ensgtotal.txt
    Ignored:    data/filcpm_counts.RDS
    Ignored:    data/filenameonly.txt
    Ignored:    data/filtered_cpm_counts.csv
    Ignored:    data/filtered_raw_counts.csv
    Ignored:    data/filtermatrix_x.RDS
    Ignored:    data/folder_05top/
    Ignored:    data/geneDoxonlyQTL.csv
    Ignored:    data/gene_corr_df.RDS
    Ignored:    data/gene_corr_frame.RDS
    Ignored:    data/gene_prob_tran3h.RDS
    Ignored:    data/gene_probabilityk5.RDS
    Ignored:    data/geneset_24.RDS
    Ignored:    data/gostresTop2bi_ER.RDS
    Ignored:    data/gostresTop2bi_LR
    Ignored:    data/gostresTop2bi_LR.RDS
    Ignored:    data/gostresTop2bi_TI.RDS
    Ignored:    data/gostrescoNR
    Ignored:    data/gtex/
    Ignored:    data/heartgenes.csv
    Ignored:    data/hsa_kegg_anno.RDS
    Ignored:    data/individualDRCfile.RDS
    Ignored:    data/individual_DRC48.RDS
    Ignored:    data/individual_LDH48.RDS
    Ignored:    data/indv_noveh1.csv
    Ignored:    data/kegglistDEG.RDS
    Ignored:    data/kegglistDEG24.RDS
    Ignored:    data/kegglistDEG3.RDS
    Ignored:    data/knowfig4.csv
    Ignored:    data/knowfig5.csv
    Ignored:    data/label_list.RDS
    Ignored:    data/ld50_table.csv
    Ignored:    data/mean_vardrug1.csv
    Ignored:    data/mean_varframe.csv
    Ignored:    data/mymatrix.RDS
    Ignored:    data/new_ld50avg.RDS
    Ignored:    data/nonresponse_cluster24h.csv
    Ignored:    data/norm_LDH.csv
    Ignored:    data/norm_counts.csv
    Ignored:    data/old_sets/
    Ignored:    data/organized_drugframe.csv
    Ignored:    data/plan2plot.png
    Ignored:    data/plot_intv_list.RDS
    Ignored:    data/plot_list_DRC.RDS
    Ignored:    data/qval24hr.RDS
    Ignored:    data/qval3hr.RDS
    Ignored:    data/qvalueEPItemp.RDS
    Ignored:    data/raw_counts.csv
    Ignored:    data/response_cluster24h.csv
    Ignored:    data/sigVDA24.txt
    Ignored:    data/sigVDA3.txt
    Ignored:    data/sigVDX24.txt
    Ignored:    data/sigVDX3.txt
    Ignored:    data/sigVEP24.txt
    Ignored:    data/sigVEP3.txt
    Ignored:    data/sigVMT24.txt
    Ignored:    data/sigVMT3.txt
    Ignored:    data/sigVTR24.txt
    Ignored:    data/sigVTR3.txt
    Ignored:    data/siglist.RDS
    Ignored:    data/siglist_final.RDS
    Ignored:    data/siglist_old.RDS
    Ignored:    data/slope_table.csv
    Ignored:    data/supp10_24hlist.RDS
    Ignored:    data/supp10_3hlist.RDS
    Ignored:    data/supp_normLDH48.RDS
    Ignored:    data/supp_pca_all_anno.RDS
    Ignored:    data/table3a.omar
    Ignored:    data/testlist.txt
    Ignored:    data/toplistall.RDS
    Ignored:    data/trtonly_24h_genes.RDS
    Ignored:    data/trtonly_3h_genes.RDS
    Ignored:    data/tvl24hour.txt
    Ignored:    data/tvl24hourw.txt
    Ignored:    data/venn_code.R
    Ignored:    data/viability.RDS

Untracked files:
    Untracked:  .RDataTmp
    Untracked:  .RDataTmp1
    Untracked:  .RDataTmp2
    Untracked:  .RDataTmp3
    Untracked:  3hr all.pdf
    Untracked:  Code_files_list.csv
    Untracked:  Data_files_list.csv
    Untracked:  Doxorubicin_vehicle_3_24.csv
    Untracked:  Doxtoplist.csv
    Untracked:  EPIqvalue_analysis.Rmd
    Untracked:  GWAS_list_of_interest.xlsx
    Untracked:  KEGGpathwaylist.R
    Untracked:  OmicNavigator_learn.R
    Untracked:  SigDoxtoplist.csv
    Untracked:  analysis/ciFIT.R
    Untracked:  analysis/export_to_excel.R
    Untracked:  cleanupfiles_script.R
    Untracked:  code/biomart_gene_names.R
    Untracked:  code/constantcode.R
    Untracked:  code/corMotifcustom.R
    Untracked:  code/cpm_boxplot.R
    Untracked:  code/extracting_ggplot_data.R
    Untracked:  code/movingfilesto_ppl.R
    Untracked:  code/pearson_extract_func.R
    Untracked:  code/pearson_tox_extract.R
    Untracked:  code/plot1C.fun.R
    Untracked:  code/spearman_extract_func.R
    Untracked:  code/venndiagramcolor_control.R
    Untracked:  cormotif_p.post.list_4.csv
    Untracked:  figS1024h.pdf
    Untracked:  individual-legenddark2.png
    Untracked:  installed_old.rda
    Untracked:  motif_ER.txt
    Untracked:  motif_LR.txt
    Untracked:  motif_NR.txt
    Untracked:  motif_TI.txt
    Untracked:  output/DNR_DEGlist.csv
    Untracked:  output/DNRvenn.RDS
    Untracked:  output/DOX_DEGlist.csv
    Untracked:  output/DOXvenn.RDS
    Untracked:  output/EPI_DEGlist.csv
    Untracked:  output/EPIvenn.RDS
    Untracked:  output/Figures/
    Untracked:  output/MTX_DEGlist.csv
    Untracked:  output/MTXvenn.RDS
    Untracked:  output/TRZ_DEGlist.csv
    Untracked:  output/TableS8.csv
    Untracked:  output/Volcanoplot_10
    Untracked:  output/Volcanoplot_10.RDS
    Untracked:  output/allfinal_sup10.RDS
    Untracked:  output/cormotif_probability_genelist.csv
    Untracked:  output/endocytosisgenes.csv
    Untracked:  output/gene_corr_fig9.RDS
    Untracked:  output/legend_b.RDS
    Untracked:  output/motif_ERrep.RDS
    Untracked:  output/motif_LRrep.RDS
    Untracked:  output/motif_NRrep.RDS
    Untracked:  output/motif_TI_rep.RDS
    Untracked:  output/output-old/
    Untracked:  output/rank24genes.csv
    Untracked:  output/rank3genes.csv
    Untracked:  output/reneem@ls6.tacc.utexas.edu
    Untracked:  output/sequencinginformationforsupp.csv
    Untracked:  output/sequencinginformationforsupp.prn
    Untracked:  output/sigVDA24.txt
    Untracked:  output/sigVDA3.txt
    Untracked:  output/sigVDX24.txt
    Untracked:  output/sigVDX3.txt
    Untracked:  output/sigVEP24.txt
    Untracked:  output/sigVEP3.txt
    Untracked:  output/sigVMT24.txt
    Untracked:  output/sigVMT3.txt
    Untracked:  output/sigVTR24.txt
    Untracked:  output/sigVTR3.txt
    Untracked:  output/supplementary_motif_list_GO.RDS
    Untracked:  output/toptablebydrug.RDS
    Untracked:  output/x_counts.RDS
    Untracked:  reneebasecode.R

Unstaged changes:
    Deleted:    analysis/Cardiotoxicity.Rproj
    Modified:   analysis/Figure5.Rmd
    Modified:   analysis/GOI_plots.Rmd
    Modified:   analysis/Knowles2019.Rmd
    Modified:   analysis/Supplementary_figures.Rmd
    Modified:   analysis/index.Rmd
    Modified:   analysis/variance_scrip.Rmd
    Deleted:    corMotifcustom.R
    Modified:   output/TNNI_LDH_RNAnormlist.txt
    Modified:   output/daplot.RDS
    Modified:   output/dxplot.RDS
    Modified:   output/epplot.RDS
    Modified:   output/mtplot.RDS
    Modified:   output/plan2plot.png
    Modified:   output/sequencing_info.txt
    Modified:   output/toplistall.csv
    Modified:   output/trplot.RDS
    Modified:   output/veplot.RDS

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/DRC_analysis.Rmd) and HTML (docs/DRC_analysis.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 6fefb5a reneeisnowhere 2023-09-26 wflow_publish("analysis/DRC_analysis.Rmd")
Rmd 62286c3 reneeisnowhere 2023-07-28 Updateing figure code
Rmd 06800c9 reneeisnowhere 2023-07-26 Commits to small changes and edits
html ae4d18d reneeisnowhere 2023-07-19 Build site.
Rmd 8d042ad reneeisnowhere 2023-07-19 added ld50 calc of averaged viability
html d404b2c reneeisnowhere 2023-07-19 Build site.
Rmd b3abdbf reneeisnowhere 2023-07-19 added ld50 calc of averaged viability
Rmd 7755b30 reneeisnowhere 2023-07-19 added ld50 calc of averaged viability
Rmd f88c9e4 reneeisnowhere 2023-07-18 adding in ld50 for average
Rmd 130918a reneeisnowhere 2023-07-14 rearrage and update codes
html 4be89c7 reneeisnowhere 2023-07-03 Build site.
Rmd e3409d1 reneeisnowhere 2023-07-03 axis change on LD50 corr
html 9a6ec64 reneeisnowhere 2023-07-03 Build site.
Rmd 0f1c868 reneeisnowhere 2023-07-03 updated ld50 correlation, adde the plots
html 6cc56e3 reneeisnowhere 2023-06-30 Build site.
Rmd c3fd0fe reneeisnowhere 2023-06-30 adding in LD50 comparisons
Rmd f4bd5e1 reneeisnowhere 2023-06-27 checking code changes overtime
Rmd c1d667f reneeisnowhere 2023-06-23 updating the codes at Friday start.
Rmd 1e75bd0 reneeisnowhere 2023-06-19 update ld50 and slope plot
html 4643600 reneeisnowhere 2023-06-16 Build site.
Rmd 3d4ca64 reneeisnowhere 2023-06-16 updates on Friday
html 8b862b3 reneeisnowhere 2023-06-13 Build site.
Rmd 5ede159 reneeisnowhere 2023-06-13 finalized plots and curves for slope and LD50 and index updata
html 03078f0 reneeisnowhere 2023-06-06 Build site.
Rmd 850d883 reneeisnowhere 2023-06-06 adding slope with t-test
Rmd 293585d reneeisnowhere 2023-06-06 updated to slope code
Rmd e0e109c reneeisnowhere 2023-05-30 adding slope plot, working on individual plots
Rmd 25d32da reneeisnowhere 2023-05-26 Adding 3 hour and chisq test to populations
Rmd 8d87a52 reneeisnowhere 2023-05-17 end of day
html a0ffcd6 reneeisnowhere 2023-04-20 Build site.
Rmd 64f64df reneeisnowhere 2023-04-20 ld50 DRC image added
html f4ba3a7 reneeisnowhere 2023-04-20 Build site.
Rmd 33ec579 reneeisnowhere 2023-04-20 ld50 DRC image added
html 2cd8dbe reneeisnowhere 2023-04-20 Build site.
Rmd 79c0445 reneeisnowhere 2023-04-20 adding DRC analysis to github
html 3ff1a00 reneeisnowhere 2023-04-20 Build site.
Rmd 7c0c02a reneeisnowhere 2023-04-20 adding DRC analysis to github
html bea5c80 reneeisnowhere 2023-04-20 Build site.
Rmd 2faf972 reneeisnowhere 2023-04-20 adding DRC analysis to github
Rmd 6d925a2 reneeisnowhere 2023-04-16 updating cormotif with updated RNAseq counts
Rmd 575fd81 reneeisnowhere 2023-04-11 updating cormotif
Rmd 4e52216 reneeisnowhere 2023-03-31 End of week updates
Rmd 3a26d52 reneeisnowhere 2023-03-22 Wed poster analysis changes
Rmd 945460e reneeisnowhere 2023-03-19 Updating go plot with reorder
Rmd 69b5d53 reneeisnowhere 2023-03-17 updated DRC 6 plot with color for indivd
Rmd 11a2ab4 reneeisnowhere 2023-03-03 updates
Rmd 49191f8 reneeisnowhere 2023-03-03 more tracking and updates
Rmd 90a0227 reneeisnowhere 2023-02-27 monday2-27
Rmd accc241 reneeisnowhere 2023-02-10 updates for the week
Rmd 1fc5c19 reneeisnowhere 2023-02-09 Git update
Rmd 8c41736 reneeisnowhere 2023-02-07 update with corrMotif

This is my Dose-Response curve analysis and data with summaries.
I hope to explain what and how I did things for future analysis, so that the code and data are reproducible. All data was created by treating cardiomyocytes at ~day 27 of diff with 0.01-50 \(\mu\)M concentrations of the following drugs:
Daunorubicin (DNR)
Doxorubicin (DOX)
Epirubicin (EPI)
Mitoxantrone (MTX)
Trastuzumab (TRZ)
[ note: TRZ could only be used at concentrations of 10 \(\mu\)M and lower]
Vehicle (VEH)

VEH is effectively the same media, however water is added in volumes equivalent to the volume used to dilute the drugs in a 10 mM stock concentration. This is why it has values at different concentrations and why I analyze the data this way.

Cell viability was assessed using Presto Blue reagent according to manufacturer’s protocols.
90 uL of Galactose media + 10 uL of Presto Blue reagent were added to each well of the 96 well DRC plate for one hour. The cell media was then extracted to a black, clear bottom plate and wrapped in foil and stored at 4 degrees overnight. A plate reader was used to measure florescence intensity and the relative fluorescent (RFLU) values were exported to an excel file.

Analysis was done as follows:

  1. The background wells containing media + reagent only were averaged and the average value was subtracted from every well on the plate. Because the wells on the plate were randomized, matching the treatment with the wells is critical and was done inefficiently in an excel file for each experiment.

  2. Percent Viability was calculated by averaging the RFLU from the vehicle at each concentration, and dividing each drug’s RFLU at that concentration by the Vehicle control average RFLU to give a ratio. All values less than 0 were turned into zero in the excel document, and a final compilation for each differentiation and dose curve treatment was stored in an document called DRC_compilation.xlsx. ( note: I spelled incorrectly in my computer)

  3. For calculation to control for plate to plate variance, the “Empty_Blank” well RFLU2 values from each plate within an experiment were averaged.
    eg:

    Step 1. plate 1= empty average RFLU2 = 29000,

    Step 2. plate 2 empty average RFLU2 =31000 normalized ratio plate 1/plate 2 or 29000/31000 =0.9355

    Step 3. This normalization ratio then was divided into every RFLU2 value on plate 1. Plate 2 would be divided by 1 to keep the formulas consistent (31000/31000 or plate2/plate2) to create a column that contained the adjusted RFLU2 values, called “adj”.

  4. Calculations then proceed as described originally. The first viability value is called “Percent”. The adjusted value for intra-plate differences is called “Padj” although this use was later deprecated.

Part 2 of the analysis of data begins by entering data from the excel compilation to R. The data is stored as an excel file, which was then stored as an .RDS object for analysis retrieval.

Step 1 in R is loading the libraries needed for analysis:

library(car)
library(tidyverse)
library(tinytex)
library(BiocGenerics)
library(data.table)
library(drc)
library(Hmisc)
library(cowplot)
library(grid)
library(ggsignif)
library(RColorBrewer)
library(broom)

Step 2 is importing the data from the DRC_compilation.xlsx file. The data was imported and then stored as a data table in R.

Step 3:

The files have a list of similar names: 

  • ‘Drug’ which is the short name of drug used

  • ‘Conc’ which is the concentration of drug added (in microMolar);

  • ‘Sname’ the abbreviated name of Drug and Conc;

  • ‘Well’ letter with two number format ‘Row’ # 1-8 for A-G ‘Column’ numbers 1-12;

  • ‘Plate’ will vary between one and three;

  • ‘RFLU’ the RFLU from the 0 hour reading with background subtracted (not all experiments have them);

  • ‘RFLU2’ the RFLU from the 48 hour reading with background subtracted.

I streamlined the data into more simple formats:

  • Individual 1 is cell line 75-1 (D04_75_1,D05_75_1 )

  • Individual 2 is cell line 87-1 (D04_87_1, D05_87_1)

  • Individual 3 is cell line 77-1 (D02_77_1, D03_77_1)

  • Individual 4 is 79-1 (D04_79_1, D05_79_1)

  • Individual 5 is 78-1 (D01_78_1, D03_78_1)

  • Individual 6 is 71-1 (D02_71_1, DJAG_71_1)

    • As of 6-2-22 I am implementing a new naming for R handles:
      ind1a, ind1b etc, to make sure I process out the “empty_blanks”

      I am also converting ‘Conc’ column to numeric

Step 4: File cleanup first subsets each file imported by taking out the ‘Empty’ samples in the Drug column and then renaming the file to individual names and DRC a and b

A data-frame called DRC48hoursdata.csv is complied from each of the experiments above and is the “final” table stored in the data folder.

Loading the data into R

drug_pal_fact <- c("#8B006D","#DF707E","#F1B72B", "#3386DD","#707031","#41B333")
full_list <- read.csv("data/DRC48hoursdata.csv", row.names = 1)

Once they are all in a data frame, a few thing need to be defined for other function like ggplot.

daunls <- list() ###daunorubicin list
doxols <- list() ### doxorubicin list
epils <- list() ###epirubicin list
mitols <- list() ###mitoxantrone list
trasls <- list() ###trastuzmab list
vehls <- list() ###vehicle list
# name <- c( "Veh","Daun", "Doxo","Epi", "Mito", "Tras")### text list of drugs

Viability

### to extract parameters for mapping

averageFL <-   full_list %>%
  na.omit()%>% 
    mutate(sDrug=Drug) %>% 
    mutate(sDrug=case_match(Drug,"Daun"~"DNR",
                            "Doxo"~"DOX",
                            "Epi"~"EPI",
                            "Mito"~"MTX",
                            "Tras"~"TRZ",
                            "Veh"~ "VEH", .default= Drug)) %>%
    group_by(SampleID, sDrug,Conc) %>%
    mutate(sDrug=factor(sDrug, levels = c('DOX','EPI','DNR','MTX','TRZ','VEH'))) %>% 
    dplyr::summarize(Mean = mean(Percent))
# saveRDS(averageFL,"data/averageviabilitytable.RDS")

  averageFL %>%
    ungroup() %>% 
    mutate(indv=substr(SampleID,4,4)) %>%
    mutate(indv=factor(indv, levels= c('1','2','3','4','5','6'))) %>% 
    filter(Conc <5) %>% 
    mutate(Conc= factor(as.numeric(Conc))) %>% 
    group_by(indv,sDrug,Conc) %>% 
    dplyr::summarize(Viability=mean(Mean)) %>%
    ungroup() %>% 
    ggplot(.,  aes(x=sDrug, y= Viability*100 )) +
    geom_boxplot(position="dodge", outlier.colour = "transparent",
                 aes(fill=sDrug))+
    geom_point(aes(color=indv))+
    guides(alpha = "none")+
    ylim(0,150.5)+
    scale_color_brewer(palette = "Dark2",
                       guide="legend",
                       name ="Individual", 
                       labels(c(1,2,3,4,5,6)))+
    scale_fill_manual(values=drug_pal_fact, name ="Treatment")+
    theme_classic() +
    # geom_hline(yintercept = 1,lty = 4)+
    ylab("Viability") +
    facet_wrap(~Conc)+ 
    ggtitle("Viablity across concentrations at 48 hours")+
    theme(axis.title=element_text(size=10),
          axis.ticks=element_line(size =2),
          axis.text=element_text(size=9, face = "bold"),
          panel.grid.major = element_line(colour = 'darkgrey'),
          panel.border=element_rect(fill = NA, size = 2),
          plot.title = element_text(hjust = 0.5, size =15, face = "bold"))

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13
bea5c80 reneeisnowhere 2023-04-20
averageFL %>% 
  ungroup() %>% 
  mutate(indv=substr(SampleID,4,4)) %>%
  mutate(indv=factor(as.numeric(indv))) %>% 
  filter(Conc<5) %>% 
  group_by(indv,sDrug,Conc) %>% 
  dplyr::summarize(Viability=mean(Mean)) %>% ungroup() %>% 
  ggplot(.,  aes(x=as.factor(Conc), y= Viability*100 )) +
  geom_boxplot(position="dodge",outlier.colour="transparent", aes(fill=sDrug))+
  geom_point(aes(color=indv))+
  guides(alpha = "none")+
  ylim(0,150.5)+
  scale_color_brewer(palette = "Dark2",guide="legend",
                     name = "Individual",labels(c(1,2,3,4,5,6)))+
  scale_fill_manual(values=drug_pal_fact, name = "Treatment")+
  theme_classic() +
  xlab(expression(paste("Concentration [", mu, "M]")))+
  ylab("Viability") +
  facet_wrap(~sDrug)+ 
  ggtitle("Viablity across drugs at 48 hours")+
  theme(axis.title=element_text(size=10),
        axis.ticks=element_line(size =2),
        axis.text=element_text(size=9, face = "bold"),
        panel.grid.major = element_line(colour = 'darkgrey'),
        panel.border=element_rect(fill = NA, size = 2),
        plot.title = element_text(hjust = 0.5, size =15, face = "bold"))

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13
bea5c80 reneeisnowhere 2023-04-20

The above codes can be altered to include ALL concentrations.

Ploting the DRC

Making the Dose-response curve involved averaging the quadruplicates at each concentration for each curve analyzed.

I broke up the full list into treatments and replicates. DA, DX, EP, MT, TR, and VE objects stored the mean viability tables, and

DA2, DX2, EP2, MT2, TR2, and VE2 contain all the data points for generation of the confidence intervals later in the analysis.

avg_via <- averageFL %>%
    ungroup() %>% 
    mutate(indv=substr(SampleID,4,4)) %>%
    mutate(indv=factor(indv, levels= c('1','2','3','4','5','6'))) %>% 
    group_by(indv,sDrug,Conc) %>% 
    dplyr::summarize(Viability=mean(Mean))

updated_list <- full_list %>%
  na.omit()%>% 
  mutate(sDrug=Drug) %>% 
  mutate(sDrug=case_match(Drug,"Daun"~"DNR",
                            "Doxo"~"DOX",
                            "Epi"~"EPI",
                            "Mito"~"MTX",
                            "Tras"~"TRZ",
                            "Veh"~ "VEH", .default= Drug)) %>%
    group_by(SampleID, sDrug,Conc) %>%
    mutate(indv=substr(SampleID,4,4)) %>%
    mutate(indv=factor(as.numeric(indv))) %>% 
    mutate(sDrug=factor(sDrug, levels = c('DOX','EPI','DNR','MTX','TRZ','VEH'))) 



DA <- avg_via %>% filter(sDrug == "DNR")
DX <- avg_via %>% filter(sDrug =="DOX")
EP <- avg_via %>% filter(sDrug =="EPI")
MT <- avg_via %>% filter(sDrug =="MTX")
TR <- avg_via %>% filter(sDrug =="TRZ")
VE <- avg_via%>% filter(sDrug =="VEH")

DA2 <- updated_list %>% filter(sDrug == "DNR")
DX2 <- updated_list %>% filter(sDrug =="DOX")
EP2 <- updated_list %>% filter(sDrug =="EPI")
MT2 <- updated_list %>% filter(sDrug =="MTX")
TR2 <- updated_list %>% filter(sDrug =="TRZ")
VE2 <- updated_list%>% filter(sDrug =="VEH")

The code below is an explanation of the ggplot code I used to plot the DRC by individual. This uses the two mean viability values from DRC1 and biological replicate DRC2, as input to generate the Dose-response curve for each treatment/individual combination.

ggplot(DA, 
       aes(x=Conc, y= Viability, color =indv,alpha =0.4)) +
  guides(color="none", alpha = "none")+  #guides turned off for group plotting
  stat_smooth(method = "drm", ## This code calls DRM inside ggplot2
              method.args = list(fct = L.4(c(NA,NA,1,NA))), se = FALSE)+  #note: fct means function, and L.4 stands for 4 parameter log-logistic curve  I have set at 1 for upper-limit and left the rest 'free'
  ylim(0,1.5)+ #setting the limits so everything with graph
  scale_color_brewer(palette = "Dark2")+ #adding color of choice
  scale_x_log10() +  # Change the x-axis scale to log 10 scale
  theme_classic() +  # looks pretty
  xlab(expression(paste("Concentration [", mu, "M]")))+
  ylab("Percent viability/100") +
  ggtitle("Daunorubicin")+
  theme(plot.title = element_text(hjust = 0.5, size =15, face = "bold"),
        axis.title=element_text(size=10),
        axis.ticks=element_line(linewidth =2),
        axis.text=element_text(size=10, face = "bold"),
        panel.grid.major = element_line(colour = 'lightgrey'),
        panel.border=element_rect(fill = NA, linewidth = 2),
        plot.background = element_rect(fill = "white", colour = NA))

The code above is used multiple times and output values are stored into an R object, so I can later combine the group into one full plot.

daplot <-
  ggplot(DA,aes(x=Conc, y= Viability, 
                 color = indv)) +
  stat_smooth(method = "drm", 
                method.args = list(fct = L.4(c(NA,NA,1,NA))), 
              se = FALSE)+
  ylim(0,1.5)+
  scale_color_brewer(palette = "Dark2")+
  guides(color="none")+
      scale_x_log10() +  # Change the x-axis scale to log 10 scale
      theme_classic() +
      xlab(NULL)+#expression(paste("Concentration [", mu, "M]")))+
    ylab(NULL) +
    ggtitle("DNR")+
    theme(plot.title = element_text(hjust = 0.5, size =15, face = "bold"),
          axis.title=element_text(size=10),
          axis.ticks=element_line(linewidth =2),
          axis.text=element_text(size=10, face = "bold"),
          panel.grid.major = element_line(colour = 'lightgrey'),
          panel.border=element_rect(fill = NA, linewidth = 2),
          plot.background = element_rect(fill = "white", colour = NA))
dxplot <-
  ggplot(DX,aes(x=Conc, y= Viability, 
                 color = indv)) +
  stat_smooth(method = "drm", 
                method.args = list(fct = L.4(c(NA,NA,1,NA))), 
              se = FALSE)+
  ylim(0,1.5)+
  scale_color_brewer(palette = "Dark2")+
  guides(color=guide_legend(title="Treatment"))+
  guides(color="none")+
      scale_x_log10() +  # Change the x-axis scale to log 10 scale
      theme_classic() +
      xlab(NULL)+
      ylab(NULL) +
      theme(plot.title = element_text(hjust = 0.5, size =15, face ="bold"))+
      ggtitle("DOX")+
      theme(axis.title=element_text(size=10),
            axis.ticks=element_line(linewidth = 2),
            axis.text=element_text(size=10, face = "bold"),
            panel.grid.major = element_line(colour = 'lightgrey'),
            panel.border=element_rect(fill = NA, linewidth = 2),
            plot.background = element_rect(fill = "white", colour = NA))
epplot <- 
  ggplot(EP, 
         aes(x=Conc, y= Viability, color = indv)) +
  stat_smooth(method = "drm",
              method.args = list(fct = L.4(c(NA,NA,1,NA))), se = FALSE)+
  ylim(0,1.5)+
  scale_color_brewer(palette = "Dark2")+
  guides(color="none")+
  scale_x_log10() +  
  theme_classic() +
  scale_color_brewer(palette = "Dark2")+
  xlab(NULL)+
  ylab(NULL) +
  theme(plot.title = element_text(hjust = 0.5, size =15, face ="bold"))+
  ggtitle("EPI")+
  theme(axis.title=element_text(size=10),
        axis.ticks=element_line(linewidth = 2),
        axis.text=element_text(size=10, face = "bold"),
        panel.grid.major = element_line(colour = 'lightgrey'),
        panel.border=element_rect(fill = NA, linewidth = 2),
        plot.background = element_rect(fill = "white", colour = NA))
mtplot <- 
  ggplot(MT, 
         aes(x=Conc, y= Viability, color = indv)) +
  stat_smooth(method = "drm",
              method.args = list(fct = L.4(c(NA,NA,1,NA))), se = FALSE)+
  ylim(0,1.5)+
  scale_color_brewer(palette = "Dark2")+
  guides(color="none")+
  scale_x_log10() +
  scale_color_brewer(palette = "Dark2")+
  theme_classic() +
  xlab(NULL)+
  ylab(NULL) +
  theme(plot.title = element_text(hjust = 0.5, size =15, face="bold"))+
  ggtitle("MTX")+
  theme(axis.title=element_text(size=10),
        axis.ticks=element_line(linewidth = 2),
        axis.text=element_text(size=10, face = "bold"),
        panel.grid.major = element_line(colour = 'lightgrey'),
        panel.border=element_rect(fill = NA, linewidth =  2),
        plot.background = element_rect(fill = "white", colour = NA))
##creating legend for full plot

leg <- ggplot(TR, aes(x=Conc, y= Viability, color = indv, alpha = 0.6)) +
          geom_line( size=2)+
          theme_classic() +
  guides(alpha = "none")+
      scale_color_brewer(palette = "Dark2",labels = c("1", "2", "3","4","5","6"))+
        labs(color = "Individual", linewidth=3)
    
trplot <-
  ggplot(TR, 
        aes(x=Conc, y= Viability, color = indv)) +
  stat_smooth(method = "drm", 
              method.args = list(fct = L.4(c(NA,1,NA,NA))), se = FALSE)+
  ylim(0,1.5)+
  scale_color_brewer(palette = "Dark2")+
  guides(color="none")+
  scale_x_log10() + 
  theme_classic() +
  scale_color_brewer(palette = "Dark2")+
  xlab(expression(paste("Concentration ", mu, "M")))+
  ylab(NULL) +
  theme(plot.title = element_text(hjust = 0.5, size =15, face = "bold"))+
  ggtitle("TRZ")+
  theme(axis.title=element_text(size=10),
        axis.ticks=element_line(size =2),
        axis.text=element_text(size=10, face = "bold"),
        panel.grid.major = element_line(colour = 'lightgrey'),
        panel.border=element_rect(fill = NA, size = 2),
        plot.background = element_rect(fill = "white", colour = NA))
veplot <- 
  ggplot(VE,
         aes(x=Conc, y= Viability, color = indv)) +
  stat_smooth(method = "drm", 
              method.args = list(fct = L.4(c(NA,NA,NA,NA))), se = FALSE)+
  ylim(0,1.5)+
  scale_color_brewer(palette = "Dark2")+
  guides(color="none")+
  scale_x_log10() +  
  theme_classic() +
  xlab(expression(paste("Concentration ", mu, "M"))) +
  ylab(NULL) +
  ggtitle("VEH") +
  theme(plot.title = element_text(hjust = 0.5, size = 15, face = "bold"))+
  theme(axis.title = element_text(size = 10),
        axis.ticks = element_line(linewidth =  2),
        axis.text = element_text(size = 10, face = "bold"),
        panel.grid.major = element_line(colour = 'lightgrey'),
        panel.border = element_rect(fill = NA, linewidth = 2),
        panel.background = element_rect(fill = "white"),
        plot.background = element_rect(fill = "white", colour = NA))

plot all together!

## take a legend from a plot
legend_b <- ggpubr::get_legend(leg)

ggpubr::as_ggplot(legend_b)

Version Author Date
d404b2c reneeisnowhere 2023-07-19
plan2 <-  plot_grid(daplot,dxplot,epplot,mtplot, trplot,veplot,legend_b,ncol =4)

plan2

Version Author Date
d404b2c reneeisnowhere 2023-07-19

LD50 and slope extraction (First try)

Now I want to extract from the model, the slope and LD50 calculated by the dose-response model. I make several lists to store the info into.

daunls <- list() ###daunorubicin list
dnr_sl <- list() ##slope
doxols <- list() ### doxorubicin list
dox_sl <- list()
epils <- list() ###epirubicin list
epi_sl <- list()
mitols <- list() ###mitoxantrone list
mtx_sl <- list()
trasls <- list() ###trastuzmab list
trz_sl <- list()
vehls <- list() ###vehicle list
veh_sl <- list()
ID <- c("ind1a",
        "ind1b",
        "ind2a",
        "ind2b",
        "ind3a",
        "ind3b",
        "ind4a",
        "ind4b",
        "ind5a",
        "ind5b",
        "ind6a",
        "ind6b")

Then I run the complete samples without averaging, to get the LD50s from each replicate and individual. The values are stored in several files. Slope values are in the *_sl dataframes, LD50 are in the *ls dataframes and confidence intervals are in the *_intv dataframes.

da_confint <- list()
for(k in ID){
thingda <-  filter(DA2, SampleID==k)
  thingda.m <- drm(Percent~Conc, data = thingda, fct=LL.4(c(NA, NA,1, NA),names=c("Slope", "Lower Limit","Upper Limit","ED50")))
  dnr_sl[k] <- thingda.m$fit$par[1]
  daunls[k] <- thingda.m$fit$par[3]
  da_confint[paste0(k)]<-list(predict(thingda.m, interval="confidence"))
}
DNR_intv <- map_df(da_confint, ~as.data.frame(.x), .id="indv")
DNR_intv$Conc <- DA2$Conc
 dx_confint<-list()

for(k in ID){  
thingdx <-  filter(DX2, SampleID==k)
  thingdx.m <- drm(Percent~Conc, data = thingdx, fct=LL.4(c(NA, NA,1, NA),names=c("Slope","Lower Limit","Upper Limit","ED50")))
  dox_sl[k] <- thingdx.m$fit$par[1]
  doxols[k] <-thingdx.m$fit$par[3]
  dx_confint[paste0(k)]<-list(predict(thingdx.m,interval="confidence"))
}

DOX_intv <- map_df(dx_confint, ~as.data.frame(.x), .id="indv")
DOX_intv$Conc <- DX2$Conc
 ep_confint<-list()
 for(k in ID){ 
 thingep <-  filter(EP2, SampleID==k)
  thingep.m <- drm(Percent~Conc, data = thingep, fct=LL.4(c(NA, NA,1, NA),names=c("Slope", "Lower Limit","Upper Limit","ED50")))
  epi_sl[k] <- thingep.m$fit$par[1]
  # onione <- ED(thingep.m, c(50), interval = "delta")
  epils[k] <- thingep.m$fit$par[3]
  # print(paste0(k, " Epirubicin"))
  ep_confint[paste0(k)]<-list(predict(thingep.m,interval="confidence"))
 }

EPI_intv <- map_df(ep_confint, ~as.data.frame(.x), .id="indv")
EPI_intv$Conc <- EP2$Conc
 mt_confint<-list()
for(k in ID){
  thingmt <-  filter(MT2, SampleID==k)
  thingmt.m <- drm(Percent~Conc, data = thingmt, fct=LL.4(c(NA,NA,1, NA),names=c("Slope","Lower Limit","Upper Limit", "ED50")))
  mtx_sl[k] <- thingmt.m$fit$par[1]
  # onionm <- ED(thingmt.m, c(50), interval = "delta")
  mitols[k] <- thingmt.m$fit$par[3]
  # print(paste0(k, " Mitoxantrone"))
  mt_confint[paste0(k)]<-list(predict(thingmt.m,interval="confidence"))
}
MTX_intv <- map_df(mt_confint, ~as.data.frame(.x), .id="indv")
MTX_intv$Conc<- MT2$Conc 

Note: Could not get numbers to plot for TRZ and VEH

 tr_confint<-list()
for(k in ID){
  thingtr <-  filter(TR2, SampleID==k)
  try(thingtr.m <- drm(Percent~Conc, 
                       data = thingtr, fct=L.4(c(NA, NA,1,NA), names=c("Slope","Lower Limit","Upper Limit", "ED50")))) 
  try(trz_sl[k] <- thingtr.m$fit$par[1])
  try(trasls[k] <- thingtr.m$fit$par[3])
  try(tr_confint[paste0(k)]<-list(predict(thingtr.m,interval="confidence")))
         }
 
TRZ_intv <- map_df(tr_confint, ~as.data.frame(.x), .id="indv")
TRZ_intv$Conc <- TR2$Conc
 ve_confint<-list()
for(k in ID){
  thingve <-  filter(VE2, SampleID==k)
  try(thingve.m <- tryCatch(drm(Percent~Conc, data = thingve, fct=L.4(c(0, NA,NA,NA),names=c("Slope","Lower Limit","Upper Limit", "ED50")))))
  try(veh_sl[k] <- thingve.m$fit$par[1])
  try(vehls[k] <- thingve.m$fit$par[3])
  try(ve_confint[paste0(k)]<-list(predict(thingve.m,interval="confidence")))
}
VEH_intv <- map_df(ve_confint, ~as.data.frame(.x), .id="indv")
VEH_intv$Conc <- VE2$Conc

DRC replicates

How reproducible are each of the DRCs? here I plot several to see how the overlap is working. Each replicate for each Treatment set is ploted

pull_drc <- data.frame(individual=c('ind1','ind2','ind3','ind4','ind5','ind6'))
pull_drc2 <- data.frame("ind1", "ind2","ind3","ind4","ind5","ind6")
doubl_plot <- data.frame("ind3a", "ind3b", "ind5a", "ind5b")

for (each in 1:6){
  newdata <- DNR_intv %>% 
   filter(indv==paste0(pull_drc2[[each]],'a')|
                         indv==paste0(pull_drc2[[each]],'b')) %>% 
    mutate(indv=factor(indv,levels=c(paste0(pull_drc2[[each]],'a'),paste0(pull_drc2[[each]],'b'))))
     f <- DA2 %>% filter(SampleID==paste0(pull_drc2[[each]],'a')|
                         SampleID==paste0(pull_drc2[[each]],'b')) %>% 
   ggplot(., aes(x=Conc, y= Percent, color = SampleID,alpha =0.6)) +
  guides(color="none", alpha = "none")+
      geom_ribbon(data = newdata, aes(x = Conc, y = Prediction, ymin = Lower, ymax = Upper, fill=indv),
              alpha = 0.1, color = "white")+
     stat_smooth(method = "drm",
                  method.args = list(fct = L.4(c(NA,NA,1,NA))),
                 se = FALSE)+
      ylim(-.4,1.5)+
      scale_color_brewer(palette = "Dark2")+
       scale_fill_brewer(palette = "Dark2")+
       scale_x_log10() +  # Change the x-axis scale to log 10 scale
      theme_classic() +
      xlab(NULL)+
      ylab(NULL) +
        # scale_y_continuous( expand = expansion(mult = .1)) +
      theme(plot.title = element_text(hjust = 0.5, size =15, face ="bold"))+
      ggtitle(paste0("Daunorubicin individual ",each))+
      theme(axis.title=element_text(size=10),
            axis.ticks=element_line(linewidth = 2),
            axis.text=element_text(size=10, face = "bold"),
            panel.grid.major = element_line(colour = 'lightgrey'),
            panel.border=element_rect(fill = NA, linewidth = 2),
            plot.background = element_rect(fill = "white", colour = NA))
  print(f)
} 

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13

Version Author Date
d404b2c reneeisnowhere 2023-07-19
8b862b3 reneeisnowhere 2023-06-13
for (each in 1:6){
  
  newdata <- EPI_intv %>%
    filter(indv==paste0(pull_drc2[[each]],'a')|
                         indv==paste0(pull_drc2[[each]],'b')) %>% 
    mutate(indv=factor(indv,levels=c(paste0(pull_drc2[[each]],'a'),paste0(pull_drc2[[each]],'b'))))
  
  ep<- EP2 %>% 
    filter(SampleID==paste0(pull_drc2[[each]],'a')|
                         SampleID==paste0(pull_drc2[[each]],'b')) %>% 
    ggplot(., aes(x=Conc, y= Percent, color = SampleID,alpha =0.6)) +
    geom_ribbon(data = newdata, aes(x = Conc, y = Prediction, ymin = Lower, ymax = Upper, fill=indv),
              alpha = 0.1, color = "white")+
     stat_smooth(method = "drm",
                  method.args = list(fct = L.4(c(NA,NA,1,NA))),
                 se = FALSE)+
      ylim(-.4,1.5)+
    guides(color="none", alpha = "none", fill="none")+
      scale_color_brewer(palette = "Dark2")+
     scale_fill_brewer(palette = "Dark2")+
      scale_x_log10() +  # Change the x-axis scale to log 10 scale
      theme_classic() +
      xlab(NULL)+
      ylab(NULL) +
      theme(plot.title = element_text(hjust = 0.5, size =15, face ="bold"))+
      ggtitle(paste0("Epirubicin individual ",each))+
      theme(axis.title=element_text(size=10),
            axis.ticks=element_line(linewidth = 2),
            axis.text=element_text(size=10, face = "bold"),
            panel.grid.major = element_line(colour = 'lightgrey'),
            panel.border=element_rect(fill = NA, linewidth = 2),
            plot.background = element_rect(fill = "white", colour = NA))
  print(ep)
} 

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19
for (each in 1:6){
  
  newdata <- MTX_intv %>%
    filter(indv==paste0(pull_drc2[[each]],'a')|
                         indv==paste0(pull_drc2[[each]],'b')) %>% 
    mutate(indv=factor(indv,levels=c(paste0(pull_drc2[[each]],'a'),paste0(pull_drc2[[each]],'b'))))
  
  mt<-MT2 %>% 
    filter(SampleID==paste0(pull_drc2[[each]],'a')|
                         SampleID==paste0(pull_drc2[[each]],'b')) %>% 
    ggplot(., aes(x=Conc, y= Percent, color = SampleID,alpha =0.6)) +
    geom_ribbon(data = newdata, aes(x = Conc, y = Prediction, ymin = Lower, ymax = Upper, fill=indv),
              alpha = 0.1, color = "white")+
     stat_smooth(method = "drm",
                  method.args = list(fct = L.4(c(NA,NA,1,NA))),
                 se = FALSE)+
      ylim(-.4,1.5)+
    guides(color="none", alpha = "none", fill="none")+
      scale_color_brewer(palette = "Dark2")+
     scale_fill_brewer(palette = "Dark2")+
      scale_x_log10() +  # Change the x-axis scale to log 10 scale
      theme_classic() +
      xlab(NULL)+
      ylab(NULL) +
      theme(plot.title = element_text(hjust = 0.5, size =15, face ="bold"))+
      ggtitle(paste0("Mitoxantrone individual ",each))+
      theme(axis.title=element_text(size=10),
            axis.ticks=element_line(linewidth = 2),
            axis.text=element_text(size=10, face = "bold"),
            panel.grid.major = element_line(colour = 'lightgrey'),
            panel.border=element_rect(fill = NA, linewidth = 2),
            plot.background = element_rect(fill = "white", colour = NA))
  print(mt)
} 

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19
for (each in 1:6){
   newdata <- TRZ_intv %>%
    filter(indv==paste0(pull_drc2[[each]],'a')|
                         indv==paste0(pull_drc2[[each]],'b'))%>% 
    mutate(indv=factor(indv,levels=c(paste0(pull_drc2[[each]],'a'),paste0(pull_drc2[[each]],'b'))))
  
  tr<-TR2 %>% 
    filter(SampleID==paste0(pull_drc2[[each]],'a')|
                         SampleID==paste0(pull_drc2[[each]],'b')) %>% 
    ggplot(., aes(x=Conc, y= Percent, color = SampleID,alpha =0.6)) +
    geom_ribbon(data = newdata, aes( y = Prediction, ymin = Lower, ymax = Upper, fill=indv),
              alpha = 0.1, color = "white")+
     stat_smooth(method = "drm",
                  method.args = list(fct = L.4(c(NA,NA,1,NA))),
                 se = FALSE)+
      ylim(-.4,1.5)+
    guides(color="none", alpha = "none", fill="none")+
      scale_color_brewer(palette = "Dark2")+
      scale_x_log10() +  # Change the x-axis scale to log 10 scale
      theme_classic() +
      xlab(NULL)+
      ylab(NULL) +
      theme(plot.title = element_text(hjust = 0.5, size =15, face ="bold"))+
      ggtitle(paste0("Trastuzumab individual ",each))+
      theme(axis.title=element_text(size=10),
            axis.ticks=element_line(linewidth = 2),
            axis.text=element_text(size=10, face = "bold"),
            panel.grid.major = element_line(colour = 'lightgrey'),
            panel.border=element_rect(fill = NA, linewidth = 2),
            plot.background = element_rect(fill = "white", colour = NA))
  print(tr)
} 

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19
for (each in 1:6){
  newdata <- VEH_intv %>%
    filter(indv==paste0(pull_drc2[[each]],'a')|
                         indv==paste0(pull_drc2[[each]],'b'))%>% 
    mutate(indv=factor(indv,levels=c(paste0(pull_drc2[[each]],'a'),paste0(pull_drc2[[each]],'b'))))
  
  ve<-VE2 %>% 
    filter(SampleID==paste0(pull_drc2[[each]],'a')|
                         SampleID==paste0(pull_drc2[[each]],'b')) %>% 
    ggplot(., aes(x=Conc, y= Percent, color = SampleID,alpha =0.6)) +
    geom_ribbon(data = newdata, aes( y = Prediction, ymin = Lower, ymax = Upper, fill=indv),
              alpha = 0.1, color = "white")+
     stat_smooth(method = "drm",
                  method.args = list(fct = L.4(c(NA,NA,1,NA))),
                 se = FALSE)+
      ylim(-.4,1.5)+
    guides(color="none", alpha = "none", fill="none")+
      scale_color_brewer(palette = "Dark2")+
      scale_x_log10() +  # Change the x-axis scale to log 10 scale
      theme_classic() +
      xlab(NULL)+
      ylab(NULL) +
      theme(plot.title = element_text(hjust = 0.5, size =15, face ="bold"))+
      ggtitle(paste0("Vehicle individual ",each))+
      theme(axis.title=element_text(size=10),
            axis.ticks=element_line(linewidth = 2),
            axis.text=element_text(size=10, face = "bold"),
            panel.grid.major = element_line(colour = 'lightgrey'),
            panel.border=element_rect(fill = NA, linewidth = 2),
            plot.background = element_rect(fill = "white", colour = NA))
  print(ve)
 } 

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Version Author Date
d404b2c reneeisnowhere 2023-07-19

LD50 correlation

##EC50 of breast cancer cell lines

###combining all values into a larger dataframe

library(RColorBrewer)
drug_palc <- c("#8B006D","#DF707E","#F1B72B", "#3386DD","#707031","#41B333")

BC_cell_lines <- read.csv("data/BC_cell_lines.csv",row.names = 1)

  
graphBC <- BC_cell_lines %>%
    mutate(Cell_line= factor(Cell_line)) %>% 
  pivot_longer(.,col=!Cell_line,names_to = 'Treatment',values_to = 'LD50') %>% 
  ggplot(., (aes(x = (Treatment), y = log10(LD50)))) +
  geom_boxplot(position = "identity",aes(fill=Treatment))+
  geom_point(aes(color = Cell_line,
                 size = 5,alpha = 0.5)) +
  ggtitle(expression("Breast cancer cell line reported  LD"[50]*"s"))+
  xlab("")+
  ylab(bquote('Log'[10]~ 'LD'[50]~'in '*mu*M))+
  scale_color_brewer(palette = "Spectral",
                     name = "Cell lines")+
          scale_fill_manual(values=drug_palc)+
  ylim(-2,2)+
  theme_bw() + 
  theme(plot.title = element_text(hjust =0.5, size = 18))+
  guides(alpha ="none", size = "none", fill= "none")+
  #theme(strip.background = element_rect(fill = "transparent")) +
  theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
        legend.position = "none",
         axis.title = element_text(size = 15, color = "black"),
        axis.ticks = element_line(linewidth = 1.5),
        axis.line = element_line(linewidth = 1.5),
        axis.text = element_text(size = 12, color = "black", angle = 0),
        strip.text.x = element_text(size = 15, color = "black", face = "bold"))   
  graphBC

Version Author Date
d404b2c reneeisnowhere 2023-07-19
9a6ec64 reneeisnowhere 2023-07-03
bea5c80 reneeisnowhere 2023-04-20

LD50 by avg of viability:

This is calculating the avg viability for each replicate first, then using those two points to model the dose-response curve on for the final values.

coll_avg_ld50 <- list(DOX_50_avg,EPI_50_avg,DNR_50_avg,MTX_50_avg)
names(coll_avg_ld50) <- c("DOX","EPI","DNR","MTX")
 new_ld50avg <- map_df(coll_avg_ld50, ~as.data.frame(.x), .id="Treatment")
  # saveRDS(new_ld50avg, "data/new_ld50avg.RDS")

  new_ld50avg %>%   
  mutate(Treatment= factor(Treatment, levels = c("DOX","EPI","DNR","MTX"))) %>% 
  mutate(indv= factor(indv, levels = c('1','2','3','4','5','6'))) %>% 
  ggplot(., (aes(x = (Treatment), y = log10(Estimate)))) +
  geom_boxplot(position = "identity",aes(fill=Treatment))+
  geom_point(aes(color = indv,
                 size = 5,alpha = 0.5)) +
  ggtitle(expression("Experimentally-derived LD"[50]*"s from treated cardiomyocytes"))+
  xlab("Treatment")+
  ylab(bquote('Log'[10]~ 'LD'[50]~'in '*mu*M))+
  scale_color_brewer(palette = "Dark2",
                     name = "Individual")+
  ylim(-2,2)+
  scale_fill_manual(values=drug_pal_fact)+
  theme_bw() + 
  theme(plot.title = element_text(hjust =0.5, size = 18))+
  guides(alpha ="none", size = "none")+
  #theme(strip.background = element_rect(fill = "transparent")) +
  theme(plot.title = element_text(size = rel(1.5), hjust = 0.5),
        # legend.position = "none",
        axis.title = element_text(size = 15, color = "black"),
        axis.ticks = element_line(linewidth = 1.5),
        axis.line = element_line(linewidth = 1.5),
        axis.text = element_text(size = 12, color = "black", angle = 0),
        strip.text.x = element_text(size = 15, color = "black", face = "bold"))   

Version Author Date
d404b2c reneeisnowhere 2023-07-19

Replication of DRC in two individuals

This code is to test plotting two individuals on one plot with VE2 code (tried to loop but did not get to work yet)

doubl_plot <- data.frame("ind3a", "ind3b", "ind5a", "ind5b")
trt <- data.frame("DOX","EPI", "DNR", "MTX", "TRZ", "VEH")
plotloop_list <- list("DOX_intv","EPI_intv","DNR_intv", "MTX_intv","TRZ_intv","VEH_intv")

for (each in 1:6){
  newdata <- VEH_intv %>%
    filter(indv%in% doubl_plot)
  
  ve<-VE2 %>% 
    filter(SampleID==paste0(pull_drc2[[each]],'a')|
                         SampleID==paste0(pull_drc2[[each]],'b')) %>% 
    ggplot(., aes(x=Conc, y= Percent, color = SampleID,alpha =0.6)) +
    geom_ribbon(data = newdata, aes( y = Prediction, ymin = Lower, ymax = Upper, fill=indv),
              alpha = 0.1, color = "white")+
     stat_smooth(method = "drm",
                  method.args = list(fct = L.4(c(NA,NA,1,NA))),
                 se = FALSE)+
      ylim(-.4,1.5)+
    guides(color="none", alpha = "none", fill="none")+
      scale_color_brewer(palette = "Dark2")+
      scale_x_log10() +  # Change the x-axis scale to log 10 scale
      theme_classic() +
      xlab(NULL)+
      ylab(NULL) +
      theme(plot.title = element_text(hjust = 0.5, size =15, face ="bold"))+
      ggtitle(paste0("Vehicle individual ",each))+
      theme(axis.title=element_text(size=10),
            axis.ticks=element_line(linewidth = 2),
            axis.text=element_text(size=10, face = "bold"),
            panel.grid.major = element_line(colour = 'lightgrey'),
            panel.border=element_rect(fill = NA, linewidth = 2),
            plot.background = element_rect(fill = "white", colour = NA))
  print(ve)
 } 


sessionInfo()
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Chicago
tzcode source: internal

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

other attached packages:
 [1] broom_1.0.5         RColorBrewer_1.1-3  ggsignif_0.6.4     
 [4] cowplot_1.1.1       Hmisc_5.1-1         drc_3.0-1          
 [7] MASS_7.3-60         data.table_1.14.8   BiocGenerics_0.46.0
[10] tinytex_0.46        lubridate_1.9.2     forcats_1.0.0      
[13] stringr_1.5.0       dplyr_1.1.3         purrr_1.0.2        
[16] readr_2.1.4         tidyr_1.3.0         tibble_3.2.1       
[19] ggplot2_3.4.3       tidyverse_2.0.0     car_3.1-2          
[22] carData_3.0-5       workflowr_1.7.1    

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0  farver_2.1.1      fastmap_1.1.1     TH.data_1.1-2    
 [5] promises_1.2.1    digest_0.6.33     rpart_4.1.19      timechange_0.2.0 
 [9] lifecycle_1.0.3   cluster_2.1.4     survival_3.5-7    processx_3.8.2   
[13] magrittr_2.0.3    compiler_4.3.1    rlang_1.1.1       sass_0.4.7       
[17] tools_4.3.1       plotrix_3.8-2     utf8_1.2.3        yaml_2.3.7       
[21] knitr_1.44        labeling_0.4.3    htmlwidgets_1.6.2 multcomp_1.4-25  
[25] abind_1.4-5       withr_2.5.0       foreign_0.8-85    nnet_7.3-19      
[29] fansi_1.0.4       ggpubr_0.6.0      git2r_0.32.0      colorspace_2.1-0 
[33] scales_1.2.1      gtools_3.9.4      cli_3.6.1         mvtnorm_1.2-3    
[37] rmarkdown_2.24    generics_0.1.3    rstudioapi_0.15.0 httr_1.4.7       
[41] tzdb_0.4.0        cachem_1.0.8      splines_4.3.1     base64enc_0.1-3  
[45] vctrs_0.6.3       Matrix_1.6-1      sandwich_3.0-2    jsonlite_1.8.7   
[49] callr_3.7.3       hms_1.1.3         rstatix_0.7.2     Formula_1.2-5    
[53] htmlTable_2.4.1   jquerylib_0.1.4   glue_1.6.2        codetools_0.2-19 
[57] ps_1.7.5          stringi_1.7.12    gtable_0.3.4      later_1.3.1      
[61] munsell_0.5.0     pillar_1.9.0      htmltools_0.5.6   R6_2.5.1         
[65] rprojroot_2.0.3   evaluate_0.21     lattice_0.21-8    backports_1.4.1  
[69] httpuv_1.6.11     bslib_0.5.1       Rcpp_1.0.11       nlme_3.1-163     
[73] gridExtra_2.3     checkmate_2.2.0   mgcv_1.9-0        whisker_0.4.1    
[77] xfun_0.40         fs_1.6.3          zoo_1.8-12        getPass_0.2-2    
[81] pkgconfig_2.0.3