orderBranchesUsingHubGenes(WGCNA)
orderBranchesUsingHubGenes()所属R语言包:WGCNA
Optimize dendrogram using branch swaps and reflections.
优化系统树分支掉期和反射。
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function takes as input the hierarchical clustering tree as well as a subset of genes in the network (generally corresponding to branches in the tree), then returns a semi-optimally ordered tree. The idea is to maximize the correlations between adjacent branches in the dendrogram, in as much as that is possible by adjusting the arbitrary positionings of the branches by swapping and reflecting branches.
此函数接受作为输入的层次聚类树的一个子集,以及在网络中的基因(一般对应于在树的分支),则返回一个半最佳有序树。这样做是为了最大限度地相邻的分支树状图之间的相关性,在尽可能多的,因为这是可以通过调整任意的定位的分支机构通过交换和反映分支。
用法----------Usage----------
orderBranchesUsingHubGenes(hierTOM, datExpr = NULL, colorh = NULL, type = "signed", adj = NULL, iter = NULL, useReflections = FALSE, allowNonoptimalSwaps = FALSE)
参数----------Arguments----------
参数:hierTOM
A hierarchical clustering object (or gene tree) that is used to plot the dendrogram. For example, the output object from the function hclust or flashClust. Note that elements of hierTOM$order MUST be named (for example, with the corresponding gene name).
分层聚类对象(或基因树),用于绘制树状图。例如,在输出对象从函数hclust或flashClust。需要注意的是hierTOM元,元素必须被命名(例如,与相应的基因名称)。
参数:datExpr
Gene expression data with rows as samples and columns as genes, or NULL if a pre-made adjacency is entered. Column names of datExpr must be a subset of gene names of hierTOM$order.
如果预先制作的邻接进入基因表达数据为样本,作为基因或NULL的列与行。列名datExpr必须是基因名称的hierTOM为了一个子集。
参数:colorh
The module assignments (color vectors) corresponding to the rows in datExpr, or NULL if a pre-made adjacency is entered.
该模块分配(彩色矢量)对应的行datExpr,或NULL如果进入一个预制的邻接。
参数:type
What type of network is being entered. Common choices are "signed" (default) and "unsigned". With "signed" negative correlations count against, whereas with "unsigned" negative correlations are treated identically as positive correlations.
什么类型的网络被输入。常见的选择“签名”(默认)和“无符号”。 “签名”的负相关关系计算在“无符号”的负相关关系,而被视为相同的正相关关系。
参数:adj
Either NULL (default) or an adjacency (or any other square) matrix with rows and columns corresponding to a subset of the genes in hierTOM$order. If entered, datExpr, colorh, and type are all ignored. Typically, this would be left blank but could include correlations between module eigengenes, with rows and columns renamed as genes in the corresponding modules, for example.
是NULL(默认值),或邻接(或任何其他的正方形)hierTOM元顺序的基因在一个子集对应于矩阵的行和列。如果输入,datExpr,colorh和类型都被忽略。通常,这将被留为空白,但可包括模块特征基因之间的相关性,基因中的对应的模块,例如改名为具有行和列。
参数:iter
The number of iterations to run the function in search of optimal branch ordering. The default is the square of the number of modules (or the quare of the number of genes in the adjacency matrix).
迭代次数,运行在寻找最佳分支订购的功能。默认值是模块(或正职的基因中的邻接矩阵的数量)的数量的平方。
参数:useReflections
If TRUE, both reflections and branch swapping will be used to optimize dendrogram. If FALSE (default) only branch swapping will be used.
如果是TRUE,反射和分支交换将被用于优化聚类分析。如果为FALSE(默认值)的唯一分支机构交换将被使用。
参数:allowNonoptimalSwaps
If TRUE, there is chance (that decreases with each iteration) of swapping / reflecting branches whether or not the new correlation between expression of genes in adjacent branches is better or worse. The idea (which has not been sufficiently tested), is that this would prevent the function from getting stuck at a local maxima of correlation. If FALSE (default), the swapping / reflection of branches only occurs if it results in a higher correlation between adjacent branches.
如果是TRUE,有机会(即随每一次迭代)的交换/反射分支机构之间的相关性表达的基因在相邻的分支是否是好还是坏。的想法(它没有得到充分的测试),是卡住在一个局部极大值的相关性,这将防止功能。如果为FALSE(默认值),交换/反射的分支机构只发生,如果它导致相邻分支之间的相关性较高。
值----------Value----------
参数:hierTOM
A hierarchical clustering object with the hierTOM$order variable properly adjusted, but all other variables identical as the heirTOM input.
分层聚类对象的hierTOM元,可变适当的调整,但所有其他变量相同的heirTOM输入。
参数:changeLog
A log of all of the changes that were made to the dendrogram, including what change was made, on what iteration, and the Old and New scores based on correlation. These scores have arbitrary units, but higher is better.
一个记录所有的变化,树状图,包括了什么样的变化,什么样的迭代,并根据相关的旧的和新的成绩。这些分数有任意单位,但是越高越好。
注意----------Note----------
This function is very slow and is still in an *experimental* function. We have not had problems with ~10 modules across ~5000 genes, although theoretically it should work for many more genes and modules, depending upon the speed of the computer running R. Please address any problems or suggestions to jeremyinla@gmail.com.
这个功能是非常缓慢的,仍然是在实验*功能。我们还没有跨越~5000基因~10个模块的问题,虽然理论上它应该有更多的基因和模块,根据在计算机上运行的速度R.解决任何问题或建议,jeremyinla@gmail.com。
(作者)----------Author(s)----------
Jeremy Miller
实例----------Examples----------
## Example: first simulate some data.[#示例:首先模拟了一些数据。]
MEturquoise = sample(1:100,50)
MEblue = c(MEturquoise[1:25], sample(1:100,25))
MEbrown = sample(1:100,50)
MEyellow = sample(1:100,50)
MEgreen = c(MEyellow[1:30], sample(1:100,20))
MEred = c(MEbrown [1:20], sample(1:100,30))
ME = data.frame(MEturquoise, MEblue, MEbrown, MEyellow, MEgreen, MEred)
dat1 = simulateDatExpr(ME,400,c(0.16,0.12,0.11,0.10,0.10,0.10,0.1), signed=TRUE)
TOM1 = TOMsimilarityFromExpr(dat1$datExpr, networkType="signed")
colnames(TOM1) <- rownames(TOM1) <- colnames(dat1$datExpr)
tree1 = flashClust(as.dist(1-TOM1),method="average")
colorh = labels2colors(dat1$allLabels)
plotDendroAndColors(tree1,colorh,dendroLabels=FALSE)
## Reassign modules using the selectBranch and chooseOneHubInEachModule functions[#重新分配使用selectBranch和chooseOneHubInEachModule功能模块。]
datExpr = dat1$datExpr
hubs = chooseOneHubInEachModule(datExpr, colorh)
colorh2 = rep("grey", length(colorh))
colorh2 [selectBranch(tree1,hubs["blue"],hubs["turquoise"])] = "blue"
colorh2 [selectBranch(tree1,hubs["turquoise"],hubs["blue"])] = "turquoise"
colorh2 [selectBranch(tree1,hubs["green"],hubs["yellow"])] = "green"
colorh2 [selectBranch(tree1,hubs["yellow"],hubs["green"])] = "yellow"
colorh2 [selectBranch(tree1,hubs["red"],hubs["brown"])] = "red"
colorh2 [selectBranch(tree1,hubs["brown"],hubs["red"])] = "brown"
plotDendroAndColors(tree1,cbind(colorh,colorh2),c("Old","New"),dendroLabels=FALSE)
## Now swap and reflect some branches, then optimize the order of the branches [#交换和反映的一些分支,然后优化的分支机构的顺序]
# and output pdf with resulting images[产生的图像和输出的PDF]
## Not run: [#不运行:]
pdf("DENDROGRAM_PLOTS.pdf",width=10,height=5)
plotDendroAndColors(tree1,colorh2,dendroLabels=FALSE,main="Starting Dendrogram")
tree1 = swapTwoBranches(tree1,hubs["red"],hubs["turquoise"])
plotDendroAndColors(tree1,colorh2,dendroLabels=FALSE,main="Swap blue/turquoise and red/brown")
tree1 = reflectBranch(tree1,hubs["blue"],hubs["green"])
plotDendroAndColors(tree1,colorh2,dendroLabels=FALSE,main="Reflect turquoise/blue")
# (This function will take a few minutes)[(此功能需要几分钟)]
out = orderBranchesUsingHubGenes(tree1,datExpr,colorh2,useReflections=TRUE,iter=100)
tree1 = out$geneTree
plotDendroAndColors(tree1,colorh2,dendroLabels=FALSE,main="Semi-optimal branch order")
out$changeLog
dev.off()
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|