生物信息学/MethylMix

维基教科书,自由的教学读本

MethylMix[编辑]

MethylMix是一种用于识别疾病的高甲基化和低甲基化基因的算法。MethylMix基于Beta混合模型来识别甲基化状态,并将其与正常的DNA甲基化状态进行比较。MethylMix使用一种新的统计量,差异甲基化值或DM值,定义为甲基化状态与正常甲基化状态之间的差异。最后,匹配的基因表达数据用于识别除差异外,功能性甲基化状态,重点关注影响基因表达的甲基化变化。

  • 计算基因甲基化化水平和基因表达相关性,找出显著相关的基因。
  • 对样品甲基化程度构建混合模型( mixture model )。
  • Wilcoxon rank test计算正常组和处理组的差异甲基化。
  • 对计算的p值进行矫正。

MethylMix软件官网:https://bioconductor.org/packages/release/bioc/html/MethylMix.html

使用手册[编辑]

https://bioconductor.org/packages/release/bioc/vignettes/MethylMix/inst/doc/vignettes.html

安装MethylMix[编辑]

在R语言IDE命令行中运行如下代码进行安装:

# 检查是否安装BiocManager软件包
if (!requireNamespace("BiocManager", quietly=TRUE))
  install.packages("BiocManager")
  
# 安装MethylMix扩展包
BiocManager::install("MethylMix")

MethylMix包的函数与参数[编辑]

用于下载和整理TCGA数据的函数[编辑]

  • Download_DNAmethylation下载TCGA指定癌症类型的甲基化数据
    • Preprocess_DNAmethylation处理Download_DNAmethylation函数下载的甲基化数据
  • Download_GeneExpression下载TCGA指定癌症类型的基因表达数据
    • Preprocess_GeneExpression处理Download_GeneExpressio函数下载的基因表达数据
  • GetData:下载和整理基因表达和甲基化数据
Download_*和Getdata参数
CancerSite 长度为1的字符类型,包含TCGA癌症编码。
TargetDirectory 字符类型,用于创建储存下载文件的目录名。
downloadData 逻辑值,指示是否应下载数据(默认值:TRUE)。如果为false,则返回所需数据的URL。

Download_*返回值

列出 27k 和 450k 甲基化数据的下载文件路径。

Getdata返回值

将在目标目录中创建以下文件:

  • gdac:包含从 TCGA 下载的原始数据的文件夹。
  • MET_CancerSite_Processed.rds:在 CpG 位点级别(未聚类)处理的甲基化数据。
  • GE_CancerSite_Processed.rds:处理过的基因表达数据。
  • data_CancerSite.rds:包含基因表达和甲基化数据的列表。 甲基化数据在基因水平上聚集和呈现。 包含从 CpG 位点到基因映射的矩阵。

Preprocess_*参数[编辑]

CancerSite 长度为1的字符类型,包含TCGA癌症编码。
MAdirectories 带有下载数据目录的字符向量。 它可以是 Download_DNAmethylation 函数返回的对象。
MissingValueThresholdGene 每个基因缺失值的阈值。 去除 NA 百分比大于此阈值的基因。 默认值为 0.3。
MissingValueThresholdSample 每个样本缺失值的阈值。 去除 NA 百分比大于此阈值的样本。 默认值为 0.1。
METdirectories 带有下载数据目录的字符向量。 它可以是 Download_DNAmethylation 函数返回的对象。
MissingValueThreshold 删除具有缺失值的样本或基因的阈值。 默认值为 0.2

Preprocess_*返回值

列出癌症和正常样本的预处理数据矩阵。

ClusterProbes:其他来源数据整理注释[编辑]

此函数使用 Illumina 甲基化芯片的注释将每个探针映射到一个基因。 然后,对于每个基因,它使用层次聚类和 Pearson 相关作为距离和完整连锁对其所有 CpG 位点进行聚类。 如果提供了正常样本的数据,则仅使用癌症和正常样本之间的重叠探针。 去除带有 SNP 的探针。 如果用户注册了一个并行结构,这个函数准备并行运行,否则它会顺序运行。 此函数还整理样本名称,将它们转换为 12 位数字格式。

参数[编辑]

MET_Cancer 癌症样本的甲基化数据矩阵。
MET_Normal 正常样本的甲基化数据矩阵。
CorThreshold 分类的相关阈值。

返回值[编辑]

列出聚类数据集以及探针和基因之间的映射。

内置示例数据:METcancer、METnormal和GEcancer[编辑]

> data(METcancer)
> METcancer[1:4,1:4]
       TCGA.02.0001 TCGA.02.0003 TCGA.02.0006 TCGA.02.0007
ERBB2      0.066976     0.056493      0.16083     0.059322
FAAH       0.251890     0.193620      0.29216     0.856140
FNDC3B     0.691420     0.563600      0.54231     0.306230
FOXD1      0.084173     0.091946      0.19121     0.752810
> data(METnormal)
> METnormal[1:4,1:4]
       X4321207019_B X4321207026_C X4321207042_E X4321207042_K
ERBB2        0.14834      0.105520      0.088934      0.084731
FAAH         0.21961      0.279150      0.196890      0.220890
FNDC3B       0.76382      0.784840      0.796010      0.752130
FOXD1        0.13591      0.074815      0.085960      0.088573
> data(GEcancer)
> GEcancer[1:4,1:4]
       TCGA.02.0001 TCGA.02.0003 TCGA.02.0006 TCGA.02.0007
ERBB2     -0.191840     -1.24440    -0.026743     1.524600
FAAH      -0.075087     -0.70167    -0.580130    -1.237400
FNDC3B     0.033780     -0.64668    -0.356230    -0.050206
FOXD1      0.102790      0.11901     0.155030    -1.002300

MethylMix:癌症中 DNA 甲基化数据的混合模型[编辑]

MethylMix 通过模拟癌症与正常的 DNA 甲基化数据并寻找同质亚群来识别 DNA 甲基化驱动基因。 此外,匹配的基因表达数据(例如来自芯片技术或 RNA 测序)用于通过要求特定基因的甲基化和基因表达之间存在负相关来识别功能性 DNA 甲基化事件。 请参阅下面的参考资料。

Gevaert 0. MethylMix: an R package for identifying DNA methylation-driven genes. Bioinformatics (Oxford, England). 2015;31(11):1839-41. doi:10.1093/bioinformatics/btv020.

Gevaert O, Tibshirani R, Plevritis SK. Pancancer analysis of DNA methylation-driven genes using MethylMix. Genome Biology. 2015;16(1):17. doi:10.1186/s13059-014-0579-8.

Pierre-Louis Cedoz, Marcos Prunello, Kevin Brennan, Olivier Gevaert; MethylMix 2.0: an R package for identifying DNA methylation genes. Bioinformatics. doi:10.1093/bioinformatics/bty156.

参数[编辑]

METcancer 癌组织甲基化数据的矩阵,行中有基因,列中有样本。
GEcancer 癌组织的基因表达数据,行中有基因,列中有样本。
METnormal 矩阵与 METcancer 中相同基因的正常甲基化数据。 同样是行中的基因和列中的样本。 样本不必与癌症数据相匹配。 如果此参数为 NULL,MethylMix 将在不与正常样本进行比较的情况下运行。
listOfGenes 带有待评估基因名称的向量,名称必须与 METcancer 的行名称一致。
filter 逻辑指示是否应执行线性回归以选择在甲基化和基因表达之间具有显着线性负相关关系的基因(默认值:TRUE)。
NoNormalMode 逻辑指示是否应将癌症样本中发现的甲基化状态与正常样本进行比较(默认值:FALSE)。
OutputRoot 存储 MethylMix 结果对象的路径。

返回值[编辑]

MethylationDrivers 被 MethylMix 鉴定为转录预测和差异甲基化的基因。
NrComponents 为每个驱动基因找到的甲基化数目。
MixtureStates 每个驱动基因的 DM 值列表。 对于给定基因,差异甲基化值(DM 值)定义为癌症样本的一种混合物成分的甲基化平均值与正常样本的甲基化平均值之间的差异。
MethylationStates 具有所有驱动基因(行)和所有样本(列)的 DM 值的矩阵。
Classifications 对于每个基因,带有整数的矩阵指示每个癌症样本被分配到哪个混合物成分。
Models 每个驱动基因的 Beta 混合模型参数。

MethylMix的输出结果进行操作的函数[编辑]

  • MethylMix_ModelGeneExpression:使用简单的线性回归模型将基因表达建模为基因表达的函数。 返回在 DNA 甲基化和基因表达之间具有显着负线性关联的基因。
  • MethylMix_PlotModel:生成图来表示 MethylMix 的输出。
  • MethylMix_Predict:给定一个包含甲基化数据的新数据集,此函数可预测每个新样本和驱动基因的混合成分。 预测基于使用 MethylMix'x 拟合混合模型计算的后验概率。

参数[编辑]

MethylMix_ModelGeneExpression
METcancer 癌症样本甲基化数据的矩阵(行中的基因,列中的样本)。
GEcancer 癌症样本基因表达数据的矩阵(行中的基因,列中的样本)。
CovariateData 矢量(数字或字符)指示要包含在模型中以对其进行调整的协变量。 不用于 MethylMix 的标准运行。 例如,如果样本可以来自不同的组织类型,则可以使用它。
MethylMix_PlotModel
GeneName 要为其创建 MethylMix 图的基因的名称。
MixtureModelResults MethylMix 函数返回的列表。
METcancer 癌组织甲基化数据的矩阵,行中有基因,列中有样本。
GEcancer 癌组织的基因表达数据,行中有基因,列中有样本(可选)。
METnormal 矩阵与 METcancer 中相同基因的正常甲基化数据(可选)。 同样是行中的基因和列中的样本。
MethylMix_Predict
newBetaValuesMatrix 具有用于预测的新观察结果的矩阵,行中的基因/cpg 位点,列中的样本。 虽然这个新矩阵的基因/cpg 位点数量可能与运行 MethylMix 时作为 METcancer 提供的矩阵不同,但基因/cpg 位点的命名应该是相同的。
MethylMixResult MethylMix 的输出对象

返回值[编辑]

MethylMix_ModelGeneExpression 带有基因名称的向量,在这些基因中,甲基化和基因表达之间存在显着的线性和负相关关系。
MethylMix_PlotModel 包含 MethylMix 图的列表、甲基化数据的直方图 (MixtureModelPlot) 和 DNA 甲基化与基因表达之间的散点图(CorrelationPlot,如果未提供基因表达数据,则为 NULL)。 两个图都显示了已识别的不同混合物成分。
MethylMix_Predict 具有预测(混合成分的索引)、行中的驱动基因、列中的新样本的矩阵

MethylMix运行示例[编辑]

一次性下载TCGA基因表达和甲基化数据[编辑]

library(MethylMix)
cancerSite <- "OV"
targetDirectory <- paste0(getwd(), "/")
GetData(cancerSite, targetDirectory)
### 并行处理
cancerSite <- "OV"
targetDirectory <- paste0(getwd(), "/")

library(doParallel)
cl <- makeCluster(5)
registerDoParallel(cl)
GetData(cancerSite, targetDirectory)
stopCluster(cl)

分别下载TCGA表达和甲基化数据[编辑]

library(MethylMix)
cancerSite <- "OV"
targetDirectory <- paste0(getwd(), "/")

cl <- makeCluster(5)
registerDoParallel(cl)

# Downloading methylation data
METdirectories <- Download_DNAmethylation(cancerSite, targetDirectory)
# Processing methylation data
METProcessedData <- Preprocess_DNAmethylation(cancerSite, METdirectories)
# Saving methylation processed data
saveRDS(METProcessedData, file = paste0(targetDirectory, "MET_", cancerSite, "_Processed.rds"))

# Downloading gene expression data
GEdirectories <- Download_GeneExpression(cancerSite, targetDirectory)
# Processing gene expression data
GEProcessedData <- Preprocess_GeneExpression(cancerSite, GEdirectories)
# Saving gene expression processed data
saveRDS(GEProcessedData, file = paste0(targetDirectory, "GE_", cancerSite, "_Processed.rds"))

# Clustering probes to genes methylation data
METProcessedData <- readRDS(paste0(targetDirectory, "MET_", cancerSite, "_Processed.rds"))
res <- ClusterProbes(METProcessedData[[1]], METProcessedData[[2]])

# Putting everything together in one file
toSave <- list(METcancer = res[[1]], METnormal = res[[2]], GEcancer = GEProcessedData[[1]],
    GEnormal = GEProcessedData[[2]], ProbeMapping = res$ProbeMapping)
saveRDS(toSave, file = paste0(targetDirectory, "data_", cancerSite, ".rds"))

stopCluster(cl)

其他来源数据整理[编辑]

library(MethylMix)
METcancer = matrix(data = methylation_data, nrow = nb_of_genes, ncol = nb_of_samples)
METnormal = matrix(data = methylation_data, nrow = nb_of_genes, ncol = nb_of_samples)
GEcancer = matrix(data = expression_data, nrow = nb_of_genes, ncol = nb_of_samples)
ClusterProbes(MET_Cancer, MET_Normal, CorThreshold = 0.4)

MethylMix构建模型[编辑]

> library(MethylMix)
> library(doParallel)
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
> data(METcancer)
> data(METnormal)
> data(GEcancer)
### 不开启并行处理
> MethylMixResults <- MethylMix(METcancer, GEcancer, METnormal)
Found 251 samples with both methylation and expression data.
Correlating methylation data with gene expression...

Found 9 transcriptionally predictive genes.

Starting Beta mixture modeling.
Running Beta mixture model on 9 genes and on 251 samples.
ERBB2 :  2  components are best.
FAAH :  2  components are best.
FOXD1 :  2  components are best.
ME1 :  2  components are best.
MGMT :  2  components are best.
OAS1 :  2  components are best.
SOX10 :  2  components are best.
TRAF6 :  2  components are best.
ZNF217 :  2  components are best.
Warning message:
executing %dopar% sequentially: no parallel backend registered 
### 并行处理
> library(doParallel)
> cl <- makeCluster(5)
> registerDoParallel(cl)
> MethylMixResults <- MethylMix(METcancer, GEcancer, METnormal)
Found 251 samples with both methylation and expression data.
Correlating methylation data with gene expression...

Found 9 transcriptionally predictive genes.

Starting Beta mixture modeling.
Running Beta mixture model on 9 genes and on 251 samples.
> stopCluster(cl)
### 查看结果
> MethylMixResults$MethylationDrivers
[1] "ERBB2"  "FAAH"   "FOXD1"  "ME1"    "MGMT"   "OAS1"   "SOX10" 
[8] "TRAF6"  "ZNF217"
> MethylMixResults$NrComponents
 ERBB2   FAAH  FOXD1    ME1   MGMT   OAS1  SOX10  TRAF6 ZNF217 
     2      2      2      2      2      2      2      2      2 
> MethylMixResults$MixtureStates
$ERBB2
         [,1]
[1,] 0.000000
[2,] 0.318555

$FAAH
          [,1]
[1,] 0.0000000
[2,] 0.3973068

$FOXD1
          [,1]
[1,] 0.0000000
[2,] 0.2217989

$ME1
          [,1]
[1,] 0.1418296
[2,] 0.5834757

$MGMT
          [,1]
[1,] 0.0000000
[2,] 0.3141419

$OAS1
           [,1]
[1,] -0.3391054
[2,]  0.0000000

$SOX10
          [,1]
[1,] 0.0000000
[2,] 0.2076643

$TRAF6
          [,1]
[1,] 0.0000000
[2,] 0.2452776

$ZNF217
           [,1]
[1,] -0.1724214
[2,]  0.1875210

> MethylMixResults$MethylationStates[, 1:5]
       TCGA.02.0001 TCGA.02.0003 TCGA.02.0006 TCGA.02.0007
ERBB2     0.0000000    0.0000000    0.0000000    0.0000000
FAAH      0.0000000    0.0000000    0.0000000    0.3973068
FOXD1     0.0000000    0.0000000    0.2217989    0.2217989
ME1       0.5834757    0.5834757    0.5834757    0.5834757
MGMT      0.0000000    0.0000000    0.3141419    0.0000000
OAS1     -0.3391054    0.0000000   -0.3391054   -0.3391054
SOX10     0.2076643    0.2076643    0.2076643    0.2076643
TRAF6     0.2452776    0.0000000    0.0000000    0.0000000
ZNF217   -0.1724214   -0.1724214   -0.1724214   -0.1724214
       TCGA.02.0009
ERBB2     0.0000000
FAAH      0.3973068
FOXD1     0.2217989
ME1       0.1418296
MGMT      0.0000000
OAS1      0.0000000
SOX10     0.2076643
TRAF6     0.0000000
ZNF217   -0.1724214
> MethylMixResults$Classifications[, 1:5]
       TCGA.02.0001 TCGA.02.0003 TCGA.02.0006 TCGA.02.0007
ERBB2             1            1            1            1
FAAH              1            1            1            2
FOXD1             1            1            2            2
ME1               2            2            2            2
MGMT              1            1            2            1
OAS1              1            2            1            1
SOX10             2            2            2            2
TRAF6             2            1            1            1
ZNF217            1            1            1            1
       TCGA.02.0009
ERBB2             1
FAAH              2
FOXD1             2
ME1               1
MGMT              1
OAS1              2
SOX10             2
TRAF6             1
ZNF217            1

结果可视化[编辑]

plots <- MethylMix_PlotModel("MGMT", MethylMixResults, METcancer)
plots$MixtureModelPlot
plots <- MethylMix_PlotModel("MGMT", MethylMixResults, METcancer, METnormal = METnormal)
plots$MixtureModelPlot
plots <- MethylMix_PlotModel("ZNF217", MethylMixResults, METcancer, METnormal = METnormal)
plots$MixtureModelPlot
plots <- MethylMix_PlotModel("MGMT", MethylMixResults, METcancer, GEcancer, METnormal)
plots$MixtureModelPlot
plots$CorrelationPlot
for (gene in MethylMixResults$MethylationDrivers) {
    MethylMix_PlotModel(gene, MethylMixResults, METcancer, METnormal = METnormal)
}