This script loads in predicted muscle nuclei-type proportions and investigates how they changed during the intervention.


Setup

Load required packages

library(tidyverse)
library(SummarizedExperiment)
library(lmerTest)
library(lme4)

Add to data

Load data

load("../GOTO_Data/GOTO_targets-filtered.Rdata")
load("../GOTO_Data/GOTO_methData-filtered.Rdata")
load("../GOTO_Data/Cell_Counts/Muscle/Music_PredictedMuscleCells.Rdata")

Format targets

targets <- targets %>% 
  mutate(join = paste0(IOP2_ID, '_', 
                       ifelse(targets$timepoint==1, 2, 1)))

Format nuclei data

colnames(deconv)
## [1] "Slow Skeletal Muscle" "FAPs"                 "Fast Skeletal Muscle"
## [4] "SATs"                 "T/NK/Macrophages"     "Endothelial Cells"   
## [7] "Smooth Muscle"
deconv <- deconv * 100

deconv <- as.data.frame(deconv) %>% 
  rownames_to_column(var="join")

colnames(deconv) <- c("join", "cc_musc_slowSM", "cc_musc_FAP", 
                      "cc_musc_fastSM", "cc_musc_SAT", 
                      "cc_musc_TNKmacro", "cc_musc_endo", 
                      "cc_musc_smooth")

Merge

targets <- left_join(targets, deconv, by = "join")

Make covariates factors

targets$timepoint <- as.factor(targets$timepoint)
targets$sex <- as.factor(targets$sex)
targets$smoke <- as.factor(targets$smoke)

Save

colData(methData) <- DataFrame(targets)
save(targets, file='../GOTO_Data/GOTO_targets-filtered.Rdata')
save(methData, file="../GOTO_Data/GOTO_methData-filtered.Rdata")

Nuclei changes

cell_names <- c("cc_musc_slowSM", "cc_musc_FAP", 
                "cc_musc_fastSM", "cc_musc_SAT",
                "cc_musc_TNKmacro", "cc_musc_endo",
                "cc_musc_smooth")

Keep only muscle samples

targets <- targets %>% filter(tissue == 'muscle')
summary(targets[,cell_names])
##  cc_musc_slowSM   cc_musc_FAP      cc_musc_fastSM     cc_musc_SAT     
##  Min.   : 0.00   Min.   :0.00000   Min.   : 0.1605   Min.   :0.00000  
##  1st Qu.:20.69   1st Qu.:0.00000   1st Qu.: 9.9912   1st Qu.:0.00000  
##  Median :38.69   Median :0.00000   Median :20.7903   Median :0.00000  
##  Mean   :34.92   Mean   :0.08472   Mean   :26.0746   Mean   :0.03977  
##  3rd Qu.:47.80   3rd Qu.:0.00000   3rd Qu.:39.5855   3rd Qu.:0.00000  
##  Max.   :69.57   Max.   :2.08963   Max.   :77.4087   Max.   :2.16730  
##  NA's   :12      NA's   :12        NA's   :12        NA's   :12       
##  cc_musc_TNKmacro   cc_musc_endo   cc_musc_smooth   
##  Min.   :0.00000   Min.   :22.12   Min.   :0.00000  
##  1st Qu.:0.00000   1st Qu.:32.99   1st Qu.:0.00000  
##  Median :0.08679   Median :37.69   Median :0.00000  
##  Mean   :0.71859   Mean   :38.15   Mean   :0.01574  
##  3rd Qu.:0.88586   3rd Qu.:43.16   3rd Qu.:0.00000  
##  Max.   :9.09209   Max.   :59.30   Max.   :0.90539  
##  NA's   :12        NA's   :12      NA's   :12
for(i in cell_names){
  base_mean <- mean((targets %>% 
    filter(timepoint == 0) %>% select(all_of(i)))[,1], na.rm=TRUE)
  
  base_sd <- sd((targets %>% 
    filter(timepoint == 0) %>% select(all_of(i)))[,1], na.rm=TRUE)
  
  fit <- lmer(get(i) ~ timepoint + age + sex + smoke + (1|IOP2_ID),
              data = targets)
  
  df <- data.frame(
    cell = i,
    mean = base_mean,
    sd = base_sd,
    es = summary(fit)$coefficients[2,1],
    se = summary(fit)$coefficients[2,2],
    p = summary(fit)$coefficients[2,5]
  )
  
  if(i == cell_names[1]){
    out <- df
  } else {
    out <- rbind(out, df)
  }
}

Adjust p-values

out$padj <- p.adjust(out$p, method = 'fdr')

Look at results

out %>% arrange(padj)
##               cell        mean         sd           es         se            p
## 1     cc_musc_endo 36.56967436  7.0586944  3.259327949 0.89513908 0.0005030611
## 2      cc_musc_FAP  0.01759775  0.1133872  0.132055693 0.05440369 0.0164628596
## 3      cc_musc_SAT  0.00000000  0.0000000  0.078739052 0.03748519 0.0374492394
## 4   cc_musc_slowSM 35.96309022 17.3242235 -2.009689482 2.34669514 0.3945754930
## 5   cc_musc_fastSM 26.74673289 19.8978430 -1.510131460 2.35807157 0.5239038139
## 6 cc_musc_TNKmacro  0.68921938  1.5566276  0.045708146 0.21703904 0.8337862040
## 7   cc_musc_smooth  0.01368539  0.1055268  0.003953557 0.01640958 0.8102837650
##          padj
## 1 0.003521428
## 2 0.057620009
## 3 0.087381559
## 4 0.690507113
## 5 0.733465340
## 6 0.833786204
## 7 0.833786204

Forest plot

Print plot

plot <- out %>% 
  mutate(lower = es - (1.96 * se),
         upper = es + (1.96 * se)) %>% 
  filter(mean > 0.05) %>% 
  ggplot(aes(x = es, 
             y = reorder(cell, mean),
             xmin = lower,
             xmax = upper)) +
  geom_vline(xintercept=0, linewidth=1, 
             color='grey60', linetype='dashed') +
  geom_errorbar(width=0.5,
                linewidth=1,
                position=position_dodge(width=0.9)) +
  geom_point(size=5,
             shape=21,
             stroke=1.2,
             position=position_dodge(width=0.9),
             fill = "#D62839") +
  xlab('Intervention effect') + ylab('') + xlim(c(-7,7)) +
  theme(axis.text = element_text(size=14, color = '#373334'),
        axis.title = element_text(size=16, hjust=0.5, 
                                  color = '#373334'),
        text=element_text(size=14),
        panel.background = element_rect(fill = 'white',
                                        color='#373334'),
        panel.grid.major = element_line(color = 'grey95'),
        panel.grid.minor = element_line(color = 'grey95'),
        plot.background = element_rect(fill = 'white'),
        axis.ticks.x = element_line(size=1))
print(plot)


Save

Forest plot

png(file="../GOTO_Data/Figures/Figure_1A.png")
print(plot)
dev.off()
## png 
##   2

Save data

write_csv(out, file = '../GOTO_Data/Tables/ST03.csv')

Session Info

sessionInfo()
## R version 4.2.2 (2022-10-31)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Rocky Linux 8.10 (Green Obsidian)
## 
## Matrix products: default
## BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.15.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] GEOquery_2.62.2                                    
##  [2] MuSiC_0.2.0                                        
##  [3] nnls_1.4                                           
##  [4] gplots_3.1.3                                       
##  [5] plotly_4.10.1                                      
##  [6] SeuratObject_4.1.3                                 
##  [7] Seurat_4.3.0                                       
##  [8] gridExtra_2.3                                      
##  [9] lattice_0.21-8                                     
## [10] bacon_1.22.0                                       
## [11] ellipse_0.4.5                                      
## [12] methylGSA_1.12.0                                   
## [13] sva_3.42.0                                         
## [14] genefilter_1.76.0                                  
## [15] mgcv_1.8-42                                        
## [16] nlme_3.1-162                                       
## [17] limma_3.54.2                                       
## [18] lmerTest_3.1-3                                     
## [19] lme4_1.1-30                                        
## [20] IlluminaHumanMethylationEPICanno.ilm10b4.hg19_0.6.0
## [21] snpStats_1.44.0                                    
## [22] survival_3.5-5                                     
## [23] ggrepel_0.9.1                                      
## [24] ggfortify_0.4.14                                   
## [25] irlba_2.3.5.1                                      
## [26] Matrix_1.5-4.1                                     
## [27] omicsPrint_1.14.0                                  
## [28] MASS_7.3-60                                        
## [29] DNAmArray_2.0.0                                    
## [30] pls_2.8-2                                          
## [31] FDb.InfiniumMethylation.hg19_2.2.0                 
## [32] org.Hs.eg.db_3.14.0                                
## [33] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2            
## [34] GenomicFeatures_1.46.5                             
## [35] AnnotationDbi_1.56.2                               
## [36] IlluminaHumanMethylationEPICmanifest_0.3.0         
## [37] minfi_1.40.0                                       
## [38] bumphunter_1.36.0                                  
## [39] locfit_1.5-9.8                                     
## [40] iterators_1.0.14                                   
## [41] foreach_1.5.2                                      
## [42] Biostrings_2.62.0                                  
## [43] XVector_0.34.0                                     
## [44] SummarizedExperiment_1.24.0                        
## [45] Biobase_2.58.0                                     
## [46] MatrixGenerics_1.10.0                              
## [47] matrixStats_1.0.0                                  
## [48] GenomicRanges_1.46.1                               
## [49] GenomeInfoDb_1.34.9                                
## [50] IRanges_2.32.0                                     
## [51] S4Vectors_0.36.2                                   
## [52] BiocGenerics_0.44.0                                
## [53] BiocParallel_1.32.6                                
## [54] MethylAid_1.28.0                                   
## [55] forcats_0.5.2                                      
## [56] stringr_1.5.0                                      
## [57] dplyr_1.1.3                                        
## [58] purrr_0.3.4                                        
## [59] readr_2.1.2                                        
## [60] tidyr_1.2.1                                        
## [61] tibble_3.2.1                                       
## [62] ggplot2_3.4.3                                      
## [63] tidyverse_1.3.2                                    
## [64] rmarkdown_2.16                                     
## 
## loaded via a namespace (and not attached):
##   [1] ica_1.0-3                                         
##   [2] Rsamtools_2.10.0                                  
##   [3] cinaR_0.2.3                                       
##   [4] lmtest_0.9-40                                     
##   [5] crayon_1.5.2                                      
##   [6] rhdf5filters_1.10.1                               
##   [7] backports_1.4.1                                   
##   [8] reprex_2.0.2                                      
##   [9] GOSemSim_2.20.0                                   
##  [10] rlang_1.1.1                                       
##  [11] ROCR_1.0-11                                       
##  [12] readxl_1.4.1                                      
##  [13] SparseM_1.81                                      
##  [14] nloptr_2.0.3                                      
##  [15] filelock_1.0.2                                    
##  [16] rjson_0.2.21                                      
##  [17] bit64_4.0.5                                       
##  [18] glue_1.6.2                                        
##  [19] sctransform_0.3.5                                 
##  [20] rngtools_1.5.2                                    
##  [21] spatstat.sparse_3.0-1                             
##  [22] mcmc_0.9-7                                        
##  [23] spatstat.geom_3.2-1                               
##  [24] DOSE_3.20.1                                       
##  [25] haven_2.5.1                                       
##  [26] tidyselect_1.2.0                                  
##  [27] fitdistrplus_1.1-11                               
##  [28] XML_3.99-0.14                                     
##  [29] zoo_1.8-12                                        
##  [30] GenomicAlignments_1.30.0                          
##  [31] MatrixModels_0.5-1                                
##  [32] xtable_1.8-4                                      
##  [33] magrittr_2.0.3                                    
##  [34] evaluate_0.21                                     
##  [35] cli_3.6.1                                         
##  [36] zlibbioc_1.44.0                                   
##  [37] miniUI_0.1.1.1                                    
##  [38] rstudioapi_0.14                                   
##  [39] doRNG_1.8.6                                       
##  [40] sp_1.6-1                                          
##  [41] MultiAssayExperiment_1.20.0                       
##  [42] bslib_0.5.0                                       
##  [43] fastmatch_1.1-3                                   
##  [44] treeio_1.18.1                                     
##  [45] shiny_1.7.2                                       
##  [46] xfun_0.39                                         
##  [47] askpass_1.1                                       
##  [48] multtest_2.50.0                                   
##  [49] cluster_2.1.4                                     
##  [50] caTools_1.18.2                                    
##  [51] tidygraph_1.2.2                                   
##  [52] KEGGREST_1.34.0                                   
##  [53] quantreg_5.94                                     
##  [54] base64_2.0.1                                      
##  [55] ape_5.7-1                                         
##  [56] scrime_1.3.5                                      
##  [57] listenv_0.9.0                                     
##  [58] png_0.1-8                                         
##  [59] reshape_0.8.9                                     
##  [60] future_1.32.0                                     
##  [61] withr_2.5.0                                       
##  [62] bitops_1.0-7                                      
##  [63] ggforce_0.3.4                                     
##  [64] plyr_1.8.8                                        
##  [65] cellranger_1.1.0                                  
##  [66] coda_0.19-4                                       
##  [67] pillar_1.9.0                                      
##  [68] cachem_1.0.8                                      
##  [69] fs_1.6.2                                          
##  [70] clusterProfiler_4.2.2                             
##  [71] DelayedMatrixStats_1.16.0                         
##  [72] vctrs_0.6.3                                       
##  [73] ellipsis_0.3.2                                    
##  [74] generics_0.1.3                                    
##  [75] tools_4.2.2                                       
##  [76] munsell_0.5.0                                     
##  [77] tweenr_2.0.2                                      
##  [78] fgsea_1.20.0                                      
##  [79] DelayedArray_0.24.0                               
##  [80] abind_1.4-5                                       
##  [81] fastmap_1.1.1                                     
##  [82] compiler_4.2.2                                    
##  [83] httpuv_1.6.11                                     
##  [84] rtracklayer_1.54.0                                
##  [85] beanplot_1.3.1                                    
##  [86] MCMCpack_1.6-3                                    
##  [87] GenomeInfoDbData_1.2.9                            
##  [88] edgeR_3.40.2                                      
##  [89] deldir_1.0-9                                      
##  [90] utf8_1.2.3                                        
##  [91] later_1.3.1                                       
##  [92] RobustRankAggreg_1.2.1                            
##  [93] BiocFileCache_2.2.1                               
##  [94] jsonlite_1.8.5                                    
##  [95] scales_1.2.1                                      
##  [96] pbapply_1.7-0                                     
##  [97] tidytree_0.4.0                                    
##  [98] sparseMatrixStats_1.10.0                          
##  [99] lazyeval_0.2.2                                    
## [100] promises_1.2.0.1                                  
## [101] goftest_1.2-3                                     
## [102] spatstat.utils_3.0-3                              
## [103] reticulate_1.30                                   
## [104] htm2txt_2.2.2                                     
## [105] nor1mix_1.3-0                                     
## [106] cowplot_1.1.1                                     
## [107] statmod_1.5.0                                     
## [108] siggenes_1.68.0                                   
## [109] Rtsne_0.16                                        
## [110] downloader_0.4                                    
## [111] uwot_0.1.14                                       
## [112] igraph_1.4.3                                      
## [113] HDF5Array_1.22.1                                  
## [114] numDeriv_2016.8-1.1                               
## [115] yaml_2.3.7                                        
## [116] htmltools_0.5.5                                   
## [117] memoise_2.0.1                                     
## [118] BiocIO_1.8.0                                      
## [119] graphlayouts_0.8.1                                
## [120] quadprog_1.5-8                                    
## [121] viridisLite_0.4.2                                 
## [122] digest_0.6.31                                     
## [123] assertthat_0.2.1                                  
## [124] mime_0.12                                         
## [125] rappdirs_0.3.3                                    
## [126] RSQLite_2.2.17                                    
## [127] yulab.utils_0.0.6                                 
## [128] future.apply_1.11.0                               
## [129] data.table_1.14.8                                 
## [130] blob_1.2.4                                        
## [131] preprocessCore_1.60.2                             
## [132] splines_4.2.2                                     
## [133] labeling_0.4.2                                    
## [134] Rhdf5lib_1.20.0                                   
## [135] illuminaio_0.40.0                                 
## [136] googledrive_2.0.0                                 
## [137] RaggedExperiment_1.18.0                           
## [138] RCurl_1.98-1.12                                   
## [139] broom_1.0.1                                       
## [140] hms_1.1.2                                         
## [141] modelr_0.1.9                                      
## [142] rhdf5_2.42.1                                      
## [143] colorspace_2.1-0                                  
## [144] aplot_0.1.7                                       
## [145] sass_0.4.6                                        
## [146] Rcpp_1.0.10                                       
## [147] mclust_6.0.0                                      
## [148] RANN_2.6.1                                        
## [149] enrichplot_1.14.2                                 
## [150] fansi_1.0.4                                       
## [151] tzdb_0.4.0                                        
## [152] parallelly_1.36.0                                 
## [153] R6_2.5.1                                          
## [154] grid_4.2.2                                        
## [155] ggridges_0.5.4                                    
## [156] lifecycle_1.0.3                                   
## [157] curl_5.0.1                                        
## [158] googlesheets4_1.0.1                               
## [159] minqa_1.2.5                                       
## [160] leiden_0.4.3                                      
## [161] jquerylib_0.1.4                                   
## [162] DO.db_2.9                                         
## [163] qvalue_2.26.0                                     
## [164] RcppAnnoy_0.0.20                                  
## [165] RColorBrewer_1.1-3                                
## [166] spatstat.explore_3.1-0                            
## [167] htmlwidgets_1.5.4                                 
## [168] polyclip_1.10-4                                   
## [169] biomaRt_2.50.3                                    
## [170] missMethyl_1.28.0                                 
## [171] shadowtext_0.1.2                                  
## [172] timechange_0.2.0                                  
## [173] gridGraphics_0.5-1                                
## [174] reactome.db_1.77.0                                
## [175] rvest_1.0.3                                       
## [176] globals_0.16.2                                    
## [177] openssl_2.0.6                                     
## [178] spatstat.random_3.1-5                             
## [179] patchwork_1.1.2                                   
## [180] progressr_0.13.0                                  
## [181] codetools_0.2-19                                  
## [182] IlluminaHumanMethylation450kanno.ilmn12.hg19_0.6.0
## [183] lubridate_1.9.2                                   
## [184] GO.db_3.14.0                                      
## [185] gtools_3.9.4                                      
## [186] prettyunits_1.1.1                                 
## [187] dbplyr_2.2.1                                      
## [188] gridBase_0.4-7                                    
## [189] gtable_0.3.3                                      
## [190] DBI_1.1.3                                         
## [191] tensor_1.5                                        
## [192] ggfun_0.0.7                                       
## [193] httr_1.4.6                                        
## [194] highr_0.10                                        
## [195] KernSmooth_2.23-21                                
## [196] stringi_1.7.12                                    
## [197] vroom_1.5.7                                       
## [198] progress_1.2.2                                    
## [199] reshape2_1.4.4                                    
## [200] farver_2.1.1                                      
## [201] annotate_1.72.0                                   
## [202] viridis_0.6.2                                     
## [203] hexbin_1.28.3                                     
## [204] ggtree_3.2.1                                      
## [205] xml2_1.3.4                                        
## [206] boot_1.3-28.1                                     
## [207] restfulr_0.0.15                                   
## [208] scattermore_0.8                                   
## [209] ggplotify_0.1.0                                   
## [210] bit_4.0.5                                         
## [211] spatstat.data_3.0-1                               
## [212] scatterpie_0.1.8                                  
## [213] ggraph_2.0.6                                      
## [214] pkgconfig_2.0.3                                   
## [215] gargle_1.5.0                                      
## [216] knitr_1.43

Clear

rm(list=ls())