{"id":68662,"date":"2026-12-04T09:01:21","date_gmt":"2026-12-04T01:01:21","guid":{"rendered":"https:\/\/www.biocloudservice.com\/wordpress\/?p=68662"},"modified":"2026-12-04T09:01:21","modified_gmt":"2026-12-04T01:01:21","slug":"r-guide-fgsea-practice","status":"publish","type":"post","link":"https:\/\/www.biocloudservice.com\/wordpress\/r-guide-fgsea-practice\/","title":{"rendered":"fgsea \u7684 NES \u5f88\u9ad8\uff0c\u600e\u6837\u5224\u8bfb\u6392\u5e8f\u3001\u6838\u5fc3\u57fa\u56e0\u548c\u6781\u5c0f P \u503c\uff1f"},"content":{"rendered":"<div class=\"ysx-r-practice\" id=\"ysx-r-fgsea\" style=\"max-width:820px;margin:0 auto;color:#203449;font-size:17px;line-height:1.88;overflow-wrap:break-word;\">\n<p style=\"margin:.5em 0 1em\">\u540c\u4e00\u6761\u901a\u8def\u4ece\u6392\u5e8f\u524d\u7aef\u632a\u5230\u672b\u7aef\uff0c\u5bcc\u96c6\u65b9\u5411\u4f1a\u53d8\u3002\u53ea\u6709\u663e\u8457\u57fa\u56e0\u7684\u540d\u5355\u901a\u5e38\u5df2\u7ecf\u4e22\u5931\u4e86\u8fd9\u79cd\u5b8c\u6574\u987a\u5e8f\u3002\u51c6\u5907 fgsea \u8f93\u5165\u65f6\uff0c\u5148\u628a\u6bcf\u4e2a\u57fa\u56e0\u5bf9\u5e94\u5230\u552f\u4e00\u3001\u6709\u65b9\u5411\u7684\u7edf\u8ba1\u91cf\uff0c\u518d\u770b\u901a\u8def\u7684\u54ea\u4e9b\u6210\u5458\u63a8\u52a8\u4e86\u5f97\u5206\u3002<\/p>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">fgsea \u7684\u8f93\u5165\u548c\u5206\u6790\u5bf9\u8c61<\/h2>\n<p style=\"margin:.5em 0 1em\">ranks \u662f\u5b8c\u6574\u53ef\u68c0\u9a8c\u57fa\u56e0\u7684\u5e26\u552f\u4e00\u540d\u79f0\u3001\u6709\u6b63\u8d1f\u65b9\u5411\u7684\u6570\u503c\u5206\u6570\uff0cpathways \u662f\u547d\u540d\u4e3a\u901a\u8def\u7684\u57fa\u56e0\u96c6\u5408\u5217\u8868\uff0c\u4e8c\u8005\u57fa\u56e0\u6807\u8bc6\u540c\u7248\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u51fd\u6570\u8fd0\u884c\u7684\u6838\u5fc3\u662f\u901a\u8fc7 fgseaMultilevel \u7684\u8ba1\u7b97\u6d41\u7a0b\uff0c\u5bf9\u6bcf\u4e2a\u57fa\u56e0\u96c6\u8fdb\u884c\u5bcc\u96c6\u5206\u6570\u7684\u4f30\u8ba1\u3002\u8be5\u51fd\u6570\u4f1a\u6839\u636e\u6392\u5e8f\u5411\u91cf\u4e2d\u7684\u57fa\u56e0\u6392\u540d\uff0c\u8ba1\u7b97\u6bcf\u4e2a\u901a\u8def\u7684\u5bcc\u96c6\u5206\u6570\uff08ES\uff09\uff0c\u5e76\u8fdb\u4e00\u6b65\u4f30\u8ba1\u6807\u51c6\u5316\u5bcc\u96c6\u5206\u6570\uff08NES\uff09\u53ca\u5176\u6821\u6b63\u540e\u7684 P \u503c\u3002NES \u503c\u7684\u5927\u5c0f\u53cd\u6620\u4e86\u57fa\u56e0\u96c6\u5728\u6392\u5e8f\u5411\u91cf\u4e2d\u7684\u5bcc\u96c6\u7a0b\u5ea6\uff0c\u6b63\u503c\u8868\u793a\u6b63\u5411\u5bcc\u96c6\uff0c\u8d1f\u503c\u5219\u4e3a\u8d1f\u5411\u5bcc\u96c6\u3002\u5728\u5206\u6790\u8fc7\u7a0b\u4e2d\uff0c\u51fd\u6570\u4f1a\u81ea\u52a8\u5904\u7406\u57fa\u56e0\u96c6\u5927\u5c0f\u7684\u9650\u5236\uff0c\u786e\u4fdd\u6bcf\u4e2a\u57fa\u56e0\u96c6\u5728\u5408\u7406\u8303\u56f4\u5185\u8fdb\u884c\u6bd4\u8f83\u3002\u901a\u8fc7\u8bbe\u5b9a\u7684\u6837\u672c\u5927\u5c0f\u548c\u91cd\u590d\u6b21\u6570\uff0c\u51fd\u6570\u4f1a\u751f\u6210\u5927\u91cf\u968f\u673a\u6392\u5217\u6765\u4f30\u8ba1 P \u503c\uff0c\u4ece\u800c\u63d0\u4f9b\u66f4\u7a33\u5065\u7684\u7edf\u8ba1\u63a8\u65ad\u3002\u8fd9\u79cd\u5904\u7406\u65b9\u5f0f\u80fd\u6709\u6548\u907f\u514d\u56e0\u57fa\u56e0\u96c6\u5927\u5c0f\u6216\u6392\u5e8f\u504f\u5dee\u5bfc\u81f4\u7684\u8bef\u5224\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u5728\u5904\u7406\u5b9e\u9645\u6570\u636e\u65f6\uff0c\u57fa\u56e0\u96c6\u7684\u6392\u5e8f\u4f4d\u7f6e\u5bf9\u5bcc\u96c6\u7ed3\u679c\u6709\u663e\u8457\u5f71\u54cd\u3002\u4f8b\u5982\uff0c\u82e5\u4e24\u4e2a\u57fa\u56e0\u96c6\u5927\u5c0f\u76f8\u540c\uff0c\u4f46\u524d\u8005\u5728\u6392\u5e8f\u524d\u6bb5\u547d\u4e2d\u66f4\u591a\u57fa\u56e0\uff0c\u5176\u5bcc\u96c6\u5206\u6570\u4f1a\u66f4\u9ad8\u3002\u5728\u7ed9\u5b9a\u7684\u7ec3\u4e60\u4e2d\uff0c\u7532\u96c6\u5408\u524d\u56db\u540d\u547d\u4e2d\u57fa\u56e0\uff0c\u4e59\u96c6\u5408\u540e\u56db\u540d\u547d\u4e2d\uff0c\u5c3d\u7ba1\u4e24\u8005\u57fa\u56e0\u6570\u76f8\u540c\uff0c\u4f46\u524d\u8005\u5728\u6392\u5e8f\u524d\u6bb5\u7684\u547d\u4e2d\u60c5\u51b5\u66f4\u6709\u5229\u4e8e\u5bcc\u96c6\u5206\u6570\u7684\u63d0\u5347\u3002\u8fd9\u79cd\u5dee\u5f02\u5728 NES \u503c\u4e0a\u4f1a\u4f53\u73b0\u4e3a\u6b63\u5411\u5bcc\u96c6\u7a0b\u5ea6\u4e0d\u540c\u3002\u901a\u8fc7\u89c2\u5bdf\u6392\u5e8f\u5411\u91cf\u7684\u5206\u5e03\uff0c\u53ef\u4ee5\u5224\u65ad\u57fa\u56e0\u96c6\u662f\u5426\u771f\u6b63\u5bcc\u96c6\u4e8e\u6392\u5e8f\u7684\u7279\u5b9a\u533a\u57df\uff0c\u4ece\u800c\u907f\u514d\u56e0\u6392\u5e8f\u5206\u5e03\u4e0d\u5747\u5bfc\u81f4\u7684\u8bef\u5224\u3002\u8fd9\u79cd\u5206\u6790\u65b9\u6cd5\u5f3a\u8c03\u4e86\u6392\u5e8f\u65b9\u5411\u548c\u57fa\u56e0\u96c6\u4f4d\u7f6e\u7684\u7ed3\u5408\u5224\u65ad\uff0c\u6709\u52a9\u4e8e\u66f4\u51c6\u786e\u5730\u89e3\u91ca\u57fa\u56e0\u96c6\u5bcc\u96c6\u7ed3\u679c\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u4e3a\u6bcf\u4e2a\u5bf9\u6bd4\u5efa\u7acb\u5e26\u552f\u4e00\u57fa\u56e0\u540d\u7684\u6709\u5411\u6392\u5e8f\u5206\u6570\uff0c\u7528 <code>fgseaMultilevel()<\/code> \u5bf9\u540c\u4e00\u5957\u901a\u8def\u8ba1\u7b97 NES\u3001\u6821\u6b63 P \u503c\u4e0e\u6838\u5fc3\u57fa\u56e0\u3002 <a href=\"https:\/\/bioconductor.org\/packages\/release\/bioc\/manuals\/fgsea\/man\/fgsea.pdf\" style=\"color:#185CB7;text-decoration:underline;\">fgsea \u5b98\u65b9\u51fd\u6570\u624b\u518c<\/a><\/p>\n<pre style=\"white-space:pre;overflow:auto;max-width:100%;padding:14px;background:#F0F7FF;border:1px solid #D1E7FF;border-radius:8px;color:#183551;font-size:14px;line-height:1.6;box-sizing:border-box;\"><code class=\"language-r\" style=\"font-family:Consolas,monospace;white-space:pre;overflow-wrap:normal;word-break:normal;\">stopifnot(!anyDuplicated(names(ranks)),all(is.finite(ranks)))\nranks &lt;- sort(ranks,decreasing=TRUE)\nset.seed(24)\nf &lt;- fgsea::fgseaMultilevel(pathways,stats=ranks)\nhead(as.data.frame(f)[,c(\"pathway\",\"NES\",\"padj\",\"log2err\")])\n<\/code><\/pre>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">\u76f8\u540c\u5927\u5c0f\u7684\u57fa\u56e0\u96c6\uff0c\u6392\u5e8f\u524d\u6bb5\u547d\u4e2d\u4e0d\u540c<\/h2>\n<p style=\"margin:.5em 0 1em\">\u5341\u4e2a\u6709\u5e8f\u57fa\u56e0\uff0c\u7532\u96c6\u5408\u4f4d\u4e8e\u7b2c\u4e00\u3001\u4e8c\u3001\u56db\u3001\u4e5d\u540d\uff0c\u4e59\u5728\u516d\u3001\u4e03\u3001\u516b\u3001\u5341\u540d\u3002\u524d\u4e94\u5404\u6709\u4e09\u548c\u96f6\u3002\u53ea\u662f\u6392\u5e8f\u65b9\u5411\u7684\u76f4\u89c2\u68c0\u67e5\uff0c\u4e0d\u662f ES \u6216 NES\uff0c\u4e0d\u80fd\u7531\u8fd9\u5f20\u56fe\u7ed9\u51fa\u663e\u8457\u6027\u3002<\/p>\n<pre style=\"white-space:pre;overflow:auto;max-width:100%;padding:14px;background:#F0F7FF;border:1px solid #D1E7FF;border-radius:8px;color:#183551;font-size:14px;line-height:1.6;box-sizing:border-box;\"><code class=\"language-r\" style=\"font-family:Consolas,monospace;white-space:pre;overflow-wrap:normal;word-break:normal;\">v &lt;- c(sum(c(1,2,4,9)&lt;=5),sum(c(6,7,8,10)&lt;=5),4)\nnames(v) &lt;- c(\"\u7532\u524d\u4e94\", \"\u4e59\u524d\u4e94\", \"\u4e24\u96c6\u5408\u5927\u5c0f\")\nprint(v)\n<\/code><\/pre>\n<table style=\"width:100%;border-collapse:collapse;margin:1em 0;font-size:15px\">\n<thead>\n<tr>\n<th style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#ECF6FF;\">\u8f93\u5165\u6216\u6bd4\u8f83\u9879<\/th>\n<th style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#ECF6FF;\">R \u8ba1\u7b97\u7ed3\u679c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">\u7532\u524d\u4e94<\/td>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">3<\/td>\n<\/tr>\n<tr>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">\u4e59\u524d\u4e94<\/td>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">0<\/td>\n<\/tr>\n<tr>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">\u4e24\u96c6\u5408\u5927\u5c0f<\/td>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<figure style=\"margin:1.5em 0;\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2026\/11\/r-guide-fgsea-practice-8fded6a8.png?resize=1120%2C690&#038;ssl=1\" alt=\"\u76f8\u540c\u5927\u5c0f\u7684\u57fa\u56e0\u96c6\uff0c\u6392\u5e8f\u524d\u6bb5\u547d\u4e2d\u4e0d\u540c\u3002\u7532\u524d\u4e94 3\uff0c\u4e59\u524d\u4e94 0\uff0c\u4e24\u96c6\u5408\u5927\u5c0f 4\u3002\" width=\"1120\" height=\"690\" style=\"max-width:100%;width:100%;height:auto;display:block\"><figcaption style=\"font-size:14px;color:#455970;line-height:1.6;\">\u6559\u5b66\u7b97\u4f8b\uff0c\u6570\u636e\u4e0e\u8ba1\u7b97\u5f0f\u89c1\u56fe\u4e0a\u65b9\u3002<\/figcaption><\/figure>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">\u5e76\u5217\u5206\u6570\u80fd\u6539\u53d8\u524d\u51e0\u540d\u7531\u8c01\u5360\u636e\u5417\uff1f<\/h2>\n<p style=\"margin:.5em 0 1em\">\u524d\u4e24\u4e2a\u57fa\u56e0\u7684\u5206\u6570\u5b8c\u5168\u76f8\u540c\uff0c\u8c03\u6362\u8f93\u5165\u6b21\u5e8f\u5c31\u80fd\u4f7f\u5b83\u4eec\u5728\u5e76\u5217\u533a\u95f4\u7684\u6392\u5e8f\u6b21\u5e8f\u6539\u53d8\u3002\u5927\u91cf\u540c\u5206\u65f6\u5e94\u56de\u770b\u7edf\u8ba1\u91cf\u7cbe\u5ea6\u548c\u539f\u59cb\u6a21\u578b\uff0c\u4e0d\u5b9c\u4e3a\u5f97\u5230\u66f4\u6f02\u4eae\u7684\u901a\u8def\u7ed3\u679c\u53cd\u590d\u6539\u53d8\u5e76\u5217\u5904\u7406\u3002<\/p>\n<pre style=\"white-space:pre;overflow:auto;max-width:100%;padding:14px;background:#F0F7FF;border:1px solid #D1E7FF;border-radius:8px;color:#183551;font-size:14px;line-height:1.6;box-sizing:border-box;\"><code class=\"language-r\" style=\"font-family:Consolas,monospace;white-space:pre;overflow-wrap:normal;word-break:normal;\">z &lt;- c(a=3,b=3,c=1,d=-2)\nlist(order1=names(sort(z,decreasing=TRUE)),order2=names(sort(z[c(2,1,3,4)],decreasing=TRUE)))\n<\/code><\/pre>\n<p style=\"margin:.5em 0 1em\">\u82e5\u6392\u5e8f\u5411\u91cf\u4e2d\u5b58\u5728\u5927\u91cf\u91cd\u590d\u57fa\u56e0\u540d\uff0c\u51fd\u6570\u5c06\u65e0\u6cd5\u6b63\u786e\u5339\u914d\u57fa\u56e0\u96c6\u4e2d\u7684\u57fa\u56e0\u4e0e\u6392\u5e8f\u5411\u91cf\u4e2d\u7684\u57fa\u56e0\u3002\u4f8b\u5982\uff0c\u82e5\u6392\u5e8f\u5411\u91cf\u4e2d\u67d0\u57fa\u56e0\u540d\u91cd\u590d\u51fa\u73b0\uff0c\u800c\u57fa\u56e0\u96c6\u4e2d\u7684\u8be5\u57fa\u56e0\u540d\u4e5f\u91cd\u590d\uff0c\u51fd\u6570\u5728\u5339\u914d\u65f6\u53ef\u80fd\u8bef\u5224\u57fa\u56e0\u4f4d\u7f6e\uff0c\u4ece\u800c\u5f71\u54cd\u5bcc\u96c6\u5206\u6570\u7684\u8ba1\u7b97\u3002\u8fd9\u79cd\u9519\u8bef\u5728\u57fa\u56e0\u96c6\u8f83\u5927\u65f6\u5c24\u4e3a\u660e\u663e\uff0c\u56e0\u4e3a\u91cd\u590d\u57fa\u56e0\u540d\u4f1a\u663e\u8457\u589e\u52a0\u5339\u914d\u7684\u4e0d\u786e\u5b9a\u6027\u3002\u4e3a\u6392\u67e5\u6b64\u7c7b\u95ee\u9898\uff0c\u5e94\u5148\u4f7f\u7528 <code>duplicated()<\/code> \u68c0\u67e5\u6392\u5e8f\u5411\u91cf\u4e2d\u662f\u5426\u5b58\u5728\u91cd\u590d\u540d\u79f0\u3002\u82e5\u53d1\u73b0\u91cd\u590d\uff0c\u5e94\u6839\u636e\u5b9e\u9a8c\u8bbe\u8ba1\u91cd\u65b0\u751f\u6210\u6392\u5e8f\u5411\u91cf\uff0c\u786e\u4fdd\u6bcf\u4e2a\u57fa\u56e0\u540d\u5728\u6392\u5e8f\u4e2d\u552f\u4e00\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u82e5\u5728\u5206\u6790\u4e2d\u6539\u53d8\u57fa\u56e0\u96c6\u7684\u5927\u5c0f\uff0c\u53ef\u80fd\u5bf9 NES \u503c\u4ea7\u751f\u663e\u8457\u5f71\u54cd\u3002\u4f8b\u5982\uff0c\u82e5\u5c06\u4e00\u4e2a\u539f\u672c\u5305\u542b 20 \u4e2a\u57fa\u56e0\u7684\u57fa\u56e0\u96c6\u7f29\u5c0f\u81f3 10 \u4e2a\u57fa\u56e0\uff0c\u5176\u5bcc\u96c6\u5206\u6570\u53ef\u80fd\u4f1a\u56e0\u57fa\u56e0\u6570\u91cf\u51cf\u5c11\u800c\u53d1\u751f\u53d8\u5316\u3002\u8fd9\u79cd\u53d8\u5316\u5728\u57fa\u56e0\u96c6\u5927\u5c0f\u8f83\u5c0f\u65f6\u5c24\u4e3a\u660e\u663e\uff0c\u56e0\u4e3a\u5c0f\u57fa\u56e0\u96c6\u66f4\u5bb9\u6613\u53d7\u5230\u968f\u673a\u6027\u5f71\u54cd\u3002\u4e3a\u9a8c\u8bc1\u5206\u6790\u7684\u7a33\u5065\u6027\uff0c\u5e94\u4f7f\u7528\u4e0d\u540c\u5927\u5c0f\u7684\u57fa\u56e0\u96c6\u8fdb\u884c\u5bf9\u6bd4\uff0c\u89c2\u5bdf NES \u503c\u662f\u5426\u4fdd\u6301\u4e00\u81f4\u3002\u82e5\u53d1\u73b0\u663e\u8457\u5dee\u5f02\uff0c\u5e94\u68c0\u67e5\u57fa\u56e0\u96c6\u662f\u5426\u5305\u542b\u8db3\u591f\u7684\u4ee3\u8868\u6027\u57fa\u56e0\uff0c\u6216\u662f\u5426\u56e0\u57fa\u56e0\u96c6\u8fc7\u5c0f\u800c\u65e0\u6cd5\u6709\u6548\u53cd\u6620\u751f\u7269\u5b66\u8fc7\u7a0b\u3002<\/p>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">\u5728\u540c\u4e00\u5b8c\u6574\u6392\u5e8f\u4e0a\u8fd0\u884c fgseaMultilevel<\/h2>\n<pre style=\"white-space:pre;overflow:auto;max-width:100%;padding:14px;background:#F0F7FF;border:1px solid #D1E7FF;border-radius:8px;color:#183551;font-size:14px;line-height:1.6;box-sizing:border-box;\"><code class=\"language-r\" style=\"font-family:Consolas,monospace;white-space:pre;overflow-wrap:normal;word-break:normal;\">set.seed(31)\nr&lt;-setNames(seq(3,-3,length.out=120),paste0(\"g\",1:120))\npw&lt;-list(up=names(r)[1:15],down=names(r)[100:115],mixed=names(r)[seq(3,100,by=7)])\nz&lt;-fgsea::fgseaMultilevel(pw,r,minSize=5,maxSize=40,eps=.001,nproc=1)\nc(length(pw),nrow(z),sum(z$NES&gt;0))\n<\/code><\/pre>\n<p style=\"margin:.5em 0 1em\">\u5728 R 4.5.2\u3001fgsea 1.36.2 \u4e2d\u8fd0\u884c\uff0c\u8f93\u51fa\u4f9d\u6b21\u4e3a\u8f93\u5165\u96c6\u5408 3\uff0c\u8fd4\u56de\u96c6\u5408 3\uff0c\u6b63\u5411\u5bcc\u96c6\u96c6\u5408 2\u3002<\/p>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">\u9047\u5230\u5f02\u5e38\uff0c\u5148\u6838\u5bf9\u54ea\u4e00\u9879<\/h2>\n<p style=\"margin:.5em 0 1em\">\u5927\u91cf\u5e76\u5217\u540d\u6b21\u3001\u91cd\u590d ID \u6216\u5168\u90e8\u540c\u53f7\u4f1a\u6539\u53d8\u5bcc\u96c6\u89e3\u91ca\u3002\u5148\u67e5\u6392\u5e8f\u5206\u5e03\u548c\u57fa\u56e0\u8986\u76d6\u7387\uff0c\u518d\u7ed3\u5408 <code>log2err<\/code> \u770b\u4f30\u8ba1\u7cbe\u5ea6\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u5728 fgseaMultilevel \u5206\u6790\u4e2d\uff0c\u4e00\u4e2a\u5e38\u89c1\u7684\u9519\u8bef\u8bbe\u5b9a\u662f\u672a\u4e25\u683c\u63a7\u5236\u6392\u5e8f\u5206\u6570\u7684\u552f\u4e00\u6027\u4e0e\u65b9\u5411\u6027\u3002\u4f8b\u5982\uff0c\u82e5\u6392\u5e8f\u5411\u91cf\u4e2d\u5b58\u5728\u591a\u4e2a\u57fa\u56e0\u5177\u6709\u76f8\u540c\u5206\u6570\uff0c\u800c\u8fd9\u4e9b\u57fa\u56e0\u53c8\u6070\u597d\u4f4d\u4e8e\u57fa\u56e0\u96c6\u7684\u8fb9\u754c\u4f4d\u7f6e\uff0c\u51fd\u6570\u5c06\u65e0\u6cd5\u51c6\u786e\u5224\u65ad\u5176\u5728\u6392\u5e8f\u4e2d\u7684\u76f8\u5bf9\u4f4d\u7f6e\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5bcc\u96c6\u5206\u6570\u7684\u4f30\u8ba1\u4f1a\u56e0\u6392\u5e8f\u4e0d\u786e\u5b9a\u6027\u800c\u53d1\u751f\u504f\u79fb\uff0c\u5bfc\u81f4 NES \u503c\u504f\u79bb\u771f\u5b9e\u60c5\u51b5\u3002\u8fd9\u79cd\u504f\u5dee\u5728\u57fa\u56e0\u96c6\u5927\u5c0f\u8f83\u5c0f\u65f6\u5c24\u4e3a\u660e\u663e\uff0c\u56e0\u4e3a\u5c0f\u57fa\u56e0\u96c6\u66f4\u5bb9\u6613\u53d7\u5230\u6392\u5e8f\u5fae\u5c0f\u53d8\u5316\u7684\u5f71\u54cd\u3002\u56e0\u6b64\uff0c\u5728\u5206\u6790\u524d\u5e94\u786e\u4fdd\u6392\u5e8f\u5411\u91cf\u4e2d\u4e0d\u5b58\u5728\u91cd\u590d\u503c\uff0c\u4e14\u6240\u6709\u57fa\u56e0\u7684\u6392\u5e8f\u65b9\u5411\u4e00\u81f4\uff0c\u4ee5\u907f\u514d\u56e0\u6392\u5e8f\u6a21\u7cca\u5e26\u6765\u7684\u89e3\u91ca\u8bef\u5dee\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u5728\u5b9e\u9645\u64cd\u4f5c\u4e2d\uff0c\u82e5\u5bcc\u96c6\u7ed3\u679c\u51fa\u73b0\u5f02\u5e38\u9ad8\u7684 NES \u503c\uff0c\u5e94\u9996\u5148\u68c0\u67e5\u6392\u5e8f\u5411\u91cf\u662f\u5426\u5305\u542b\u975e\u6709\u9650\u503c\uff0c\u5982 NaN \u6216 Inf\u3002\u8fd9\u4e9b\u503c\u5728\u6392\u5e8f\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u5f15\u53d1\u51fd\u6570\u4e2d\u65ad\u6216\u7ed3\u679c\u9519\u8bef\u3002\u4f8b\u5982\uff0c\u82e5\u6392\u5e8f\u5411\u91cf\u4e2d\u67d0\u57fa\u56e0\u7684\u8868\u8fbe\u503c\u4e3a NaN\uff0c\u51fd\u6570\u5728\u8ba1\u7b97\u5bcc\u96c6\u5206\u6570\u65f6\u53ef\u80fd\u8df3\u8fc7\u8be5\u57fa\u56e0\uff0c\u4ece\u800c\u5f71\u54cd\u6574\u4f53\u8bc4\u5206\u3002\u6b64\u65f6\u5e94\u4f7f\u7528 <code>is.finite()<\/code> \u68c0\u67e5\u6392\u5e8f\u5411\u91cf\uff0c\u786e\u4fdd\u6240\u6709\u503c\u5747\u4e3a\u6709\u9650\u6570\u3002\u8fd9\u79cd\u68c0\u67e5\u6b65\u9aa4\u80fd\u6709\u6548\u907f\u514d\u56e0\u6570\u636e\u5f02\u5e38\u5bfc\u81f4\u7684\u5206\u6790\u504f\u5dee\u3002<\/p>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">\u5982\u4f55\u7528\u81ea\u5df1\u7684\u6570\u636e\u590d\u6838<\/h2>\n<p style=\"margin:.5em 0 1em\">\u4fdd\u5b58\u5b8c\u6574\u7684\u6709\u7b26\u53f7\u57fa\u56e0\u6392\u5e8f\uff0c\u62bd\u67e5\u4e00\u4e2a\u4f4d\u4e8e\u699c\u9996\u3001\u4e00\u4e2a\u4f4d\u4e8e\u4e2d\u90e8\u3001\u4e00\u4e2a\u4f4d\u4e8e\u699c\u5c3e\u7684\u901a\u8def\u57fa\u56e0\u3002\u82e5\u628a\u7edd\u5bf9\u7edf\u8ba1\u91cf\u7528\u4e8e\u6392\u5e8f\uff0c\u4e0a\u4e0b\u8c03\u4f1a\u88ab\u653e\u5230\u540c\u4e00\u7aef\uff0c\u6b63\u8d1f\u5bcc\u96c6\u65b9\u5411\u5c31\u4e0d\u518d\u56de\u7b54\u539f\u95ee\u9898\u3002\u547d\u4e2d\u57fa\u56e0\u591a\u7684\u901a\u8def\u4e2d\uff0c\u8fd8\u8981\u770b\u6838\u5fc3\u8d21\u732e\u662f\u5426\u96c6\u4e2d\u5728\u5c11\u6570\u5171\u4eab\u57fa\u56e0\u3002\u5bf9\u51e0\u4e2a\u529f\u80fd\u76f8\u8fd1\u7684\u663e\u8457\u96c6\u5408\uff0c\u53ef\u4ee5\u5217\u51fa\u5b83\u4eec\u6838\u5fc3\u57fa\u56e0\u7684\u4ea4\u96c6\u4e0e\u5404\u81ea\u72ec\u6709\u6210\u5458\uff0c\u907f\u514d\u628a\u540c\u4e00\u4fe1\u53f7\u89e3\u91ca\u6210\u591a\u6761\u72ec\u7acb\u901a\u8def\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u5148\u4ece\u6574\u4e2a\u5b9e\u9a8c\u53ef\u89c2\u6d4b\u5e76\u5b9e\u9645\u7eb3\u5165\u68c0\u9a8c\u7684\u5bf9\u8c61\u51fa\u53d1\uff0c\u6807\u51fa\u6bcf\u4e2a\u5019\u9009\u4e3a\u4ec0\u4e48\u6709\u673a\u4f1a\u8fdb\u5165\u540d\u5355\u3002\u82e5\u4e00\u90e8\u5206\u5bf9\u8c61\u56e0\u4e3a\u547d\u540d\u4f53\u7cfb\u3001\u8986\u76d6\u6216\u9884\u5148\u8fc7\u6ee4\u5b8c\u5168\u65e0\u6cd5\u5165\u9009\uff0c\u4e0d\u80fd\u628a\u5b83\u4eec\u4e00\u5f8b\u7b97\u4f5c\u53ef\u9760\u7684\u9634\u6027\u3002\u8bb0\u5f55\u4ece\u5168\u90e8\u5bf9\u8c61\u5230\u5b9e\u9645\u53ef\u7528\u96c6\u5408\u7684\u635f\u5931\u53d1\u751f\u5728\u54ea\u4e00\u6b65\u3002\u5bf9\u4e8e\u4e00\u4e2a\u770b\u8d77\u6765\u5f88\u7a81\u51fa\u7684\u7ec4\u5408\uff0c\u53ef\u4ee5\u624b\u5de5\u6838\u5bf9\u51e0\u4e2a\u8d21\u732e\u6700\u5927\u7684\u6210\u5458\u5728\u539f\u59cb\u6570\u636e\u4e2d\u7684\u8eab\u4efd\u548c\u65b9\u5411\uff0c\u540c\u65f6\u7559\u4e00\u4e2a\u8868\u4e0a\u6ca1\u6709\u51fa\u73b0\u7684\u3001\u7406\u8bba\u4e0a\u5e94\u8be5\u53ef\u6d4b\u7684\u5bf9\u7167\u6210\u5458\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u5982\u679c\u4e24\u4e2a\u9879\u76ee\u8981\u6bd4\u8f83\u540c\u4e00\u6307\u6807\uff0c\u53ef\u4ee5\u5148\u4ec5\u5728\u53cc\u65b9\u5171\u6709\u4e14\u5b9a\u4e49\u4e00\u81f4\u7684\u90e8\u5206\u91cd\u505a\u4e00\u6b21\uff0c\u518d\u628a\u5404\u81ea\u5168\u91cf\u7ed3\u679c\u653e\u5728\u65c1\u8fb9\u3002\u5171\u6709\u90e8\u5206\u7684\u7b54\u6848\u7a33\u4e0d\u7a33\u5b9a\uff0c\u80fd\u591f\u5e2e\u52a9\u786e\u5b9a\u5dee\u5f02\u662f\u5426\u4e3b\u8981\u7531\u4e0d\u540c\u7684\u89c2\u6d4b\u7a7a\u95f4\u9a71\u52a8\u3002\u7f29\u5c0f\u5206\u6790\u8303\u56f4\u4e5f\u53ef\u80fd\u727a\u7272\u771f\u6b63\u6709\u4fe1\u606f\u7684\u5bf9\u8c61\uff0c\u6240\u4ee5\u8fd9\u4efd\u5bf9\u7167\u8981\u548c\u539f\u5206\u6790\u540c\u65f6\u4fdd\u5b58\uff0c\u5e76\u6ce8\u660e\u5b83\u56de\u7b54\u7684\u662f\u53d7\u9650\u4ea4\u96c6\u4e2d\u7684\u95ee\u9898\u3002<\/p>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">\u4e0b\u8f7d\u4ee3\u7801\u548c\u793a\u4f8b\u6570\u636e\uff0c\u5728 Linux \u4e0a\u590d\u73b0<\/h2>\n<p style=\"margin:.5em 0 1em\"><a style=\"color:#1458a5;text-decoration:underline;\" href=\"https:\/\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/r-practice-labs\/039-fgsea-code-7eb0ca19b3bdd519.zip\">\u4e0b\u8f7d\u672c\u7bc7 R \u4ee3\u7801\uff08ZIP\uff0c4.3 KiB\uff09<\/a> \u00b7 <a style=\"color:#1458a5;text-decoration:underline;\" href=\"https:\/\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/r-practice-labs\/039-fgsea-data-6183259174a01f87.zip\">\u4e0b\u8f7d\u914d\u5957\u793a\u4f8b\u6570\u636e\uff08ZIP\uff0c1.7 KiB\uff09<\/a><\/p>\n<p style=\"margin:.5em 0 1em\">\u5c06\u4e24\u4e2a ZIP \u89e3\u538b\u5230\u540c\u4e00\u4f4d\u7f6e\uff0c\u8fdb\u5165 <code style=\"background:#edf5fc;padding:.05em .25em;border-radius:3px;\">039-fgsea<\/code> \u76ee\u5f55\uff0c\u8fd0\u884c <code style=\"background:#edf5fc;padding:.05em .25em;border-radius:3px;\">Rscript --vanilla run.R<\/code>\u3002\u6253\u5f00 <code style=\"background:#edf5fc;padding:.05em .25em;border-radius:3px;\">results\/metrics.tsv<\/code> \u67e5\u770b\u7ed3\u679c\uff0c\u4ee3\u7801\u5305\u4e2d\u7684 <code style=\"background:#edf5fc;padding:.05em .25em;border-radius:3px;\">expected\/metrics.tsv<\/code> \u53ef\u4f9b\u9010\u884c\u6838\u5bf9\u3002\u8981\u91cd\u505a\u6587\u4e2d\u7684\u4e24\u4e2a\u6570\u503c\u7ec3\u4e60\uff0c\u53ef\u7ee7\u7eed\u8fd0\u884c <code style=\"background:#edf5fc;padding:.05em .25em;border-radius:3px;\">Rscript --vanilla checks.R<\/code>\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u672c\u6b21\u4ece\u4e0b\u8f7d\u5305\u590d\u73b0\u7684\u6b65\u9aa4\u662f\u201c\u5728\u540c\u4e00\u5b8c\u6574\u6392\u5e8f\u4e0a\u8fd0\u884c fgseaMultilevel\u201d\u3002Linux x86_64\u3001R 4.3.3\u3001fgsea 1.22.0 \u7684\u8f93\u51fa\u4e3a\u8f93\u5165\u96c6\u5408 3\uff0c\u8fd4\u56de\u96c6\u5408 3\uff0c\u6b63\u5411\u5bcc\u96c6\u96c6\u5408 2\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u9009\u62e9\u4e00\u4e2a\u6b63\u5411 NES \u7684\u901a\u8def\uff0c\u6253\u5370\u5176\u6210\u5458\u5728\u5b8c\u6574\u6392\u5e8f\u4e2d\u7684\u4f4d\u7f6e\uff0c\u518d\u770b leadingEdge \u4e2d\u5b9e\u9645\u53c2\u4e0e\u5cf0\u503c\u7684\u57fa\u56e0\u3002\u8c03\u6362\u6392\u5e8f\u7edf\u8ba1\u91cf\u7684\u65b9\u5411\u540e\uff0c\u6b63\u8d1f\u53f7\u7684\u751f\u7269\u5b66\u89e3\u91ca\u4e5f\u4f1a\u968f\u4e4b\u7ffb\u8f6c\u3002<\/p>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">\u5b9e\u8dd1\u540e\u7684\u7ecf\u9a8c\u603b\u7ed3<\/h2>\n<p style=\"margin:.5em 0 1em\">\u540c\u4e00\u6392\u5e8f\u4e0a\u4e09\u4e2a\u96c6\u5408\u90fd\u8fdb\u5165\u7ed3\u679c\u8868\uff0c\u6b63\u5411\u5bcc\u96c6\u7684\u53ea\u5360\u5176\u4e2d\u4e00\u90e8\u5206\u3002\u6df7\u5408\u5206\u5e03\u7684\u96c6\u5408\u4e5f\u53ef\u80fd\u5728\u4e00\u6b21\u6a21\u62df\u4e2d\u53d6\u5f97\u6b63\u65b9\u5411\uff0c\u6240\u4ee5\u4e0d\u80fd\u4ec5\u51ed\u6b63\u8d1f\u7ed9\u901a\u8def\u547d\u540d\u3002\u5e94\u5bf9\u7167\u6392\u5e8f\u5206\u5e03\u3001\u6821\u6b63\u503c\u548c\u6838\u5fc3\u6210\u5458\uff0c\u518d\u68c0\u67e5\u6362\u5408\u7406\u7684\u6392\u540d\u89c4\u5219\u540e\u662f\u5426\u7a33\u5b9a\u3002<\/p>\n<p style=\"border-top:1px solid #DAE6F2;margin-top:2em;padding-top:1em;\">\u5f53\u6570\u636e\u4e0e\u4ee3\u7801\u5df2\u7ecf\u5728\u5c0f\u89c4\u6a21\u8f93\u5165\u4e0a\u5bf9\u9f50\uff0c\u540e\u9762\u9700\u8981\u6309\u540c\u4e00\u53e3\u5f84\u5206\u6790\u6574\u6279\u9879\u76ee\u65f6\uff0c\u53ef\u4ee5\u6309\u5b9e\u9645\u4efb\u52a1\u4f7f\u7528<a href=\"https:\/\/www.biocloudservice.com\/wordpress\/compute-services\/\" style=\"color:#185CB7;text-decoration:underline;\" data-ysx-event=\"contact_click\">\u4e91\u751f\u4fe1\u751f\u7269\u4fe1\u606f\u5b66\u5206\u6790\u670d\u52a1\u5668<\/a>\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5341\u4e2a\u6709\u5e8f\u57fa\u56e0\uff0c\u7532\u96c6\u5408\u4f4d\u4e8e\u7b2c\u4e00\u3001\u4e8c\u3001\u56db\u3001\u4e5d\u540d\uff0c\u4e59\u5728\u516d\u3001\u4e03\u3001\u516b\u3001\u5341\u540d\uff1b\u524d\u4e94\u5404\u6709\u4e09\u548c\u96f6\u3002<\/p>\n","protected":false},"author":1,"featured_media":68661,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1,72],"tags":[759,728,750],"class_list":["post-68662","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-part","category-transcriptomics","tag-fgsea","tag-r","tag-750"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2026\/11\/r-guide-fgsea-practice-8fded6a8.png?fit=1120%2C690&ssl=1","_links":{"self":[{"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts\/68662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/comments?post=68662"}],"version-history":[{"count":2,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts\/68662\/revisions"}],"predecessor-version":[{"id":70814,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts\/68662\/revisions\/70814"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/media\/68661"}],"wp:attachment":[{"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/media?parent=68662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/categories?post=68662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/tags?post=68662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}