{"id":68591,"date":"2026-12-05T09:10:35","date_gmt":"2026-12-05T01:10:35","guid":{"rendered":"https:\/\/www.biocloudservice.com\/wordpress\/?p=68591"},"modified":"2026-12-05T09:10:35","modified_gmt":"2026-12-05T01:10:35","slug":"r-guide-harmony-practice","status":"publish","type":"post","link":"https:\/\/www.biocloudservice.com\/wordpress\/r-guide-harmony-practice\/","title":{"rendered":"Harmony \u6574\u5408\u540e\u4e24\u6279\u7ec6\u80de\u6df7\u5728\u4e00\u8d77\uff0c\u600e\u6837\u770b\u51fa\u751f\u7269\u5b66\u4fe1\u53f7\u8fd8\u5728\uff1f"},"content":{"rendered":"<div class=\"ysx-r-practice\" id=\"ysx-r-harmony\" 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\">\u5982\u679c\u4e24\u6279\u7ec6\u80de\u5728\u56fe\u4e0a\u6df7\u5300\u4e86\uff0c\u5374\u8fde\u539f\u5148\u6709\u6807\u5fd7\u652f\u6301\u7684\u5c0f\u7fa4\u4e5f\u6d88\u5931\u4e86\uff0c\u8be5\u4e0d\u8be5\u63a5\u53d7\u8fd9\u6b21\u6574\u5408\uff1fHarmony \u8fd4\u56de\u4f4e\u7ef4\u5750\u6807\uff0c\u53ef\u4ee5\u5e2e\u52a9\u627e\u5230\u8de8\u6279\u6b21\u90bb\u5c45\u3002\u5224\u65ad\u503c\u4e0d\u503c\u5f97\u7528\u8fd9\u4e9b\u90bb\u5c45\u5efa\u56fe\uff0c\u8981\u56de\u5230\u5b9e\u9a8c\u7684\u6279\u6b21\u5b89\u6392\u548c\u540c\u7c7b\u7ec6\u80de\u7684\u6807\u5fd7\u8868\u8fbe\u3002<\/p>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">harmony \u7684\u8f93\u5165\u548c\u5206\u6790\u5bf9\u8c61<\/h2>\n<p style=\"margin:.5em 0 1em\">pc \u4e3a\u7ec6\u80de\u00d7\u4e3b\u6210\u5206\u6570\u503c\u77e9\u9635\u3002meta \u4ee5\u7ec6\u80de\u6761\u7801\u4f5c\u884c\u540d\uff0cbatch \u8868\u793a\u5b9e\u9a8c\u6279\u6b21\uff0c\u884c\u987a\u5e8f\u4e0e pc \u4e00\u81f4\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u6574\u5408\u6279\u6b21\u540e\u4ecd\u9700\u786e\u8ba4\u751f\u7269\u5b66\u4fe1\u53f7\u662f\u5426\u4fdd\u7559\uff0c\u662f\u5355\u7ec6\u80de\u5206\u6790\u4e2d\u5e38\u89c1\u7684\u6838\u5fc3\u95ee\u9898\u3002\u5f53\u4e24\u4e2a\u6279\u6b21\u7684\u7ec6\u80de\u6df7\u5408\u540e\uff0c\u6279\u6b21\u6548\u5e94\u53ef\u80fd\u63a9\u76d6\u771f\u5b9e\u751f\u7269\u5b66\u5dee\u5f02\uff0c\u5c24\u5176\u5728\u75c5\u4f8b\u4e0e\u5bf9\u7167\u5b8c\u5168\u5206\u5c5e\u4e0d\u540c\u6279\u6b21\u65f6\uff0c\u7b97\u6cd5\u96be\u4ee5\u533a\u5206\u75be\u75c5\u6548\u5e94\u4e0e\u6280\u672f\u5dee\u5f02\u3002\u4e3a\u9a8c\u8bc1\u6574\u5408\u662f\u5426\u6210\u529f\uff0c\u9700\u5148\u68c0\u67e5\u5206\u7ec4\u4e0e\u6279\u6b21\u7684\u4ea4\u53c9\u8868\uff0c\u786e\u8ba4\u662f\u5426\u5b58\u5728\u53ef\u72ec\u7acb\u9a8c\u8bc1\u7684\u6761\u4ef6\u6548\u5e94\u3002\u82e5\u5bf9\u7167\u7ec4\u548c\u75c5\u4f8b\u7ec4\u5728\u4e0d\u540c\u6279\u6b21\u4e2d\u5206\u5e03\u5747\u5300\uff0c\u53ef\u5229\u7528\u6279\u6b21\u95f4\u5dee\u5f02\u8bc4\u4f30\u6574\u5408\u6548\u679c\u3002\u82e5\u75c5\u4f8b\u72ec\u5360\u67d0\u4e00\u6279\u6b21\uff0c\u5219\u65e0\u6cd5\u901a\u8fc7\u6279\u6b21\u5206\u7ec4\u9a8c\u8bc1\u751f\u7269\u5b66\u4fe1\u53f7\uff0c\u9700\u4f9d\u8d56\u5176\u4ed6\u65b9\u5f0f\u5224\u65ad\u6574\u5408\u662f\u5426\u6709\u6548\u3002\u7814\u7a76\u8bbe\u5b9a\u4e2d\uff0c\u5148\u901a\u8fc7\u4f9b\u4f53\u7ea7\u4ea4\u53c9\u8868\u5224\u65ad\u6761\u4ef6\u662f\u5426\u53ef\u4e0e\u6279\u6b21\u5206\u79bb\uff0c\u518d\u7528\u540c\u4e00\u7ec6\u80de\u7c7b\u578b\u5185\u7684\u5c40\u90e8\u90bb\u5c45\u8bc4\u4ef7\u6df7\u5408\u7a0b\u5ea6\uff0c\u786e\u4fdd\u6574\u5408\u540e\u4ecd\u4fdd\u7559\u751f\u7269\u5b66\u610f\u4e49\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u6559\u5b66\u8bbe\u5b9a\u4e2d\u89c2\u5bdf\u7532\u6279\u4e00\u4e2a\u7ec6\u80de\uff0c\u5047\u8bbe\u5728\u540c\u7c7b\u7ec6\u80de\u5185\u4e24\u4e2a\u6279\u6b21\u4eba\u6570\u76f8\u5f53\uff0c\u90bb\u5c45\u7ec4\u6210\u6bd4\u4f8b\u53ef\u8bbe\u4e3a10%\u300140%\u548c50%\u300210%\u4e0e40%\u662f\u4eba\u4e3a\u8bbe\u5b9a\u7684\u90bb\u5c45\u7ec4\u6210\uff0c50%\u4e3a\u7b49\u91cf\u53c2\u8003\uff0c\u4e0d\u662f\u5fc5\u987b\u903c\u8fd1\u7684\u76ee\u6807\u3002\u8be5\u8bbe\u5b9a\u4fdd\u7559\u4e86\u7a00\u6709\u72b6\u6001\u548c\u5df2\u77e5\u6807\u5fd7\uff0c\u6709\u52a9\u4e8e\u8bc4\u4f30\u6574\u5408\u540e\u7ec6\u80de\u7c7b\u578b\u662f\u5426\u4ecd\u53ef\u8bc6\u522b\u3002\u901a\u8fc7\u8c03\u6574\u90bb\u5c45\u6bd4\u4f8b\uff0c\u53ef\u4ee5\u6a21\u62df\u4e0d\u540c\u6279\u6b21\u6df7\u5408\u7a0b\u5ea6\u4e0b\u7684\u7ec6\u80de\u5206\u5e03\u60c5\u51b5\u3002\u8fd9\u79cd\u8bbe\u5b9a\u5141\u8bb8\u89c2\u5bdf\u5728\u4e0d\u540c\u6279\u6b21\u6bd4\u4f8b\u4e0b\uff0c\u6574\u5408\u7b97\u6cd5\u662f\u5426\u4ecd\u80fd\u4fdd\u7559\u7ec6\u80de\u7c7b\u578b\u4fe1\u606f\u3002\u901a\u8fc7\u5bf9\u6bd4\u6574\u5408\u524d\u540e\u90bb\u5c45\u56fe\uff0c\u53ef\u8bc4\u4f30\u6279\u6b21\u6548\u5e94\u662f\u5426\u88ab\u6709\u6548\u6821\u6b63\uff0c\u4ece\u800c\u5224\u65ad\u6574\u5408\u662f\u5426\u6210\u529f\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u51c6\u5907 PCA \u5750\u6807\u548c\u6280\u672f\u6279\u6b21\u5217\uff0c\u8c03\u7528 <code>RunHarmony()<\/code>\uff0c\u7528\u6821\u6b63\u540e\u7684\u4f4e\u7ef4\u5750\u6807\u5efa\u90bb\u5c45\u56fe\uff0c\u5e76\u5206\u522b\u6309\u6279\u6b21\u548c\u7ec6\u80de\u7c7b\u578b\u7740\u8272\u3002 <a href=\"https:\/\/cran.r-project.org\/web\/packages\/harmony\/refman\/harmony.html#RunHarmony\" style=\"color:#185CB7;text-decoration:underline;\">harmony CRAN \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(identical(rownames(pc), rownames(meta)))\nz &lt;- harmony::RunHarmony(pc, meta_data = meta, vars_use = \"batch\")\ndim(z)\n<\/code><\/pre>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">\u540c\u6837\u5341\u4e2a\u90bb\u5c45\uff0c\u5f02\u6279\u6bd4\u4f8b\u53ef\u4e0d\u540c<\/h2>\n<p style=\"margin:.5em 0 1em\">\u6559\u5b66\u8bbe\u5b9a\u53ea\u89c2\u5bdf\u7532\u6279\u4e00\u4e2a\u7ec6\u80de\uff0c\u5728\u540c\u4e00\u5df2\u77e5\u7c7b\u578b\u5185\u4e24\u4e2a\u6279\u6b21\u4eba\u6570\u76f8\u5f53\u3002\u767e\u5206\u4e4b\u5341\u4e0e\u56db\u5341\u662f\u4eba\u4e3a\u7ed9\u5b9a\u7684\u90bb\u5c45\u7ec4\u6210\uff0c\u4e94\u5341\u662f\u7b49\u91cf\u53c2\u8003\uff0c\u4e0d\u662f\u5fc5\u987b\u903c\u8fd1\u7684\u76ee\u6807\u3002\u8fd8\u9700\u4fdd\u7559\u7a00\u6709\u72b6\u6001\u548c\u5df2\u77e5\u6807\u5fd7\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;- 100 * c(1\/10, 4\/10, 1\/2)\nnames(v) &lt;- c(\"\u6574\u5408\u524d\", \"\u6574\u5408\u540e\", \"\u540c\u7c7b\u6c60\u671f\u671b\")\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;\">\u6574\u5408\u524d<\/td>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">10%<\/td>\n<\/tr>\n<tr>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">\u6574\u5408\u540e<\/td>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">40%<\/td>\n<\/tr>\n<tr>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">\u540c\u7c7b\u6c60\u671f\u671b<\/td>\n<td style=\"border-bottom:1px solid #CBDEEB;text-align:left;padding:8px;background:#FFF;\">50%<\/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-harmony-practice-1fa09f33.png?resize=1120%2C690&#038;ssl=1\" alt=\"\u540c\u6837\u5341\u4e2a\u90bb\u5c45\uff0c\u5f02\u6279\u6bd4\u4f8b\u53ef\u4e0d\u540c\u3002\u6574\u5408\u524d 10%\uff0c\u6574\u5408\u540e 40%\uff0c\u540c\u7c7b\u6c60\u671f\u671b 50%\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;\">\u7528\u4e00\u5f20\u56db\u683c\u8868\u5224\u65ad\u6761\u4ef6\u662f\u5426\u53ef\u8fa8\u8bc6<\/h2>\n<p style=\"margin:.5em 0 1em\">\u8bbe\u8ba1\u6709\u4e09\u5217\u3001\u79e9\u53ea\u6709\u4e8c\u3002\u8fd9\u4e2a\u53cd\u4f8b\u4e2d\u5373\u4f7f\u56fe\u4e0a\u7684\u540c\u7c7b\u7ec6\u80de\u5b8c\u5168\u6df7\u5408\uff0c\u4e5f\u4e0d\u80fd\u7528\u8be5\u8bbe\u8ba1\u7ed9\u75be\u75c5\u4e0e\u6279\u6b21\u5404\u4f30\u4e00\u4e2a\u72ec\u7acb\u7cfb\u6570\u3002\u82e5\u5b9e\u9a8c\u8bb0\u5f55\u8868\u660e\u4e24\u4e2a\u6279\u6b21\u4e2d\u90fd\u6709\u75c5\u4f8b\u4e0e\u5bf9\u7167\uff0c\u6362\u4e0a\u771f\u5b9e\u6837\u672c\u8868\u91cd\u65b0\u505a\u8fd9\u9879\u68c0\u67e5\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;\">m &lt;- data.frame(batch=c(\"A\",\"A\",\"B\",\"B\"),group=c(\"ctrl\",\"ctrl\",\"case\",\"case\"))\nX &lt;- model.matrix(~batch+group,m)\nc(qr(X)$rank,ncol(X))\n<\/code><\/pre>\n<p style=\"margin:.5em 0 1em\">\u6574\u5408\u540e\u90bb\u5c45\u56fe\u7684\u89c6\u89c9\u5224\u65ad\u9700\u7ed3\u5408\u5177\u4f53\u6570\u636e\u5206\u5e03\uff0c\u4e0d\u80fd\u4ec5\u51ed\u76f4\u89c2\u89c2\u5bdf\u3002\u5f53\u67d0\u4e00\u6279\u6b21\u7ec6\u80de\u7c7b\u578b\u9ad8\u5ea6\u96c6\u4e2d\u65f6\uff0c\u5373\u4f7f\u6574\u5408\u7b97\u6cd5\u6210\u529f\u6821\u6b63\u4e86\u6279\u6b21\u6548\u5e94\uff0c\u5c40\u90e8\u90bb\u5c45\u56fe\u4ecd\u53ef\u80fd\u663e\u793a\u8be5\u7c7b\u578b\u5728\u7a7a\u95f4\u4e0a\u805a\u96c6\u3002\u8fd9\u79cd\u805a\u96c6\u53ef\u80fd\u88ab\u8bef\u8ba4\u4e3a\u662f\u751f\u7269\u5b66\u4fe1\u53f7\uff0c\u800c\u5b9e\u9645\u4e0a\u53cd\u6620\u7684\u662f\u6279\u6b21\u5206\u5e03\u7684\u4e0d\u5747\u8861\u3002\u56e0\u6b64\uff0c\u5e94\u68c0\u67e5\u8be5\u7c7b\u578b\u5728\u4e0d\u540c\u6279\u6b21\u4e2d\u7684\u5206\u5e03\u6bd4\u4f8b\uff0c\u786e\u8ba4\u662f\u5426\u5b58\u5728\u67d0\u79cd\u7c7b\u578b\u5728\u7279\u5b9a\u6279\u6b21\u4e2d\u5360\u7edd\u5bf9\u4f18\u52bf\u3002\u82e5\u53d1\u73b0\u6b64\u7c7b\u60c5\u51b5\uff0c\u5e94\u91cd\u65b0\u8bc4\u4f30\u6574\u5408\u662f\u5426\u6709\u6548\uff0c\u907f\u514d\u5c06\u6279\u6b21\u6548\u5e94\u8bef\u5224\u4e3a\u751f\u7269\u5b66\u5dee\u5f02\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u590d\u67e5\u6b65\u9aa4\u5e94\u5148\u9a8c\u8bc1\u6279\u6b21\u4e0e\u7ec6\u80de\u7c7b\u578b\u4ea4\u53c9\u8868\uff0c\u518d\u89c2\u5bdf\u6574\u5408\u540e\u90bb\u5c45\u56fe\u7684\u5206\u5e03\u60c5\u51b5\u3002\u82e5\u4ea4\u53c9\u8868\u663e\u793a\u67d0\u4e00\u7ec6\u80de\u7c7b\u578b\u5b8c\u5168\u96c6\u4e2d\u4e8e\u67d0\u4e00\u6279\u6b21\uff0c\u5e94\u8fdb\u4e00\u6b65\u68c0\u67e5\u8be5\u7c7b\u578b\u5728\u6574\u5408\u540e\u90bb\u5c45\u56fe\u4e2d\u7684\u5206\u5e03\u662f\u5426\u4ecd\u4fdd\u6301\u96c6\u4e2d\u3002\u82e5\u53d1\u73b0\u6574\u5408\u540e\u4ecd\u96c6\u4e2d\u5206\u5e03\uff0c\u5e94\u5224\u65ad\u662f\u5426\u4e3a\u6279\u6b21\u6548\u5e94\u6b8b\u7559\u6216\u7b97\u6cd5\u6821\u6b63\u4e0d\u8db3\u3002\u82e5\u8be5\u7c7b\u578b\u5728\u6574\u5408\u540e\u5206\u5e03\u5747\u5300\uff0c\u5219\u8bf4\u660e\u6279\u6b21\u6548\u5e94\u5df2\u88ab\u6709\u6548\u6821\u6b63\u3002\u82e5\u4ecd\u5b58\u5728\u96c6\u4e2d\u5206\u5e03\uff0c\u5219\u5e94\u8c03\u6574\u6821\u6b63\u53c2\u6570\u6216\u91cd\u65b0\u8bbe\u5b9a\u6279\u6b21\u53d8\u91cf\uff0c\u786e\u4fdd\u6574\u5408\u540e\u751f\u7269\u5b66\u4fe1\u53f7\u6e05\u6670\u53ef\u8fa8\u3002<\/p>\n<h2 style=\"margin:2em 0 .6em;color:#205CAC;font-size:1.38em;line-height:1.5;\">\u76f4\u63a5\u5bf9\u4e24\u6279\u6a21\u62df\u4e3b\u6210\u5206\u8fd0\u884c Harmony<\/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(12)\npc &lt;- matrix(rnorm(120*6),120,6,dimnames=list(paste0(\"c\",1:120),NULL))\nbatch &lt;- rep(c(\"A\",\"B\"),each=60)\npc[batch==\"B\",1] &lt;- pc[batch==\"B\",1]+1\nmeta &lt;- data.frame(batch=batch,row.names=rownames(pc))\nz &lt;- harmony::RunHarmony(pc,meta_data=meta,vars_use=\"batch\",nclust=3,verbose=FALSE)\nc(nrow(z),ncol(z),sum(is.finite(z)))\n<\/code><\/pre>\n<p style=\"margin:.5em 0 1em\">\u5728 R 4.5.2\u3001harmony 2.0.5 \u4e2d\u8fd0\u884c\uff0c\u8f93\u51fa\u4f9d\u6b21\u4e3a\u8f93\u5165\u7ec6\u80de 120\uff0c\u8f93\u51fa\u7ef4\u6570 6\uff0c\u6709\u9650\u5750\u6807\u6570 720\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\">\u75c5\u4f8b\u4e0e\u5bf9\u7167\u5b8c\u5168\u5206\u5c5e\u4e0d\u540c\u6279\u6b21\u65f6\uff0c\u7b97\u6cd5\u96be\u4ee5\u533a\u5206\u75be\u75c5\u6548\u5e94\u548c\u6279\u6b21\u6548\u5e94\u3002\u5148\u5217\u51fa\u5206\u7ec4\u4e0e\u6279\u6b21\u7684\u4ea4\u53c9\u8868\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u5728\u6559\u5b66\u8bbe\u5b9a\u4e2d\uff0c\u82e5\u5c06\u4e00\u4e2a\u6279\u6b21\u5b8c\u5168\u5305\u542b\u67d0\u79cd\u7279\u5b9a\u7ec6\u80de\u7c7b\u578b\uff0c\u800c\u53e6\u4e00\u6279\u6b21\u5305\u542b\u5176\u4f59\u7c7b\u578b\uff0c\u8fd9\u79cd\u6781\u7aef\u5206\u5e03\u5bb9\u6613\u5bfc\u81f4\u6574\u5408\u540e\u65e0\u6cd5\u8bc6\u522b\u771f\u5b9e\u751f\u7269\u5b66\u5dee\u5f02\u3002\u4f8b\u5982\uff0c\u82e5\u7532\u6279\u6b21\u6240\u6709\u7ec6\u80de\u5747\u4e3a\u67d0\u4e00\u7a00\u6709\u7c7b\u578b\uff0c\u800c\u4e59\u6279\u6b21\u5176\u4f59\u7ec6\u80de\u7c7b\u578b\u6df7\u5408\u5206\u5e03\uff0c\u5219\u6574\u5408\u7b97\u6cd5\u53ef\u80fd\u5c06\u8be5\u7a00\u6709\u7c7b\u578b\u89c6\u4e3a\u6279\u6b21\u6548\u5e94\u7684\u4e00\u90e8\u5206\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u6574\u5408\u540e\u90bb\u5c45\u56fe\u663e\u793a\u7ec6\u80de\u7c7b\u578b\u6df7\u6742\uff0c\u4e5f\u96be\u4ee5\u5224\u65ad\u662f\u771f\u5b9e\u751f\u7269\u5b66\u5dee\u5f02\u8fd8\u662f\u6279\u6b21\u5f71\u54cd\u3002\u82e5\u672a\u4e8b\u5148\u68c0\u67e5\u6279\u6b21\u4e0e\u7ec6\u80de\u7c7b\u578b\u4ea4\u53c9\u8868\uff0c\u5bb9\u6613\u8bef\u5c06\u6279\u6b21\u6548\u5e94\u5f53\u4f5c\u751f\u7269\u5b66\u4fe1\u53f7\uff0c\u4ece\u800c\u5f97\u51fa\u9519\u8bef\u7ed3\u8bba\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u5728\u72ec\u7acb\u8f93\u5165\u6761\u4ef6\u4e0b\uff0c\u82e5\u5c06\u6279\u6b21\u4fe1\u606f\u4f5c\u4e3a\u53d8\u91cf\u4f20\u5165\u6574\u5408\u7b97\u6cd5\uff0c\u53ef\u89c2\u5bdf\u6574\u5408\u540e\u90bb\u5c45\u56fe\u4e2d\u7ec6\u80de\u7c7b\u578b\u662f\u5426\u4ecd\u80fd\u6e05\u6670\u533a\u5206\u3002\u82e5\u6279\u6b21\u4fe1\u606f\u672a\u88ab\u6709\u6548\u6821\u6b63\uff0c\u7ec6\u80de\u7c7b\u578b\u5728\u6574\u5408\u540e\u4ecd\u53ef\u80fd\u6309\u6279\u6b21\u805a\u96c6\uff0c\u8fd9\u8868\u660e\u6574\u5408\u672a\u6210\u529f\u3002\u6b64\u65f6\u5e94\u68c0\u67e5\u539f\u59cbPCA\u5750\u6807\u4e0e\u6574\u5408\u540e\u5750\u6807\u7684\u5dee\u5f02\uff0c\u786e\u8ba4\u662f\u5426\u5f15\u5165\u4e86\u65b0\u7684\u504f\u5dee\u3002\u82e5\u5750\u6807\u5dee\u5f02\u663e\u8457\uff0c\u5219\u8bf4\u660e\u6574\u5408\u8fc7\u7a0b\u53ef\u80fd\u672a\u5b8c\u5168\u6d88\u9664\u6279\u6b21\u6548\u5e94\uff0c\u9700\u8c03\u6574\u53c2\u6570\u91cd\u65b0\u6821\u6b63\u3002\u82e5\u5750\u6807\u5dee\u5f02\u8f83\u5c0f\uff0c\u4e14\u90bb\u5c45\u56fe\u4e2d\u7ec6\u80de\u7c7b\u578b\u5206\u5e03\u5747\u5300\uff0c\u5219\u8bf4\u660e\u6574\u5408\u540e\u751f\u7269\u5b66\u4fe1\u53f7\u5f97\u4ee5\u4fdd\u7559\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\">\u53ef\u4ee5\u7ed9\u6bcf\u4e2a\u7ec6\u80de\u7559\u4e24\u5217\u8fd1\u90bb\u540d\u5355\uff0c\u5206\u522b\u53d6\u81ea\u6821\u6b63\u524d\u3001\u540e\u7684\u540c\u7ef4\u4e3b\u6210\u5206\u7a7a\u95f4\u3002\u5148\u6309\u7ec6\u80de\u6761\u7801\u8fde\u63a5\u6279\u6b21\u3001\u5df2\u77e5\u8c31\u7cfb\u548c\u4f9b\u4f53\uff0c\u518d\u95ee\u90bb\u5c45\u91cc\u540c\u8c31\u7cfb\u8de8\u6279\u6b21\u7684\u7ec6\u80de\u6709\u6ca1\u6709\u589e\u52a0\u3002\u82e5\u8de8\u8c31\u7cfb\u90bb\u5c45\u4e5f\u5927\u91cf\u51fa\u73b0\uff0c\u56de\u539f\u59cb\u8868\u8fbe\u67e5\u770b\u4e24\u4fa7\u7684\u7ecf\u5178\u6807\u5fd7\u3002\u67d0\u7c7b\u7ec6\u80de\u4ec5\u5728\u4e00\u4e2a\u6761\u4ef6\u4e2d\u51fa\u73b0\u65f6\uff0c\u5176\u6df7\u5408\u5ea6\u6ca1\u6709\u5bf9\u5e94\u7684\u8de8\u6761\u4ef6\u771f\u503c\uff0c\u4e0d\u80fd\u9760\u8c03\u53c2\u6570\u8feb\u4f7f\u5b83\u4e0e\u53e6\u4e00\u7c7b\u91cd\u53e0\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u53ef\u7ed9\u540c\u4e00\u6279\u5bf9\u8c61\u753b\u4e24\u4efd\u5c0f\u56fe\uff0c\u7b2c\u4e00\u4efd\u6309\u5df2\u77e5\u6280\u672f\u6765\u6e90\u7740\u8272\uff0c\u7b2c\u4e8c\u4efd\u6309\u72ec\u7acb\u83b7\u5f97\u7684\u751f\u7269\u5b66\u4fe1\u606f\u7740\u8272\u3002\u4e24\u56fe\u5fc5\u987b\u6cbf\u7528\u540c\u4e00\u5957\u70b9\u548c\u7f16\u53f7\uff0c\u8f74\u7684\u5c3a\u5ea6\u4e5f\u8981\u4e00\u81f4\u3002\u82e5\u67d0\u4e2a\u5c0f\u7fa4\u5728\u5176\u4e2d\u4e00\u5f20\u56fe\u4e0a\u5206\u5f97\u5f88\u5e72\u51c0\uff0c\u5148\u628a\u8fd9\u4e9b\u70b9\u7684\u7f16\u53f7\u62ff\u56de\u539f\u8868\uff0c\u6570\u4e00\u6570\u5b83\u4eec\u7a76\u7adf\u6765\u81ea\u51e0\u4f4d\u53d7\u8bd5\u8005\u3001\u51e0\u4e2a\u6587\u5e93\u6216\u51e0\u4e2a\u5b9e\u9645\u89c6\u91ce\u3002\u4e00\u4e2a\u6280\u672f\u6765\u6e90\u72ec\u5360\u4e00\u4e2a\u533a\u57df\u65f6\uff0c\u53ea\u51ed\u5206\u79bb\u5f97\u6e05\u695a\u4e0d\u8db3\u4ee5\u5224\u5b9a\u5b83\u6709\u72ec\u7acb\u7684\u751f\u7269\u5b66\u89e3\u91ca\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u6311\u51e0\u5904\u53d8\u5316\u6700\u5927\u7684\u5bf9\u8c61\uff0c\u7ecf\u5e38\u6bd4\u53ea\u7b97\u5168\u56fe\u5e73\u5747\u66f4\u6709\u4fe1\u606f\u3002\u5206\u522b\u8bb0\u4e0b\u5b83\u4eec\u5728\u53d8\u52a8\u524d\u540e\u9760\u8fd1\u8c01\u3001\u8fdc\u79bb\u8c01\uff0c\u518d\u770b\u539f\u59cb\u6d4b\u91cf\u662f\u5426\u4e5f\u652f\u6301\u8fd9\u79cd\u6539\u53d8\u3002\u9488\u5bf9\u672c\u6765\u5c31\u5f88\u7a00\u5c11\u7684\u7c7b\u522b\uff0c\u5148\u5728\u8be5\u7c7b\u522b\u9002\u7528\u7684\u8303\u56f4\u5185\u8ba1\u7b97\uff0c\u518d\u51b3\u5b9a\u662f\u5426\u5408\u5e76\u6c47\u603b\u3002\u82e5\u7a00\u5c11\u7c7b\u522b\u53ea\u5b58\u5728\u4e8e\u4e00\u4e2a\u6765\u6e90\uff0c\u660e\u786e\u6807\u8bb0\u8de8\u6765\u6e90\u590d\u6838\u7f3a\u5c11\u5bf9\u5e94\u89c2\u6d4b\uff0c\u522b\u628a\u8fd9\u79cd\u8bbe\u8ba1\u9650\u5236\u6df7\u8fdb\u7b97\u6cd5\u8868\u73b0\u7684\u6570\u5b57\u91cc\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\/003-harmony-code-d659cdb4647f7361.zip\">\u4e0b\u8f7d\u672c\u7bc7 R \u4ee3\u7801\uff08ZIP\uff0c4.5 KiB\uff09<\/a> \u00b7 <a style=\"color:#1458a5;text-decoration:underline;\" href=\"https:\/\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/r-practice-labs\/003-harmony-data-9bfb73127edc9cce.zip\">\u4e0b\u8f7d\u914d\u5957\u793a\u4f8b\u6570\u636e\uff08ZIP\uff0c10.3 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;\">003-harmony<\/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\u76f4\u63a5\u5bf9\u4e24\u6279\u6a21\u62df\u4e3b\u6210\u5206\u8fd0\u884c Harmony\u201d\u3002Linux x86_64\u3001R 4.5.2\u3001harmony 1.2.4 \u7684\u8f93\u51fa\u4e3a\u8f93\u5165\u7ec6\u80de 120\uff0c\u8f93\u51fa\u7ef4\u6570 6\uff0c\u6709\u9650\u5750\u6807\u6570 720\u3002<\/p>\n<p style=\"margin:.5em 0 1em\">\u4fdd\u7559\u540c\u4e00\u4efd\u4e3b\u6210\u5206\u77e9\u9635\uff0c\u628a\u6821\u6b63\u524d\u540e\u5404\u7ec6\u80de\u7684\u540c\u8c31\u7cfb\u8fd1\u90bb\u5360\u6bd4\u5e76\u6392\u8ba1\u7b97\u3002\u6709\u9650\u5750\u6807\u6570\u7b49\u4e8e\u884c\u6570\u4e58\u5217\u6570\uff0c\u53ea\u80fd\u8bf4\u660e\u6295\u5f71\u6ca1\u6709\u7f3a\u503c\u3002\u8be5\u68c0\u67e5\u901a\u8fc7\u540e\u624d\u8f6e\u5230\u8003\u5bdf\u67d0\u4e2a\u8c31\u7cfb\u662f\u5426\u88ab\u6df7\u5165\u5176\u4ed6\u7fa4\u4f53\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\">\u5728\u8fd9\u4efd\u6a21\u62df\u4e3b\u6210\u5206\u4e0a\uff0c\u6821\u6b63\u524d\u540e\u4e00\u767e\u4e8c\u5341\u4e2a\u7ec6\u80de\u90fd\u5728\uff0c\u516d\u5217\u5750\u6807\u4e5f\u90fd\u6709\u6709\u9650\u503c\u3002\u5b83\u80fd\u5e2e\u52a9\u6392\u9664\u7ec6\u80de\u4e22\u5931\u548c\u5750\u6807\u7f3a\u5931\uff0c\u5374\u8fd8\u6ca1\u6709\u68c0\u9a8c\u7ec6\u80de\u7c7b\u578b\u662f\u5426\u4fdd\u7559\u3002\u628a\u76f8\u540c\u7684\u5df2\u77e5\u6807\u5fd7\u4e0e\u4f9b\u4f53\u4fe1\u606f\u53e0\u56de\u4e24\u5957\u5750\u6807\uff0c\u68c0\u67e5\u662f\u54ea\u4e00\u7fa4\u771f\u6b63\u6539\u53d8\u90bb\u5c45\uff0c\u624d\u662f\u5224\u65ad\u6574\u5408\u6709\u6ca1\u6709\u8fc7\u5934\u7684\u4e0b\u4e00\u6b65\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>\u6559\u5b66\u8bbe\u5b9a\u53ea\u89c2\u5bdf\u7532\u6279\u4e00\u4e2a\u7ec6\u80de\uff0c\u5728\u540c\u4e00\u5df2\u77e5\u7c7b\u578b\u5185\u4e24\u4e2a\u6279\u6b21\u4eba\u6570\u76f8\u5f53\u3002<\/p>\n","protected":false},"author":1,"featured_media":68590,"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,71],"tags":[658,728,580],"class_list":["post-68591","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-part","category-single-cell","tag-harmony","tag-r","tag-580"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2026\/11\/r-guide-harmony-practice-1fa09f33.png?fit=1120%2C690&ssl=1","_links":{"self":[{"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts\/68591","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=68591"}],"version-history":[{"count":3,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts\/68591\/revisions"}],"predecessor-version":[{"id":70908,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts\/68591\/revisions\/70908"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/media\/68590"}],"wp:attachment":[{"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/media?parent=68591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/categories?post=68591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/tags?post=68591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}