forked from duty-machine/duty-machine
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: "听说你想把多个样本的 GSEA 画在一起?" | ||
date: 2023-09-09T23:36:10Z | ||
draft: ["false"] | ||
tags: [ | ||
"fetched", | ||
"老俊俊的生信笔记" | ||
] | ||
categories: ["Acdemic"] | ||
--- | ||
听说你想把多个样本的 GSEA 画在一起? by 老俊俊的生信笔记 | ||
------ | ||
<div><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com" data-mpa-powered-by="yiban.io"><h4 data-tool="mdnice编辑器"><span></span></h4><section><mp-common-profile data-pluginname="mpprofile" data-id="MzkyMTI1MTYxNA==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/G5jjcE4usey42oX5qyLTVibLRO9dz8ic5G4TpEHQc9rICYlpS4MHg6Et8cgXrQDqibvibXombicTro8t9cekJRlDBcw/0?wx_fmt=png" data-nickname="老俊俊的生信笔记" data-alias="JunJunLab" data-signature="老俊俊的生信技能和知识分享,我不是巨人,但你可以站在我的肩膀上更进一步!" data-from="0" data-is_biz_ban="0"></mp-common-profile></section></section><section><qqmusic musicid="125494406" mid="000A0MgV2a12dq" albumurl="http://y.gtimg.cn/music/photo_new/T001R120x120M000003tMm0y0TuewY_3.jpg" audiourl="http://isure6.stream.qqmusic.qq.com/C200003bpSNO2gbhaF.m4a?guid=2000000052&vkey=F5107498AF51962B610B47A6D0CC34479CA98AFEEB9D4F775224A0FCF34F93908C203031EDAD3EE7CD567DE172D91AFBF782D3670740493E&uin=0&fromtag=20052" music_name="我变了我没变" singer="杨宗纬" play_length="435" src="/mp/readtemplate?t=app_editor/music&singer=%E6%9D%A8%E5%AE%97%E7%BA%AC&music_name=%E6%88%91%E5%8F%98%E4%BA%86%E6%88%91%E6%B2%A1%E5%8F%98&albumurl=http%3A%2F%2Fy.gtimg.cn%2Fmusic%2Fphoto_new%2FT001R120x120M000003tMm0y0TuewY_3.jpg&musictype=1" musictype="1" otherid="000A0MgV2a12dq" albumid="" jumpurlkey="" data-pluginname="insertaudio"></qqmusic></section><section data-tool="mdnice编辑器" data-website="https://www.mdnice.com"><h4 data-tool="mdnice编辑器"><span></span></h4><h2 data-tool="mdnice编辑器"><span><span>1</span></span><span>引言</span><span></span></h2><blockquote data-tool="mdnice编辑器"><p>有粉丝提问, <strong>如何把多个组/实验的同一条 GSEA 结果画在一个图里,这样可以查看不同实验条件该通路的变化情况</strong>。本质上就是提取多个通路的富集结果,合并一下数据,然后绘图就好了,写了个简单的函数 <strong>GSEAmultiGP</strong> 来做这样的事情。</p></blockquote><p data-tool="mdnice编辑器"><strong>示例文献图,来自粉丝:</strong></p><figure data-tool="mdnice编辑器"><img data-ratio="0.7769230769230769" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpsX5y4zCib2XQSFDW6sUxjibcvf0Wxha1VoWABayspOl1vrolJD8GqRFQ/640?wx_fmt=png" data-type="png" data-w="780" src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpsX5y4zCib2XQSFDW6sUxjibcvf0Wxha1VoWABayspOl1vrolJD8GqRFQ/640?wx_fmt=png"></figure><p data-tool="mdnice编辑器"><strong>文献题目:</strong></p><blockquote data-tool="mdnice编辑器"><p><strong><em>p53 Mediates Vast Gene Expression Changes That Contribute to Poor Chemotherapeutic Response in a Mouse Model of Breast Cancer</em></strong></p></blockquote><h2 data-tool="mdnice编辑器"><span><span>2</span></span><span>安装</span><span></span></h2><p data-tool="mdnice编辑器">重新安装获取新功能:</p><pre data-tool="mdnice编辑器"><span></span><code><span># install.packages("devtools")</span><br>devtools::install_github(<span>"junjunlab/GseaVis"</span>)<br></code></pre><h2 data-tool="mdnice编辑器"><span><span>3</span></span><span>使用示例</span><span></span></h2><h3 data-tool="mdnice编辑器"><span></span><span>数据准备</span><span></span></h3><p data-tool="mdnice编辑器">先造三个不同的 genelist,代表三个条件下基因的变化:</p><pre data-tool="mdnice编辑器"><span></span><code><span>library</span>(clusterProfiler)<br><span>library</span>(org.Hs.eg.db)<br><span>library</span>(GseaVis)<br><br>data(geneList, package=<span>"DOSE"</span>)<br><br>geneList1 <- sort(sample(seq(-<span>2</span>,<span>2</span>,by = <span>0.01</span>),<span>12495</span>,replace = <span>T</span>),decreasing = <span>T</span>)<br>names(geneList1) <- sample(names(geneList),<span>12495</span>,replace = <span>F</span>)<br><br>geneList2 <- sort(sample(seq(-<span>2</span>,<span>2</span>,by = <span>0.01</span>),<span>12495</span>,replace = <span>T</span>),decreasing = <span>T</span>)<br>names(geneList2) <- sample(names(geneList),<span>12495</span>,replace = <span>F</span>)<br><br><br>all_glist <- list(geneList,geneList1,geneList2)<br></code></pre><p data-tool="mdnice编辑器">然后做 GSEA 富集分析,返回 list,这里设置 <strong>pvalueCutoff=1</strong>,保证在每个富集结果里都有共同的通路:</p><pre data-tool="mdnice编辑器"><span></span><code><span># loop to enrich</span><br>lapply(<span>1</span>:<span>3</span>, <span>function</span>(x){<br> ego3 <- gseGO(geneList = all_glist[[x]],<br> OrgDb = org.Hs.eg.db,<br> ont = <span>"BP"</span>,<br> minGSSize = <span>100</span>,<br> maxGSSize = <span>500</span>,<br> pvalueCutoff = <span>1</span>,<br> verbose = <span>FALSE</span>)<br>}) -> m_gsea_list<br></code></pre><figure data-tool="mdnice编辑器"><img data-ratio="0.25112107623318386" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicp4Z2gkJZLsibEve8bwfFwx1CPKcJRXdoBwEWxt8icyX0dBYMoKWl8CxKQ/640?wx_fmt=png" data-type="png" data-w="669" src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicp4Z2gkJZLsibEve8bwfFwx1CPKcJRXdoBwEWxt8icyX0dBYMoKWl8CxKQ/640?wx_fmt=png"></figure><p data-tool="mdnice编辑器">查看其中一个结果:</p><pre data-tool="mdnice编辑器"><span></span><code><span># check</span><br>df <- data.frame(m_gsea_list[[<span>1</span>]])<br></code></pre><figure data-tool="mdnice编辑器"><img data-ratio="0.26717557251908397" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpF0DmM0pt0qrGIVGt8A4OwcysD05uedLWpGxfUUcS8AsR3shRZ2Yb6g/640?wx_fmt=png" data-type="png" data-w="1441" src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpF0DmM0pt0qrGIVGt8A4OwcysD05uedLWpGxfUUcS8AsR3shRZ2Yb6g/640?wx_fmt=png"></figure><h3 data-tool="mdnice编辑器"><span></span><span>绘图</span><span></span></h3><p data-tool="mdnice编辑器">默认绘图:</p><pre data-tool="mdnice编辑器"><span></span><code><span># plot</span><br>GSEAmultiGP(gsea_list = m_gsea_list,<br> geneSetID = <span>"GO:0002757"</span>,<br> exp_name = c(<span>"group1"</span>,<span>"group2"</span>,<span>"group3"</span>))<br></code></pre><figure data-tool="mdnice编辑器"><img data-ratio="0.7813953488372093" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpfJ4oZ8ffuTfkl6numGaQal4E0yWXJEicpoEkmrO6uHbiaW9bVvLYiaXLQ/640?wx_fmt=png" data-type="png" data-w="645" src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpfJ4oZ8ffuTfkl6numGaQal4E0yWXJEicpoEkmrO6uHbiaW9bVvLYiaXLQ/640?wx_fmt=png"></figure><p data-tool="mdnice编辑器">修改颜色:</p><pre data-tool="mdnice编辑器"><span></span><code>GSEAmultiGP(gsea_list = m_gsea_list,<br> geneSetID = <span>"GO:0002757"</span>,<br> exp_name = c(<span>"group1"</span>,<span>"group2"</span>,<span>"group3"</span>),<br> curve.col = ggsci::pal_lancet()(<span>3</span>))<br></code></pre><figure data-tool="mdnice编辑器"><img data-ratio="0.772093023255814" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicp2dYYJDQharql5WTdt0CicjBRu3xiafvdLYvMMJicEibCDwGcibzZTL3T8Vg/640?wx_fmt=png" data-type="png" data-w="645" src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicp2dYYJDQharql5WTdt0CicjBRu3xiafvdLYvMMJicEibCDwGcibzZTL3T8Vg/640?wx_fmt=png"></figure><p data-tool="mdnice编辑器">添加 P 值:</p><pre data-tool="mdnice编辑器"><span></span><code>GSEAmultiGP(gsea_list = m_gsea_list,<br> geneSetID = <span>"GO:0002757"</span>,<br> exp_name = c(<span>"group1"</span>,<span>"group2"</span>,<span>"group3"</span>),<br> curve.col = ggsci::pal_d3()(<span>3</span>),<br> addPval = <span>T</span>,<br> pvalX = <span>0.99</span>,pvalY = <span>0.99</span>,<br> legend.position = <span>"right"</span>)<br></code></pre><figure data-tool="mdnice编辑器"><img data-ratio="0.7993779160186625" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpEV3Ct0YPwBZEO1yZfibIRq3djrAeaIIVAZMeibhD7eqskxJF0kMqkbcw/640?wx_fmt=png" data-type="png" data-w="643" src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpEV3Ct0YPwBZEO1yZfibIRq3djrAeaIIVAZMeibhD7eqskxJF0kMqkbcw/640?wx_fmt=png"></figure><p data-tool="mdnice编辑器">修改底部标签:</p><pre data-tool="mdnice编辑器"><span></span><code>GSEAmultiGP(gsea_list = m_gsea_list,<br> geneSetID = <span>"GO:0002757"</span>,<br> exp_name = c(<span>"group1"</span>,<span>"group2"</span>,<span>"group3"</span>),<br> curve.col = ggsci::pal_d3()(<span>3</span>),<br> addPval = <span>T</span>,<br> pvalX = <span>0.99</span>,pvalY = <span>0.99</span>,<br> legend.position = <span>"right"</span>,<br> rect.bm.label = c(<span>"DOX"</span>,<span>"DMSO"</span>))<br></code></pre><figure data-tool="mdnice编辑器"><img data-ratio="0.7713841368584758" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpoLCcWxPxOic1IYQAMlnYZMW5KPqPBdicajiazTpYLE6UsEbdrEVuDDrSQ/640?wx_fmt=png" data-type="png" data-w="643" src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpoLCcWxPxOic1IYQAMlnYZMW5KPqPBdicajiazTpYLE6UsEbdrEVuDDrSQ/640?wx_fmt=png"></figure><blockquote data-tool="mdnice编辑器"><p><strong>这样就可以查看不同实验条件下通路的变化了。</strong></p></blockquote><h2 data-tool="mdnice编辑器"><span><span>4</span></span><span>结尾</span><span></span></h2><blockquote data-tool="mdnice编辑器"><p><strong>路漫漫其修远兮,吾将上下而求索。</strong></p></blockquote><hr data-tool="mdnice编辑器"><p data-tool="mdnice编辑器">欢迎加入生信交流群。加我微信我也拉你进 <strong>微信群聊</strong> <strong>老俊俊生信交流群</strong> <strong>(微信交流群需收取 20 元入群费用,一旦交费,拒不退还!(防止骗子和便于管理))</strong> 。QQ 群可免费加入, 记得进群按格式修改备注哦。</p><section data-tool="mdnice编辑器"><section><p><strong>老俊俊微信:</strong></p><figure><img data-ratio="1" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpER0jU9Z2jYzFkFFiaH2MbPBvnn383SmEjQkiaicT0ozZqzQQ8lpSMFK5A/640?wx_fmt=png" data-type="png" data-w="430" src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpER0jU9Z2jYzFkFFiaH2MbPBvnn383SmEjQkiaicT0ozZqzQQ8lpSMFK5A/640?wx_fmt=png"></figure><figure><img data-ratio="1.3668430335097002" data-src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpM2lI6mzYIU5je0NEfH493zqdw6WvvLdrel5IBiaZyjff2NTnHPkJVEw/640?wx_fmt=png" data-type="png" data-w="567" src="https://mmbiz.qpic.cn/sz_mmbiz_png/G5jjcE4useyib8cOmnJpicniaZUy78dYKicpM2lI6mzYIU5je0NEfH493zqdw6WvvLdrel5IBiaZyjff2NTnHPkJVEw/640?wx_fmt=png"></figure></section><section><p><strong>知识星球:</strong></p><figure><img data-ratio="1.5896226415094339" data-src="https://mmbiz.qpic.cn/sz_mmbiz_jpg/G5jjcE4useyib8cOmnJpicniaZUy78dYKicp2mt41j2hA06500QQzsBCTmele6eW0eZ7oPCia3aJq3LI2iaU7TYtzc1g/640?wx_fmt=jpeg" data-type="jpeg" data-w="1060" src="https://mmbiz.qpic.cn/sz_mmbiz_jpg/G5jjcE4useyib8cOmnJpicniaZUy78dYKicp2mt41j2hA06500QQzsBCTmele6eW0eZ7oPCia3aJq3LI2iaU7TYtzc1g/640?wx_fmt=jpeg"></figure></section></section><hr data-tool="mdnice编辑器"><p data-tool="mdnice编辑器"><br></p><center data-tool="mdnice编辑器"><strong> 往期回顾目录</strong></center><blockquote data-tool="mdnice编辑器"><p><br></p><center><strong><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509821&idx=1&sn=66d6b4c47efed6c8dbfd9f2027d5a015&chksm=c1849d4cf6f3145af6077e06c25e4b9f3b5c7f7b93bf5ca507e56d4dd74d399df896dbd8c5d5&token=778653154&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">grid 里绘制连续型图例</a></strong></center><strong><center><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509799&idx=1&sn=b3bc4bbbb8c1e3a98be3f5815cbcb4f0&chksm=c1849d56f6f3144000e22d4b9ebf989ad79349c450928c2a2346749b0187d857fca15d9e7183&token=613129250&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">听说你要绘制 scanpy 版的散点图?</a></center></strong><strong><center><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509762&idx=1&sn=97596153e141170c7c6af1dab29499ac&chksm=c1849d73f6f31465bbb6d78217ead9b402f3b5ade770e23f9f35904ae2856392c3f332ba8c23&token=613129250&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">听说你要手搓一个 grid.xaxis2/grid.yaxis2?</a></center></strong><strong><center><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509735&idx=1&sn=212e45f9e6c8cfd13bc943b6ac806dc2&chksm=c1849c96f6f31580624e0d4bab65b47d7b3e4cf7fc604881fb9c27a32249bd071dd1eae20d66&token=613129250&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">用 grid 手搓一个单细胞散点图+细胞数量条形图</a></center></strong><strong><center><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509673&idx=1&sn=d1459c0c3790d87902b296c4cceae60f&chksm=c1849cd8f6f315ce7d7249971e39900b72d8fd897e778873a1ac1b8b27f4bfdcfd54ab45dd1b&token=868587677&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">lattice 分面设置</a></center></strong><strong><center><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509656&idx=1&sn=184ada98f9f6601deac7b402a737032d&chksm=c1849ce9f6f315ffdcbb0c32d70a337648ee4c4715d9261ba946f0233456df09e79472214d15&token=942343261&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">获取字符串的长度和宽度</a></center></strong><strong><center><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509621&idx=1&sn=9bb204ed21066faf253bee488c194e02&chksm=c1849c04f6f31512470c3f315ca964120b93efe2868c1a490a1fd9aa211e7c6eaaf3d0cd647c&token=540433608&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">piggyback 轻松像向 github 上传大文件</a></center></strong><strong><center><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509603&idx=1&sn=6d41b84e829740f9e59fb76e2304db7e&chksm=c1849c12f6f31504ea91f974728195c3e008c898ed6c6c5c41b15786bfbe03b7c2eaf8cc90c3&token=7125559&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">ClusterGVis 添加 GSEA 富集图</a></center></strong><strong><center><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509592&idx=1&sn=ded92cd239b4d0d03b516750511a0161&chksm=c1849c29f6f3153f7e87c687ac24d0a1ec43c6a697ab7669baa011611cc8e4b7220fa110e6bb&token=7125559&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">使用 lattice 绘制散点图</a></center></strong><strong><center><a href="https://mp.weixin.qq.com/s?__biz=MzkyMTI1MTYxNA==&mid=2247509534&idx=1&sn=80ced13313c341ff5c3230d71f6e0fa7&chksm=c1849c6ff6f3157957031171f14dc698646a6a60872e1bb695c72fe19c86a9ed50d03a2ca74a&token=1097150266&lang=zh_CN&scene=21#wechat_redirect" data-linktype="2">ggh4x 部分实用功能分享</a></center></strong><p><br></p></blockquote></section><p><mp-style-type data-value="3"></mp-style-type></p></div> | ||
<hr> | ||
<a href="https://mp.weixin.qq.com/s/gnfCnZ9wMLwjt96bGY1otA",target="_blank" rel="noopener noreferrer">原文链接</a> |