Skip to content

Commit

Permalink
hypeR包:多种富集分析的额外选择
Browse files Browse the repository at this point in the history
  • Loading branch information
ixxmu committed Oct 26, 2023
1 parent ead400d commit 97ebcbe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/2023-10/hypeR包_多种富集分析的额外选择.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "hypeR包:多种富集分析的额外选择"
date: 2023-10-26T09:13:30Z
draft: ["false"]
tags: [
"fetched",
"生信碱移"
]
categories: ["Acdemic"]
---
hypeR包:多种富集分析的额外选择 by 生信碱移
------
<div><section powered-by="xiumi.us"><section><section powered-by="xiumi.us"><section><section><section powered-by="xiumi.us"><section><section powered-by="xiumi.us"><section><img data-ratio="1.0324675324675325" data-src="https://mmbiz.qpic.cn/mmbiz_gif/lN9Tp5oiaqHFn9Rg6MwMU3ukMR9ROPh7bf7QWHEMwhUBUwSUKFsV8oK9noHic3jLaeJVQewHJcLq1cTXVAat35Tw/640?wx_fmt=gif" data-type="gif" data-w="154" src="https://mmbiz.qpic.cn/mmbiz_gif/lN9Tp5oiaqHFn9Rg6MwMU3ukMR9ROPh7bf7QWHEMwhUBUwSUKFsV8oK9noHic3jLaeJVQewHJcLq1cTXVAat35Tw/640?wx_fmt=gif"></section></section></section></section></section><section><section powered-by="xiumi.us"><section><p>老铁们快点击蓝字 <strong>关注起来</strong></p></section></section></section><section><section powered-by="xiumi.us"><section><section powered-by="xiumi.us"><section><img data-ratio="1.0324675324675325" data-src="https://mmbiz.qpic.cn/mmbiz_gif/lN9Tp5oiaqHFn9Rg6MwMU3ukMR9ROPh7bf7QWHEMwhUBUwSUKFsV8oK9noHic3jLaeJVQewHJcLq1cTXVAat35Tw/640?wx_fmt=gif" data-type="gif" data-w="154" src="https://mmbiz.qpic.cn/mmbiz_gif/lN9Tp5oiaqHFn9Rg6MwMU3ukMR9ROPh7bf7QWHEMwhUBUwSUKFsV8oK9noHic3jLaeJVQewHJcLq1cTXVAat35Tw/640?wx_fmt=gif"></section></section></section></section></section></section></section></section></section><section data-class="_mbEditor" data-id="15520"><section><section data-src="https://mmbiz.qlogo.cn/mmbiz_png/SNYb3icBibCTCKbvxVO0e7RbdL9JJhubuo53vK5Bm0baDkTOFVSlJvib0riaBZibRibwhZAORfuK61a8AmDWqUbepHpg/0?wx_fmt=png"><section><section data-mpa-powered-by="yiban.io" data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)" data-style='white-space: normal; max-width: 100%; letter-spacing: 0.544px; text-size-adjust: auto; background-color: rgb(255, 255, 255); font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif; box-sizing: border-box !important; overflow-wrap: break-word !important;'><section data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)"><section data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)"><section data-id="85660" data-custom="rgb(117, 117, 118)" data-color="rgb(117, 117, 118)" data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)"><section data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)"><section data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)"><section data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)"><section data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)"><section data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)"><section data-id="85660" data-custom="rgb(117, 117, 118)" data-color="rgb(117, 117, 118)" data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)"><section data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)" data-style="margin-top: 2em; padding-top: 0.5em; padding-bottom: 0.5em; max-width: 100%; border-style: solid none; text-decoration: inherit; border-top-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-top-width: 1px; border-bottom-width: 1px; box-sizing: border-box !important; overflow-wrap: break-word !important;"><p><span>生信碱移</span></p><section><span><strong>hypeR富集工具</strong></span></section></section></section></section></section></section></section></section></section></section></section></section><blockquote data-type="2" data-url="" data-author-name="" data-content-utf8-length="68" data-source-title="" data-darkmode-bgcolor-16095509242984="rgb(25, 25, 25)" data-darkmode-original-bgcolor-16095509242984="rgb(255, 255, 255)" data-darkmode-color-16095509242984="rgba(163, 163, 163, 0.498)" data-darkmode-original-color-16095509242984="rgba(0, 0, 0, 0.498)" data-style='color: rgba(0, 0, 0, 0.498); white-space: normal; max-width: 100%; letter-spacing: 0.544px; font-family: -apple-system-font, system-ui, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif; background-color: rgb(255, 255, 255); box-sizing: border-box !important; overflow-wrap: break-word !important;'><p><span>基因集富集是一种流行的注释高通量测序数据的方法。Anthony Federico为基因集丰富工作流程提供了一个全面的 R 包,内置结果报告并提供多种富集、可视化和共享方法。hypeR 是一个一站式解决方案,可以为广泛的受众执行基因集富集。</span></p></blockquote><section data-tools="135编辑器" data-id="89174"><section><section><section><img data-galleryid="" data-ratio="0.9195767195767196" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGYP8z4TP4lZPCjQgjPx3UEOibCz7PhcgxO38Xiadw0cZOmkYkfDr9ClbA/640?wx_fmt=png" data-type="png" data-w="945" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGYP8z4TP4lZPCjQgjPx3UEOibCz7PhcgxO38Xiadw0cZOmkYkfDr9ClbA/640?wx_fmt=png"></section><p><span><strong>示例文件与代码的获取:</strong></span><span><strong>afhype</strong></span></p><p><span><strong>项目地址:https://github.com/montilab/hypeR</strong></span></p></section></section></section><section><br></section><section><span><strong><strong><span>软件包与参数设置</span></strong></strong></span></section><p><span><strong><span>①引用R包(没有安装的需要安装):</span></strong></span></p><pre data-tool="markdown.com.cn编辑器"><span></span><code>#devtools::install_github("montilab/hypeR")<br>library(hypeR)<br>library(dplyr)<br></code></pre><pre data-tool="markdown.com.cn编辑器"></pre><section><span><strong><span>②设置参数</span></strong></span></section><pre data-tool="markdown.com.cn编辑器"><span></span><code>###参数设置<br>hyperdb_available() #参看目前内置的基因集数据集<br># source gsets<br>#1 KEGG KEGG_v92.0.rds<br>#2 METABOANALYST METABOANALYST_DISEASE_CSF_v5.0.rds<br>#3 METABOANALYST METABOANALYST_DISEASE_FECAL_v5.0.rds<br>#4 METABOANALYST METABOANALYST_DISEASE_URINE_v5.0.rds<br>#5 METABOANALYST METABOANALYST_DRUG_v5.0.rds<br>#6 METABOANALYST METABOANALYST_KEGG_v5.0.rds<br>#7 METABOANALYST METABOANALYST_SMPDB_v5.0.rds<br>#8 METABOANALYST METABOANALYST_WITH_HMDB<br>#9 METABOANALYST METABOANALYST_WITH_HMDB<br>#10 METABOANALYST METABOANALYST_WITH_HMDB<br>#11 METABOANALYST METABOANALYST_WITH_HMDB<br>#12 METABOANALYST METABOANALYST_WITH_HMDB<br>#13 METABOANALYST METABOANALYST_WITH_HMDB<br>#14 METABOANALYST METABOANALYST_WITH_HMDB<br>#15 METABOANALYST README.md<br>#16 REACTOME REACTOME_v70.0.rds<br>#17 REFMET README.Rmd<br>#18 REFMET README.md<br>#19 REFMET RMSETS_RefMet_2022_05_11.rds<br>#20 SMPDB SMPDB_v2.75.rds<br>#选择KEGG数据集<br>genesets &lt;- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")<br>logFCfil=1 #设置logFc过滤标准,绝对值<br>Pfil=0.05 #设置P值过滤标准<br>adjPfil=0.05 #设置矫正后的P值过滤标准</code></pre><section><br></section><p><span><strong><strong><span>文件读入</span></strong></strong></span></p><section><span><strong><span>①输入文件,<span>"diff.txt"</span></span></strong><strong><span>表头如下(分别对应有三列)</span></strong><strong><span>:</span></strong></span></section><p><img data-galleryid="" data-ratio="0.8232044198895028" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGNA80006PUBhIFzGEiajx9Vbg9DEC5Hh0wmk0M2kjEKDaEwz8rqxLrNA/640?wx_fmt=png" data-type="png" data-w="543" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGNA80006PUBhIFzGEiajx9Vbg9DEC5Hh0wmk0M2kjEKDaEwz8rqxLrNA/640?wx_fmt=png"></p><p><strong></strong></p><pre data-tool="markdown.com.cn编辑器"><span></span><code>#读入差异分析结果<br>limma=read.table("diff.txt",sep = "\t",header = T,check.names = F)<br>limma=limma[,c(1,2,5,6)]<br>colnames(limma)=c("symbol","logFC","PValue","adj.Pval")<br>#添加高低表达分组分组<br>limma$group=ifelse(limma$logFC==0,"Stable",ifelse(limma$logFC&gt;0,"UP","Down"))</code></pre><p><span><strong><strong><span></span></strong></strong></span></p><p><span><strong><strong><span>①无权重基因的分析</span></strong></strong></span></p><section><span><strong><strong><span>(即单纯的基因列表)</span></strong></strong></span></section><pre data-tool="markdown.com.cn编辑器"><span></span><code>signature &lt;- limma %&gt;% <br> dplyr::filter(abs(logFC) &gt; logFCfil &amp; PValue&lt;Pfil &amp; adj.Pval &lt; adjPfil) %&gt;% <br> magrittr::use_series(symbol)<br>head(signature)<br>#开始富集,生成hyp_obj对象<br>hyp_obj &lt;- hypeR(signature, genesets, test="hypergeometric", background=50000, fdr=0.01, plotting=TRUE)<br>#保存文件<br>hyp_to_excel(hyp_obj,"kegg.xls")</code></pre><pre data-tool="markdown.com.cn编辑器"><span></span><code>#查看一下显著的结果数目<br>length(hyp_obj$plots)<br></code></pre><p><img data-galleryid="" data-ratio="0.18433179723502305" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGYYhUv88r6WziceIBXuIR3G7N7YM8icmpd90dCzs0iaclHj3YTT75DicKFw/640?wx_fmt=png" data-type="png" data-w="217" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGYYhUv88r6WziceIBXuIR3G7N7YM8icmpd90dCzs0iaclHj3YTT75DicKFw/640?wx_fmt=png"></p><pre data-tool="markdown.com.cn编辑器"><span></span><code>#绘制第一个具体信号的交集基因数目<br>hyp_obj$plots[[1]]<br></code></pre><section><img data-galleryid="" data-ratio="0.6659528907922913" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmG1AFcJQicOnb9GA4yj4VQPgzcvBdyn1iaux0g8VnmJu699UvziaQ2SQDdw/640?wx_fmt=png" data-type="png" data-w="467" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmG1AFcJQicOnb9GA4yj4VQPgzcvBdyn1iaux0g8VnmJu699UvziaQ2SQDdw/640?wx_fmt=png"></section><pre data-tool="markdown.com.cn编辑器"><span></span><code>#<span>展示结果表格,可以拖出保存</span><br><span>hyp_show(hyp_obj)</span><span></span></code></pre><p><img data-galleryid="" data-ratio="0.5037037037037037" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGKBtSzCBLjiaQeCWyIcaBsem52zlDDOaIWTiaSiadQdtLaTWVUiayMGl3GQ/640?wx_fmt=png" data-type="png" data-w="1080" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGKBtSzCBLjiaQeCWyIcaBsem52zlDDOaIWTiaSiadQdtLaTWVUiayMGl3GQ/640?wx_fmt=png"></p><pre data-tool="markdown.com.cn编辑器"><span></span><code>#<span>展示点图</span><br>hyp_dots(hyp_obj)<span></span></code></pre><p><img data-galleryid="" data-ratio="0.9970104633781763" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGaN6sJVVlibjueekwhvGLnjfzpSj0aExwrGNuLMX02k3yb7nS1xApnrw/640?wx_fmt=png" data-type="png" data-w="669" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGaN6sJVVlibjueekwhvGLnjfzpSj0aExwrGNuLMX02k3yb7nS1xApnrw/640?wx_fmt=png"></p><pre data-tool="markdown.com.cn编辑器"><span></span><code>#展示富集网络<br>ots)hyp_emap(hyp_obj)</code></pre><section><img data-galleryid="" data-ratio="0.9467455621301775" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGZRGVfR54nDwdlOPW2ug9EoAmefibIGO0q2bRDFKo8DMWb0H4qL7oOgg/640?wx_fmt=png" data-type="png" data-w="338" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGZRGVfR54nDwdlOPW2ug9EoAmefibIGO0q2bRDFKo8DMWb0H4qL7oOgg/640?wx_fmt=png"></section><p><img data-galleryid="" data-ratio="0.7493074792243767" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGLETvE6txPPCSjtWQzVsO1fkK0n01IiaibficWUH73kMu55YxMw09DOvxQ/640?wx_fmt=png" data-type="png" data-w="722" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGLETvE6txPPCSjtWQzVsO1fkK0n01IiaibficWUH73kMu55YxMw09DOvxQ/640?wx_fmt=png"></p><pre data-tool="markdown.com.cn编辑器"><span></span><code>#保存文件<br>hyp_to_excel(hyp_obj,"kegg.xls")<br></code></pre><pre data-tool="markdown.com.cn编辑器"></pre><section><br></section><p><span><strong><strong><span>②有权重基因的分析</span></strong></strong></span></p><p><span><strong><strong><span>(logFC排序列表)</span></strong></strong></span></p><section><span><em></em></span></section><section><strong></strong></section><pre data-tool="markdown.com.cn编辑器"><span></span><code>signature &lt;- limma %&gt;% <br> dplyr::arrange(desc(logFC)) %&gt;% <br> dplyr::select(symbol, logFC) %&gt;% <br> tibble::deframe()<br>#开始富集<br>hyp_obj &lt;- hypeR(signature, genesets, test="kstest", fdr=0.05, plotting=TRUE)<br># 保存结果表格<br>hyp_to_excel(hyp_obj,"Weighted.xls")</code></pre><pre data-tool="markdown.com.cn编辑器"><code>#可视化第一个通路结果<br>hyp_obj$plots[[1]]<br></code></pre><p><img data-galleryid="" data-ratio="0.6801968019680197" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGzGruDKzzf5s8eGZKicdtQMeYpXcy2DW3W5q0TX66wnsx6xuhlbuSib2g/640?wx_fmt=png" data-type="png" data-w="813" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGzGruDKzzf5s8eGZKicdtQMeYpXcy2DW3W5q0TX66wnsx6xuhlbuSib2g/640?wx_fmt=png"></p><section><br></section><section><span><strong><strong><span>③有分组的富集</span></strong></strong></span></section><pre data-tool="markdown.com.cn编辑器"><span></span><code>signature &lt;- limma %&gt;% <br> dplyr::filter(abs(logFC) &gt; logFCfil &amp; PValue&lt;Pfil &amp; adj.Pval &lt; adjPfil)<br>head(signature)<br>dn=signature$symbol[which(signature$group=="Down")]<br>up=signature$symbol[which(signature$group=="UP")]<br>signatures=list(Down=dn,UP=up)<br>mhyp &lt;- hypeR(signatures, genesets, test="hypergeometric", background=50000)<br># 保存结果表格<br>hyp_to_excel(mhyp,"group.xls")</code></pre><pre data-tool="markdown.com.cn编辑器"><span></span><code>#绘制点图<br>hyp_dots(mhyp, merge=TRUE, fdr=0.05, title="Differential gene enrichment")<br></code></pre><p><img data-galleryid="" data-ratio="1.0362976406533575" data-s="300,640" data-src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGBmNkfu4HtspBWjQbWeQB6a0PV3l1qYNUQgCkoPblEbaibz4Y24k7YeA/640?wx_fmt=png" data-type="png" data-w="551" src="https://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeVgpzZ4otBFF5HAptOO3xmGBmNkfu4HtspBWjQbWeQB6a0PV3l1qYNUQgCkoPblEbaibz4Y24k7YeA/640?wx_fmt=png"><strong><strong><strong><strong></strong></strong></strong></strong></p><section><strong><strong><strong></strong></strong></strong></section><section><mp-common-profile data-id="MzkyNTIzMzYyMA==" data-pluginname="mpprofile" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/LvUIqvYKCeXYZNMxRMnjiaicO2a27jDZ2FgQga8TdeQcsGRJRIn2IInkKtfcbbMXOBSViaPXpTOBulUlNzd11pzow/0?wx_fmt=png" data-nickname="生信碱移" data-alias="liudoufu307" data-signature="春来秋至,分享我的所见与所识" data-from="2" data-is_biz_ban="0" data-weui-theme="light"></mp-common-profile></section><section><strong><span>END~</span></strong></section><section><strong><span><br></span></strong></section><section><strong></strong></section><section><strong></strong></section></section></section></section></section><p><mp-style-type data-value="3"></mp-style-type></p></div>
<hr>
<a href="https://mp.weixin.qq.com/s/bfDhWsACdX7RVej0OA67Xw",target="_blank" rel="noopener noreferrer">原文链接</a>

0 comments on commit 97ebcbe

Please sign in to comment.