{"id":60814,"date":"2024-09-12T14:37:21","date_gmt":"2024-09-12T06:37:21","guid":{"rendered":"http:\/\/www.biocloudservice.com\/wordpress\/?p=60814"},"modified":"2024-09-12T14:37:21","modified_gmt":"2024-09-12T06:37:21","slug":"sctype%e7%9a%84%e5%8a%9f%e8%83%bd%e5%8f%88%e5%8f%8c%e5%8f%92%e5%8f%95%e6%9b%b4%e6%96%b0%e5%95%a6%ef%bc%81%e5%8f%8d%e5%8d%b7%e7%a7%af%e7%ae%97%e6%b3%95%e4%b8%ba%e7%a9%ba%e9%97%b4%e8%bd%ac%e5%bd%95","status":"publish","type":"post","link":"http:\/\/www.biocloudservice.com\/wordpress\/?p=60814","title":{"rendered":"scType\u7684\u529f\u80fd\u53c8\u53cc\u53d2\u53d5\u66f4\u65b0\u5566\uff01\u53cd\u5377\u79ef\u7b97\u6cd5\u4e3a\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u7ec6\u80de\u7c7b\u578b\u6ce8\u91ca\u8d4b\u80fd\uff01"},"content":{"rendered":"\n<p><strong>\u524d\u8a00<\/strong><strong><\/strong><\/p>\n\n\n\n<p>\u770b\u5230scType\u662f\u4e0d\u662f\u6709\u79cd\u4f3c\u66fe\u76f8\u8bc6\u7684\u611f\u89c9\uff1f\u6ca1\u9519\uff0c\u51e0\u4e2a\u6708\u524d\u5c0f\u4e91\u5e26\u7740\u5927\u5bb6\u5b66\u4e60\u8fc7\u8fd9\u4e2aR\u5305\uff0c\u4e0d\u77e5\u9053\u5927\u5bb6\u5bf9\u4e4b\u524d\u5b66\u4e60\u8fc7\u7684scType\u8fd8\u6709\u5370\u8c61\u5417\uff1f\u6ca1\u5370\u8c61\u7684\u5c0f\u4f19\u4f34\u4eec\u5feb\u53bb\u7ffb\u7ffb\u7b14\u8bb0\uff01\u4e0a\u6b21\u5c0f\u4e91\u5e26\u7740\u5927\u5bb6\u5b66\u4e60\u4e86\u5355\u7ec6\u80de\u8f6c\u5f55\u7ec4\u6570\u636e\u7684\u7279\u5b9a\u6807\u8bb0\u7ec4\u5408\u8fdb\u884c\u5168\u81ea\u52a8\u548c\u8d85\u5feb\u901f\u7684\u7ec6\u80de\u7c7b\u578b\u9274\u5b9a\uff0c\u8fd9\u4e0d\u8fd8\u6ca1\u591a\u957f\u65f6\u95f4\uff0cscType\u7684\u529f\u80fd\u53c8\u53cc\u53d2\u53d5\u66f4\u65b0\u5566\uff01\u7c73\u7279\u7f57\u00b7\u7c73\u57fa\u5b81\u6559\u6388\u56e2\u961f\u53c8\u7814\u7a76\u4e86\u4e00\u79cd\u79f0\u4e3ascType\u7684\u57fa\u4e8e\u53cd\u5377\u79ef\u6807\u8bb0\u7684\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u7ec6\u80de\u6ce8\u91ca\u65b9\u6cd5\u3002\u8fd9\u4e0b\u65b9\u4fbf\u5927\u5bb6\u4e86\uff0c\u4e00\u4e2a\u5305\u4e24\u4e2a\u7528\u5904\uff01\u4e0d\u4ec5\u5982\u6b64\uff0cR\u8bed\u8a00\u548cpython\u90fd\u901a\u7528\u54e6\uff01\u5f00\u59cb\u4e4b\u524d\u8bf7\u5141\u8bb8\u5c0f\u4e91\u6253\u4e2a\u5e7f\u544a\uff0c\u5e7f\u544a\u4e4b\u540e\u66f4\u7cbe\u5f69\u54e6\uff01\u7ec3\u4e86\u5341\u5e74\u751f\u4fe1\u5206\u6790\u7684\u5c0f\u4e91\u5bf9\u4e8e\u751f\u4fe1\u5206\u6790\u77e5\u8bc6\u5df2\u7ecf\u5982\u9c7c\u5f97\u6c34\uff0c\u76f8\u4fe1\u6709\u5c0f\u4e91\u7684\u52a0\u6301\u4e00\u5b9a\u80fd\u8ba9\u5927\u5bb6\u5b66\u4f1a\uff01\u6ca1\u6709\u65f6\u95f4\u5b66\u4e60\u4e14\u6709\u751f\u4fe1\u5206\u6790\u7684\u5c0f\u4f19\u4f34\u4eec\u5feb\u6765\u6ef4\u6ef4\u5c0f\u4e91\u5662\uff01\u4ece\u5206\u6790\u5230\u53ef\u89c6\u5316\u76f4\u5230\u4f60\u6ee1\u610f\u4e3a\u6b62\uff01<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"223\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72471.png?resize=640%2C223\" alt=\"\" class=\"wp-image-60818\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72471.png?resize=1024%2C357 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72471.png?resize=300%2C105 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72471.png?resize=768%2C268 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72471.png?resize=600%2C209 600w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72471.png?w=1348 1348w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72471.png?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u6570\u636e\u5904\u7406\u8d77\u6765\u5360\u7528\u5185\u5b58\u5b9e\u5728\u592a\u5927\u4e86\uff0c\u653e\u8fc7\u81ea\u5df1\u7684\u7535\u8111\u5427\uff01\u5c0f\u4e91\u5728\u8fd9\u91cc\u7ed9\u5927\u5bb6\u9001\u4e0a\u798f\u5229\u4e86\uff0c\u6709\u9700\u8981\u670d\u52a1\u5668\u7684\u5c0f\u4f19\u4f34\u4eec\uff0c\u6b22\u8fce\u5927\u5bb6\u8054\u7cfb\u5c0f\u4e91\uff0c\u4fdd\u8bc1\u670d\u52a1\u5668\u7684\u6027\u4ef7\u6bd4\u6700\u9ad8\u54e6\uff01<\/p>\n\n\n\n<p><strong>\u5b9e\u4f8b\u6559\u7a0b<\/strong><strong><\/strong><\/p>\n\n\n\n<p><strong>1.\u57fa\u4e8e<\/strong><strong>python<\/strong><strong>\u7684\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u7ec6\u80de\u7c7b\u578b\u6ce8\u91ca<\/strong><strong><\/strong><\/p>\n\n\n\n<p>##\u52a0\u8f7d\u76f8\u5e94\u7684python\u5e93<\/p>\n\n\n\n<p>import urllib.request<\/p>\n\n\n\n<p>import scanpy as sc<\/p>\n\n\n\n<p>import numpy as np<\/p>\n\n\n\n<p>import pandas as pd<\/p>\n\n\n\n<p>np.random.seed(100)<\/p>\n\n\n\n<p># \u4eceURL\u4e2d\u83b7\u53d6\u811a\u672c<\/p>\n\n\n\n<p>url = &#8220;https:\/\/raw.githubusercontent.com\/kris-nader\/sc-type-py\/main\/sctype_py.py&#8221;<\/p>\n\n\n\n<p>response = urllib.request.urlopen(url)<\/p>\n\n\n\n<p>script = response.read().decode()<\/p>\n\n\n\n<p># \u6267\u884c\u811a\u672c<\/p>\n\n\n\n<p>exec(script)<\/p>\n\n\n\n<p>\u52a0\u8f7d\u901a\u8fc7\u00a0Scanpy \u63d0\u4f9b\u7684\u793a\u4f8b\u6570\u636e\u3002\u60f3\u8981\u6570\u636e\u53ca\u4ee3\u7801\u7684\u79c1\u4fe1\u5c0f\u4e91\u54e6\uff01\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u9075\u5faa Scanpy \u5728\u5176\u57fa\u672c\u5206\u6790\u6559\u7a0b\u4e2d\u6982\u8ff0\u7684\u9884\u5904\u7406\u6b65\u9aa4\u3002 \u8bf7\u6ce8\u610f\uff0c\u9884\u5904\u7406\u9009\u9879\u7684\u53d8\u5316\u53ef\u80fd\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u6ce8\u91ca\u3002\u6b64\u5916\uff0c\u5982\u672c\u6587\u6240\u8ff0\uff0c\u5728\u4e0d\u540c\u7684\u8f6f\u4ef6\u5305\uff08\u4f8b\u5982 Seurat \u548c Scanpy\uff09\u4e4b\u95f4\u4ea7\u751f\u7684\u6ce8\u91ca\u53ef\u80fd\u4f1a\u6709\u5f88\u5927\u5dee\u5f02\u3002<\/p>\n\n\n\n<p>adata = sc.datasets.visium_sge(sample_id=&#8221;V1_Human_Lymph_Node&#8221;)<\/p>\n\n\n\n<p>adata.var_names_make_unique()<\/p>\n\n\n\n<p>adata.layers[&#8220;counts&#8221;] = adata.X.copy()<\/p>\n\n\n\n<p>sc.pp.highly_variable_genes(adata, n_top_genes=2000, flavor=&#8221;seurat_v3&#8243;,layer=&#8221;counts&#8221;)<\/p>\n\n\n\n<p>sc.pp.normalize_total(adata)<\/p>\n\n\n\n<p>sc.pp.log1p(adata)<\/p>\n\n\n\n<p>adata.raw = adata<\/p>\n\n\n\n<p>#\u53bb\u6279\u6b21\u548c\u8fd0\u884cPCA<\/p>\n\n\n\n<p>sc.pp.scale(adata,max_value=10)<\/p>\n\n\n\n<p>scaled_data = pd.DataFrame(adata.X)<\/p>\n\n\n\n<p># \u66f4\u6539\u5217\u7d22\u5f15<\/p>\n\n\n\n<p>scaled_data.columns =adata.var_names<\/p>\n\n\n\n<p># \u66f4\u6539\u884c\u7d22\u5f15<\/p>\n\n\n\n<p>scaled_data.index = adata.obs_names<\/p>\n\n\n\n<p>scaled_data=scaled_data.T<\/p>\n\n\n\n<p>sc.tl.pca(adata,zero_center=False,random_state=0)<\/p>\n\n\n\n<p>sc.pp.neighbors(adata, n_neighbors=20, n_pcs=10,use_rep=&#8221;X_pca&#8221;,random_state=0)<\/p>\n\n\n\n<p>sc.tl.leiden(adata,resolution=0.8,n_iterations=10)<\/p>\n\n\n\n<p># \u4f7f\u7528UMAP\u53ef\u89c6\u5316\u805a\u7c7b<\/p>\n\n\n\n<p>sc.tl.umap(adata,min_dist=0.3)<\/p>\n\n\n\n<p>sc.pl.umap(adata, color=[&#8216;leiden&#8217;])<\/p>\n\n\n\n<p>sc.pl.spatial(adata, img_key=&#8221;hires&#8221;, color=[&#8220;leiden&#8221;])<\/p>\n\n\n\n<p>\u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u8fd0\u884c&nbsp;sctype \u51fd\u6570\u3002\u8fd9\u6d89\u53ca\u51e0\u4e2a\u6b65\u9aa4\uff1a\u5728HGNC\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u6279\u51c6\u7684\u57fa\u56e0\u7b26\u53f7\uff0c\u8ba1\u7b97sctype\u5206\u6570\uff0c\u6839\u636e\u805a\u7c7b\u4fe1\u606f\u6c47\u603b\u8fd9\u4e9b\u5206\u6570\uff0c\u5e76\u5c06\u7ed3\u679c\u53e0\u52a0\u5230\u4f4e\u7ef4\u7a7a\u95f4\uff08\u5982UMAP\u6216t-SNE\uff09\u4e0a\u3002\u5927\u5bb6\u4e5f\u53ef\u4ee5\u4f7f\u7528\u81ea\u5df1\u81ea\u5b9a\u4e49\u7684\u6807\u8bb0\u6570\u636e\u96c6\u54e6\uff01\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u9ed8\u8ba4\u7684&nbsp;scTypeDB\uff0c\u5176\u4e2d\u5305\u542b\u5404\u79cd\u5065\u5eb7\u7ec4\u7ec7\u7684\u6ce8\u91ca\u3002<\/p>\n\n\n\n<p>scRNAseqData=scaled_data<\/p>\n\n\n\n<p>gs_list=gene_sets_prepare(path_to_db_file=&#8221;https:\/\/raw.githubusercontent.com\/IanevskiAleksandr\/sc-type\/master\/ScTypeDB_full.xlsx&#8221; ,cell_type=&#8221;Brain&#8221;)<\/p>\n\n\n\n<p>es_max = sctype_score(scRNAseqData = scRNAseqData, scaled = True, gs = gs_list[&#8216;gs_positive&#8217;], gs2 = gs_list[&#8216;gs_negative&#8217;])<\/p>\n\n\n\n<p>unique_clusters = adata.obs[&#8216;leiden&#8217;].unique()<\/p>\n\n\n\n<p># \u5c06\u8be5\u51fd\u6570\u5e94\u7528\u4e8e\u6bcf\u4e2a\u552f\u4e00\u7684\u4e9a\u7fa4\uff0c\u5e76\u5c06\u7ed3\u679c\u7ec4\u5408\u5230\u4e00\u4e2aDataFrame\u4e2d<\/p>\n\n\n\n<p>cL_results = pd.concat([process_cluster(cluster,adata,es_max,&#8221;leiden&#8221;) for cluster in unique_clusters])<\/p>\n\n\n\n<p># \u5206\u7ec4\u5e76\u6839\u636e\u5206\u6570\u9009\u62e9\u6700\u4e0a\u9762\u4e00\u884c<\/p>\n\n\n\n<p>sctype_scores = cL_results.groupby(&#8216;cluster&#8217;).apply(lambda x: x.nlargest(1, &#8216;scores&#8217;)).reset_index(drop=True)<\/p>\n\n\n\n<p># \u5c06\u4f4e\u7f6e\u4fe1\u5ea6\u7fa4\u96c6\u8bbe\u7f6e\u4e3a\u201c\u672a\u77e5\u201d<\/p>\n\n\n\n<p>sctype_scores.loc[sctype_scores[&#8216;scores&#8217;] &lt; sctype_scores[&#8216;ncells&#8217;] \/ 4, &#8216;type&#8217;] = &#8216;Unknown&#8217;<\/p>\n\n\n\n<p>adata.obs[&#8216;sctype_classification&#8217;] = &#8220;&#8221;<\/p>\n\n\n\n<p>#\u8fed\u4ee3\u552f\u4e00\u96c6\u7fa4<\/p>\n\n\n\n<p>for cluster in sctype_scores[&#8216;cluster&#8217;].unique():<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;#\u8fc7\u6ee4\u5f53\u524d\u96c6\u7fa4\u7684sctype_scores<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;cl_type = sctype_scores[sctype_scores[&#8216;cluster&#8217;] == cluster]<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;# \u83b7\u53d6\u5f53\u524d\u96c6\u7fa4\u7684\u7c7b\u578b<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;cl_type_value = cl_type[&#8216;type&#8217;].iloc[0]<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;# \u66f4\u65b0pbmc\u4e2d\u7684&#8217;sctype_classification&#8217;\u3002\u5c5e\u4e8e\u5f53\u524d\u96c6\u7fa4\u7684\u7ec6\u80de\u7684\u5bf9\u8c61<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;adata.obs.loc[adata.obs[&#8216;leiden&#8217;] == cluster, &#8216;sctype_classification&#8217;] = cl_type_value<\/p>\n\n\n\n<p>#\u7528sctype_classification\u4f5c\u4e3a\u6807\u7b7e\u7ed8\u5236UMAP<\/p>\n\n\n\n<p>sc.pl.umap(adata, color=&#8217;sctype_classification&#8217;, title=&#8217;UMAP with sctype_classification&#8217;)<\/p>\n\n\n\n<p>sc.pl.spatial(adata, img_key=&#8221;hires&#8221;, color=[&#8220;sctype_classification&#8221;])<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"431\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72472.png?resize=640%2C431\" alt=\"\" class=\"wp-image-60819\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72472.png?resize=1024%2C689 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72472.png?resize=300%2C202 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72472.png?resize=768%2C516 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72472.png?resize=600%2C403 600w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72472.png?w=1261 1261w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p><strong>2<\/strong><strong>.\u57fa\u4e8e<\/strong><strong>R\u8bed\u8a00<\/strong><strong>\u7684\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u7ec6\u80de\u7c7b\u578b\u6ce8\u91ca<\/strong><strong><\/strong><\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u52a0\u8f7d\u4e00\u4e2a\u516c\u5f00\u53ef\u7528\u7684\u77e2\u72b6\u5c0f\u9f20\u8111\u5207\u7247\uff0c\u8fd9\u4e9b\u5207\u7247\u662f\u4f7f\u7528&nbsp;Visium v1 \u5316\u5b66\u751f\u6210\u7684\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7 Seurat \u8f6f\u4ef6\u5305\u6765\u5b8c\u6210\u3002\u6211\u4eec\u8fd8\u5c06\u7ee7\u7eed\u52a0\u8f7d\u6240\u6709\u5176\u4ed6\u5fc5\u9700\u7684\u5305\u3002<\/p>\n\n\n\n<p>##\u52a0\u8f7dR\u5305\u53ca\u6570\u636e<\/p>\n\n\n\n<p>lapply(c(&#8220;dplyr&#8221;, &#8220;Seurat&#8221;, &#8220;HGNChelper&#8221;, &#8220;openxlsx&#8221;), library, character.only = T)<\/p>\n\n\n\n<p>#\u52a0\u8f7dSeuratData\u6765\u5b89\u88c5\u5c0f\u9f20\u5927\u8111\u6570\u636e\u96c6<\/p>\n\n\n\n<p># devtools:: install_github(&#8221; satijalab \/ secure -data &#8220;)<\/p>\n\n\n\n<p>library(SeuratData)<\/p>\n\n\n\n<p>#\u52a0\u8f7d\u51fd\u6570<\/p>\n\n\n\n<p>source(&#8220;https:\/\/raw.githubusercontent.com\/kris-nader\/sp-type\/main\/sp-type.R&#8221;);<\/p>\n\n\n\n<p># \u52a0\u8f7d\u5c0f\u9f20\u5927\u8111\u6f14\u793a\u6570\u636e<\/p>\n\n\n\n<p># InstallData(&#8220;stxBrain&#8221;)\u53ef\u80fd\u65e0\u6cd5\u5de5\u4f5c;\u4e00\u4e2a\u5feb\u901f\u7684\u89e3\u51b3\u65b9\u6848\u662f\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5:<\/p>\n\n\n\n<p>options(timeout=600) # \u5c06download.packages()\u7684\u8d85\u65f6\u9650\u5236\u8bbe\u7f6e\u4e3a600\u79d2<\/p>\n\n\n\n<p>InstallData(&#8220;stxBrain&#8221;)<\/p>\n\n\n\n<p>brain &lt;- LoadData(&#8220;stxBrain&#8221;, type = &#8220;anterior1&#8221;)<\/p>\n\n\n\n<p>brain &lt;- SCTransform(brain, assay = &#8220;Spatial&#8221;, verbose = FALSE)<\/p>\n\n\n\n<p>brain &lt;- RunPCA(brain, assay = &#8220;SCT&#8221;, verbose = FALSE)<\/p>\n\n\n\n<p>brain &lt;- FindNeighbors(brain, reduction = &#8220;pca&#8221;, dims = 1:30)<\/p>\n\n\n\n<p>brain &lt;- FindClusters(brain, verbose = FALSE)<\/p>\n\n\n\n<p>brain &lt;- RunUMAP(brain, reduction = &#8220;pca&#8221;, dims = 1:30)<\/p>\n\n\n\n<p>\u7ec6\u80de\u7c7b\u578b\u6ce8\u91ca\uff1a\u8981\u5bf9\u6837\u672c\u8fdb\u884c\u6ce8\u91ca\uff0c\u53ea\u9700\u5c06\u5305\u88c5\u5668\u51fd\u6570\u5e94\u7528\u4e8eSeurat\u5bf9\u8c61\u5373\u53ef\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8be5\u51fd\u6570\u4f7f\u7528&nbsp;scTypeDB\u3002\u8fd9\u5305\u62ec\u4ee5\u4e0b\u7ec4\u7ec7\u4e2d\u7ec6\u80de\u7c7b\u578b\u7684\u9633\u6027\u548c\u9634\u6027\u6807\u8bb0\u7269\uff1a\u514d\u75ab\u7cfb\u7edf\u3001\u80f0\u817a\u3001\u809d\u810f\u3001\u773c\u775b\u3001\u80be\u810f\u3001\u5927\u8111\u3001\u80ba\u3001\u80be\u4e0a\u817a\u3001\u5fc3\u810f\u3001\u80a0\u9053\u3001\u808c\u8089\u3001\u80ce\u76d8\u3001\u813e\u810f\u3001\u80c3\u3001\u80f8\u817a\u3002\u7528\u6237\u5e94\u5728\u53c2\u6570known_tissue_type\u4e2d\u8f93\u5165\u6b63\u786e\u7684\u7ec4\u7ec7<\/p>\n\n\n\n<p>\u8981\u5bf9\u6837\u672c\u8fdb\u884c\u6ce8\u91ca\uff0c\u53ea\u9700\u5c06\u5305\u88c5\u5668\u51fd\u6570\u5e94\u7528\u4e8e\u4fee\u62c9\u7279\u5bf9\u8c61\u5373\u53ef\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8be5\u51fd\u6570\u4f7f\u7528&nbsp;scTypeDB\u3002\u8fd9\u5305\u62ec\u4ee5\u4e0b\u7ec4\u7ec7\u4e2d\u7ec6\u80de\u7c7b\u578b\u7684\u9633\u6027\u548c\u9634\u6027\u6807\u8bb0\u7269\uff1a\u514d\u75ab\u7cfb\u7edf\u3001\u80f0\u817a\u3001\u809d\u810f\u3001\u773c\u775b\u3001\u80be\u810f\u3001\u5927\u8111\u3001\u80ba\u3001\u80be\u4e0a\u817a\u3001\u5fc3\u810f\u3001\u80a0\u9053\u3001\u808c\u8089\u3001\u80ce\u76d8\u3001\u813e\u810f\u3001\u80c3\u3001\u80f8\u817a\u3002\u7528\u6237\u5e94\u5728\u53c2\u6570known_tissue_type\u4e2d\u8f93\u5165\u6b63\u786e\u7684\u7ec4\u7ec7<\/p>\n\n\n\n<p>brain &lt;- run_sctype(brain, known_tissue_type=&#8221;Brain&#8221;, slot=&#8221;SCT&#8221;)<\/p>\n\n\n\n<p>#\u53ef\u89c6\u5316<\/p>\n\n\n\n<p># \u5728DimPlots\u4e0a\u53e0\u52a0\u6ce8\u91ca<\/p>\n\n\n\n<p>SpatialDimPlot(brain, group.by=&#8221;sctype_classification&#8221;)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"261\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72473.png?resize=640%2C261\" alt=\"\" class=\"wp-image-60820\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72473.png?resize=1024%2C417 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72473.png?resize=300%2C122 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72473.png?resize=768%2C312 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72473.png?resize=600%2C244 600w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/\u56fe\u72473.png?w=1192 1192w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>\u5bf9\u4e8e\u5c1a\u672a\u5305\u542b\u5728&nbsp;scTypeDB \u4e2d\u7684\u7ec4\u7ec7\uff0c\u5c0f\u4f19\u4f34\u4eec\u4e5f\u4e0d\u8981\u614c\u54e6\uff01\u8be5\u56e2\u961f\u4e5f\u521b\u5efa\u4e86\u4e00\u4e2a\u51fd\u6570\uff0c\u7528\u4e8e\u4ece\u53c2\u8003 scRNA-seq \u6570\u636e\u96c6\u4e2d\u9009\u62e9\u6807\u8bb0\u57fa\u56e0\u3002\u4f5c\u8005\u6b63\u5728\u5bf9&nbsp;scTypeDB \u8fdb\u884c\u5927\u91cf\u66f4\u65b0\uff0c\u4ee5\u8fdb\u4e00\u6b65\u63d0\u9ad8\u5176\u5bf9\u5f53\u524d\u672a\u5305\u542b\u5728\u6570\u636e\u5e93\u4e2d\u7684\u7ec4\u7ec7\u7684\u53ef\u7528\u6027\u3002<\/p>\n\n\n\n<p>\u6807\u8bb0\u57fa\u56e0\u7684\u4ed4\u7ec6\u9009\u62e9\u81f3\u5173\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u662fscType\u7684\u57fa\u7840\u3002\u6700\u521d\u7684 scTypeDB \u7ecf\u8fc7\u7cbe\u5fc3\u7b56\u5212\uff0c\u4ee5\u786e\u4fdd\u6bcf\u4e2a\u6807\u8bb0\u57fa\u56e0\u7684\u7279\u5f02\u6027\u3002<\/p>\n\n\n\n<p>##\u7b80\u800c\u8a00\u4e4b\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u884c\u751f\u6210\u6807\u8bb0\u96c6\uff1a<\/p>\n\n\n\n<p>reference=readRDS(&#8220;.\/reference.RDS&#8221;)<\/p>\n\n\n\n<p>Idents(reference)=reference$ground_truth<\/p>\n\n\n\n<p>reference_marker_genes=FindAllMarkers(reference)<\/p>\n\n\n\n<p>marker_genes=retrieve_markers(reference_marker_genes,&#8221;Breast&#8221;)<\/p>\n\n\n\n<p>writexl::write_xlsx(marker_genes,&#8221;.\/default_settings_marker_gene_set.xlsx&#8221;)<\/p>\n\n\n\n<p><strong>\u5c0f\u7ed3<\/strong><strong><\/strong><\/p>\n\n\n\n<p>scType \u7684\u7a7a\u95f4\u5e94\u7528\u4e0d\u9700\u8981\u8ba1\u7b97\u8d39\u529b\u7684\u53cd\u5377\u79ef\uff0c\u4e5f\u4e0d\u9700\u8981\u5927\u578b\u5355\u7ec6\u80de\u53c2\u8003\u56fe\u96c6\u3002scType \u80fd\u591f\u4ece ST \u6570\u636e\u4e2d\u8d85\u5feb\u901f\u51c6\u786e\u5730\u9274\u5b9a\u4e30\u5bcc\u7684\u7ec6\u80de\u7c7b\u578b\uff0c\u5c24\u5176\u662f\u5728\u68c0\u6d4b\u5230\u8db3\u591f\u5927\u7684\u4e00\u7ec4\u57fa\u56e0\u65f6\u3002\u6b64\u7c7b\u68c0\u6d4b\u7684\u793a\u4f8b\u5305\u62ec Visium \u548c Slide-seq\uff0c\u5b83\u4eec\u76ee\u524d\u5728\u9ad8\u5206\u8fa8\u7387\u548c\u7ec6\u80de\u7c7b\u578b\u6ce8\u91ca\u68c0\u6d4b\u68c0\u6d4b\u5230\u7684\u57fa\u56e0\u6570\u91cf\u4e4b\u95f4\u63d0\u4f9b\u4e86\u6700\u4f73\u6743\u8861\u3002\u6700\u540e\u5c0f\u4e91\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e2a\u4e91\u5de5\u5177\uff01\u540c\u5b66\u4eec\u5982\u679c\u89c9\u5f97\u81ea\u5df1\u7684\u4ee3\u7801\u6c34\u5e73\u4e00\u822c\uff0c\u5bf9\u4e8e\u5f88\u591a\u7684\u53c2\u6570\u4e0d\u77e5\u9053\u600e\u4e48\u6539\uff0c\u53ef\u4ee5\u4f53\u9a8c\u4e00\u4e0b\u6211\u4eec\u7684\u4e91\u751f\u4fe1\u5c0f\u5de5\u5177\uff0c\u53ea\u9700\u8f93\u5165\u6570\u636e\uff0c\u5373\u53ef\u8f7b\u677e\u751f\u6210\u6240\u9700\u56fe\u8868\uff0c\u5b57\u4f53\u5927\u5c0f\u3001\u6807\u9898\u7b49\u4e5f\u53ef\u4e00\u952e\u66f4\u6539\u3002\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u53bb\u4e91\u751f\u4fe1\uff08http:\/\/www.biocloudservice.com\/home.html\uff09\u4f53\u9a8c\u4e00\u4e0b\u5427\uff01\u9700\u8981\u4ee3\u7801\u7684\u4e5f\u53ef\u4ee5\u8054\u7cfb\u6211\u4eec\u5440\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/b83a70e861b85da4e5d054d57384bcfc.png?resize=640%2C284\" alt=\"\" class=\"wp-image-60821\" width=\"640\" height=\"284\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/b83a70e861b85da4e5d054d57384bcfc.png?w=553 553w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/09\/b83a70e861b85da4e5d054d57384bcfc.png?resize=300%2C133 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u770b\u5230scType\u662f\u4e0d\u662f\u6709\u79cd\u4f3c\u66fe\u76f8\u8bc6\u7684\u611f\u89c9\uff1f\u6ca1\u9519\uff0c\u51e0\u4e2a\u6708\u524d\u5c0f\u4e91\u5e26\u7740\u5927\u5bb6\u5b66\u4e60\u8fc7\u8fd9\u4e2aR\u5305\uff0c\u4e0d\u77e5\u9053\u5927\u5bb6\u5bf9\u4e4b\u524d\u5b66\u4e60 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":""},"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/60814"}],"collection":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=60814"}],"version-history":[{"count":1,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/60814\/revisions"}],"predecessor-version":[{"id":60822,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/60814\/revisions\/60822"}],"wp:attachment":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=60814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=60814"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=60814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}