Run methylationGLM_T1.R
methylationGLM_T1(
inputPheno = "rData/preprocessingPheno/mergeData/phenoBetaT1.RData",
outputLogs = "logs",
outputRData = "rData/methylationGLM_T1/models",
outputPlots = "figures/methylationGLM_T1",
phenotypes =
"DASS_Depression,DASS_Anxiety,DASS_Stress,PCL5_TotalScore,\n MHCSF_TotalScore,BRS_TotalScore",
covariates = "Sex,Age,Ethnicity,TraumaDefinition,Leukocytes,Epithelial.cells",
factorVars = "Sex,Ethnicity,TraumaDefinition",
cpgPrefix = "cg",
cpgLimit = NA,
nCores = 32,
plotWidth = 2000,
plotHeight = 1000,
plotDPI = 150,
interactionTerm = NULL,
libPath = NULL,
glmLibs = "glm2",
prsMap = NULL,
summaryPval = NA,
summaryResidualSD = TRUE,
saveSignificantCpGs = FALSE,
significantCpGDir = "preliminaryResults/cpgs/methylationGLM_T1",
significantCpGPval = 0.05,
saveTxtSummaries = TRUE,
chunkSize = NULL,
summaryTxtDir = "preliminaryResults/summary/methylationGLM_T1/glm",
fdrThreshold = 0.05,
padjmethod = "fdr",
annotationPackage = "IlluminaHumanMethylationEPICv2anno.20a1.hg38",
annotationCols =
"Name,chr,pos,UCSC_RefGene_Group,UCSC_RefGene_Name,\n Relation_to_Island,GencodeV41_Group",
annotatedGLMOut = "data/methylationGLM_T1"
)Character. Path to merged phenotype and beta-value RData file.
Character. Directory for log files.
Character. Directory for model RData outputs.
Character. Directory for output plots.
Character. Comma-separated phenotype variables to model.
Character. Comma-separated covariate variables.
Character. Comma-separated factor variables.
Character. CpG identifier prefix.
Integer or NA. Maximum number of CpGs to analyse.
Integer. Number of CPU cores to use.
Integer. Plot width in pixels.
Integer. Plot height in pixels.
Integer. Plot resolution in DPI.
Character or NULL. Optional interaction term.
Character or NULL. Optional library path.
Character. GLM libraries to use.
Character or NULL. Optional PRS mapping file.
Numeric or NA. P-value threshold for summaries.
Logical. Whether to summarise residual SD.
Logical. Save significant CpGs.
Character. Directory for significant CpGs.
Numeric. P-value threshold for significant CpGs.
Logical. Save text summaries.
Integer. Number of CpGs processed per chunk.
Character. Directory for summary text files.
Numeric. FDR threshold.
Character. P-value adjustment method.
Character. Annotation package name.
Character. Annotation columns to extract.
Character. Output directory for annotated results.
Invisibly returns NULL. This function is called for its side effects,
running CpG-level GLM analyses and writing model results, summaries,
plots, and annotated tables to disk.
tmp <- tempdir()
stopifnot(dir.exists(tmp))
# \donttest{
methylationGLM_T1(
inputPheno = "rData/preprocessingPheno/mergeData/phenoBetaT1.RData",
outputLogs = "logs",
outputRData = "rData/methylationGLM_T1/models",
outputPlots = "figures/methylationGLM_T1",
phenotypes = "DASS_Depression,DASS_Anxiety,DASS_Stress,
PCL5_TotalScore,MHCSF_TotalScore,BRS_TotalScore",
covariates = "Sex,Age,Ethnicity,TraumaDefinition,
Leukocytes,Epithelial.cells",
factorVars = "Sex,Ethnicity,TraumaDefinition",
cpgPrefix = "cg",
cpgLimit = NA,
nCores = 4,
plotWidth = 2000,
plotHeight = 1000,
plotDPI = 150,
interactionTerm = NULL,
libPath = NULL,
glmLibs = "glm2",
prsMap = NULL,
summaryPval = NA,
summaryResidualSD = TRUE,
saveSignificantCpGs = FALSE,
significantCpGDir = "preliminaryResults/cpgs/methylationGLM_T1",
significantCpGPval = 0.05,
saveTxtSummaries = TRUE,
chunkSize = 10000,
summaryTxtDir = "preliminaryResults/summary/methylationGLM_T1/glm",
fdrThreshold = 0.05,
padjmethod = "fdr",
annotationPackage =
"IlluminaHumanMethylationEPICv2anno.20a1.hg38",
annotationCols =
"Name,chr,pos,UCSC_RefGene_Group,
UCSC_RefGene_Name,Relation_to_Island,
GencodeV41_Group",
annotatedGLMOut = "data/methylationGLM_T1"
)
#> ==== Starting DNAm GLM Analysis (Timepoint 1) ====
#> Start time: 2026-04-02 05:15:45
#> Input phenotype + beta file: rData/preprocessingPheno/mergeData/phenoBetaT1.RData
#> Output RData folder: rData/methylationGLM_T1/models
#> Output logs folder: logs
#> Output plots folder: figures/methylationGLM_T1
#> Phenotypes: DASS_Depression,DASS_Anxiety,DASS_Stress,
#> PCL5_TotalScore,MHCSF_TotalScore,BRS_TotalScore
#> Covariates: Sex,Age,Ethnicity,TraumaDefinition,
#> Leukocytes,Epithelial.cells
#> Factor variables: Sex,Ethnicity,TraumaDefinition
#> CpG column prefix: cg
#> CpG limit: All
#> Number of cores: 4
#> Interaction term:
#> Library path: /__w/_temp/Library /usr/local/lib/R/site-library /usr/local/lib/R/library
#> GLM libraries: glm2
#> PRS mapping: None
#> Include Residual SD in summary: TRUE
#> Summary p-value filter: None
#> Save summary tables: TRUE
#> Chunk size for parallel processing: 10000
#> Summary output folder: preliminaryResults/summary/methylationGLM_T1/glm
#> FDR threshold: 0.05
#> P-value adjustment method: fdr
#> Save significant CpGs: FALSE
#> Significant CpG output folder: preliminaryResults/cpgs/methylationGLM_T1
#> Significance p-value cutoff: 0.05
#> Annotation package: IlluminaHumanMethylationEPICv2anno.20a1.hg38
#> Annotation columns: Name,chr,pos,UCSC_RefGene_Group,
#> UCSC_RefGene_Name,Relation_to_Island,
#> GencodeV41_Group
#> Annotated output CSV: data/methylationGLM_T1
#> =======================================================================
#> Warning: cannot open compressed file 'rData/preprocessingPheno/mergeData/phenoBetaT1.RData', probable reason 'No such file or directory'
#> Error in readChar(con, 5L, useBytes = TRUE): cannot open the connection
# }