Bohrium
robot
新建

空间站广场

论文
Notebooks
比赛
课程
Apps
我的主页
我的Notebooks
我的论文库
我的足迹

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
WGCNA:一个用于分析基因表达数据的 R 包
生物信息学
R包
基因共表达分析
核心基因
生物信息学R包基因共表达分析核心基因
孙楠
发布于 2023-11-21
推荐镜像 :bio-r-notebook:v1
推荐机型 :c4_m16_cpu
WGCNA依赖数据(v1)

WGCNA:一个用于分析基因表达数据的 R 包

代码
文本

Open In Bohrium

WGCNA,全称为 Weighted Gene Co-Expression Network Analysis,是一种用于分析基因表达数据的生物信息学方法。它的主要目标是发现基因之间的共表达模式——两者同时上调表达,还是同时下调表达;并将这些基因分组成具有生物学意义的共表达模块——例如关于调控花青素合成的基因可能就会聚类在同一个模块里面,关于调控叶绿素合成则可能会聚类在另一个模块里面。WGCNA 还可用于识别与特定生物学过程、疾病状态或实验条件相关的基因网络,并且找到其中的 hub gene。

原始论文:Peter Langfelder, Horvath Steve. WGCNA: an R package for weighted correlation network analysis. BMC bioinformatics 9.1 (2008): 1-13. https://doi.org/10.1186/1471-2105-9-559.

代码
文本

📖 上手指南
本文档可在 Bohrium Notebook 上直接运行。你可以点击界面上方按钮 开始连接,选择 `bio-r-notebook:v1` 镜像和 `c4_m16_cpu` 节点配置,稍等片刻选择 `R kernel` 即可运行。

代码
文本
[1]
library(WGCNA)
Loading required package: dynamicTreeCut

Loading required package: fastcluster


Attaching package: ‘fastcluster’


The following object is masked from ‘package:stats’:

    hclust





Attaching package: ‘WGCNA’


The following object is masked from ‘package:stats’:

    cor


代码
文本

一、数据读入和预处理

代码
文本

1. 读入基因表达数据

代码
文本
[2]
femData = read.csv("/bohr/wgcna-ss71/v1/LiverFemale3600.csv")
datExpr0 = as.data.frame(t(femData[, -c(1:8)])) # 提取出表达量的数据 ,删去不需要的数据重新生成矩阵
colnames(datExpr0) = femData$substanceBXH # gene name
rownames(datExpr0) = names(femData)[-c(1:8)] # sample name
head(datExpr0) # 行为 sample,列为 gene
A data.frame: 6 × 3600
MMT00000044MMT00000046MMT00000051MMT00000076MMT00000080MMT00000102MMT00000149MMT00000159MMT00000207MMT00000212MMT00082822MMT00082828MMT00082829MMT00082832MMT00082847MMT00082850MMT00082869MMT00082877MMT00082899MMT00082906
<dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl>
F2_2-0.0181000-0.0773-0.02260000-0.00924-0.04870000 0.176000000.07680000-0.14800000 0.06870000 0.06090000 0.0135000-0.15400000-0.0218000 0.03100000.1290000 0.0467000 0.00991000 0.0291000-0.00927 0.0436000
F2_3 0.0642000-0.0297 0.06170000-0.14500 0.05820000-0.189000000.18600000 0.17700000 0.10100000 0.05570000-0.0097100-0.07410000 0.0900000 0.01060000.1130000-0.0252000 0.03190000 0.0408000-0.12100 0.0827000
F2_14 0.0000644 0.1120-0.12900000 0.02870-0.04830000-0.065000000.21400000-0.13200000 0.10900000 0.19100000 0.0709000-0.13900000 0.0277000-0.13100000.2550000-0.1230000 0.08800000 0.0892000-0.11400-0.0872000
F2_15-0.0580000-0.0589 0.08710000-0.04390-0.03710000-0.008460000.12000000 0.10700000-0.00858000-0.12100000-0.0313000-0.07250000 0.0178000 0.08820000.0790000 0.0002760-0.04820000 0.0493000-0.05010-0.0390000
F2_19 0.0483000 0.0443-0.11500000 0.00425 0.02510000-0.005740000.02100000-0.11900000 0.10500000 0.05410000 0.0695000-0.11500000 0.0618000 0.29500000.1270000-0.0560000-0.02890000-0.0389000 0.00718 0.0710000
F2_20-0.1519741-0.0938-0.06502607-0.23610 0.08504274-0.018071820.06222751-0.05497686-0.02441415 0.06343181 0.1743492-0.09405315 0.1176646 0.11619630.1180381-0.1171272-0.09774204-0.0745188 0.31857 0.2047701
代码
文本

2. 检查缺失值和识别离群值(异常值)

查看是否有缺失值:

代码
文本
[3]
gsg = goodSamplesGenes(datExpr0, verbose = 3)
names(gsg)
gsg$allOK
 Flagging genes and samples with too many missing values...
  ..step 1
  1. 'goodGenes'
  2. 'goodSamples'
  3. 'allOK'
TRUE
代码
文本

如果 `gsgallOK) {

Optionally, print the gene and sample names that were removed:

if (sum(!gsggoodGenes], collapse = ", "))); if (sum(!gsggoodSamples], collapse = ", ")));

Remove the offending genes and samples from the data:

datExpr0 = datExpr0[gsggoodGenes] }

    
<font size = '3'> 聚类所有样本,观察是否有离群值或异常值:
代码
文本
[4]
sampleTree = hclust(dist(datExpr0), method = "average")
par(cex = 0.6)
par(mar = c(0,4,2,0))
plot(sampleTree, main = "Sample clustering to detect outliers", sub="", xlab="", cex.lab = 1.5, cex.axis = 1.5, cex.main = 2)

abline(h = 15, col = "red") # 划定需要剪切的枝长
clust = cutreeStatic(sampleTree, cutHeight = 15, minSize = 10)
table(clust)
代码
文本

有一个离群值,删除离群样本:

代码
文本
[5]
keepSamples = (clust==1) # 保留非离群(clust==1)的样本
datExpr = datExpr0[keepSamples, ] # 去除离群值后的数据
head(datExpr)
A data.frame: 6 × 3600
MMT00000044MMT00000046MMT00000051MMT00000076MMT00000080MMT00000102MMT00000149MMT00000159MMT00000207MMT00000212MMT00082822MMT00082828MMT00082829MMT00082832MMT00082847MMT00082850MMT00082869MMT00082877MMT00082899MMT00082906
<dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl>
F2_2-0.0181000-0.0773-0.02260000-0.00924-0.04870000 0.176000000.07680000-0.14800000 0.06870000 0.06090000 0.0135000-0.15400000-0.0218000 0.03100000.1290000 0.0467000 0.00991000 0.0291000-0.00927 0.0436000
F2_3 0.0642000-0.0297 0.06170000-0.14500 0.05820000-0.189000000.18600000 0.17700000 0.10100000 0.05570000-0.0097100-0.07410000 0.0900000 0.01060000.1130000-0.0252000 0.03190000 0.0408000-0.12100 0.0827000
F2_14 0.0000644 0.1120-0.12900000 0.02870-0.04830000-0.065000000.21400000-0.13200000 0.10900000 0.19100000 0.0709000-0.13900000 0.0277000-0.13100000.2550000-0.1230000 0.08800000 0.0892000-0.11400-0.0872000
F2_15-0.0580000-0.0589 0.08710000-0.04390-0.03710000-0.008460000.12000000 0.10700000-0.00858000-0.12100000-0.0313000-0.07250000 0.0178000 0.08820000.0790000 0.0002760-0.04820000 0.0493000-0.05010-0.0390000
F2_19 0.0483000 0.0443-0.11500000 0.00425 0.02510000-0.005740000.02100000-0.11900000 0.10500000 0.05410000 0.0695000-0.11500000 0.0618000 0.29500000.1270000-0.0560000-0.02890000-0.0389000 0.00718 0.0710000
F2_20-0.1519741-0.0938-0.06502607-0.23610 0.08504274-0.018071820.06222751-0.05497686-0.02441415 0.06343181 0.1743492-0.09405315 0.1176646 0.11619630.1180381-0.1171272-0.09774204-0.0745188 0.31857 0.2047701
代码
文本

3. 读入临床表征数据

代码
文本
[6]
traitData = read.csv("/bohr/wgcna-ss71/v1/ClinicalTraits.csv") # 行为 sample,列为 info
allTraits = traitData[, -c(31, 16)] # 删除不需要的数据
allTraits = allTraits[, c(2, 11:36) ] # 只保留数值型数据
head(allTraits)
A data.frame: 6 × 27
Miceweight_glength_cmab_fatother_fattotal_fatX100xfat_weightTriglyTotal_CholHDL_CholLeptin_pg_mlAdiponectinAortic.lesionsAneurysmAortic_cal_MAortic_cal_LCoronaryArtery_CalMyocardial_calBMD_all_limbsBMD_femurs_only
<chr><dbl><dbl><dbl><dbl><dbl><dbl><int><int><int><dbl><dbl><int><int><int><int><int><int><dbl><dbl>
1F2_29036.9 9.92.532.264.7912.981030 53116750245462.0011.27449625016 0170 0 NA NA
2F2_29148.510.72.902.975.8712.103093 61123032 84420.88 7.099 NA16 4 02 40.05480.07730
3F2_29245.710.41.042.313.35 7.330416 41128581105889.76 5.795218500 0 0110 00.05540.08065
4F2_29350.310.90.911.892.80 5.566600271129964100398.68 5.495 61250 0 0 002360.05970.08680
5F2_29444.8 9.81.222.473.69 8.236607114141050130846.30 6.8682437501210 00 0 NA NA
6F2_29539.210.23.062.495.5514.158163 72153318 75166.2217.32810425017 2 00 00.05570.07700
代码
文本

用样本名字将临床表征数据和基因表达数据进行匹配:

代码
文本
[7]
femaleSamples = rownames(datExpr)
traitRows = match(femaleSamples, allTraits$Mice)
datTraits = allTraits[traitRows, -1]
rownames(datTraits) = allTraits[traitRows, 1]
head(datTraits)
A data.frame: 6 × 26
weight_glength_cmab_fatother_fattotal_fatX100xfat_weightTriglyTotal_CholHDL_CholUCLeptin_pg_mlAdiponectinAortic.lesionsAneurysmAortic_cal_MAortic_cal_LCoronaryArtery_CalMyocardial_calBMD_all_limbsBMD_femurs_only
<dbl><dbl><dbl><dbl><dbl><dbl><int><int><int><int><dbl><dbl><int><int><int><int><int><int><dbl><dbl>
F2_238.010.53.812.786.5917.342105 14164634668 NA NA22450056 5 000NANA
F2_333.510.81.702.053.7511.19403010912162740215148.7614.339296250 8 4NA00NANA
F2_1433.910.01.291.672.96 8.731563 2 83417354 6188.7415.4394863132712NA18NANA
F2_1544.310.33.623.346.9615.711061 7115654153618400.2611.124180750 0 0NA04NANA
F2_1932.9 9.72.081.853.9311.945289 55106041411 8438.7016.842113000 0 0NA00NANA
F2_2044.810.33.723.206.9215.446429 3411723944841801.5413.498166750 6 0NA00NANA
代码
文本

可视化临床表征数据与基因表达数据的联系,重构样本聚类树:

代码
文本
[8]
sampleTree2 = hclust(dist(datExpr), method = "average")
traitColors = numbers2colors(datTraits, signed = FALSE) # 颜色代表关联度
plotDendroAndColors(sampleTree2, traitColors,
groupLabels = names(datTraits),
main = "Sample dendrogram and trait heatmap")
代码
文本

图片结果解释了临床数据和基因表达量的关联程度,颜色越深,代表这个表型数据与这个样本的基因表达量关系越密切。

代码
文本
[9]
save(datExpr, datTraits, file = "female_liver_01.RData")
代码
文本

二、构建表达网络

是否构建正确的表达网络对后期模块的划分和关联表型数据筛选 hub gene 至关重要。挑选软阈值是构建网络拓扑分析的关键,选择软阈值是基于近无尺度拓扑标准的。其次就是构建 TOM 矩阵或者邻接矩阵的时候运行大数据无法成功。

代码
文本
[10]
lnames = load(file = "female_liver_01.RData")
lnames
  1. 'datExpr'
  2. 'datTraits'
代码
文本

1. 构建自动化网络和检测模块

选择软阈值:

代码
文本
[11]
powers = c(c(1:10), seq(from = 12, to=20, by=2))
sft = pickSoftThreshold(datExpr, powerVector = powers, verbose = 5)
par(mfrow = c(1,2))
cex1 = 0.9
pickSoftThreshold: will use block size 3600.
 pickSoftThreshold: calculating connectivity for given powers...
   ..working on genes 1 through 3600 of 3600
Warning message:
“executing %dopar% sequentially: no parallel backend registered”
   Power SFT.R.sq  slope truncated.R.sq mean.k. median.k. max.k.
1      1   0.0278  0.345          0.456  747.00  762.0000 1210.0
2      2   0.1260 -0.597          0.843  254.00  251.0000  574.0
3      3   0.3400 -1.030          0.972  111.00  102.0000  324.0
4      4   0.5060 -1.420          0.973   56.50   47.2000  202.0
5      5   0.6810 -1.720          0.940   32.20   25.1000  134.0
6      6   0.9020 -1.500          0.962   19.90   14.5000   94.8
7      7   0.9210 -1.670          0.917   13.20    8.6800   84.1
8      8   0.9040 -1.720          0.876    9.25    5.3900   76.3
9      9   0.8590 -1.700          0.836    6.80    3.5600   70.5
10    10   0.8330 -1.660          0.831    5.19    2.3800   65.8
11    12   0.8530 -1.480          0.911    3.33    1.1500   58.1
12    14   0.8760 -1.380          0.949    2.35    0.5740   51.9
13    16   0.9070 -1.300          0.970    1.77    0.3090   46.8
14    18   0.9120 -1.240          0.973    1.39    0.1670   42.5
15    20   0.9310 -1.210          0.977    1.14    0.0951   38.7
代码
文本

无标度拓扑拟合指数:

代码
文本
[12]
plot(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],
xlab="Soft Threshold (power)",ylab="Scale Free Topology Model Fit,signed R^2",type="n",
main = paste("Scale independence"))
text(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],
labels=powers,cex=cex1,col="red")
abline(h=0.90,col="red") #查看位于0.9以上的点,可以改变高度值
代码
文本

选择在 以上的对应的值作为软阈值,上图 6 是第一个达到 0.9 的数值,考虑 6 作为软阈值。

平均连接度:

代码
文本
[13]
plot(sft$fitIndices[,1], sft$fitIndices[,5],
xlab="Soft Threshold (power)", ylab="Mean Connectivity", type="n",
main = paste("Mean connectivity"))
text(sft$fitIndices[,1], sft$fitIndices[,5], labels=powers, cex=cex1,col="red")
代码
文本

从上图可以看出,数值为 6 的时候,图形开始持平,说明软阈值为 6 时,网络的连通性好。

同时运行下面的代码,如果有合适的软阈值,系统会自动推荐出来;如果显示的结果为 NA,则表明系统无法给出合适的软阈值,这时候就需要自己挑选软阈值。 手动挑选软阈值的大致规则如上图形中所述:

代码
文本
[14]
sft$powerEstimate
6
代码
文本

2. 一步法构建网络和模块检测

此外还有逐步法和分步法,这三种方法的主要区别是:

  • 一步法:适合处理较少的数据量,方便快捷,自动化程度高
  • 逐步法:适合处理适中的数据量,可以自定义参数
  • 分步法:适合处理较大的数据量(5000个以上基因),需要分不同的block划分模块,自定义参数
代码
文本
[15]
net = blockwiseModules(datExpr, power = 6, # power = 6:刚才选择的软阈值
TOMType = "unsigned", minModuleSize = 30, # minModuleSize = 30:模块中最少的基因数
reassignThreshold = 0, mergeCutHeight = 0.25, # mergeCutHeight = 0.25:模块合并阈值,阈值越大,模块越少(重要)
numericLabels = TRUE, pamRespectsDendro = FALSE,
saveTOMs = TRUE,
saveTOMFileBase = "femaleMouseTOM",
verbose = 3) # saveTOMs = TRUE,saveTOMFileBase = "femaleMouseTOM"保存 TOM 矩阵,名字为 "femaleMouseTOM"
 Calculating module eigengenes block-wise from all genes
   Flagging genes and samples with too many missing values...
    ..step 1
Cluster size 3600 broken into 2108 1492 
Cluster size 2108 broken into 1126 982 
Done cluster 1126 
Done cluster 982 
Done cluster 2108 
Done cluster 1492 
 ..Working on block 1 .
    TOM calculation: adjacency..
    ..will not use multithreading.
     Fraction of slow calculations: 0.396405
    ..connectivity..
    ..matrix multiplication (system BLAS)..
    ..normalization..
    ..done.
   ..saving TOM for block 1 into file femaleMouseTOM-block.1.RData
 ....clustering..
 ....detecting modules..
 ....calculating module eigengenes..
 ....checking kME in modules..
     ..removing 1 genes from module 1 because their KME is too low.
     ..removing 1 genes from module 7 because their KME is too low.
     ..removing 1 genes from module 8 because their KME is too low.
     ..removing 1 genes from module 21 because their KME is too low.
 ..merging modules that are too close..
     mergeCloseModules: Merging modules whose distance is less than 0.25
       Calculating new MEs...
代码
文本

查看划分的模块数和每个模块里面包含的基因个数:

代码
文本
[16]
table(net$colors)
  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18 
 99 609 460 409 316 312 221 211 157 123 106 100  94  91  77  76  58  47  34 
代码
文本

一共可以分为 18 个模块,第二行是每个模块对应的基因数,有多到少。从模块 1 开始,基因数逐渐减少。模块 0 是无法识别的基因数。

模块标识的层次聚类树状图,使用以下代码将树状图与颜色分配一起显示:

代码
文本
[17]
mergedColors = labels2colors(net$colors)
plotDendroAndColors(net$dendrograms[[1]], mergedColors[net$blockGenes[[1]]],
"Module colors",
dendroLabels = FALSE, hang = 0.03,
addGuide = TRUE, guideHang = 0.05)
代码
文本

保存分配模块和模块包含的基因信息:

代码
文本
[18]
moduleLabels = net$colors
moduleColors = labels2colors(net$colors)
MEs = net$MEs;
geneTree = net$dendrograms[[1]];
save(MEs, moduleLabels, moduleColors, geneTree,
file = "female_liver_02.RData")
代码
文本

三、模块与表型数据关联并识别重要基因

代码
文本
[19]
lnames = load(file = "female_liver_01.RData")
lnames
lnames = load(file = "female_liver_02.RData")
lnames
  1. 'datExpr'
  2. 'datTraits'
  1. 'MEs'
  2. 'moduleLabels'
  3. 'moduleColors'
  4. 'geneTree'
代码
文本

1. 模块-表型数据关联

这个分析将识别与表型数据显著相关的模块。已经有每个模块的eigengene,只需要将eigengene与外部数据相关联,寻找重要的关联:

代码
文本
[20]
nGenes = ncol(datExpr)
nSamples = nrow(datExpr)

# 重新计算带有颜色标签的模块
MEs0 = moduleEigengenes(datExpr, moduleColors)$eigengenes
MEs = orderMEs(MEs0)
moduleTraitCor = cor(MEs, datTraits, use = "p")
moduleTraitPvalue = corPvalueStudent(moduleTraitCor, nSamples)
# 通过相关值对每个关联进行颜色编码

# 展示模块与表型数据的相关系数和 P 值
textMatrix = paste(signif(moduleTraitCor, 2), "\n(",
signif(moduleTraitPvalue, 1), ")", sep = "")
dim(textMatrix) = dim(moduleTraitCor)
par(mar = c(6, 8.5, 3, 3))
# 用热图的形式展示相关系数
labeledHeatmap(Matrix = moduleTraitCor,
xLabels = names(datTraits),
yLabels = names(MEs),
ySymbols = names(MEs),
colorLabels = FALSE,
colors = greenWhiteRed(50),
textMatrix = textMatrix,
setStdMargins = FALSE,
cex.text = 0.5,
zlim = c(-1,1),
main = paste("Module-trait relationships"))
代码
文本

颜色越红的模块表示与表型性状与该模块的基因高度正相关,颜色越绿表示高度负相关。

看到棕色模块与体重的相关性非常高,下面探讨这个模块中的基因与体重的关系。

2. 基因与表型数据的关系、重要模块:基因显著性和模块成员

用基因的显著性 GS 定义为基因与性状的相关性(绝对值),以定量单个基因与我们感兴趣的性状的关联。对于每个模块,我们将用模块成员 MM 的定量测定定义为模块 eigengene 和基因表达特征的相关性。这样能够量化矩阵上所有基因和每个模块的相似性。

代码
文本
[21]
weight = as.data.frame(datTraits$weight_g);
names(weight) = "weight";
modNames = substring(names(MEs), 3)
geneModuleMembership = as.data.frame(cor(datExpr, MEs, use = "p"));
MMPvalue = as.data.frame(corPvalueStudent(as.matrix(geneModuleMembership), nSamples));
names(geneModuleMembership) = paste("MM", modNames, sep="");
names(MMPvalue) = paste("p.MM", modNames, sep="");
geneTraitSignificance = as.data.frame(cor(datExpr, weight, use = "p"));#和体重性状的关联
GSPvalue = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance), nSamples));
names(geneTraitSignificance) = paste("GS.", names(weight), sep="");
names(GSPvalue) = paste("p.GS.", names(weight), sep="");

代码
文本

3. 模块内分析:鉴定具有高GS和高MM的基因

GS和MM测量,可以识别与体重高度相关的基因,以及感兴趣的模块中的高度相关的成员。这个例子中,体重与棕色模块的关联度较高,因此在棕色模块中绘制基因显著性和模块成员关系的散点图。

GS:所有基因表达谱与这个模块的eigengene的相关性(cor)。每一个值代表这个基因与模块之间的关系。如果这个值的绝对值接近0,那么这个基因就不是这个模块中的一部分,如果这个值的绝对值接近1,那么这个基因就与这个模块高度相关。

MM:基因和表型性状比如体重之间的相关性的绝对值。为了将表型特征信息与共表达网络联合起来,比如体重与哪个模块高度相关。每一个基因的表达值与表型性状之间的相关性的绝对值。0表示这个基因与这个性状不相关,1表示高度相关。如果一个模块中的基因都有这个性状高度相关,那么这个模块也就与这个性状高度相关。

运行以下代码可视化GS和MM:

代码
文本
[22]
module = "brown"
column = match(module, modNames);
moduleGenes = moduleColors==module;
par(mfrow = c(1,1));
verboseScatterplot(abs(geneModuleMembership[moduleGenes, column]),
abs(geneTraitSignificance[moduleGenes, 1]),
xlab = paste("Module Membership in", module, "module"),
ylab = "Gene significance for body weight",
main = paste("Module membership vs. gene significance\n"),
cex.main = 1.2, cex.lab = 1.2, cex.axis = 1.2, col = module)

代码
文本

MM-GS图的每一个点代表一个基因。横坐标值表示基因与模块的相关性,纵坐标值表示基因与表型性状的相关性,这里可以看出与性状高度显著相关的基因往往是与这个性状显著相关的模块中的重要元素。

4. 输出网络分析结果

代码
文本
[23]
# 返回所有在分析中的基因ID
names(datExpr)
  1. 'MMT00000044'
  2. 'MMT00000046'
  3. 'MMT00000051'
  4. 'MMT00000076'
  5. 'MMT00000080'
  6. 'MMT00000102'
  7. 'MMT00000149'
  8. 'MMT00000159'
  9. 'MMT00000207'
  10. 'MMT00000212'
  11. 'MMT00000231'
  12. 'MMT00000241'
  13. 'MMT00000268'
  14. 'MMT00000283'
  15. 'MMT00000334'
  16. 'MMT00000365'
  17. 'MMT00000368'
  18. 'MMT00000373'
  19. 'MMT00000384'
  20. 'MMT00000401'
  21. 'MMT00000418'
  22. 'MMT00000464'
  23. 'MMT00000517'
  24. 'MMT00000525'
  25. 'MMT00000549'
  26. 'MMT00000550'
  27. 'MMT00000602'
  28. 'MMT00000608'
  29. 'MMT00000701'
  30. 'MMT00000713'
  31. 'MMT00000719'
  32. 'MMT00000743'
  33. 'MMT00000792'
  34. 'MMT00000793'
  35. 'MMT00000801'
  36. 'MMT00000840'
  37. 'MMT00000864'
  38. 'MMT00000887'
  39. 'MMT00000963'
  40. 'MMT00000988'
  41. 'MMT00000996'
  42. 'MMT00001022'
  43. 'MMT00001077'
  44. 'MMT00001085'
  45. 'MMT00001100'
  46. 'MMT00001110'
  47. 'MMT00001154'
  48. 'MMT00001185'
  49. 'MMT00001190'
  50. 'MMT00001245'
  51. 'MMT00001260'
  52. 'MMT00001291'
  53. 'MMT00001298'
  54. 'MMT00001318'
  55. 'MMT00001373'
  56. 'MMT00001387'
  57. 'MMT00001394'
  58. 'MMT00001397'
  59. 'MMT00001423'
  60. 'MMT00001434'
  61. 'MMT00001486'
  62. 'MMT00001496'
  63. 'MMT00001510'
  64. 'MMT00001545'
  65. 'MMT00001555'
  66. 'MMT00001587'
  67. 'MMT00001596'
  68. 'MMT00001613'
  69. 'MMT00001646'
  70. 'MMT00001675'
  71. 'MMT00001698'
  72. 'MMT00001714'
  73. 'MMT00001732'
  74. 'MMT00001791'
  75. 'MMT00001806'
  76. 'MMT00001923'
  77. 'MMT00001947'
  78. 'MMT00001949'
  79. 'MMT00001995'
  80. 'MMT00002002'
  81. 'MMT00002004'
  82. 'MMT00002021'
  83. 'MMT00002022'
  84. 'MMT00002037'
  85. 'MMT00002042'
  86. 'MMT00002046'
  87. 'MMT00002048'
  88. 'MMT00002050'
  89. 'MMT00002099'
  90. 'MMT00002102'
  91. 'MMT00002151'
  92. 'MMT00002160'
  93. 'MMT00002161'
  94. 'MMT00002175'
  95. 'MMT00002209'
  96. 'MMT00002227'
  97. 'MMT00002238'
  98. 'MMT00002272'
  99. 'MMT00002304'
  100. 'MMT00002330'
  101. 'MMT00002338'
  102. 'MMT00002391'
  103. 'MMT00002392'
  104. 'MMT00002494'
  105. 'MMT00002521'
  106. 'MMT00002529'
  107. 'MMT00002532'
  108. 'MMT00002546'
  109. 'MMT00002575'
  110. 'MMT00002592'
  111. 'MMT00002594'
  112. 'MMT00002597'
  113. 'MMT00002655'
  114. 'MMT00002755'
  115. 'MMT00002758'
  116. 'MMT00002824'
  117. 'MMT00002875'
  118. 'MMT00002932'
  119. 'MMT00002956'
  120. 'MMT00003016'
  121. 'MMT00003058'
  122. 'MMT00003069'
  123. 'MMT00003071'
  124. 'MMT00003081'
  125. 'MMT00003107'
  126. 'MMT00003127'
  127. 'MMT00003136'
  128. 'MMT00003188'
  129. 'MMT00003211'
  130. 'MMT00003214'
  131. 'MMT00003278'
  132. 'MMT00003342'
  133. 'MMT00003365'
  134. 'MMT00003391'
  135. 'MMT00003410'
  136. 'MMT00003424'
  137. 'MMT00003453'
  138. 'MMT00003456'
  139. 'MMT00003470'
  140. 'MMT00003498'
  141. 'MMT00003506'
  142. 'MMT00003530'
  143. 'MMT00003533'
  144. 'MMT00003545'
  145. 'MMT00003569'
  146. 'MMT00003575'
  147. 'MMT00003586'
  148. 'MMT00003596'
  149. 'MMT00003620'
  150. 'MMT00003651'
  151. 'MMT00003672'
  152. 'MMT00003724'
  153. 'MMT00003764'
  154. 'MMT00003905'
  155. 'MMT00003906'
  156. 'MMT00003908'
  157. 'MMT00003950'
  158. 'MMT00003968'
  159. 'MMT00003970'
  160. 'MMT00003975'
  161. 'MMT00003980'
  162. 'MMT00003982'
  163. 'MMT00003994'
  164. 'MMT00004034'
  165. 'MMT00004086'
  166. 'MMT00004126'
  167. 'MMT00004142'
  168. 'MMT00004170'
  169. 'MMT00004171'
  170. 'MMT00004172'
  171. 'MMT00004176'
  172. 'MMT00004227'
  173. 'MMT00004230'
  174. 'MMT00004254'
  175. 'MMT00004264'
  176. 'MMT00004276'
  177. 'MMT00004283'
  178. 'MMT00004326'
  179. 'MMT00004393'
  180. 'MMT00004394'
  181. 'MMT00004397'
  182. 'MMT00004398'
  183. 'MMT00004408'
  184. 'MMT00004428'
  185. 'MMT00004455'
  186. 'MMT00004520'
  187. 'MMT00004524'
  188. 'MMT00004529'
  189. 'MMT00004594'
  190. 'MMT00004605'
  191. 'MMT00004614'
  192. 'MMT00004625'
  193. 'MMT00004631'
  194. 'MMT00004639'
  195. 'MMT00004671'
  196. 'MMT00004682'
  197. 'MMT00004703'
  198. 'MMT00004721'
  199. 'MMT00004807'
  200. 'MMT00004841'
  201. 'MMT00078449'
  202. 'MMT00078455'
  203. 'MMT00078486'
  204. 'MMT00078506'
  205. 'MMT00078523'
  206. 'MMT00078527'
  207. 'MMT00078537'
  208. 'MMT00078543'
  209. 'MMT00078546'
  210. 'MMT00078551'
  211. 'MMT00078559'
  212. 'MMT00078566'
  213. 'MMT00078625'
  214. 'MMT00078657'
  215. 'MMT00078658'
  216. 'MMT00078676'
  217. 'MMT00078692'
  218. 'MMT00078698'
  219. 'MMT00078706'
  220. 'MMT00078723'
  221. 'MMT00078732'
  222. 'MMT00078811'
  223. 'MMT00078816'
  224. 'MMT00078831'
  225. 'MMT00078835'
  226. 'MMT00078837'
  227. 'MMT00078844'
  228. 'MMT00078851'
  229. 'MMT00078861'
  230. 'MMT00078909'
  231. 'MMT00078918'
  232. 'MMT00078919'
  233. 'MMT00078931'
  234. 'MMT00078940'
  235. 'MMT00078942'
  236. 'MMT00078950'
  237. 'MMT00078969'
  238. 'MMT00078976'
  239. 'MMT00079074'
  240. 'MMT00079130'
  241. 'MMT00079131'
  242. 'MMT00079144'
  243. 'MMT00079155'
  244. 'MMT00079156'
  245. 'MMT00079213'
  246. 'MMT00079275'
  247. 'MMT00079286'
  248. 'MMT00079290'
  249. 'MMT00079309'
  250. 'MMT00079316'
  251. 'MMT00079332'
  252. 'MMT00079343'
  253. 'MMT00079348'
  254. 'MMT00079364'
  255. 'MMT00079369'
  256. 'MMT00079385'
  257. 'MMT00079397'
  258. 'MMT00079426'
  259. 'MMT00079439'
  260. 'MMT00079517'
  261. 'MMT00079520'
  262. 'MMT00079550'
  263. 'MMT00079592'
  264. 'MMT00079610'
  265. 'MMT00079611'
  266. 'MMT00079617'
  267. 'MMT00079636'
  268. 'MMT00079659'
  269. 'MMT00079689'
  270. 'MMT00079723'
  271. 'MMT00079761'
  272. 'MMT00079786'
  273. 'MMT00079792'
  274. 'MMT00079850'
  275. 'MMT00079874'
  276. 'MMT00079876'
  277. 'MMT00079883'
  278. 'MMT00079885'
  279. 'MMT00079905'
  280. 'MMT00079956'
  281. 'MMT00080032'
  282. 'MMT00080077'
  283. 'MMT00080093'
  284. 'MMT00080097'
  285. 'MMT00080105'
  286. 'MMT00080150'
  287. 'MMT00080162'
  288. 'MMT00080165'
  289. 'MMT00080167'
  290. 'MMT00080321'
  291. 'MMT00080367'
  292. 'MMT00080406'
  293. 'MMT00080515'
  294. 'MMT00080518'
  295. 'MMT00080534'
  296. 'MMT00080541'
  297. 'MMT00080548'
  298. 'MMT00080563'
  299. 'MMT00080578'
  300. 'MMT00080620'
  301. 'MMT00080624'
  302. 'MMT00080630'
  303. 'MMT00080680'
  304. 'MMT00080684'
  305. 'MMT00080694'
  306. 'MMT00080695'
  307. 'MMT00080701'
  308. 'MMT00080717'
  309. 'MMT00080721'
  310. 'MMT00080768'
  311. 'MMT00080789'
  312. 'MMT00080792'
  313. 'MMT00080840'
  314. 'MMT00080864'
  315. 'MMT00080903'
  316. 'MMT00080943'
  317. 'MMT00080984'
  318. 'MMT00081002'
  319. 'MMT00081013'
  320. 'MMT00081019'
  321. 'MMT00081115'
  322. 'MMT00081122'
  323. 'MMT00081127'
  324. 'MMT00081133'
  325. 'MMT00081171'
  326. 'MMT00081203'
  327. 'MMT00081213'
  328. 'MMT00081218'
  329. 'MMT00081249'
  330. 'MMT00081261'
  331. 'MMT00081264'
  332. 'MMT00081290'
  333. 'MMT00081299'
  334. 'MMT00081300'
  335. 'MMT00081331'
  336. 'MMT00081348'
  337. 'MMT00081360'
  338. 'MMT00081375'
  339. 'MMT00081411'
  340. 'MMT00081414'
  341. 'MMT00081436'
  342. 'MMT00081439'
  343. 'MMT00081532'
  344. 'MMT00081543'
  345. 'MMT00081555'
  346. 'MMT00081571'
  347. 'MMT00081578'
  348. 'MMT00081596'
  349. 'MMT00081689'
  350. 'MMT00081718'
  351. 'MMT00081757'
  352. 'MMT00081768'
  353. 'MMT00081874'
  354. 'MMT00081880'
  355. 'MMT00081919'
  356. 'MMT00081967'
  357. 'MMT00081975'
  358. 'MMT00082034'
  359. 'MMT00082041'
  360. 'MMT00082073'
  361. 'MMT00082101'
  362. 'MMT00082110'
  363. 'MMT00082126'
  364. 'MMT00082164'
  365. 'MMT00082181'
  366. 'MMT00082243'
  367. 'MMT00082250'
  368. 'MMT00082255'
  369. 'MMT00082259'
  370. 'MMT00082303'
  371. 'MMT00082316'
  372. 'MMT00082420'
  373. 'MMT00082428'
  374. 'MMT00082445'
  375. 'MMT00082461'
  376. 'MMT00082551'
  377. 'MMT00082556'
  378. 'MMT00082577'
  379. 'MMT00082579'
  380. 'MMT00082585'
  381. 'MMT00082592'
  382. 'MMT00082622'
  383. 'MMT00082650'
  384. 'MMT00082651'
  385. 'MMT00082663'
  386. 'MMT00082677'
  387. 'MMT00082712'
  388. 'MMT00082753'
  389. 'MMT00082759'
  390. 'MMT00082798'
  391. 'MMT00082822'
  392. 'MMT00082828'
  393. 'MMT00082829'
  394. 'MMT00082832'
  395. 'MMT00082847'
  396. 'MMT00082850'
  397. 'MMT00082869'
  398. 'MMT00082877'
  399. 'MMT00082899'
  400. 'MMT00082906'
代码
文本
[24]
# 返回属于棕色模块的基因ID
names(datExpr)[moduleColors=="brown"]
  1. 'MMT00000887'
  2. 'MMT00001077'
  3. 'MMT00001185'
  4. 'MMT00001486'
  5. 'MMT00002002'
  6. 'MMT00002037'
  7. 'MMT00002102'
  8. 'MMT00002209'
  9. 'MMT00002575'
  10. 'MMT00002758'
  11. 'MMT00002824'
  12. 'MMT00003081'
  13. 'MMT00003586'
  14. 'MMT00003596'
  15. 'MMT00003970'
  16. 'MMT00003982'
  17. 'MMT00003994'
  18. 'MMT00004034'
  19. 'MMT00004170'
  20. 'MMT00004283'
  21. 'MMT00004397'
  22. 'MMT00004428'
  23. 'MMT00004844'
  24. 'MMT00006001'
  25. 'MMT00006077'
  26. 'MMT00006097'
  27. 'MMT00006230'
  28. 'MMT00006315'
  29. 'MMT00006378'
  30. 'MMT00006545'
  31. 'MMT00006709'
  32. 'MMT00006713'
  33. 'MMT00006822'
  34. 'MMT00006859'
  35. 'MMT00007042'
  36. 'MMT00007205'
  37. 'MMT00007277'
  38. 'MMT00007603'
  39. 'MMT00007709'
  40. 'MMT00007836'
  41. 'MMT00007847'
  42. 'MMT00007859'
  43. 'MMT00007963'
  44. 'MMT00007995'
  45. 'MMT00008094'
  46. 'MMT00008463'
  47. 'MMT00008968'
  48. 'MMT00008970'
  49. 'MMT00009272'
  50. 'MMT00009690'
  51. 'MMT00009857'
  52. 'MMT00009951'
  53. 'MMT00010412'
  54. 'MMT00010542'
  55. 'MMT00010602'
  56. 'MMT00010873'
  57. 'MMT00010907'
  58. 'MMT00011268'
  59. 'MMT00011876'
  60. 'MMT00012202'
  61. 'MMT00012203'
  62. 'MMT00012511'
  63. 'MMT00012992'
  64. 'MMT00013100'
  65. 'MMT00013122'
  66. 'MMT00013203'
  67. 'MMT00013227'
  68. 'MMT00013704'
  69. 'MMT00013759'
  70. 'MMT00014132'
  71. 'MMT00014558'
  72. 'MMT00014630'
  73. 'MMT00014730'
  74. 'MMT00015180'
  75. 'MMT00015289'
  76. 'MMT00015334'
  77. 'MMT00015563'
  78. 'MMT00015593'
  79. 'MMT00015674'
  80. 'MMT00016457'
  81. 'MMT00016835'
  82. 'MMT00016958'
  83. 'MMT00017188'
  84. 'MMT00017203'
  85. 'MMT00017421'
  86. 'MMT00017456'
  87. 'MMT00017674'
  88. 'MMT00017718'
  89. 'MMT00018071'
  90. 'MMT00018085'
  91. 'MMT00018374'
  92. 'MMT00018479'
  93. 'MMT00018643'
  94. 'MMT00018797'
  95. 'MMT00019063'
  96. 'MMT00019191'
  97. 'MMT00019257'
  98. 'MMT00019405'
  99. 'MMT00019744'
  100. 'MMT00020088'
  101. 'MMT00020374'
  102. 'MMT00020598'
  103. 'MMT00020770'
  104. 'MMT00020883'
  105. 'MMT00021004'
  106. 'MMT00021090'
  107. 'MMT00021275'
  108. 'MMT00021643'
  109. 'MMT00021734'
  110. 'MMT00021743'
  111. 'MMT00021805'
  112. 'MMT00022098'
  113. 'MMT00022230'
  114. 'MMT00022657'
  115. 'MMT00022754'
  116. 'MMT00022932'
  117. 'MMT00024107'
  118. 'MMT00024150'
  119. 'MMT00024300'
  120. 'MMT00024492'
  121. 'MMT00024851'
  122. 'MMT00025030'
  123. 'MMT00025048'
  124. 'MMT00025256'
  125. 'MMT00025527'
  126. 'MMT00025842'
  127. 'MMT00025886'
  128. 'MMT00026028'
  129. 'MMT00026117'
  130. 'MMT00026255'
  131. 'MMT00026611'
  132. 'MMT00026638'
  133. 'MMT00027064'
  134. 'MMT00027170'
  135. 'MMT00027378'
  136. 'MMT00027530'
  137. 'MMT00027663'
  138. 'MMT00027667'
  139. 'MMT00027763'
  140. 'MMT00027861'
  141. 'MMT00027989'
  142. 'MMT00028002'
  143. 'MMT00028568'
  144. 'MMT00028633'
  145. 'MMT00028763'
  146. 'MMT00028861'
  147. 'MMT00028979'
  148. 'MMT00029126'
  149. 'MMT00029192'
  150. 'MMT00029369'
  151. 'MMT00030150'
  152. 'MMT00030176'
  153. 'MMT00030229'
  154. 'MMT00030448'
  155. 'MMT00030465'
  156. 'MMT00030541'
  157. 'MMT00030781'
  158. 'MMT00030800'
  159. 'MMT00030931'
  160. 'MMT00031029'
  161. 'MMT00031086'
  162. 'MMT00031229'
  163. 'MMT00031263'
  164. 'MMT00031585'
  165. 'MMT00031586'
  166. 'MMT00031617'
  167. 'MMT00031650'
  168. 'MMT00031751'
  169. 'MMT00032175'
  170. 'MMT00032542'
  171. 'MMT00032545'
  172. 'MMT00032680'
  173. 'MMT00032840'
  174. 'MMT00032920'
  175. 'MMT00033105'
  176. 'MMT00033171'
  177. 'MMT00033222'
  178. 'MMT00033268'
  179. 'MMT00034286'
  180. 'MMT00034467'
  181. 'MMT00034709'
  182. 'MMT00034792'
  183. 'MMT00034839'
  184. 'MMT00034916'
  185. 'MMT00035158'
  186. 'MMT00035243'
  187. 'MMT00035724'
  188. 'MMT00035984'
  189. 'MMT00036340'
  190. 'MMT00036739'
  191. 'MMT00036954'
  192. 'MMT00037447'
  193. 'MMT00038270'
  194. 'MMT00038471'
  195. 'MMT00038915'
  196. 'MMT00038934'
  197. 'MMT00039183'
  198. 'MMT00039459'
  199. 'MMT00039764'
  200. 'MMT00039882'
  201. 'MMT00042929'
  202. 'MMT00042972'
  203. 'MMT00043411'
  204. 'MMT00043537'
  205. 'MMT00043939'
  206. 'MMT00043964'
  207. 'MMT00044287'
  208. 'MMT00044996'
  209. 'MMT00045252'
  210. 'MMT00045344'
  211. 'MMT00045751'
  212. 'MMT00046778'
  213. 'MMT00046836'
  214. 'MMT00047127'
  215. 'MMT00047197'
  216. 'MMT00047418'
  217. 'MMT00048209'
  218. 'MMT00048535'
  219. 'MMT00048720'
  220. 'MMT00049092'
  221. 'MMT00049111'
  222. 'MMT00049221'
  223. 'MMT00049383'
  224. 'MMT00049553'
  225. 'MMT00049556'
  226. 'MMT00049743'
  227. 'MMT00050031'
  228. 'MMT00050086'
  229. 'MMT00050363'
  230. 'MMT00050552'
  231. 'MMT00050576'
  232. 'MMT00051177'
  233. 'MMT00051278'
  234. 'MMT00051292'
  235. 'MMT00051303'
  236. 'MMT00051523'
  237. 'MMT00052337'
  238. 'MMT00052658'
  239. 'MMT00052695'
  240. 'MMT00052859'
  241. 'MMT00053210'
  242. 'MMT00053218'
  243. 'MMT00053489'
  244. 'MMT00053497'
  245. 'MMT00053545'
  246. 'MMT00053917'
  247. 'MMT00054261'
  248. 'MMT00054422'
  249. 'MMT00054464'
  250. 'MMT00054735'
  251. 'MMT00055005'
  252. 'MMT00055132'
  253. 'MMT00055391'
  254. 'MMT00055441'
  255. 'MMT00056362'
  256. 'MMT00056584'
  257. 'MMT00056716'
  258. 'MMT00056798'
  259. 'MMT00057508'
  260. 'MMT00058021'
  261. 'MMT00058158'
  262. 'MMT00058222'
  263. 'MMT00058752'
  264. 'MMT00059202'
  265. 'MMT00059241'
  266. 'MMT00059258'
  267. 'MMT00059782'
  268. 'MMT00060094'
  269. 'MMT00060423'
  270. 'MMT00060443'
  271. 'MMT00060559'
  272. 'MMT00060760'
  273. 'MMT00060952'
  274. 'MMT00061101'
  275. 'MMT00061203'
  276. 'MMT00061256'
  277. 'MMT00061313'
  278. 'MMT00061484'
  279. 'MMT00061509'
  280. 'MMT00061586'
  281. 'MMT00061735'
  282. 'MMT00061739'
  283. 'MMT00061815'
  284. 'MMT00061857'
  285. 'MMT00061884'
  286. 'MMT00061892'
  287. 'MMT00061998'
  288. 'MMT00062460'
  289. 'MMT00062787'
  290. 'MMT00062990'
  291. 'MMT00063198'
  292. 'MMT00063359'
  293. 'MMT00063470'
  294. 'MMT00063623'
  295. 'MMT00064235'
  296. 'MMT00064433'
  297. 'MMT00064617'
  298. 'MMT00064719'
  299. 'MMT00064851'
  300. 'MMT00064897'
  301. 'MMT00065001'
  302. 'MMT00065115'
  303. 'MMT00065116'
  304. 'MMT00065159'
  305. 'MMT00065770'
  306. 'MMT00066884'
  307. 'MMT00067008'
  308. 'MMT00067079'
  309. 'MMT00067105'
  310. 'MMT00067156'
  311. 'MMT00067261'
  312. 'MMT00067296'
  313. 'MMT00067525'
  314. 'MMT00067823'
  315. 'MMT00068494'
  316. 'MMT00068509'
  317. 'MMT00068530'
  318. 'MMT00068861'
  319. 'MMT00069165'
  320. 'MMT00069425'
  321. 'MMT00069884'
  322. 'MMT00070201'
  323. 'MMT00070277'
  324. 'MMT00070342'
  325. 'MMT00070429'
  326. 'MMT00070618'
  327. 'MMT00070677'
  328. 'MMT00070750'
  329. 'MMT00071052'
  330. 'MMT00071242'
  331. 'MMT00071411'
  332. 'MMT00071664'
  333. 'MMT00071772'
  334. 'MMT00071856'
  335. 'MMT00071857'
  336. 'MMT00071976'
  337. 'MMT00072042'
  338. 'MMT00072057'
  339. 'MMT00072237'
  340. 'MMT00072411'
  341. 'MMT00072657'
  342. 'MMT00073157'
  343. 'MMT00073211'
  344. 'MMT00073308'
  345. 'MMT00073344'
  346. 'MMT00073365'
  347. 'MMT00073735'
  348. 'MMT00073829'
  349. 'MMT00074488'
  350. 'MMT00074499'
  351. 'MMT00074523'
  352. 'MMT00074527'
  353. 'MMT00074580'
  354. 'MMT00074886'
  355. 'MMT00074990'
  356. 'MMT00075171'
  357. 'MMT00075402'
  358. 'MMT00075556'
  359. 'MMT00075754'
  360. 'MMT00076056'
  361. 'MMT00076233'
  362. 'MMT00076371'
  363. 'MMT00076382'
  364. 'MMT00076602'
  365. 'MMT00076754'
  366. 'MMT00076864'
  367. 'MMT00077152'
  368. 'MMT00077244'
  369. 'MMT00077345'
  370. 'MMT00077649'
  371. 'MMT00078015'
  372. 'MMT00078110'
  373. 'MMT00078258'
  374. 'MMT00078486'
  375. 'MMT00078698'
  376. 'MMT00078723'
  377. 'MMT00078816'
  378. 'MMT00078851'
  379. 'MMT00078976'
  380. 'MMT00079074'
  381. 'MMT00079144'
  382. 'MMT00079155'
  383. 'MMT00079156'
  384. 'MMT00079213'
  385. 'MMT00079316'
  386. 'MMT00079723'
  387. 'MMT00079874'
  388. 'MMT00080695'
  389. 'MMT00081019'
  390. 'MMT00081127'
  391. 'MMT00081171'
  392. 'MMT00081331'
  393. 'MMT00081375'
  394. 'MMT00081436'
  395. 'MMT00081571'
  396. 'MMT00081975'
  397. 'MMT00082041'
  398. 'MMT00082551'
  399. 'MMT00082712'
  400. 'MMT00082759'
代码
文本
[25]
annot = read.csv(file = "GeneAnnotation.csv");
dim(annot)
names(annot)
probes = names(datExpr) # 匹配信息
probes2annot = match(probes, annot$substanceBXH);
sum(is.na(probes2annot)) # 检测是否有没有匹配上的ID号,正常来说为0,即全匹配上了。
  1. 23388
  2. 34
  1. 'X'
  2. 'ID'
  3. 'arrayname'
  4. 'substanceBXH'
  5. 'gene_symbol'
  6. 'LocusLinkID'
  7. 'OfficialGeneSymbol'
  8. 'OfficialGeneName'
  9. 'LocusLinkSymbol'
  10. 'LocusLinkName'
  11. 'ProteomeShortDescription'
  12. 'UnigeneCluster'
  13. 'LocusLinkCode'
  14. 'ProteomeID'
  15. 'ProteomeCode'
  16. 'SwissprotID'
  17. 'OMIMCode'
  18. 'DirectedTilingPriority'
  19. 'AlternateSymbols'
  20. 'AlternateNames'
  21. 'SpeciesID'
  22. 'cytogeneticLoc'
  23. 'Organism'
  24. 'clustername'
  25. 'reporterid'
  26. 'probeid'
  27. 'sequenceid'
  28. 'clusterid'
  29. 'chromosome'
  30. 'startcoordinate'
  31. 'endcoordinate'
  32. 'strand'
  33. 'sequence_3_to_5_prime'
  34. 'sequence_5_to_3_prime'
0
代码
文本
[26]
# 输出必要的信息:
geneInfo0 = data.frame(substanceBXH = probes,
geneSymbol = annot$gene_symbol[probes2annot],
LocusLinkID = annot$LocusLinkID[probes2annot],
moduleColor = moduleColors,
geneTraitSignificance,
GSPvalue);

# 按照与体重的显著水平将模块进行排序:
modOrder = order(-abs(cor(MEs, weight, use = "p")));

# 添加模块成员的信息:
for (mod in 1:ncol(geneModuleMembership))
{
oldNames = names(geneInfo0)
geneInfo0 = data.frame(geneInfo0, geneModuleMembership[, modOrder[mod]],
MMPvalue[, modOrder[mod]]);
names(geneInfo0) = c(oldNames, paste("MM.", modNames[modOrder[mod]], sep=""),
paste("p.MM.", modNames[modOrder[mod]], sep=""))
}
geneOrder = order(geneInfo0$moduleColor, -abs(geneInfo0$GS.weight)); # 排序
geneInfo = geneInfo0[geneOrder, ]

# 输出为CSV格式,可用fix(geneInfo)在R中查看:
write.csv(geneInfo, file = "geneInfo.csv")
代码
文本

四、网络交互分析(GO注释等)

将重要的基因进行功能注释

1. 输出基因列表供在线软件服务使用

导出基因识标符列表,该列表可以在几个常用的基因本体David和功能富集分析AmiGo中输入使用。例如,将brown棕色模块的LocusLinkID(entrez)标识符代码写到一个文件中:

代码
文本
[27]
annot = read.csv(file = "/bohr/wgcna-ss71/v1/GeneAnnotation.csv")
probes = names(datExpr)
probes2annot = match(probes, annot$substanceBXH)
allLLIDs = annot$LocusLinkID[probes2annot]
intModules = c("brown", "red", "salmon")

for (module in intModules)
{
# Select module probes
modGenes = (moduleColors==module);
# Get their entrez ID codes
modLLIDs = allLLIDs[modGenes];
# Write them into a file
fileName = paste("LocusLinkIDs-", module, ".txt", sep="");
write.table(as.data.frame(modLLIDs), file = fileName,
row.names = FALSE, col.names = FALSE)
}
代码
文本

2. 直接用 R 进行 GO 富集分析

代码
文本
[28]
GOenr = GOenrichmentAnalysis(moduleColors, allLLIDs, organism = "mouse", nBestP = 10) # 这个例子中研究的是小鼠的基因表达
tab = GOenr$bestPTerms[[4]]$enrichment
Warning message in GOenrichmentAnalysis(moduleColors, allLLIDs, organism = "mouse", :
“This function is deprecated and will be removed in the near future. 
We suggest using the replacement function enrichmentAnalysis 
in R package anRichment, available from the following URL:
https://labs.genetics.ucla.edu/horvath/htdocs/CoexpressionNetwork/GeneAnnotation/”
Loading required package: org.Mm.eg.db

Loading required package: AnnotationDbi

Loading required package: stats4

Loading required package: BiocGenerics


Attaching package: ‘BiocGenerics’


The following objects are masked from ‘package:stats’:

    IQR, mad, sd, var, xtabs


The following objects are masked from ‘package:base’:

    Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min


Loading required package: Biobase

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


Loading required package: IRanges

Loading required package: S4Vectors


Attaching package: ‘S4Vectors’


The following object is masked from ‘package:utils’:

    findMatches


The following objects are masked from ‘package:base’:

    I, expand.grid, unname




Loading required package: GO.db

 GOenrichmentAnalysis: loading annotation data...
  ..of the 3038  Entrez identifiers submitted, 2843 are mapped in current GO categories.
  ..will use 2843 background genes for enrichment calculations.
  ..preparing term lists (this may take a while).. 
  ..working on label set 1 ..
    ..calculating enrichments (this may also take a while)..
    ..putting together terms with highest enrichment significance..
代码
文本

以上结果是一个富集列表,包含每个模块颜色中10个最佳的条目。可以通过以下方式访问表中列的名称:

代码
文本
[29]
names(tab)
write.table(tab, file = "GOEnrichmentTable.csv", sep = ",", quote = TRUE, row.names = FALSE)
  1. 'module'
  2. 'modSize'
  3. 'bkgrModSize'
  4. 'rank'
  5. 'enrichmentP'
  6. 'BonferoniP'
  7. 'nModGenesInTerm'
  8. 'fracOfBkgrModSize'
  9. 'fracOfBkgrTermSize'
  10. 'bkgrTermSize'
  11. 'termID'
  12. 'termOntology'
  13. 'termName'
  14. 'termDefinition'
代码
文本

也可以直接删减一些内容,使其在 R 中快速显示出来:

代码
文本
[30]
keepCols = c(1, 2, 5, 6, 7, 12, 13);
screenTab = tab[, keepCols];
numCols = c(3, 4);
screenTab[, numCols] = signif(apply(screenTab[, numCols], 2, as.numeric), 2) #将数字保留两位小数

# 将术语名称截断为最多 40 个字符:
screenTab[, 7] = substring(screenTab[, 7], 1, 40)
colnames(screenTab) = c("module", "size", "p-val", "Bonf", "nInTerm", "ont", "term name");
rownames(screenTab) = NULL;
options(width=95)
screenTab
A data.frame: 190 × 7
modulesizep-valBonfnInTermontterm name
<chr><int><dbl><dbl><dbl><chr><chr>
black1667.0e-051.0e+00 15MFreceptor ligand activity
black1667.9e-051.0e+00 15MFsignaling receptor activator activity
black1661.8e-041.0e+00 15MFsignaling receptor regulator activity
black1666.6e-041.0e+00 5BPmRNA transport
black1666.9e-041.0e+00 4BPdopamine transport
black1662.0e-031.0e+00 6BPrRNA metabolic process
black1662.2e-031.0e+00 5BPRNA transport
black1662.4e-031.0e+00 15BPG protein-coupled receptor signaling pat
black1662.6e-031.0e+00 2BPventricular compact myocardium morphogen
black1662.6e-031.0e+00 2BPsynaptic vesicle fusion to presynaptic a
blue 4285.1e-449.8e-40193BPimmune system process
blue 4282.6e-424.9e-38150BPimmune response
blue 4289.1e-351.7e-30115BPdefense response to other organism
blue 4283.8e-347.2e-30144BPdefense response
blue 4288.4e-341.6e-29132BPregulation of immune system process
blue 4282.9e-325.6e-28131BPresponse to external biotic stimulus
blue 4282.9e-325.6e-28131BPresponse to other organism
blue 4281.9e-313.6e-27106BPpositive regulation of immune system pro
blue 4281.0e-292.0e-25 93BPinnate immune response
blue 4281.7e-293.2e-25132BPbiological process involved in interspec
brown3962.4e-234.6e-19 51CCextracellular matrix
brown3962.1e-184.0e-14 37CCcollagen-containing extracellular matrix
brown3968.1e-181.6e-13 30MFextracellular matrix structural constitu
brown3968.5e-181.6e-13124CCextracellular region
brown3963.3e-146.3e-10 36BPextracellular matrix organization
brown3966.1e-131.2e-08 62BPvasculature development
brown3961.2e-122.2e-08 60BPblood vessel development
brown3961.8e-123.4e-08 95CCextracellular space
brown3961.9e-123.7e-08196CCcell periphery
brown3962.5e-114.9e-07 52BPblood vessel morphogenesis
tan 816.9e-051.00 3BPplatelet dense granule organization
tan 811.7e-041.00 3BPvesicle cargo loading
tan 813.8e-041.00 38MFcatalytic activity
tan 816.9e-041.00 2BPclathrin-coated vesicle cargo loading, A
tan 816.9e-041.00 2CCAP-3 adaptor complex
tan 817.7e-041.00 6BPhormone metabolic process
tan 819.0e-041.00 3BPsecretory granule organization
tan 811.7e-031.00 32CCendomembrane system
tan 811.8e-031.00 20BPsmall molecule metabolic process
tan 811.9e-031.00 3BPcanonical glycolysis
turquoise5292.8e-050.54 12BPtranslational initiation
turquoise5295.3e-051.00 36CCintracellular protein-containing complex
turquoise5299.2e-051.00 39MFtranscription factor binding
turquoise5291.2e-041.00 16BPsensory perception of chemical stimulus
turquoise5291.5e-041.00 14BPsensory perception of smell
turquoise5291.8e-041.00 26MFtranscription coregulator activity
turquoise5292.9e-041.00378CCintracellular organelle
turquoise5294.9e-041.00 73BPpositive regulation of macromolecule bio
turquoise5295.7e-041.00124CCnucleoplasm
turquoise5295.9e-041.00136CCnuclear lumen
yellow 1991.2e-041.00 3MFnickel cation binding
yellow 1991.8e-041.00 5CCendocytic vesicle membrane
yellow 1991.9e-041.00 4BPxenobiotic catabolic process
yellow 1993.7e-041.00 4BPregulation of animal organ formation
yellow 1998.2e-041.00 7BPglycolytic process
yellow 1998.2e-041.00 7BPATP generation from ADP
yellow 1998.4e-041.00 5BPvesicle budding from membrane
yellow 1991.0e-031.00 4BPbenzene-containing compound metabolic pr
yellow 1991.1e-031.00 14BPpurine nucleotide metabolic process
yellow 1991.2e-031.00 7BPnucleoside diphosphate phosphorylation
代码
文本

五、网络可视化

代码
文本
[31]
nGenes = ncol(datExpr)
nSamples = nrow(datExpr)
代码
文本

1. 可视化基因网络

计算 TOM 矩阵:

代码
文本
[32]
dissTOM = 1-TOMsimilarityFromExpr(datExpr, power = 6);
plotTOM = dissTOM^7;
diag(plotTOM) = NA;
sizeGrWindow(9,9)
TOMplot(plotTOM, geneTree, moduleColors, main = "Network heatmap plot, all genes")
TOM calculation: adjacency..
..will not use multithreading.
 Fraction of slow calculations: 0.396405
..connectivity..
..matrix multiplication (system BLAS)..
..normalization..
..done.
代码
文本

可视化加权网络的方法之一是制作热图。热图的每行每列代表一个基因,浅色代表低邻接(重叠);深色代表高邻接(重叠)。

生成的热图可能需要大量的时间。可以限制基因的数量来加快绘图。但是基因子集的树状图看起来与所有基因的树状图不同,下面随机选取400个基因进行绘图:

代码
文本
[33]
nSelect = 400
set.seed(10);
select = sample(nGenes, size = nSelect);
selectTOM = dissTOM[select, select];
selectTree = hclust(as.dist(selectTOM), method = "average")
selectColors = moduleColors[select];

plotDiss = selectTOM^7;
diag(plotDiss) = NA;
TOMplot(plotDiss, selectTree, selectColors, main = "Network heatmap plot, selected genes")

#改变热图的深色背景为白色背景:
library(gplots)
myheatcol = colorpanel(250,'red',"orange",'lemonchiffon')
TOMplot(plotDiss, selectTree, selectColors, main = "Network heatmap plot, selected genes", col=myheatcol)

代码
文本

2. 可视化表征基因网络

研究找到的模块之间的关系,可以使用 eigengene 表征基因作为代表轮廓,通过特征基因相关性来量化模块的相似性。该包包含的函数plotEigengeneNetworks,可以生成 eigengene 网络的摘要图。

代码
文本
[34]
# 重新计算模块的eigengenes
MEs = moduleEigengenes(datExpr, moduleColors)$eigengenes

# 提取体重的表型数据
weight = as.data.frame(datTraits$weight_g);
names(weight) = "weight"

# 加入到相应的模块
MET = orderMEs(cbind(MEs, weight))

#画图:特征模块与体重数据的聚类图和热图
par(cex = 0.9)
plotEigengeneNetworks(MET, "", marDendro = c(0,4,1,2), marHeatmap = c(3,4,1,2), cex.lab = 0.8, xLabelsAngle = 90)
代码
文本
[35]
# 拆分聚类图和热图:

par(cex = 1.0)
plotEigengeneNetworks(MET, "Eigengene dendrogram", marDendro = c(0,4,2,0),
plotHeatmaps = FALSE)
par(cex = 1.0)
plotEigengeneNetworks(MET, "Eigengene adjacency heatmap", marHeatmap = c(3,4,2,2),
plotDendrograms = FALSE, xLabelsAngle = 90)
代码
文本

从图中结果可知,体重与模块 MEbrown、MEred、MEblue的关系更密切。

六、将网络导出到网络可视化软件

第六步是我们最想要的结果,也是每篇文献中最主要的一个图,就是hub gene 的互作关系网络图。这步会告诉你如何将必要的数据导出,以供其他软件进行绘图,例如VisANT、Cytoscape。

1. 输出到 VisANT 软件所需的数据

代码
文本
[36]
TOM = TOMsimilarityFromExpr(datExpr, power = 6);
module = "brown";
probes = names(datExpr)
inModule = (moduleColors==module);
modProbes = probes[inModule];
modTOM = TOM[inModule, inModule];
dimnames(modTOM) = list(modProbes, modProbes)
vis = exportNetworkToVisANT(modTOM,
file = paste("VisANTInput-", module, ".txt", sep=""),
weighted = TRUE,
threshold = 0,
probeToGene = data.frame(annot$substanceBXH, annot$gene_symbol) )

TOM calculation: adjacency..
..will not use multithreading.
 Fraction of slow calculations: 0.396405
..connectivity..
..matrix multiplication (system BLAS)..
..normalization..
..done.
代码
文本
[37]
# 可以严格控制输出的 hub gene 的个数为 30 个以内在这个模块中:

nTop = 30;nTop = 30;
IMConn = softConnectivity(datExpr[, modProbes]);
top = (rank(-IMConn) <= nTop)
vis = exportNetworkToVisANT(modTOM[top, top],
file = paste("VisANTInput-", module, "-top30.txt", sep=""),
weighted = TRUE,
threshold = 0,
probeToGene = data.frame(annot$substanceBXH, annot$gene_symbol) )
 softConnectivity: FYI: connecitivty of genes with less than 45 valid samples will be returned as NA.
 ..calculating connectivities.. 
代码
文本

以上导出的数据可以用VisANT进行编辑,绘制互作网络。

2. 输出到 Cytoscape

Cytoscape 允许用户输入边缘文件和节点文件,允许用户指定例如连接权重和节点颜色。在这里,向 Cytoscape 展示了两个模块(红色和棕色模块)的输出。

代码
文本
[ ]
TOM = TOMsimilarityFromExpr(datExpr, power = 6);
annot = read.csv(file = "GeneAnnotation.csv");

# 选择棕色和红色的模块
modules = c("brown", "red");
probes = names(datExpr)
inModule = is.finite(match(moduleColors, modules));
modProbes = probes[inModule];
modGenes = annot$gene_symbol[match(modProbes, annot$substanceBXH)];

# 选择相关的 TOM矩阵
modTOM = TOM[inModule, inModule];
dimnames(modTOM) = list(modProbes, modProbes)

# Export the network into edge and node list files Cytoscape can read
cyt = exportNetworkToCytoscape(modTOM,
edgeFile = paste("CytoscapeInput-edges-", paste(modules, collapse="-"), ".txt", sep=""),
nodeFile = paste("CytoscapeInput-nodes-", paste(modules, collapse="-"), ".txt", sep=""),
weighted = TRUE,
threshold = 0.02,
nodeNames = modProbes,
altNodeNames = modGenes,
nodeAttr = moduleColors[inModule])

代码
文本

以上导出的数据可以用 Cytoscape 进行编辑,绘制互作网络。

代码
文本
生物信息学
R包
基因共表达分析
核心基因
生物信息学R包基因共表达分析核心基因
点个赞吧
推荐阅读
公开
有参考基因组的Bulk RNA-Seq数据分析
生物信息学rnaseq
生物信息学rnaseq
Julia_Xiang
发布于 2023-07-17
5 赞7 转存文件4 评论
公开
transPlotR:优雅地绘制基因转录本结构
生物信息学中文基因组转录组
生物信息学中文基因组转录组
Judy Lin
发布于 2023-08-05
1 赞1 转存文件2 评论