10X单细胞(10X空间转录组)聚类算法之leiden

hello,大家好,今天我们来分享一下最新常用的聚类算法----leiden,其实大家在看Seurat的函数FindClusters可能会观察到,其中有一个参数algorithm,有4个可选项,我们列举出来

1 = original Louvain algorithm(原始Louvain算法 )

2 = Louvain algorithm with multilevel refinement(具有多级细化的Louvain算法 )

3 = SLM algorithm(SLM算法,关于这个算法大家可以参考文章Neo4j:SLM群集算法的过程,我会在后续分享的文章中提到这个算法)。

4 = Leiden algorithm(leiden算法,这是我们今天分享的重点)。

在软件scanpy的运行函数中,原来的聚类函数sc.tl.louvain也被函数sc.tl.leiden取代,可见更大范围上,leiden算法比louvain更为合适。

其中关于louvain的算法,在我分享的文章10X单细胞(10X空间转录组)聚类算法之Louvain,详细介绍过,大家可以参考,而今天我们的内容,就从louvain和leiden的关系开始。

首先来总结一下louvain的缺点:

1、社区划分的精度有局限性

2、分组内细胞分布密度的大小会影响亚群的鉴定

3、被鉴定为同一个分群的细胞群内,存在两个没有连线的小分群

Leiden算法主要针对上述的第3个缺点,对louvain算法进行优化。Leiden算法的命名来源于荷兰莱顿大学(Leiden University)。该算法由莱顿大学的三位研究员开发,结果于2020年3月份发表在Scientific Reports上。

图片.png

总结Leiden算法优化louvain的两个要点:

比louvain算法运行更快。

针对louvain聚类结果中出现一些分群内部存在断链的现象(连线没有把所有细胞串起来,存在明显亚群)进行优化,分群更加合理,可能得到更多亚群。

图片.png

图解leiden算法的操作过程

再分享深入的算法之前,我们先来举一个例子

我们可以把聚类过程当作体育课的一场游戏。

学生是细胞,在操场上站队(聚类)。

模块度是体育老师,检查学生站队是否合理。

连线(细胞间权重)表示学生之间有一定的关系,比如同班同学,身高一致等。

18814178-5097858796545d61.png
经过学生的一阵骚动(初始划分聚类)之后,初始的队伍出来了,分成的三个队伍:
bbc62f88ff10f0373d084ed2d8a394f6.png
这时体育老师出来,看了看整体队形(模块度给聚类结果打分),感觉还不行(模块度分数偏低),需要调整分组站队。

Leiden和louvain算法的调整策略不同(leiden优化的要点一):

    1. Louvain:让每个同学去另外两个队伍,每次换队伍都让体育老师评价一下;
  • 2. Leiden:只让每个同学去有连线的其他队伍,节省时间。

当害羞同学从红队调整到绿队时,体育老师发现队形变好看了(模块度打分提高了)。因为红队身高整体比绿队高,害羞同学比较矮,适合绿队。害羞同学刚开始站在红队,是因为她跟红队是同班同学。

d9fa8820f6dc7aa0c4c866ab43862ac8.png

但害羞同学离开红队之后,问题就来了。红队内部出现左右两个没有连线的小队:耶小队和奸笑小队。Louvain算法没有检测这种内部断链的现象。尽管红队都是同班同学,但内部还是有身高的差异,耶小队比奸笑小队普遍矮小。之前不高不矮的害羞同学在的时候,还能起到内部过渡的作用。当害羞同学离开之后,红队内部出现两极化。

5029ff4baf29ffdf58f3e8da4f7ec5f7.png

幸亏体育老师提前备课,看了leiden算法,及时将红队分开。(leiden优化要点二)

下课铃声响起,体育老师手握Leiden书,看着同学们完美的队形,露出了满意的微笑。

那么接下来,我们就要进入深刻的leiden算法环节了。

简单回顾一下Louvain Algorithm

图片.png

对比一下leiden算法

We here introduce the Leiden algorithm, which guarantees that communities are well connected. The Leiden algorithm is partly based on the previously introduced smart local move algorithm, which itself can be seen as an improvement of the Louvain algorithm. The Leiden algorithm also takes advantage of the idea of speeding up the local moving of nodes and the idea of moving nodes to random neighbours. We consider these ideas to represent the most promising directions in which the Louvain algorithm can be improved, even though we recognise that other improvements have been suggested as well. The Leiden algorithm consists of three phases: (1) local moving of nodes, (2) refinement of the partition and (3) aggregation of the network based on the refined partition, using the non-refined partition to create an initial partition for the aggregate network. The Leiden algorithm is considerably more complex than the Louvain algorithm. Figure 3下图) provides an illustration of the algorithm.

图片.png

we show that the Louvain algorithm has a major problem, for both modularity and CPM. The algorithm may yield arbitrarily badly connected communities, over and above the well-known issue of the resolution limit. Communities may even be internally disconnected. To address this important shortcoming, we introduce a new algorithm that is faster, finds better partitions and provides explicit guarantees and bounds. The new algorithm integrates several earlier improvements, incorporating a combination of smart local move, fast local move and random neighbour move. We prove that the new algorithm is guaranteed to produce partitions in which all communities are internally connected. In addition, we prove that the algorithm converges to an asymptotically stable partition in which all subsets of all communities are locally optimally assigned. The quality of such an asymptotically stable partition provides an upper bound on the quality of an optimal partition. Finally, we demonstrate the excellent performance of the algorithm for several benchmark and real-world networks. To ensure readability of the paper to the broadest possible audience, we have chosen to relegate all technical details to the Supplementary Information. The main ideas of our algorithm are explained in an intuitive way in the main text of the paper. We name our algorithm the Leiden algorithm

好了,就分享这么多了,大家多多学习

生活很好,有你更好

©著作权归作者所有,转载或内容合作请联系作者
禁止转载,如需转载请通过简信或评论联系作者。
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,470评论 6 501
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,393评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 162,577评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,176评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,189评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,155评论 1 299
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,041评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,903评论 0 274
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,319评论 1 310
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,539评论 2 332
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,703评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,417评论 5 343
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,013评论 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,664评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,818评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,711评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,601评论 2 353

推荐阅读更多精彩内容