Last updated: 2024-05-21

Checks: 5 1

Knit directory: RA_Tcell_omics/analysis/

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 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(20221110) 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.

Tracking code development and connecting the code version to the results is critical for reproducibility. To start using Git, open the Terminal and type git init in your project directory.


This project is not being versioned with Git. To obtain the full reproducibility benefits of using workflowr, please see ?wflow_start.


Load libraries

Global variables

Load and preprocess datasets

Load omics data

Only keep probes on X chromose

Get unique symbol

Remove CpGs not associated with any function

Correlation between average methylation level and phenotype


    Two Sample t-test

data:  meanMethylation by group
t = -0.21264, df = 21, p-value = 0.8337
alternative hypothesis: true difference in means between group Control and group RA is not equal to 0
95 percent confidence interval:
 -0.03569470  0.02907226
sample estimates:
mean in group Control      mean in group RA 
            0.5530622             0.5563734 

Without Male


    Two Sample t-test

data:  meanMethylation by group
t = 0.79875, df = 16, p-value = 0.4361
alternative hypothesis: true difference in means between group Control and group RA is not equal to 0
95 percent confidence interval:
 -0.007774737  0.017175766
sample estimates:
mean in group Control      mean in group RA 
            0.5750633             0.5703628 

PCA analysis

Calculate PCA

PCA plots

PC1 versus PC2

PC2 versus PC3

Associate PCs with disease

# A tibble: 23 × 3
# Groups:   pc [23]
   pc    estimate p.value
   <chr>    <dbl>   <dbl>
 1 PC4       9.08  0.0146
 2 PC8      -5.29  0.0369
 3 PC7       4.18  0.127 
 4 PC2      10.0   0.133 
 5 PC17     -2.45  0.195 
 6 PC16     -2.30  0.233 
 7 PC14      1.76  0.391 
 8 PC20      1.24  0.468 
 9 PC13     -1.52  0.468 
10 PC1      25.6   0.531 
# ℹ 13 more rows

The first three principal components can separate RA with control samples, to some degree.

PCA analysis without males

Calculate PCA

PCA plots

PC1 versus PC2

PC2 versus PC3

Associate PCs with disease

# A tibble: 18 × 3
# Groups:   pc [18]
   pc     estimate p.value
   <chr>     <dbl>   <dbl>
 1 PC3   -1.56e+ 1 0.00999
 2 PC12  -5.43e+ 0 0.0669 
 3 PC5    7.13e+ 0 0.107  
 4 PC9    3.54e+ 0 0.302  
 5 PC18   1.85e-14 0.349  
 6 PC7   -3.54e+ 0 0.351  
 7 PC1    7.61e+ 0 0.463  
 8 PC10   2.45e+ 0 0.469  
 9 PC16  -1.82e+ 0 0.501  
10 PC14   1.66e+ 0 0.569  
11 PC11   1.81e+ 0 0.580  
12 PC6   -2.12e+ 0 0.600  
13 PC13   1.37e+ 0 0.654  
14 PC15   7.70e- 1 0.781  
15 PC17   7.11e- 1 0.781  
16 PC4   -1.27e+ 0 0.831  
17 PC8   -6.53e- 1 0.854  
18 PC2    4.50e- 1 0.958  

The first three principal components can separate RA with control samples, to some degree.

Detect differentially methylated CpGs only in Male samples

Prepare data

Process methylation dataset

[1] 13294    18

Differential methylation using limma

Add mean difference of beta values

Save the full table as excel file

diffMeth_table_onlyChrX.xlsx

Number of hypermethylation and hypomethylation

Visualize results (including males samples in the visualization)

Heatmap of associated CpGs

Table of significantly associated probes (P-Value < 0.01)

Visualize top 20 associations

Number of associated CpGs per gene

Look at specified gene list

Prepare data

Probes on sex chromosomes are not removed, as some genes in the list are from chrX and chrY

Fix some names

Check if the names are present

Genes detected

[1] "TKTL1"  "IDH3G"  "PDK3"   "COX7B"  "FOXP3"  "NOX1"   "PDHA1"  "PFKFB1"

Add all DGKs and NDUFs

Visualize results

Visualize associations


R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur/Monterey 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] forcats_0.5.1               stringr_1.4.1              
 [3] dplyr_1.1.4.9000            purrr_0.3.4                
 [5] readr_2.1.2                 tidyr_1.2.0                
 [7] tibble_3.2.1                ggplot2_3.4.1              
 [9] tidyverse_1.3.2             pheatmap_1.0.12            
[11] SummarizedExperiment_1.26.1 Biobase_2.56.0             
[13] GenomicRanges_1.48.0        GenomeInfoDb_1.32.2        
[15] IRanges_2.30.0              S4Vectors_0.34.0           
[17] BiocGenerics_0.42.0         MatrixGenerics_1.8.1       
[19] matrixStats_0.62.0          limma_3.52.2               

loaded via a namespace (and not attached):
  [1] ggbeeswarm_0.6.0       googledrive_2.0.0      colorspace_2.0-3      
  [4] ellipsis_0.3.2         rprojroot_2.0.3        XVector_0.36.0        
  [7] fs_1.5.2               rstudioapi_0.13        farver_2.1.1          
 [10] DT_0.23                ggrepel_0.9.1          bit64_4.0.5           
 [13] AnnotationDbi_1.58.0   fansi_1.0.6            lubridate_1.8.0       
 [16] xml2_1.3.3             splines_4.2.0          cachem_1.0.6          
 [19] knitr_1.39             jsonlite_1.8.3         workflowr_1.7.0       
 [22] broom_1.0.0            annotate_1.74.0        dbplyr_2.2.1          
 [25] png_0.1-7              compiler_4.2.0         httr_1.4.3            
 [28] backports_1.4.1        assertthat_0.2.1       Matrix_1.5-4          
 [31] fastmap_1.1.0          gargle_1.2.0           cli_3.6.2             
 [34] later_1.3.0            htmltools_0.5.4        tools_4.2.0           
 [37] gtable_0.3.0           glue_1.7.0             GenomeInfoDbData_1.2.8
 [40] Rcpp_1.0.9             cellranger_1.1.0       jquerylib_0.1.4       
 [43] vctrs_0.6.5            Biostrings_2.64.0      writexl_1.4.0         
 [46] crosstalk_1.2.0        xfun_0.31              rvest_1.0.2           
 [49] lifecycle_1.0.4        XML_3.99-0.10          googlesheets4_1.0.0   
 [52] zlibbioc_1.42.0        scales_1.2.0           hms_1.1.1             
 [55] promises_1.2.0.1       RColorBrewer_1.1-3     yaml_2.3.5            
 [58] memoise_2.0.1          sass_0.4.2             stringi_1.7.8         
 [61] RSQLite_2.2.15         highr_0.9              genefilter_1.78.0     
 [64] rlang_1.1.3            pkgconfig_2.0.3        bitops_1.0-7          
 [67] evaluate_0.15          lattice_0.20-45        htmlwidgets_1.5.4     
 [70] labeling_0.4.2         cowplot_1.1.1          bit_4.0.4             
 [73] tidyselect_1.2.1       magrittr_2.0.3         R6_2.5.1              
 [76] generics_0.1.3         DelayedArray_0.22.0    DBI_1.1.3             
 [79] pillar_1.9.0           haven_2.5.0            withr_3.0.0           
 [82] survival_3.4-0         KEGGREST_1.36.3        RCurl_1.98-1.7        
 [85] modelr_0.1.8           crayon_1.5.2           utf8_1.2.4            
 [88] tzdb_0.3.0             rmarkdown_2.14         grid_4.2.0            
 [91] readxl_1.4.0           blob_1.2.3             git2r_0.30.1          
 [94] reprex_2.0.1           digest_0.6.30          xtable_1.8-4          
 [97] httpuv_1.6.6           munsell_0.5.0          beeswarm_0.4.0        
[100] vipor_0.4.5            bslib_0.4.1