Last updated: 2023-07-07

Checks: 7 0

Knit directory: Cardiotoxicity/

This reproducible R Markdown analysis was created with workflowr (version 1.7.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(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 0c07b8e. 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/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/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/Ep24counts.txt
    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/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/Top2biresp_cluster24h.csv
    Ignored:    data/Viabilitylistfull.csv
    Ignored:    data/allexpressedgenes.txt
    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/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/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/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/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/individualDRCfile.RDS
    Ignored:    data/individual_DRC48.RDS
    Ignored:    data/individual_LDH48.RDS
    Ignored:    data/kegglistDEG.RDS
    Ignored:    data/knowfig4.csv
    Ignored:    data/knowfig5.csv
    Ignored:    data/label_list.RDS
    Ignored:    data/ld50_table.csv
    Ignored:    data/mymatrix.RDS
    Ignored:    data/nonresponse_cluster24h.csv
    Ignored:    data/norm_LDH.csv
    Ignored:    data/norm_counts.csv
    Ignored:    data/old_sets/
    Ignored:    data/plan2plot.png
    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/supp_normLDH48.RDS
    Ignored:    data/supp_pca_all_anno.RDS
    Ignored:    data/table3a.omar
    Ignored:    data/toplistall.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:  Doxorubicin_vehicle_3_24.csv
    Untracked:  Doxtoplist.csv
    Untracked:  GWAS_list_of_interest.xlsx
    Untracked:  OmicNavigator_learn.R
    Untracked:  SigDoxtoplist.csv
    Untracked:  analysis/export_to_excel.R
    Untracked:  code/DRC_plotfigure1.png
    Untracked:  code/constantcode.R
    Untracked:  code/cpm_boxplot.R
    Untracked:  code/extracting_ggplot_data.R
    Untracked:  code/fig1plot.png
    Untracked:  code/figurelegeddrc.png
    Untracked:  code/movingfilesto_ppl.R
    Untracked:  code/pearson_extract_func.R
    Untracked:  code/spearman_extract_func.R
    Untracked:  cormotif_probability_genelist.csv
    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/DNRvenn.RDS
    Untracked:  output/DOXvenn.RDS
    Untracked:  output/EPIvenn.RDS
    Untracked:  output/Figures/
    Untracked:  output/MTXvenn.RDS
    Untracked:  output/Volcanoplot_10
    Untracked:  output/Volcanoplot_10.RDS
    Untracked:  output/allfinal_sup10.RDS
    Untracked:  output/gene_corr_fig9.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/supplementary_motif_list_GO.RDS
    Untracked:  output/toptablebydrug.RDS
    Untracked:  output/x_counts.RDS
    Untracked:  reneebasecode.R

Unstaged changes:
    Modified:   Cardiotoxicity.Rproj
    Modified:   analysis/DRC_analysis.Rmd
    Modified:   analysis/Figure1.Rmd
    Modified:   analysis/Figure5.Rmd
    Modified:   analysis/Figure7.Rmd
    Modified:   analysis/Figure8.Rmd
    Modified:   analysis/Figure9.Rmd
    Modified:   analysis/GOI_plots.Rmd
    Modified:   analysis/Supplementary_figures.Rmd
    Modified:   analysis/other_analysis.Rmd
    Modified:   output/DNRmeSNPs.RDS
    Modified:   output/DNRreQTLs.RDS
    Modified:   output/DOXmeSNPs.RDS
    Modified:   output/DOXreQTLs.RDS
    Modified:   output/EPImeSNPs.RDS
    Modified:   output/EPIreQTLs.RDS
    Modified:   output/GOI_genelist.txt
    Modified:   output/MTXmeSNPs.RDS
    Modified:   output/MTXreQTLs.RDS
    Modified:   output/TNNI_LDH_RNAnormlist.txt
    Modified:   output/knowles4.RDS
    Modified:   output/knowles5.RDS
    Modified:   output/toplistall.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/Figure3.Rmd) and HTML (docs/Figure3.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 0c07b8e reneeisnowhere 2023-07-07 update exports of plots
html 6de33dc reneeisnowhere 2023-07-06 Build site.
Rmd c1236c9 reneeisnowhere 2023-07-06 adding fig 3 updates
html a9ef9f3 reneeisnowhere 2023-06-27 Build site.
Rmd 7e94f87 reneeisnowhere 2023-06-27 adding figures
Rmd 4d0f4ee reneeisnowhere 2023-06-27 first update

library(car)
library(tidyverse)
library(tinytex)
library(BiocGenerics)
library(data.table)
library(drc)
library(cowplot)
library(ggsignif)
library(RColorBrewer)
library(broom)
level_order2 <- c('75','87','77','79','78','71')


drug_palexpand <- c("#41B333","#8B006D","#DF707E","#F1B72B", "#3386DD","#707031","purple3","darkgreen", "darkblue")
#named colors: dark pink,Red,yellow,blue, dark grey, green(green is always control, may need to move pal around)
calcium_data <- readRDS("data/calcium_data.RDS")
clamp_summary <- readRDS("data/clamp_summary.RDS")

Figure 3

Calcium dysregulation occurs at sub-lethal concentrations of TOP2i

A. Representative line graph

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


Normalization_And_Set_File <- function(file_path) {
  # Read in the data from the file
  CALIMA_obj <- read.csv(file_path)
  
  # Normalize the data
  ROI_cut <- CALIMA_obj[,2:ncol(CALIMA_obj)]
  ROI_cut_rowmeans <- rowMeans(ROI_cut)
  Intensity <- (ROI_cut_rowmeans/min(ROI_cut_rowmeans))
  Final_ROI <- tibble::as_tibble(cbind(CALIMA_obj[,1], Intensity, ROI_cut))
  Final_ROI$Intensity <- Final_ROI$Intensity -1
  
    return(Final_ROI)
}

Plot_Line_df <- function(directory) {
  holder <- list()
  # List CSV files in the folder that is output from CALIMA 
  file_list <- list.files(directory, pattern = "*.csv", full.names = TRUE)
  file_list <- file_list %>% as.tibble() %>% 
  mutate(filenames=value) %>% 
  separate(filenames, c(NA,NA,NA,"file"), sep="/") %>% 
   separate(file, c("Drug","indv"))
  
    # Loop over all files in directory
  for (i in 1:length(file_list$value)) {
    normalized_data <- data.frame("indv"=file_list$indv[i], "drug"=file_list$Drug[i])
    # Normalize the data from the file
    
    norm_out <- Normalization_And_Set_File(file_list$value[i])
    holder[[file_list$Drug[i]]] <- cbind(normalized_data,norm_out[,1:2])
    
  # Return the plot
  
  }
  return(holder)
}
plot_77 <-  Plot_Line_df("data/CALIMA_Data/77-1/")

df_77forplot <- plot_77 %>% 
  bind_rows() %>% 
   mutate(drug=factor(drug, levels = c(  "DOX", 
                                        "EPI",
                                         "DNR",
                                          "MTX",
                                          "TRZ",
                                          "VEH"))) %>%
  rename("Xaxis"=`CALIMA_obj[, 1]`) 

    
Line_plot3<- ggplot(df_77forplot, aes(x=Xaxis, y= Intensity, group=drug))+
  geom_line(size=1.5,aes(color=drug))+
  xlab("")+
  theme_bw()+
  guides(color=guide_legend(override.aes = list(size=1)))+
  ggtitle("Individual 3")+
  scale_x_continuous(expand = c(0, 0))+
  scale_color_manual(values=drug_pal_fact,name=" ")+
  theme(plot.title = element_text(size=14,hjust = 0.5),
    axis.title = element_text(size = 10, color = "black"),
    axis.ticks = element_line(linewidth = 1),
    legend.position="right", 
    axis.line = element_line(linewidth = 1),
    axis.text = element_text(size = 10, color = "black", angle = 0),
    strip.text.x = element_text(size = 12, color = "black", face = "bold"))

 Line_plot3   

B. Mean amplitude

MA_plot <- clamp_summary %>% 
  dplyr::select(Drug,Conc,indv,Mean_Amplitude,FWHM,Rise_Slope,Decay_Slope) %>%
  ggplot(.,aes(Drug,Mean_Amplitude))+
  geom_boxplot(position = "identity", fill= drug_pal_fact)+
  geom_point(aes(col=indv, size=2, alpha=0.5))+
  # guides(size = "none",alpha="none",colour = guide_legend(override.aes = list(size=2, alpha= 0.5)))+
  guides(size = "none",alpha="none",colour = "none")+
  scale_color_brewer(palette = "Dark2", name = "Individual",label=c("2","3","5"))+
  geom_signif(comparisons = list(c("VEH","TRZ"),
                                 c("VEH","MTX"),
                                 c( "VEH","DNR"),
                                 c("VEH","EPI"),
                                 c( "VEH","DOX")),
              test = "t.test",
              map_signif_level = TRUE,
              step_increase = 0.1,
              textsize = 4)+
  ylab("a.u.")+
  xlab(" ")+
  ggtitle("Mean amplitude")+
  theme_classic()+
  theme(plot.title = element_text(size=14,hjust = 0.5),
    axis.title = element_text(size = 10, color = "black"),
    axis.ticks = element_line(linewidth = 1),
    axis.line = element_line(linewidth = 1),
    axis.text = element_text(size = 10, color = "black", angle = 0),
    strip.text.x = element_text(size = 12, color = "black", face = "bold"))

MA_plot

C. Rising slope

RS_plot <- clamp_summary %>%
  dplyr::select(Drug,Conc,indv,Mean_Amplitude,FWHM,Rise_Slope,Decay_Slope) %>%
  ggplot(.,aes(Drug,Rise_Slope))+
  geom_boxplot(position = "identity", fill= drug_pal_fact)+
  geom_point(aes(col=indv, size=2, alpha=0.5))+
  # guides(size = "none",alpha="none",colour = guide_legend(override.aes = list(size=2, alpha= 0.5)))+
  guides(size = "none",alpha="none",colour = "none")+
  scale_color_brewer(palette = "Dark2", name = "Individual",label=c("2","3","5"))+
  geom_signif(comparisons = list(c("VEH","TRZ"),
                                 c("VEH","MTX"),
                                 c( "VEH","DNR"),
                                 c("VEH","EPI"),
                                 c( "VEH","DOX")),
              test = "t.test",
              map_signif_level = TRUE,
              step_increase = 0.1,
              textsize = 4)+
  ylab("a.u./ sec")+
  xlab(" ")+
  theme_classic()+
  ggtitle("Rising slope")+
 theme(plot.title = element_text(size=14,hjust = 0.5),
    axis.title = element_text(size = 10, color = "black"),
    axis.ticks = element_line(linewidth = 1),
    axis.line = element_line(linewidth = 1),
    axis.text = element_text(size = 10, color = "black", angle = 0),
    strip.text.x = element_text(size = 12, color = "black", face = "bold"))

RS_plot

D. Decay slope

Decay_plot <- clamp_summary %>%
  dplyr::select(Drug,Conc,indv,Mean_Amplitude,FWHM,Rise_Slope,Decay_Slope) %>%
  ggplot(.,aes(Drug,Decay_Slope))+
  geom_boxplot(position = "identity", fill= drug_pal_fact)+
  geom_point(aes(col=indv, size=2, alpha=0.5))+
  # guides(size = "none",alpha="none",colour = guide_legend(override.aes = list(size=2, alpha= 0.5)))+
  guides(size = "none",alpha="none",colour = "none")+
  scale_color_brewer(palette = "Dark2", name = "Individual",label=c("2","3","5"))+
  geom_signif(comparisons = list(c("VEH","TRZ"),
                                 c("VEH","MTX"),
                                 c( "VEH","DNR"),
                                 c("VEH","EPI"),
                                 c( "VEH","DOX")),
              test = "t.test",
              map_signif_level = TRUE,
              step_increase = 0.1,
              textsize = 4)+
  ylab("a.u.")+
  xlab(" ")+
  theme_classic()+
  ggtitle("Decay slope")+
  theme(plot.title = element_text(size=14,hjust = 0.5),
    axis.title = element_text(size = 10, color = "black"),
    axis.ticks = element_line(linewidth = 1),
    axis.line = element_line(linewidth = 1),
    axis.text = element_text(size = 10, color = "black", angle = 0),
    strip.text.x = element_text(size = 12, color = "black", face = "bold"))

Decay_plot

E. Full-width at half-max

FWHM_plot <- clamp_summary %>%
  dplyr::select(Drug,Conc,indv,Mean_Amplitude,FWHM,Rise_Slope,Decay_Slope) %>%
  ggplot(.,aes(Drug,FWHM))+
  geom_boxplot(position = "identity", fill= drug_pal_fact)+
 geom_point(aes(col=indv, size=2, alpha=0.5))+
  # guides(size = "none",alpha="none",colour = guide_legend(override.aes = list(size=2, alpha= 0.5)))+
  guides(size = "none",alpha="none",colour = "none")+
  scale_color_brewer(palette = "Dark2", name = "Individual",label=c("2","3","5"))+
  geom_signif(comparisons = list(c("VEH","TRZ"),
                                 c("VEH","MTX"),
                                 c( "VEH","DNR"),
                                 c("VEH","EPI"),
                                 c( "VEH","DOX")),
              test = "t.test",
              map_signif_level = TRUE,
              step_increase = 0.1,
              textsize = 4)+
  ylab("a.u.")+
  xlab(" ")+
  theme_classic()+
  ggtitle("Full-width at half-max")+
  theme(plot.title = element_text(size=14,hjust = 0.5),
    axis.title = element_text(size = 10, color = "black"),
    axis.ticks = element_line(linewidth = 1),
    axis.line = element_line(linewidth = 1),
    axis.text = element_text(size = 10, color = "black", angle = 0),
    strip.text.x = element_text(size = 12, color = "black", face = "bold"))


FWHM_plot

F. Contraction rate

BR_plot <- calcium_data %>% 
  dplyr::select(Drug,Conc,indv,Rate) %>%#Peak_variance,Ave_FF0,
  mutate(indv=substr(indv,1,2)) %>%
  mutate(indv=factor(indv, levels = level_order2)) %>%
  mutate(contrl= 0.383) %>%
  mutate(norm_rate=Rate/contrl) %>%
  filter(Conc==0| Conc==0.5) %>%
  ggplot(., aes(x=Drug, y=Rate))+
  geom_boxplot(position = "identity", fill= drug_pal_fact)+
  geom_point(aes(col=indv, size=2, alpha=0.5))+
  guides(size = "none",alpha="none",colour = guide_legend(override.aes = list(size=5, alpha= 0.5)))+
  # guides(size = "none",alpha="none",colour = "none")+
  scale_color_brewer(palette = "Dark2", name = "Individual",label=c("2","3","5"))+
  geom_signif(comparisons = list(c("VEH","TRZ"),
                                 c("VEH","MTX"),
                                 c( "VEH","DNR"),
                                 c("VEH","EPI"),
                                 c( "VEH","DOX")),
              test = "t.test",
              map_signif_level = TRUE,
              step_increase = 0.1,
              textsize = 4)+
  ylab("avg. beats/sec")+
  xlab(" ")+
  ggtitle("Contraction rate")+
  theme_classic()+
  theme(plot.title = element_text(size=14,hjust = 0.5),
    axis.title = element_text(size = 10, color = "black"),
    axis.ticks = element_line(linewidth = 1),
    legend.direction = "horizontal", legend.position = "bottom",
    axis.line = element_line(linewidth = 1),
    axis.text = element_text(size = 10, color = "black", angle = 0),
    strip.text.x = element_text(size = 12, color = "black", face = "bold"))


BR_plot

BR_plot2 <- BR_plot+theme(legend.position = "none")
legend <- get_legend(BR_plot)

G. PCA of Calcium data

k_means <- read.csv("data/K_cluster_kisthree.csv")


k_means %>% mutate(Drug =case_match(Drug_Name,
                                    "Dau_0.5"~"DNR",
                                    "Dau_0.5.1" ~"DNR",
                                    "Dau_0.5.2" ~"DNR",
                                    "Dox_0.5"~"DOX",  
                                    "Dox_0.5.1" ~"DOX",
                                    "Dox_0.5.2" ~"DOX",
                                    "Epi_0.5"~"EPI",
                                    "Epi_0.5.1"~"EPI",
                                    "Epi_0.5.2"~"EPI",
                                    "Mito_0.5"~"MTX",
                                    "Mito_0.5.1"~"MTX",
                                    "Mito_0.5.2"~"MTX",
                                    "Tras_0.5"~"TRZ", 
                                    "Tras_0.5.1"~"TRZ", 
                                    "Tras_0.5.2"~"TRZ",
                                    "Control.1"~"VEH",
                                    "Control.2"~"VEH",
                                    "Control"~"VEH",.default = Drug_Name)) %>%
  mutate(Class= case_match(Drug,"DOX"~"TOP2i","DNR"~"TOP2i","EPI" ~"TOP2i","MTX" ~"TOP2i", "TRZ"~"not-TOP2i","VEH"~"not-TOP2i",.default = Drug)) %>% 
  mutate(Drug=factor(Drug, levels = c(  "DOX", 
                                        "EPI",
                                        "DNR",
                                          "MTX",
                                          "TRZ",
                                          "VEH"))) %>%
  
  ggplot(., aes(x=PC1, y=PC2, col= Drug,shape = factor(Class)))+
  geom_point(size = 8)+
  scale_shape_manual(values=c(19, 17,15))+
  scale_color_manual(values=drug_pal_fact)+
  ggtitle(expression("PCA of Ca"^"2+"~"data"))+
  theme_bw()+
  labs(x = "PC 1 (54 %)",y = "PC 2 (34%)")+
  theme(plot.title=element_text(size= 14,hjust = 0.5),
        axis.title = element_text(size = 10, color = "black"),
        axis.ticks = element_line(size = 1.5),
        axis.text = element_text(size = 12, color = "black", angle = 0),
        strip.text.x = element_text(size = 15, color = "black", face = "bold"))

 ggsave("output/Figures/calciumPCA.eps")
library(cowplot)
# align all plots
plots <- align_plots(Line_plot3, MA_plot, RS_plot,Decay_plot,FWHM_plot,BR_plot2,align='v',axis='l')
##make bottom row
 bottom_row <- plot_grid(plots[[4]],plots[[5]],plots[[6]], nrow =1)
# put together
top_row <- plot_grid(plots[[1]],plots[[2]],plots[[3]], nrow =1)
middle_row <- plot_grid(legend, nrow=1, scale=4)
test <- plot_grid(top_row, middle_row, bottom_row, ncol=1, rel_heights = c(1,.1,1), scale=c(1,4,1))

test

ggsave("output/Figures/Calciumgroup.eps",width = 8, height =16, units = "in")

sessionInfo()
R version 4.2.2 (2022-10-31 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    

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

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

loaded via a namespace (and not attached):
 [1] httr_1.4.6        sass_0.4.6        jsonlite_1.8.5    splines_4.2.2    
 [5] gtools_3.9.4      bslib_0.5.0       getPass_0.2-2     highr_0.10       
 [9] yaml_2.3.7        pillar_1.9.0      backports_1.4.1   lattice_0.21-8   
[13] glue_1.6.2        digest_0.6.31     promises_1.2.0.1  colorspace_2.1-0 
[17] sandwich_3.0-2    htmltools_0.5.5   httpuv_1.6.11     Matrix_1.5-4.1   
[21] pkgconfig_2.0.3   mvtnorm_1.2-2     scales_1.2.1      processx_3.8.1   
[25] whisker_0.4.1     later_1.3.1       tzdb_0.4.0        timechange_0.2.0 
[29] git2r_0.32.0      farver_2.1.1      generics_0.1.3    TH.data_1.1-2    
[33] cachem_1.0.8      withr_2.5.0       cli_3.6.1         survival_3.5-5   
[37] magrittr_2.0.3    evaluate_0.21     ps_1.7.5          fs_1.6.2         
[41] fansi_1.0.4       textshaping_0.3.6 tools_4.2.2       hms_1.1.3        
[45] lifecycle_1.0.3   multcomp_1.4-24   munsell_0.5.0     plotrix_3.8-2    
[49] callr_3.7.3       compiler_4.2.2    jquerylib_0.1.4   systemfonts_1.0.4
[53] rlang_1.1.1       grid_4.2.2        rstudioapi_0.14   labeling_0.4.2   
[57] rmarkdown_2.22    gtable_0.3.3      codetools_0.2-19  abind_1.4-5      
[61] R6_2.5.1          zoo_1.8-12        knitr_1.43        fastmap_1.1.1    
[65] utf8_1.2.3        rprojroot_2.0.3   ragg_1.2.5        stringi_1.7.12   
[69] Rcpp_1.0.10       vctrs_0.6.3       tidyselect_1.2.0  xfun_0.39