ArchR官网教程学习笔记16(下):ArchR的轨迹推断分析

系列回顾:
ArchR官网教程学习笔记1:Getting Started with ArchR
ArchR官网教程学习笔记2:基于ArchR推测Doublet
ArchR官网教程学习笔记3:创建ArchRProject
ArchR官网教程学习笔记4:ArchR的降维
ArchR官网教程学习笔记5:ArchR的聚类
ArchR官网教程学习笔记6:单细胞嵌入(Single-cell Embeddings)
ArchR官网教程学习笔记7:ArchR的基因评分和Marker基因
ArchR官网教程学习笔记8:定义与scRNA-seq一致的聚类
ArchR官网教程学习笔记9:ArchR的伪批量重复
ArchR官网教程学习笔记10:ArchR的call peak
ArchR官网教程学习笔记11:鉴定Marker峰
ArchR官网教程学习笔记12:Motif和Feature富集
ArchR官网教程学习笔记13:ChromVAR偏差富集
ArchR官网教程学习笔记14:ArchR的Footprinting分析
ArchR官网教程学习笔记15:ArchR的整合分析
ArchR官网教程学习笔记16(上):ArchR的轨迹推断分析

这是ArchR官网手册的最后一部分,后面的更多功能还在开发中。

Lymphoid Trajectory - B 细胞分化

作为轨迹分析的第二个例子,我们将创建一个B细胞轨迹从祖细胞,通过共同的淋巴祖细胞和前B细胞,一直到完全分化的B细胞。因为这种分析本质上是重复上一节的分析过程,所以我们不提供代码的解释。如果你想看详细的代码解释,请看上一节。

> p1 <- plotEmbedding(ArchRProj = projHeme5, colorBy = "cellColData", name = "Clusters", embedding = "UMAP")
> p2 <- plotEmbedding(ArchRProj = projHeme5, colorBy = "cellColData", name = "Clusters2", embedding = "UMAP")
> ggAlignPlots(p1, p2, type = "h")
(1)UMAP拟时间和独立特征绘图
> trajectory <- c("Progenitor", "CLP", "PreB", "B")
> trajectory
[1] "Progenitor" "CLP"        "PreB"       "B"    
> projHeme5 <- addTrajectory(
    ArchRProj = projHeme5, 
    name = "LymphoidU", 
    groupBy = "Clusters2",
    trajectory = trajectory, 
    embedding = "UMAP", 
    force = TRUE
)

> head(projHeme5$LymphoidU[!is.na(projHeme5$LymphoidU)])
[1] 80.68850 79.93283 81.94794 83.75315 82.66163 81.61209

> p <- plotTrajectory(projHeme5, trajectory = "LymphoidU", colorBy = "cellColData", name = "LymphoidU")
> p[[1]]
> plotPDF(p, name = "Plot-LymphoidU-Traj-UMAP.pdf", ArchRProj = projHeme5, addDOC = FALSE, width = 5, height = 5)
> p1 <- plotTrajectory(projHeme5, trajectory = "LymphoidU", colorBy = "GeneScoreMatrix", name = "PAX5", continuousSet = "horizonExtra")
> p2 <- plotTrajectory(projHeme5, trajectory = "LymphoidU", colorBy = "GeneIntegrationMatrix", name = "PAX5", continuousSet = "blueYellow")
> ggAlignPlots(p1[[1]], p2[[1]], type = "h")
> ggAlignPlots(p1[[2]], p2[[2]], type = "h")

(二)拟时间热图

> trajMM  <- getTrajectory(ArchRProj = projHeme5, name = "LymphoidU", useMatrix = "MotifMatrix", log2Norm = FALSE)
> p1 <- plotTrajectoryHeatmap(trajMM, pal = paletteContinuous(set = "solarExtra"))
> trajGSM <- getTrajectory(ArchRProj = projHeme5, name = "LymphoidU", useMatrix = "GeneScoreMatrix", log2Norm = TRUE)
> p2 <- plotTrajectoryHeatmap(trajGSM,  pal = paletteContinuous(set = "horizonExtra"))
> trajGIM <- getTrajectory(ArchRProj = projHeme5, name = "LymphoidU", useMatrix = "GeneIntegrationMatrix", log2Norm = FALSE)
> p3 <- plotTrajectoryHeatmap(trajGIM,  pal = paletteContinuous(set = "blueYellow"))
> trajPM  <- getTrajectory(ArchRProj = projHeme5, name = "LymphoidU", useMatrix = "PeakMatrix", log2Norm = TRUE)
> p4 <- plotTrajectoryHeatmap(trajPM, pal = paletteContinuous(set = "solarExtra"))
> plotPDF(p1, p2, p3, p4, name = "Plot-LymphoidU-Traj-Heatmaps.pdf", ArchRProj = projHeme5, addDOC = FALSE, width = 6, height = 8)

(三)整合拟时间分析

> corGSM_MM <- correlateTrajectories(trajGSM, trajMM)
> corGSM_MM[[1]]$matchname1
[1] "CREM"   "NFE2"   "IRF8"   "MAFG"   "RFX2"  
 [6] "CEBPA"  "SPIB"   "FOSL2"  "BCL11A" "FOXP1" 
[11] "GATA2"  "PAX5" 
> corGSM_MM[[1]]
DataFrame with 12 rows and 12 columns
         idx1      idx2 matchname1 matchname2         name1        name2       Correlation         VarAssay1
    <integer> <integer>    <array>    <array>   <character>  <character>         <numeric>         <numeric>
1        2503       978       CREM       CREM    chr10:CREM   z:CREM_108 0.627829044418012 0.853720759285683
2        5181       989       NFE2       NFE2    chr12:NFE2   z:NFE2_119 0.774565931839941 0.974488692869806
3        8690      1503       IRF8       IRF8    chr16:IRF8   z:IRF8_633 0.507694340303834 0.869805854628789
4       10078      1018       MAFG       MAFG chr17:MAFG-DT   z:MAFG_148 0.562466520749052 0.958922471570026
5       10649      1594       RFX2       RFX2    chr19:RFX2   z:RFX2_724  0.69789030765449 0.973494184286764
...       ...       ...        ...        ...           ...          ...               ...               ...
8       12241       975      FOSL2      FOSL2    chr2:FOSL2  z:FOSL2_105 0.825674336982991 0.992562805378994
9       12398      1064     BCL11A     BCL11A   chr2:BCL11A z:BCL11A_194 0.606153441405121  0.88640982401522
10      15543      1223      FOXP1      FOXP1    chr3:FOXP1  z:FOXP1_353 0.536888802177499 0.948890906732391
11      15802      1258      GATA2      GATA2    chr3:GATA2  z:GATA2_388 0.590335879793854 0.906559432697713
12      21499      1579       PAX5       PAX5     chr9:PAX5   z:PAX5_709 0.733196281144466 0.982920396073853
            VarAssay2            TStat                 Pval                  FDR
            <numeric>        <numeric>            <numeric>            <numeric>
1   0.885057471264368 7.98507143182915 2.72991368017422e-12 2.02758134245667e-10
2   0.989655172413793 12.1231529692724 3.28687596108806e-21 1.34268883010447e-18
3   0.975287356321839  5.8336624109903 6.99435032374487e-08 2.07795789618166e-06
4   0.936206896551724 6.73439692355051 1.12841066228852e-09 4.60955755544861e-08
5   0.923563218390805 9.64635100744245 7.08941391574889e-16 1.28712248203708e-13
...               ...              ...                  ...                  ...
8   0.997701149425287 14.4887028649413 4.19616643781117e-26 3.42826797969173e-23
9   0.974137931034483 7.54464082413095 2.34445039301945e-11 1.47339690084376e-09
10   0.87183908045977    6.29989802423 8.49671859337208e-09  2.9539655705468e-07
11  0.992528735632184 7.24025437563277  1.0192127271972e-10 5.74273653875939e-09
12  0.966091954022989 10.6736627799731 4.20029954662577e-18 1.14388157653108e-15
> trajGSM2 <- trajGSM[corGSM_MM[[1]]$name1, ]
> trajMM2 <- trajMM[corGSM_MM[[1]]$name2, ]

> trajCombined <- trajGSM2
> assay(trajCombined) <- t(apply(assay(trajGSM2), 1, scale)) + t(apply(assay(trajMM2), 1, scale))

> combinedMat <- plotTrajectoryHeatmap(trajCombined, returnMat = TRUE, varCutOff = 0)
> rowOrder <- match(rownames(combinedMat), rownames(trajGSM2))
> ht1 <- plotTrajectoryHeatmap(trajGSM2,  pal = paletteContinuous(set = "horizonExtra"),  varCutOff = 0, rowOrder = rowOrder)
> ht2 <- plotTrajectoryHeatmap(trajMM2,  pal = paletteContinuous(set = "solarExtra"), varCutOff = 0, rowOrder = rowOrder)
> ht1+ht2
> plotPDF(ht1+ht2, name = "B_cell_differentiation_3.pdf", ArchRProj = projHeme5, addDOC = FALSE, width = 6, height = 4)
> corGIM_MM <- correlateTrajectories(trajGIM, trajMM)
> corGIM_MM[[1]]$matchname1
[1] "NFIA"   "GATA3"  "NFKB2"  "IRF7"   "ETS1"   "NFE2"  
 [7] "STAT2"  "FOXO1"  "FOS"    "IRF8"   "HLF"    "MBD2"  
[13] "TCF4"   "TCF3"   "NFIC"   "KLF2"   "CEBPA"  "POU2F2"
[19] "RELB"   "FOSB"   "FOSL2"  "BCL11A" "REL"    "RUNX1" 
[25] "ATF4"   "FOXP1"  "GATA2"  "HLTF"   "LEF1"   "IRF2"  
[31] "MEF2C"  "IRF1"   "EBF1"   "TFEB"   "PAX5" 
> corGIM_MM[[1]]
DataFrame with 35 rows and 12 columns
         idx1      idx2 matchname1 matchname2       name1
    <integer> <integer>    <array>    <array> <character>
1         680      1612       NFIA       NFIA   chr1:NFIA
2        1936      1254      GATA3      GATA3 chr10:GATA3
3        2428      1584      NFKB2      NFKB2 chr10:NFKB2
4        2625      1505       IRF7       IRF7  chr11:IRF7
5        3790      1202       ETS1       ETS1  chr11:ETS1
...       ...       ...        ...        ...         ...
31      14165      1510      MEF2C      MEF2C  chr5:MEF2C
32      14287      1499       IRF1       IRF1   chr5:IRF1
33      14558       937       EBF1       EBF1   chr5:EBF1
34      15164       902       TFEB       TFEB   chr6:TFEB
35      17354      1579       PAX5       PAX5   chr9:PAX5
          name2       Correlation         VarAssay1
    <character>         <numeric>         <numeric>
1    z:NFIA_742 0.849724184749172  0.87866243750336
2   z:GATA3_384  0.93659867389715 0.808988764044944
3   z:NFKB2_714 0.859622456404564 0.951723025643783
4    z:IRF7_635 0.764746603642242 0.906832965969572
5    z:ETS1_332 0.712968832845789 0.972582119240901
...         ...               ...               ...
31  z:MEF2C_640 0.596546194551142 0.990323100908553
32   z:IRF1_629 0.847449427802714 0.946131928390947
33    z:EBF1_67 0.935345985945295 0.978119455943229
34    z:TFEB_32 0.714302160261238 0.907908176979732
35   z:PAX5_709 0.749530220292627 0.978280737594753
            VarAssay2            TStat                 Pval
            <numeric>        <numeric>            <numeric>
1   0.963793103448276 15.9548594705724 5.37145525952811e-29
2   0.987931034482759 26.4604722221253 1.99903508435256e-46
3   0.894827586206897 16.6555730597593 2.44787247491045e-30
4   0.902873563218391 11.7495562928653 2.04816496580159e-20
5   0.900574712643678 10.0657079170526 8.71545807437529e-17
...               ...              ...                  ...
31  0.899425287356322 7.35816402847822 5.77863043081892e-11
32  0.982183908045977 15.8027849003002 1.05864582937014e-28
33  0.993103448275862 26.1763006397724 5.05800469190381e-46
34  0.822988505747126 10.1041046801401 7.19422460446705e-17
35  0.966091954022989 11.2089206437606 2.94623276852313e-19
                     FDR
               <numeric>
1   1.84221021123075e-27
2   2.64443784015781e-44
3   9.85534744246555e-29
4   3.87061379251485e-19
5    1.0760685569162e-15
...                  ...
31  3.87754476734661e-10
32  3.49480307537261e-27
33   5.2041248274477e-44
34  9.00250268072498e-16
35  5.05224359935633e-18
> trajGIM2 <- trajGIM[corGIM_MM[[1]]$name1, ]
> trajMM2 <- trajMM[corGIM_MM[[1]]$name2, ]

> trajCombined <- trajGIM2
> assay(trajCombined) <- t(apply(assay(trajGIM2), 1, scale)) + t(apply(assay(trajMM2), 1, scale))

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

推荐阅读更多精彩内容