{"id":70260,"date":"2026-11-17T13:34:16","date_gmt":"2026-11-17T05:34:16","guid":{"rendered":"https:\/\/www.biocloudservice.com\/wordpress\/?p=70260"},"modified":"2026-11-17T13:34:16","modified_gmt":"2026-11-17T05:34:16","slug":"ysx-sc-practice-002-seurat-counts-layer","status":"publish","type":"post","link":"https:\/\/www.biocloudservice.com\/wordpress\/ysx-sc-practice-002-seurat-counts-layer\/","title":{"rendered":"\u63a5\u624b\u4e00\u4e2a Seurat \u5bf9\u8c61\uff0c\u600e\u6837\u77e5\u9053\u54ea\u4e00\u5c42\u8fd8\u80fd\u7528\u6765\u505a pseudobulk\uff1f"},"content":{"rendered":"<div style=\"max-width:820px;margin:0 auto;color:#263a47;font-size:17px;line-height:1.85;overflow-wrap:break-word\">\n<p>\u5408\u4f5c\u8005\u53d1\u6765\u4e00\u4e2a\u80fd\u591f\u76f4\u63a5\u6253\u5f00\u7684 Seurat \u5bf9\u8c61\uff0c\u7ec6\u80de\u6ce8\u91ca\u3001\u964d\u7ef4\u56fe\u548c\u75c5\u4eba\u5206\u7ec4\u4e00\u5e94\u4ff1\u5168\u3002\u4f60\u60f3\u5728\u5355\u6838\u7ec6\u80de\u91cc\u6309\u60a3\u8005\u505a\u5dee\u5f02\u8868\u8fbe\uff0c\u6b63\u51c6\u5907\u628a\u540c\u4e00\u4eba\u7684\u503c\u76f8\u52a0\uff0c\u5374\u5728 RNA assay \u4e2d\u770b\u5230\u597d\u51e0\u4e2a\u6570\u636e\u5c42\u3002\u6253\u5f00\u5176\u4e2d\u4e00\u4e2a\uff0c\u6570\u5b57\u5927\u591a\u5f88\u5c0f\uff0c\u53e6\u4e00\u4e2a\u751a\u81f3\u6709\u8d1f\u6570\uff0c\u53eb\u4f5c counts_backup \u7684\u90a3\u5c42\u5012\u662f\u6574\u6574\u9f50\u9f50\u3002\u773c\u4e0b\u6700\u5bb9\u6613\u72af\u7684\u9519\u8bef\uff0c\u662f\u6839\u636e\u5c42\u540d\u9009\u4e00\u4e2a\u770b\u8d77\u6765\u987a\u773c\u7684\u77e9\u9635\u3002\u7528\u672c\u6587\u7684\u7ec3\u4e60\uff0c\u4f60\u53ef\u4ee5\u7ed9\u6bcf\u5c42\u505a\u4e00\u4efd\u5e26\u6765\u6e90\u8bf4\u660e\u7684\u68c0\u67e5\u8bb0\u5f55\uff0c\u9009\u51fa\u80fd\u7528\u4e8e\u539f\u59cb UMI \u6c47\u603b\u7684\u8f93\u5165\uff0c\u5e76\u4eb2\u624b\u590d\u7b97\u4e00\u4e2a\u6837\u672c\u4e2d\u7684\u4e00\u4e2a\u57fa\u56e0\u3002<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1240\" height=\"800\" style=\"width:100%;height:auto;display:block;border-radius:12px\" alt=\"\u6309\u5c42\u6765\u6e90\u3001\u539f\u59cb\u8ba1\u6570\u4e0e\u4f9b\u8005\u624b\u7b97\u68c0\u67e5 Seurat \u5bf9\u8c61\u7684\u793a\u610f\u56fe\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2026\/11\/ysx-sc-practice-002-seurat-counts-layer.png?resize=1240%2C800&#038;ssl=1\" \/><\/p>\n<h2>\u63a5\u5230\u5bf9\u8c61\u65f6\uff0c\u5148\u627e\u51fa\u8c01\u521b\u5efa\u4e86\u8fd9\u4e00\u5c42<\/h2>\n<p>\u5411\u4ea4\u4ed8\u8005\u8981\u4e24\u6837\u4e1c\u897f\uff0c\u4e00\u4efd\u662f\u4ece\u539f\u59cb\u77e9\u9635\u751f\u6210\u5bf9\u8c61\u7684\u8d77\u59cb\u811a\u672c\uff0c\u53e6\u4e00\u4efd\u662f\u4fdd\u5b58\u5bf9\u8c61\u524d\u8fd0\u884c\u8fc7\u7684\u4e3b\u8981\u6b65\u9aa4\u3002\u8bfb\u811a\u672c\u65f6\uff0c\u8ffd\u5230\u77e9\u9635\u8bfb\u5165\u7684\u90a3\u4e00\u884c\uff0c\u786e\u8ba4\u5b9e\u9a8c\u7c7b\u578b\u3001\u539f\u59cb\u6587\u4ef6\u6765\u81ea\u54ea\u4e2a\u8f93\u51fa\u76ee\u5f55\u3001\u5f53\u65f6\u63d0\u53d6\u7684\u662f\u54ea\u4e2a assay\u3002\u7ec6\u80de\u8868\u9762\u86cb\u767d\u8bfb\u51fa\u548c\u57fa\u56e0\u8868\u8fbe\u53ef\u80fd\u540c\u65f6\u51fa\u73b0\u5728\u4e00\u4e2a\u5bf9\u8c61\u91cc\uff0c\u5b83\u4eec\u5171\u4eab\u8bb8\u591a\u6761\u7801\uff0c\u542b\u4e49\u5b8c\u5168\u4e0d\u540c\u3002\u4e00\u4e2a\u53eb counts \u7684\u5c42\u53ef\u80fd\u6765\u81ea\u57fa\u56e0\u8868\u8fbe\u539f\u59cb UMI\uff0c\u4e5f\u53ef\u80fd\u662f\u53e6\u4e00\u79cd\u6a21\u6001\u7684\u8ba1\u6570\u6216\u7ecf\u8fc7\u7279\u6b8a\u5904\u7406\u7684\u7ed3\u679c\u3002\u628a\u4f60\u627e\u5230\u7684\u8bc1\u636e\u5199\u5728\u8bb0\u5f55\u91cc\uff0c\u65e5\u540e\u518d\u6253\u5f00\u5bf9\u8c61\u4fbf\u4e0d\u7528\u91cd\u65b0\u731c\u6d4b\u3002<\/p>\n<p>Seurat \u7b2c\u4e94\u7248\u5141\u8bb8\u5728\u540c\u4e00\u4e2a assay \u91cc\u6709\u591a\u4e2a\u5c42\u3002\u5e38\u89c4\u5de5\u4f5c\u6d41\u91cc\u53ef\u4ee5\u5206\u522b\u4fdd\u5b58\u8ba1\u6570\u3001\u5f52\u4e00\u5316\u6570\u636e\u548c\u6807\u51c6\u5316\u540e\u7684\u6570\u503c\uff0c\u4e5f\u53ef\u80fd\u628a\u4e0d\u540c\u6279\u6b21\u7684\u539f\u59cb\u8ba1\u6570\u5b58\u653e\u5728\u4e0d\u540c\u5c42\u3002\u5148\u5217\u51fa\u5b9e\u9645\u5c42\u540d\uff0c\u770b\u6e05\u7814\u7a76\u4e2d\u7684\u6570\u636e\u7ed3\u6784\uff0c\u518d\u4ece\u6bcf\u4e2a\u5019\u9009\u5c42\u62bd\u53d6\u51e0\u4e2a\u5df2\u77e5\u57fa\u56e0\u4e0e\u6761\u7801\u3002\u522b\u9ed8\u8ba4\u4e0d\u540c\u5c42\u7684\u5217\u6570\u76f8\u540c\uff0c\u4e5f\u522b\u628a\u7b2c\u4e00\u4e2a\u5c42\u7684\u6761\u7801\u987a\u5e8f\u590d\u5236\u7ed9\u5176\u4f59\u5c42\u3002\u5373\u4f7f\u4e24\u4e2a\u4f9b\u8005\u7684\u7ec6\u80de\u6570\u6070\u597d\u4e00\u6837\uff0c\u6309\u4f4d\u7f6e\u62fc\u63a5\u4ecd\u4f1a\u628a\u4eba\u8d34\u9519\u3002<a href=\"https:\/\/satijalab.org\/seurat\/articles\/seurat5_essential_commands.html\">Seurat \u5c42\u7ed3\u6784\u4e0e\u57fa\u672c\u64cd\u4f5c<\/a><\/p>\n<h2>\u5c0f\u6570\u3001\u8d1f\u6570\u548c\u6574\u6570\u5206\u522b\u544a\u8bc9\u4e86\u6211\u4eec\u4ec0\u4e48<\/h2>\n<p>\u5728\u666e\u901a\u6db2\u6ef4 UMI \u6570\u636e\u4e2d\uff0c\u4e00\u4e2a\u7ec6\u80de\u4e00\u4e2a\u57fa\u56e0\u7684\u89c2\u6d4b\u5206\u5b50\u6570\u662f\u975e\u8d1f\u6574\u6570\u3002\u505a\u6587\u5e93\u5f52\u4e00\u5316\u548c\u53d6\u5bf9\u6570\u4ee5\u540e\uff0c\u5c0f\u6570\u5341\u5206\u5e38\u89c1\u3002\u628a\u6bcf\u4e2a\u57fa\u56e0\u4e2d\u5fc3\u5316\u65f6\uff0c\u540c\u4e00\u57fa\u56e0\u5728\u5747\u503c\u4ee5\u4e0b\u7684\u7ec6\u80de\u8fd8\u53ef\u80fd\u51fa\u73b0\u8d1f\u503c\u3002\u9047\u5230\u8fd9\u4e9b\u6570\u503c\u7279\u5f81\uff0c\u53ef\u4ee5\u6709\u4f9d\u636e\u5730\u5224\u65ad\u5b83\u4eec\u4e0e\u672c\u6b21\u539f\u59cb\u8ba1\u6570\u6c47\u603b\u7684\u8981\u6c42\u4e0d\u4e00\u81f4\u3002\u76f8\u53cd\uff0c\u5168\u90e8\u662f\u6574\u6570\u53ea\u80fd\u8bc1\u660e\u6570\u503c\u5f62\u5f0f\u76f8\u5bb9\u3002\u5982\u679c\u6709\u4eba\u628a\u8f6c\u6362\u540e\u7684\u8868\u8fbe\u56db\u820d\u4e94\u5165\u3001\u628a\u4e4b\u524d\u5df2\u7ecf\u6c47\u603b\u7684\u6837\u672c\u518d\u5f53\u4f5c\u7ec6\u80de\uff0c\u6216\u8005\u5c06\u4e8c\u503c\u68c0\u51fa\u77e9\u9635\u5b58\u56de\u5bf9\u8c61\uff0c\u5b83\u4eec\u540c\u6837\u53ef\u80fd\u6ca1\u6709\u5c0f\u6570\uff0c\u5374\u65e0\u6cd5\u6062\u590d\u6bcf\u4e2a\u7ec6\u80de\u539f\u6765\u7684\u5206\u5b50\u6570\u3002<\/p>\n<p>\u628a\u68c0\u67e5\u5206\u4e3a\u53ef\u7acb\u5373\u5224\u5b9a\u4e0e\u5c1a\u5f85\u8865\u8bc1\u4e24\u7c7b\u6709\u5b9e\u9645\u597d\u5904\u3002\u5982\u679c\u67d0\u4e00\u5c42\u5df2\u7ecf\u51fa\u73b0\u8d1f\u6570\uff0c\u624b\u91cc\u53c8\u6709\u8bb0\u5f55\u8bf4\u660e\u5b83\u7528\u6765\u7ed8\u70ed\u56fe\uff0c\u4f60\u53ef\u4ee5\u5f88\u5feb\u6392\u9664\u5b83\u3002\u82e5\u4e00\u4e2a\u770b\u4f3c\u6709\u5e0c\u671b\u7684\u6574\u6570\u5c42\u7f3a\u5c11\u4e0a\u6e38\u811a\u672c\uff0c\u5148\u628a\u5b83\u7559\u5728\u6765\u6e90\u5f85\u67e5\u6e05\u5355\uff0c\u540c\u65f6\u68c0\u67e5\u662f\u5426\u8fd8\u4fdd\u5b58\u6709\u6765\u81ea\u6d4b\u5e8f\u516c\u53f8\u7684\u7a00\u758f\u77e9\u9635\u3002\u5728\u7814\u7a76\u6570\u636e\u91cc\u62bd\u4e00\u4e2a\u57fa\u56e0\u3001\u4e24\u4e09\u4e2a\u72ec\u7279\u6761\u7801\uff0c\u4ece\u539f\u59cb\u6587\u4ef6\u4e0e\u5019\u9009\u5c42\u5206\u522b\u8bfb\u503c\uff1b\u505a\u8fd9\u79cd\u72ec\u7acb\u5bf9\u7167\u6bd4\u5728\u51e0\u4e2a\u76f8\u4e92\u590d\u5236\u7684\u5bf9\u8c61\u4e4b\u95f4\u6bd4\u8f83\u603b\u6570\u66f4\u6709\u8bf4\u670d\u529b\u3002<\/p>\n<div style=\"overflow:auto\">\n<table style=\"width:100%;border-collapse:collapse\">\n<thead>\n<tr>\n<th style=\"padding:9px;text-align:left;background:#eae0ff\">\u5c42\u91cc\u770b\u89c1\u7684\u60c5\u51b5<\/th>\n<th style=\"padding:9px;text-align:left;background:#eae0ff\">\u672c\u9898\u91c7\u7528\u7684\u5904\u7f6e<\/th>\n<th style=\"padding:9px;text-align:left;background:#eae0ff\">\u4e0b\u4e00\u9879\u80fd\u6838\u9a8c\u7684\u8bc1\u636e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u975e\u8d1f\u6574\u6570\uff0c\u6765\u6e90\u6307\u5411\u672c\u6b21 RNA \u539f\u59cb\u8ba1\u6570<\/td>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u4fdd\u7559\u4e3a\u5019\u9009\u8f93\u5165<\/td>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u6838\u5bf9\u5c11\u91cf\u6761\u7801\u3001\u57fa\u56e0\u53ca\u603b\u8ba1\u6570<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u975e\u8d1f\u6574\u6570\uff0c\u53ea\u77e5\u9053\u66fe\u4fdd\u5b58\u8fc7\u4e00\u4efd\u5907\u4efd<\/td>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u6765\u6e90\u5f85\u67e5<\/td>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u627e\u5230\u751f\u6210\u5907\u4efd\u7684\u4ee3\u7801\u6216\u539f\u59cb\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u6709\u5c0f\u6570\uff0c\u6587\u6863\u8bf4\u660e\u505a\u8fc7\u5bf9\u6570\u5f52\u4e00\u5316<\/td>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u6392\u9664\u8be5\u5c42<\/td>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u53e6\u627e\u5f52\u4e00\u5316\u524d\u7684\u5c42<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u5c5e\u4e8e\u540c\u4e00\u5b9e\u9a8c\u4f46\u53ea\u4fdd\u5b58\u9ad8\u53d8\u57fa\u56e0<\/td>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u6838\u5bf9\u7279\u5f81\u8303\u56f4<\/td>\n<td style=\"padding:9px;vertical-align:top;border-bottom:1px solid #d6e0e7\">\u9632\u6b62\u628a\u672a\u4fdd\u5b58\u7684\u57fa\u56e0\u5f53\u4f5c\u96f6\u8868\u8fbe<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2>\u5728\u4e00\u4e2a\u80fd\u624b\u7b97\u7684\u5bf9\u8c61\u4e0a\u8bd5\u4e00\u6b21<\/h2>\n<p><a download style=\"display:inline-block;margin:3px;padding:4px 10px;border:1px solid #bad0dd;border-radius:5px\" href=\"https:\/\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2026\/11\/ysx-sc-practice-002-seurat-counts-layer.zip\">\u4e0b\u8f7d\u5b8c\u6574\u4ee3\u7801\u3001\u793a\u4f8b\u6570\u636e\u4e0e\u53c2\u8003\u8f93\u51fa\uff08ZIP\uff09<\/a> \u00b7 <a download style=\"display:inline-block;margin:3px;padding:4px 10px;border:1px solid #bad0dd;border-radius:5px\" href=\"https:\/\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2026\/11\/ysx-sc-practice-002-seurat-counts-layer.pdf\">\u4e0b\u8f7d\u56fe\u6587\u64cd\u4f5c\u624b\u518c\uff08PDF\uff09<\/a><\/p>\n<p>\u8d44\u6599\u5305\u63d0\u4f9b\u4e94\u4e2a\u6a21\u62df\u5c42\u7684\u7a00\u758f\u77e9\u9635\u3001\u5bf9\u5e94\u7684\u57fa\u56e0\u6761\u7801\u6e05\u5355\u548c\u7ec6\u80de\u5143\u6570\u636e\u3002\u4e24\u4e2a\u539f\u59cb\u5c42\u5404\u6709\u4e24\u4e2a\u7ec6\u80de\uff0c\u53e6\u6709\u4e00\u4efd\u6574\u578b\u5907\u4efd\u3001\u4e00\u4e2a\u5bf9\u6570\u8f6c\u6362\u5c42\u548c\u4e00\u4e2a\u542b\u8d1f\u503c\u7684\u5c42\u3002\u5b89\u88c5\u4f9d\u8d56\u540e\u8fd0\u884c\u4e0b\u5217\u547d\u4ee4\uff0c\u5148\u770b\u8f93\u51fa\u7684\u9010\u5c42\u68c0\u67e5\u8868\uff0c\u518d\u53bb\u6253\u5f00\u805a\u5408\u7ed3\u679c\u3002\u6bcf\u5c42\u7684\u6765\u6e90\u8bf4\u660e\u5747\u6765\u81ea\u7ec3\u4e60\u8bbe\u7f6e\uff0c\u5728\u771f\u5b9e\u9879\u76ee\u4e2d\u9700\u8981\u8bfb\u8005\u81ea\u5df1\u53d6\u8bc1\u3002<\/p>\n<pre style=\"max-width:100%;overflow:auto;padding:14px;box-sizing:border-box;background:#f1f6fa;line-height:1.6;font-size:0.9em\"><code class=\"language-sh\">python -m pip install -r requirements.txt\npython run.py --input example --out results\n<\/code><\/pre>\n<pre style=\"max-width:100%;overflow:auto;padding:14px;box-sizing:border-box;background:#f1f6fa;line-height:1.6;font-size:0.9em\"><code class=\"language-python\">def inspect_layer(matrix, entry):\n    values = matrix.data\n    finite = np.isfinite(values).all()\n    negatives = int(np.sum(values &lt; 0))\n    fractions = int(np.sum(values != np.floor(values))) if finite else -1\n    known = entry[&quot;provenance&quot;] == &quot;raw_umi&quot; and bool(entry[&quot;source_note&quot;].strip())\n    if not finite or negatives or fractions:\n        status = &quot;incompatible_counts&quot;\n    elif not known:\n        status = &quot;verify_provenance&quot;\n    else:\n        status = &quot;include&quot;\n    return {&quot;name&quot;:entry[&quot;name&quot;],&quot;genes&quot;:matrix.shape[0],&quot;cells&quot;:matrix.shape[1],\n            &quot;nonzero&quot;:matrix.count_nonzero(),&quot;negatives&quot;:negatives,&quot;fractional&quot;:fractions,\n            &quot;source_note&quot;:entry[&quot;source_note&quot;],&quot;status&quot;:status}\n<\/code><\/pre>\n<p>\u5728\u68c0\u67e5\u8868\u91cc\u6311\u51fa counts_backup\u3002\u5b83\u7684\u6700\u5c0f\u503c\u548c\u5c0f\u6570\u9879\u6570\u91cf\u770b\u4e0d\u51fa\u5f02\u5e38\uff0c\u5904\u7f6e\u5374\u4ecd\u7136\u662f\u6838\u5bf9\u6765\u6e90\u3002\u73b0\u5728\u628a\u8be5\u5c42\u6307\u5411\u7684\u6761\u7801\u6587\u4ef6\u6253\u5f00\uff0c\u4f60\u4f1a\u53d1\u73b0\u539f\u59cb\u4e24\u4e2a\u5c42\u7684\u6761\u7801\u5b83\u5168\u90fd\u6709\u3002\u82e5\u56e0\u4e3a\u540d\u5b57\u542c\u8d77\u6765\u201c\u66f4\u5f7b\u5e95\u201d\u5c31\u628a\u4e09\u5c42\u4e00\u8d77\u5408\u5e76\uff0c\u76f8\u540c\u7ec6\u80de\u5c06\u88ab\u91cd\u590d\u8ba1\u6570\u3002\u7a0b\u5e8f\u5728\u6b63\u5f0f\u6c47\u603b\u524d\u53e6\u67e5\u53ef\u7528\u5c42\u4e4b\u95f4\u7684\u6761\u7801\u91cd\u53e0\u3002\u771f\u5b9e\u9879\u76ee\u4e2d\u82e5\u591a\u4e2a\u5b9e\u9a8c\u590d\u7528\u4e86\u76f8\u540c\u78b1\u57fa\u6761\u7801\uff0c\u5148\u56de\u5230\u5b9e\u9a8c\u6587\u5e93\u6807\u8bc6\u4e3a\u7ec6\u80de\u5efa\u7acb\u5168\u5c40\u552f\u4e00\u952e\uff0c\u518d\u6309\u952e\u6838\u5bf9\u91cd\u53e0\uff0c\u4e0d\u80fd\u53ea\u4e3a\u4e86\u6d88\u9664\u62a5\u9519\u968f\u610f\u6dfb\u52a0\u540e\u7f00\u3002<\/p>\n<h2>\u6cbf\u4e00\u884c\u4e00\u5217\u67e5\u5b8c\uff0c\u624d\u77e5\u9053\u6c47\u603b\u6709\u6ca1\u6709\u653e\u9519\u5730\u65b9<\/h2>\n<p>\u8981\u6838\u67e5\u4e00\u683c pseudobulk \u7ed3\u679c\uff0c\u5148\u660e\u786e\u5b83\u7684\u884c\u4ee3\u8868\u54ea\u4e2a\u57fa\u56e0\uff0c\u5217\u4ee3\u8868\u54ea\u4e2a\u751f\u7269\u6837\u672c\u4e0e\u7ec6\u80de\u7c7b\u578b\u3002\u672c\u9898\u4e2d P01 \u7684\u4e24\u4e2a T \u7ec6\u80de\u5728 G1 \u4e0a\u5404\u6709\u4e00\u548c\u4e8c\u4e2a\u5206\u5b50\uff0c\u5408\u8ba1\u5e94\u4e3a\u4e09\u3002P02 \u7684\u4e24\u4e2a\u7ec6\u80de\u5bf9\u5e94\u4e09\u548c\u4e00\uff0c\u5408\u8ba1\u4e3a\u56db\u3002\u628a\u8fd9\u56db\u4e2a\u8868\u8fbe\u503c\u4ece\u4e24\u4e2a\u539f\u59cb\u5c42\u8bfb\u51fa\u6765\uff0c\u5e76\u5728\u7ed3\u679c\u8868\u627e\u5230\u4e09\u4e0e\u56db\u3002\u53ea\u6838\u5bf9\u4e24\u4e2a\u4f9b\u8005\u7684\u603b\u548c\u4e3a\u4e03\u8fd8\u4e0d\u591f\uff0c\u5982\u679c\u628a\u4e24\u4e2a\u4f9b\u8005\u7684\u5217\u8c03\u6362\uff0c\u603b\u548c\u4ecd\u7136\u5b8c\u5168\u4e00\u81f4\uff0c\u800c\u5dee\u5f02\u8868\u8fbe\u7684\u65b9\u5411\u53ef\u80fd\u5df2\u7ecf\u53cd\u4e86\u3002<\/p>\n<pre style=\"max-width:100%;overflow:auto;padding:14px;box-sizing:border-box;background:#f1f6fa;line-height:1.6;font-size:0.9em\"><code class=\"language-python\">def sum_by_sample(matrix, cells, metadata):\n    groups = [(metadata[c][&quot;sample_id&quot;], metadata[c][&quot;cell_type&quot;]) for c in cells]\n    keys = sorted(set(groups))\n    index = {key:i for i,key in enumerate(keys)}\n    membership = sparse.csr_matrix(\n        (np.ones(len(cells),dtype=np.int64),\n         (np.arange(len(cells)),[index[k] for k in groups])),\n        shape=(len(cells),len(keys)))\n    total = (matrix @ membership).toarray()\n    if not np.array_equal(total.sum(axis=1),np.asarray(matrix.sum(axis=1)).ravel()):\n        raise ValueError(&quot;\u9010\u57fa\u56e0\u8ba1\u6570\u4e0d\u5b88\u6052&quot;)\n    return keys,total\n<\/code><\/pre>\n<p>\u51fd\u6570\u7528\u4e00\u4e2a\u7a00\u758f\u7684\u7ec6\u80de\u5230\u7ec4\u7684\u5bf9\u5e94\u77e9\u9635\u505a\u52a0\u548c\uff0c\u6bcf\u4e2a\u7ec6\u80de\u5728\u6240\u5c5e\u7ec4\u7684\u4f4d\u7f6e\u53ea\u6709\u4e00\u4e2a\u975e\u96f6\u9879\u3002\u8fd9\u6837\u57fa\u56e0\u8868\u8fbe\u77e9\u9635\u4e0d\u5fc5\u5148\u5c55\u5f00\u6210\u9010\u6761\u7801\u7684\u7a20\u5bc6\u957f\u8868\u3002\u5728\u5927\u5bf9\u8c61\u4e0a\uff0c\u8981\u7559\u610f\u805a\u5408\u77e9\u9635\u672c\u8eab\u7684\u89c4\u6a21\u53d6\u51b3\u4e8e\u57fa\u56e0\u6570\u4e58\u4ee5\u201c\u6837\u672c\u4e0e\u7c7b\u578b\u201d\u7684\u7ec4\u5408\u6570\u3002\u4f9b\u8005\u6570\u5f88\u591a\u3001\u6ce8\u91ca\u5207\u5f97\u5f88\u7ec6\u65f6\uff0c\u53ef\u4ee5\u6309\u7ec6\u80de\u7c7b\u578b\u9010\u4e2a\u8f93\u51fa\u3002\u6bcf\u6b21\u4fdd\u5b58\u90fd\u987a\u5e26\u8bb0\u4e0b\u8fd9\u4e00\u7ec4\u5305\u542b\u591a\u5c11\u6761\u7801\u3001\u6bcf\u4e2a\u6837\u672c\u603b\u5206\u5b50\u6570\uff0c\u4ee5\u53ca\u54ea\u4e9b\u6837\u672c\u6ca1\u6709\u6355\u83b7\u8be5\u7c7b\u578b\uff0c\u540e\u9762\u68c0\u67e5\u5efa\u6a21\u8bbe\u8ba1\u65f6\u4f1a\u6d3e\u4e0a\u7528\u573a\u3002<\/p>\n<h2>\u6362\u5230\u771f\u5b9e\u5bf9\u8c61\u65f6\uff0c\u7ed9\u5c42\u52a0\u4e0a\u80fd\u8ffd\u6eaf\u7684\u51ed\u636e<\/h2>\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u4f7f\u7528\u7b2c\u4e94\u7248 Seurat\uff0c\u8d44\u6599\u5305\u7684\u5bfc\u51fa\u811a\u672c\u4f1a\u5217\u51fa\u6307\u5b9a assay \u7684\u5b9e\u9645\u5c42\uff0c\u7ed9\u6bcf\u5c42\u5355\u72ec\u4fdd\u5b58\u884c\u540d\u3001\u5217\u540d\u53ca\u77e9\u9635\u3002\u5bf9\u4e8e\u53ea\u6709\u5355\u4e2a\u5904\u7406\u5c42\u7684\u65e7\u5bf9\u8c61\uff0c\u5148\u770b\u770b\u5176\u751f\u6210\u7248\u672c\u548c\u53ef\u53d6\u5f97\u7684\u539f\u59cb\u8f93\u5165\uff0c\u518d\u51b3\u5b9a\u6062\u590d\u65b9\u5f0f\u3002\u8f6c\u6362\u524d\u5148\u628a\u76ee\u6807\u57fa\u56e0\u96c6\u548c\u6761\u7801\u8eab\u4efd\u8bb0\u4e0b\u6765\u3002\u82e5\u67d0\u5c42\u7531\u78c1\u76d8\u540e\u7aef\u63d0\u4f9b\uff0c\u8f6c\u6362\u4e3a\u666e\u901a\u7a00\u758f\u77e9\u9635\u53ef\u80fd\u628a\u6574\u5c42\u8f7d\u5165\u5185\u5b58\uff0c\u5e94\u4f18\u5148\u5728\u4e00\u4e2a\u6587\u5e93\u6216\u5408\u9002\u5b50\u96c6\u4e0a\u5c1d\u8bd5\uff0c\u786e\u8ba4\u5bfc\u51fa\u7684\u5904\u7406\u8303\u56f4\u540e\u518d\u6269\u5927\u3002\u5916\u90e8\u6570\u636e\u76ee\u5f55\u53ea\u8981\u6709\u4e00\u5904\u4e22\u5931\uff0c\u80fd\u6253\u5f00\u5bf9\u8c61\u5916\u58f3\u4e5f\u4e0d\u7b49\u4e8e\u8bfb\u5f97\u51fa\u6240\u6709\u5c42\u3002<a href=\"https:\/\/satijalab.github.io\/seurat-object\/reference\/Layers.html\">SeuratObject \u5c42\u63d0\u53d6\u8bf4\u660e<\/a><\/p>\n<pre style=\"max-width:100%;overflow:auto;padding:14px;box-sizing:border-box;background:#f1f6fa;line-height:1.6;font-size:0.9em\"><code class=\"language-sh\">Rscript export_seurat.R object.rds my-data RNA sample_id cell_type\npython run.py --input my-data --out my-results\n<\/code><\/pre>\n<p>\u4e24\u6761\u547d\u4ee4\u4e4b\u95f4\u8981\u6253\u5f00\u5bfc\u51fa\u7684\u5c42\u6e05\u5355\uff0c\u6309\u7167\u524d\u9762\u67e5\u5230\u7684\u6765\u6e90\u8bc1\u636e\u8c03\u6574\u6765\u6e90\u7c7b\u578b\u5e76\u586b\u4e0a\u8bf4\u660e\u3002\u811a\u672c\u5c06\u65b0\u5bfc\u51fa\u7684\u5c42\u7edf\u4e00\u6807\u4e3a\u672a\u77e5\uff0c\u8fd9\u662f\u7559\u7ed9\u5b9e\u9645\u5206\u6790\u8005\u5b8c\u6210\u7684\u5224\u65ad\u3002\u771f\u5b9e\u6570\u636e\u4e2d\u82e5\u540c\u4e00\u60a3\u8005\u63a5\u53d7\u591a\u6b21\u53d6\u6837\uff0c\u6837\u672c\u952e\u8981\u80fd\u533a\u5206\u6bcf\u6b21\u53d6\u6750\uff0c\u518d\u628a\u60a3\u8005\u4e0e\u6761\u4ef6\u4f5c\u4e3a\u5355\u72ec\u5b57\u6bb5\u4fdd\u7559\u4e0b\u6765\u3002\u82e5\u8fc7\u65e9\u628a\u6240\u6709\u65f6\u95f4\u70b9\u90fd\u7f29\u6210\u4e00\u4e2a\u60a3\u8005\u952e\uff0c\u54ea\u6015\u6bcf\u4e2a\u57fa\u56e0\u7684\u6c47\u603b\u5b8c\u5168\u6b63\u786e\uff0c\u4e5f\u65e0\u6cd5\u91cd\u65b0\u6784\u9020\u914d\u5bf9\u6cbb\u7597\u524d\u540e\u7684\u6bd4\u8f83\u3002<\/p>\n<p>\u6709\u65f6\u5408\u4f5c\u8005\u53ea\u5173\u5fc3\u4e00\u4e2a\u5019\u9009\u57fa\u56e0\uff0c\u56fe\u4e2d\u989c\u8272\u548c\u4f60\u624b\u7b97\u7684\u7ed3\u679c\u770b\u4f3c\u4e0d\u4e00\u81f4\u3002\u5148\u89e3\u91ca\u4e24\u8005\u7684\u5355\u4f4d\uff1a\u56fe\u4e0a\u7684\u989c\u8272\u53ef\u80fd\u6765\u81ea\u5f52\u4e00\u5316\u5e73\u5747\u8868\u8fbe\uff0c\u8868\u91cc\u5219\u662f\u76f8\u52a0\u7684\u539f\u59cb\u5206\u5b50\u6570\u3002\u8981\u6838\u9a8c\u6c47\u603b\u6b63\u786e\uff0c\u53ef\u4ee5\u6bd4\u539f\u59cb\u5206\u5b50\u6570\uff1b\u8981\u5c55\u793a\u4f9b\u8005\u95f4\u76f8\u5bf9\u8868\u8fbe\uff0c\u8fd8\u9700\u7ecf\u8fc7\u76f8\u5e94\u7684\u6587\u5e93\u89c4\u6a21\u6821\u6b63\u3002\u628a\u7528\u4e8e\u805a\u5408\u7684\u5c42\u3001\u6838\u5bf9\u7684\u57fa\u56e0\u6761\u7801\u548c\u5bf9\u8c61\u7248\u672c\u5199\u5165\u65b9\u6cd5\u8bb0\u5f55\uff0c\u4e0b\u4e00\u4f4d\u540c\u4e8b\u624d\u77e5\u9053\u54ea\u4e00\u5f20\u8868\u9002\u5408\u63a5\u54ea\u4e00\u6b65\u3002\u5728\u5c11\u91cf\u6837\u672c\u4e0a\u9a8c\u8bc1\u5b8c\u8fd9\u5957\u5bf9\u7167\uff0c\u82e5\u6574\u6279\u539f\u59cb\u5c42\u7684\u8bfb\u5165\u548c\u805a\u5408\u8d85\u51fa\u672c\u673a\u5bb9\u91cf\uff0c\u53ef\u4ee5\u5e26\u4e0a\u5c42\u7684\u7ef4\u5ea6\u3001\u975e\u96f6\u6570\u91cf\u53ca\u8bd5\u8dd1\u8bb0\u5f55\u7ee7\u7eed\u5b89\u6392\u8ba1\u7b97\u3002<a href=\"https:\/\/www.biocloudservice.com\/wordpress\/compute-services\/\">\u4e91\u751f\u4fe1\u79d1\u7814\u670d\u52a1\u5668\u79df\u8d41<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4ece Seurat \u5bf9\u8c61\u9010\u5c42\u5bfc\u51fa\u57fa\u56e0\u4e0e\u6761\u7801\uff0c\u6838\u5bf9\u6765\u6e90\u3001\u6574\u6570\u8ba1\u6570\u548c\u57fa\u672c\u5355\u4f4d\uff0c\u7528\u4e00\u4e2a\u4f9b\u8005\u7684\u4e00\u683c\u539f\u59cb\u8ba1\u6570\u9a8c\u7b97 pseudobulk \u6c47\u603b\u3002<\/p>\n","protected":false},"author":1,"featured_media":70257,"comment_status":"closed","ping_status":"","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":[71],"tags":[],"class_list":["post-70260","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-single-cell"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2026\/11\/ysx-sc-practice-002-seurat-counts-layer.png?fit=1240%2C800&ssl=1","_links":{"self":[{"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts\/70260","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=70260"}],"version-history":[{"count":1,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts\/70260\/revisions"}],"predecessor-version":[{"id":73649,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/posts\/70260\/revisions\/73649"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/media\/70257"}],"wp:attachment":[{"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/media?parent=70260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/categories?post=70260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.biocloudservice.com\/wordpress\/wp-json\/wp\/v2\/tags?post=70260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}