dnaMethyAge包学习笔记
1.introduction
许多对甲基化年龄进行计算的文章都是采用网站实现计算的,能够实现对甲基化年龄的计算的R包相对比较少,其中应用最广的是dnaMethyAge包。作者本想寻找能够计算Grimage和Grimage2的R包,奈何没有寻找到,因此只能记录一下能够计算其他许多甲基化年龄的R包dnaMethyAge的学习笔记。
2.example
#安装和加载R包dnaMethyAge
devtools::install_github("yiluyucheng/dnaMethyAge")
library('dnaMethyAge')
## prepare betas dataframe
data('subGSE174422') ## load example betas,>=0.6,<=0.2
# GSM5310260_3999979009_R02C02 GSM5310261_3999979017_R05C01
#cg00000029 0.29 0.31
#cg00000108 0.84 0.83
#cg00000109 0.74 0.70
#cg00000165 0.09 0.09
#cg00000236 0.55 0.55
#cg00000289 0.53 0.43
#cg00000292 0.70 0.67
#cg00000321 0.12 0.14
#cg00000363 0.24 0.20
#cg00000622 0.03 0.03
availableClock()#List all supported clocks
# [1] "HannumG2013" "HorvathS2013" "LevineM2018" "ZhangQ2019"
# [5] "ShirebyG2020" "YangZ2016" "ZhangY2017" "LuA2019"
# [9] "HorvathS2018" "DunedinPACE" "McEwenL2019" "CBL_specific"
#[13] "PCGrimAge" "PCHorvathS2013" "PCHannumG2013" "PCHorvathS2018"
#[17] "PCPhenoAge" "CBL_common" "Cortex_common" "epiTOC2"
#[21] "BernabeuE2023c" "LuA2023p1" "LuA2023p2" "LuA2023p3"
#设置想计算的甲基化时钟
clock_name <- 'HorvathS2013'
#计算Horvath2013
horvath_age <- methyAge(betas, clock=clock_name)
print(horvath_age)
# Sample mAge
#1 GSM5310260_3999979009_R02C02 74.88139
#2 GSM5310261_3999979017_R05C01 62.36400
#3 GSM5310262_3999979018_R02C02 68.04759
#4 GSM5310263_3999979022_R02C01 61.62691
#5 GSM5310264_3999979027_R02C01 59.65161
#6 GSM5310265_3999979028_R01C01 60.95991
#7 GSM5310266_3999979029_R04C02 52.48954
#8 GSM5310267_3999979031_R06C02 64.29711
还能通过纳入age年龄计算得到age acceleration。
print(info)
# Sample Age Sex
#1 GSM5310260_3999979009_R02C02 68.8 Female
#2 GSM5310261_3999979017_R05C01 45.6 Female
#3 GSM5310262_3999979018_R02C02 67.4 Female
#4 GSM5310263_3999979022_R02C01 45.6 Female
#5 GSM5310264_3999979027_R02C01 62.5 Female
#6 GSM5310265_3999979028_R01C01 45.1 Female
#7 GSM5310266_3999979029_R04C02 53.2 Female
#8 GSM5310267_3999979031_R06C02 63.8 Female
horvath_age <- methyAge(betas, clock=clock_name, age_info=info, fit_method='Linear', do_plot=TRUE)
print(horvath_age)
# Sample Age Sex mAge Age_Acceleration
#1 GSM5310260_3999979009_R02C02 68.8 Female 74.88139 7.334461
#2 GSM5310261_3999979017_R05C01 45.6 Female 62.36400 3.318402
#3 GSM5310262_3999979018_R02C02 67.4 Female 68.04759 1.013670
#4 GSM5310263_3999979022_R02C01 45.6 Female 61.62691 2.581311
#5 GSM5310264_3999979027_R02C01 62.5 Female 59.65161 -5.586763
#6 GSM5310265_3999979028_R01C01 45.1 Female 60.95991 2.097534
#7 GSM5310266_3999979029_R04C02 53.2 Female 52.48954 -9.340977
#8 GSM5310267_3999979031_R06C02 63.8 Female 64.29711 -1.417638
参数"do_plot=TRUE"能生成methyage和age的散点图