如何在Matlab的生物信息学工具箱中使用其他聚类方法进行聚类图
编辑:我想通了。只是不明白符号。
您好,
希望有人熟悉生物信息学工具箱中的聚类图。我对该函数的图形方面(树状图/热图)感兴趣,但目前我有障碍,因为它要求我使用 Matlab 的 cluster() 函数。我更喜欢使用我个人的算法进行聚类,然后让 Matlab 为我可视化。
我已经搜索了代码,但遗憾的是我对面向对象编程的总体情况一无所知,尤其是 Matlab 的版本。因此,我只知道该函数调用行“obj = obj.getclusters”,但不知道如何编辑它,以便我使用自己的聚类算法而不是 Matlab 的算法。
任何帮助表示赞赏!
编辑:我正在专门研究一种新算法,因此为什么我不需要 pdist 或链接。树状图是在 clustergram 函数之外计算的。我用来创建树状图/热图的只是 clustergram 函数。我的生物信息学工具箱是版本 3.3
真的,我在这里寻找的只是 'obj = obj.getclusters;' 到底做什么。做?我不是程序员,对 OO 并不熟悉。对我来说,这看起来就像我们神奇地拥有了集群,因为没有函数调用。这是 clustergram() 的第 304 行
EDIT: I figured it out. Just did not understand notation.
Hello,
Hopefully someone out there is familiar with the clustergram in the bioinformatics toolbox. I am interested in the graphical aspects of the function (the dendrogram/heat map), but am currently handicapped as it requires me to use Matlab's cluster() function. I would prefer to use my personal algorithm to cluster, and then allow Matlab to visualize this for me.
I have searched the code, but am woefully ignorant about object oriented programming in general, and Matlab's version in particular. Thus all I know is the function calls the line 'obj = obj.getclusters', but have no idea how to edit it this such that I use my own clustering algorithm instead of Matlab's.
Any help is appreciated!
EDIT: I am specifically working on a new algorithm, hence why I have no need for pdist or linkage. The dendrograms are calculated outside the clustergram function. All I am using to create the dendrogram/heatmap is the clustergram function. My Bioinformatics toolbox is version 3.3
Really, all I am looking for here is what the hell does 'obj = obj.getclusters;' do? I am not a programmer and really am not familiar with OO. To me, that looks like we magically have clusters, as there is no function call. This is at line 304 of clustergram()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,我有更高版本的 Bioinformatics Toolbox(3.4 及更高版本),并且对于这些版本
clustergram.m
文件没有行obj = obj.getclusters;
记住 CLUSTERGRAM 在类中(不像旧版本那样起作用)。当您运行 clustergram(data,...) 时,您实际上运行此类的构造函数方法来创建 clustergram 对象。该对象是 obj 变量。因此,当您运行 obj = obj.getclusters; 时,您实际上运行 clustergram 类中的
getclusters
方法,该方法会更新对象obj
。要了解
getclusters
方法正在执行的更多详细信息,请在方法块中查找以下行:在最新版本中,方法
computeClusters
定义为此方法计算行和树状图列并更新对象。当然,您可以直接更改此功能,但我不推荐这样做。最好为距离度量和链接开发单独的函数,并使用这些函数来构造 clustergram 对象。
如果您的算法不使用距离和链接,请解释它如何构建树状图。它是否创建与 LINKAGE 函数的输出相同的链接矩阵?如果没有这样的矩阵,我认为即使仅用于可视化也无法使用聚类图。你有一个你的聚类图应该是什么样子的例子吗?也许您可以使用其他更简单函数的 Heatmap 类,例如 < a href="http://www.mathworks.com/help/techdoc/ref/image.html" rel="nofollow">图像 或 IMAGESC。
First I have later versions of Bioinformatics Toolbox (3.4 and later), and for those versions
clustergram.m
file does not have the lineobj = obj.getclusters;
Remember CLUSTERGRAM in the class (not function as it was it older version). When you run
clustergram(data,...)
you actually run the constructor method of this class to create clustergram object. This object isobj
variable. So when you runobj = obj.getclusters;
you actually rungetclusters
method in clustergram class, which updates the objectobj
.To get more details what
getclusters
method is doing look for a following line in methods block:In the latest versions there is method
computeClusters
defined asThis method computes both dendrograms for rows and columns and updates the object. You can directly alter this function, of course, but I wouldn't recommend it. It's much better to develop separate functions for distance metric and linkage and use those functions to construct clustergram object.
If your algorithm does not use distance and linkage, please explain how it's suppose to build dendrograms. Does it create linkage matrix same as output of LINKAGE function? Without such matrix I don't think you can use clustergram even for visualization only. Do you have an example how your clustergram should look like? May be you can use Heatmap class of other simpler functions like IMAGE or IMAGESC.