{"id":27778,"date":"2024-02-02T16:28:21","date_gmt":"2024-02-02T08:28:21","guid":{"rendered":"http:\/\/www.biocloudservice.com\/wordpress\/?p=27778"},"modified":"2024-02-02T16:28:22","modified_gmt":"2024-02-02T08:28:22","slug":"%e7%a9%ba%e9%97%b4%e8%bd%ac%e5%bd%95%e7%bb%84%e6%96%b0%e5%88%a9%e5%99%a8%ef%bc%81mia%e5%88%86%e6%9e%90%e5%b8%a6%e4%bd%a0%e5%b7%a7%e5%a6%99%e6%8b%86%e8%a7%a3%e7%bb%86%e8%83%9e","status":"publish","type":"post","link":"http:\/\/www.biocloudservice.com\/wordpress\/?p=27778","title":{"rendered":"\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u65b0\u5229\u5668\uff01MIA\u5206\u6790\u5e26\u4f60\u5de7\u5999\u201c\u62c6\u89e3\u201d\u7ec6\u80de\u7c7b\u578b\uff01\uff01"},"content":{"rendered":"<p>\u968f\u7740\u764c\u75c7\u7684\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u5206\u6790\u7684\u7206\u706b\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u80bf\u7624\u5b66TOP\u671f\u520a\u6536\u5f55\u4e86\u76f8\u5f53\u4e00\u90e8\u5206\u7684\u751f\u4fe1\u5206\u6790\u6587\u7ae0\uff0c\u5f88\u591a\u90fd\u5219\u7528\u5230\u4e86MIA(Multimodal intersection analysis)\u5206\u6790\uff0c\u8fd9\u79cd\u5206\u6790\u65b9\u6cd5\u5c0f\u679c\u8fd8\u6ca1\u6709\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u8fc7\uff0c\u8fd9\u8ba9\u5c0f\u679c\u773c\u998b\u7684\u540c\u65f6\u4e5f\u5bf9\u8fd9\u79cd\u65b0\u7684\u5bcc\u96c6\u5206\u6790\u65b9\u6cd5\u6000\u6709\u4e86\u597d\u5947\u5fc3\uff0c\u6240\u4ee5\u5c0f\u679c\u9a6c\u4e0a\u641c\u96c6\u4e86\u4e00\u7bc7Cancer reserch\u4e0a\u7684\u6587\u7ae0\uff0c\u5e26\u7740\u5c0f\u4f19\u4f34\u4eec\u4e00\u8d77\u5b66\u4e60\u5e76\u5b8c\u6210\u6587\u7ae0\u4e2d\u7684MIA\u5206\u6790\u7684\u590d\u73b0\uff01\u672c\u6b21\u7684\u6570\u636e\u53ef\u80fd\u6bd4\u8f83\u591a\uff0c\u6b22\u8fce\u5c0f\u4f19\u4f34\u4eec\u79df\u8d41\u6211\u4eec\u7684\u670d\u52a1\u5668\u6765\u8fd0\u884c\u4ee3\u7801\u54e6~<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"421\" class=\"wp-image-27779\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-1.png?resize=640%2C421\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-1.png?w=1073 1073w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-1.png?resize=300%2C197 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-1.png?resize=1024%2C674 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-1.png?resize=768%2C505 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-1.png?resize=600%2C395 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u9996\u5148\uff0c\u5c0f\u679c\u9686\u91cd\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e0b\u4eca\u5929\u7684\u6838\u5fc3\u65b9\u6cd5\u2014\u2014MIA\u5206\u6790\uff0cMultimodal intersection analysis\uff0c\u4e5f\u5c31\u662f\u591a\u6a21\u5f0f\u76f8\u4ea4\u5206\u6790\uff0c\u662f\u4e00\u79cd\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u548c\u5355\u7ec6\u80de\u8f6c\u5f55\u7ec4\u6574\u5408\u5206\u6790\u7684\u65b9\u6cd5\uff0c\u7528\u4e8e\u8bc4\u4f30\u7279\u5b9a\u7ec4\u7ec7\u533a\u57df\u4e2d\u7279\u5b9a\u7ec6\u80de\u7c7b\u578b\u7684\u5bcc\u96c6\u7a0b\u5ea6\u3002\u5176\u539f\u7406\u662f\u8ba1\u7b97\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u7684\u533a\u57df\u5dee\u5f02\u57fa\u56e0\u4e0e\u5355\u7ec6\u80de\u8f6c\u5f55\u7ec4\u9274\u5b9a\u7684\u7ec6\u80de\u7c7b\u578b\u7684marker\u57fa\u56e0\u4e4b\u95f4\u7684\u91cd\u53e0\u5173\u7cfb\uff0c\u4f7f\u7528\u8d85\u51e0\u4f55\u5206\u5e03\u63a8\u65adP\u503c\u3002MIA\u5206\u6790\u53ef\u4ee5\u5e94\u7528\u4e8e\u4e0d\u540c\u7684\u751f\u7269\u5b66\u95ee\u9898\uff0c\u4f8b\u5982\u80f0\u817a\u764c\u4ee5\u53ca\u5375\u5de2\u764c\u7684\u521d\u6b65\u5206\u6790\u79cd\uff0c\u53ef\u4ee5\u5229\u7528MIA\u5206\u6790\u8fdb\u884c\u5bcc\u96c6\uff0c\u5bf9\u7ec6\u80de\u7684\u4e0d\u540c\u7c7b\u578b\u8fdb\u884c\u201c\u62c6\u5206\u201d\u8bc4\u4f30\uff0c\u8fd9\u4f7f\u5f97MIA\u5206\u6790\u5728\u75be\u75c5\u8bca\u65ad\u548c\u4e34\u5e8a\u5b9e\u8df5\u4e2d\u4e5f\u9010\u6e10\u5f97\u5230\u4e86\u8d8a\u6765\u8d8a\u591a\u7684\u5173\u6ce8\u548c\u5e94\u7528\u3002<\/p>\n<p>\u90a3\u4e48\u5e94\u8be5\u600e\u6837\u5b9e\u73b0\u5462\uff1f\u5c0f\u679c\u8fd9\u5c31\u4ee5\u6587\u732e\u63d0\u4f9b\u7684\u6570\u636e\u548c\u4ee3\u7801\u4e3a\u4f8b\u4e3a\u5c0f\u4f19\u4f34\u4eec\u8fdb\u884c\u8bf4\u660e\u3002<\/p>\n<p>\u5728\u590d\u73b0\u4e4b\u524d\uff0c\u9700\u8981\u642d\u5efa\u5408\u9002\u7684\u5de5\u4f5c\u73af\u5883\uff0c\u4ee5\u4e0b\u662f\u6587\u732e\u6240\u4f7f\u7528\u7684\u8be6\u7ec6\u914d\u7f6e\uff1a<\/p>\n<p>R 4.1.0<\/p>\n<p>Seurat 3.2.1<\/p>\n<p>dplyr 1.0.9<\/p>\n<p>limma latest<\/p>\n<p>scales 1.2.0<\/p>\n<p>imager 0.42.13<\/p>\n<p>RColorBrewer 1.1.3<\/p>\n<p>ggplot2 3.3.6<\/p>\n<p>gplots 3.1.3<\/p>\n<p>tidyverse 1.3.1<\/p>\n<p>\u642d\u5efa\u597d\u81ea\u5df1\u7684\u5e73\u53f0\u4e4b\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u8fdb\u884c\u6570\u636e\u5206\u6790\u4e86\uff01\u5982\u679c\u5927\u5bb6\u4e0d\u4f1a\u642d\u5efa\u81ea\u5df1\u7684\u5e73\u53f0\uff0c\u6b22\u8fce\u79df\u8d41\u6211\u4eec\u7684\u670d\u52a1\u5668\u54e6~<\/p>\n<p>\u7b2c\u4e00\u6b65\uff0c\u5c06\u6570\u636e\u77e9\u9635\u52a0\u8f7d\u5230Seurat\u4e2d<\/p>\n<p>\u672c\u6b21\u590d\u73b0\u6240\u7528\u7684\u6570\u636e\u5c0f\u679c\u5df2\u7ecf\u5e2e\u5927\u5bb6\u6574\u7406\u597d\u4e86\u5466\uff1a<\/p>\n<p>\u94fe\u63a5\uff1ahttps:\/\/pan.baidu.com\/s\/10mos4vmEvXunU1o3SQOz9g<\/p>\n<p>\u63d0\u53d6\u7801\uff1aikl5<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"449\" class=\"wp-image-27780\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-2.png?resize=640%2C449\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-2.png?w=1361 1361w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-2.png?resize=300%2C210 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-2.png?resize=1024%2C718 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-2.png?resize=768%2C538 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-2.png?resize=600%2C421 600w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-2.png?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u8f93\u5165\u6587\u4ef6\u5982\u56fe\u6240\u793a\uff0c\u662f\u4e00\u4e2a\u5b58\u50a8\u6709\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u6570\u636e\u7684\u6587\u4ef6\uff0c\u5b83\u5305\u542b\u4e86\u7ec6\u80de\u7684\u7a7a\u95f4\u5750\u6807\u548c\u57fa\u56e0\u8868\u8fbe\u77e9\u9635\u3002<\/p>\n<p>##1.\u5bfc\u5165\u5305<\/p>\n<p>library(Seurat)<\/p>\n<p>library(dplyr)<\/p>\n<p>library(limma)<\/p>\n<p>#\u8bbe\u7f6e\u5de5\u4f5c\u76ee\u5f55<\/p>\n<p>data_dir = &#8216;\/data\/ST_data_matrices&#8217;<\/p>\n<p>save_dir = &#8216;\/results&#8217;<\/p>\n<p>files = list.files(data_dir)<\/p>\n<p>#\u8bfb\u53d6\u6570\u636e<\/p>\n<p>files &lt;- c(&#8220;file1.txt&#8221;, &#8220;file2.txt&#8221;, &#8220;file3.txt&#8221;, &#8220;file4.txt&#8221;)<\/p>\n<p>for (i in 1:4) {<\/p>\n<p>file_path &lt;- paste0(data_dir, &#8220;\/&#8221;, files[i])<\/p>\n<p>assign(paste0(&#8220;dA&#8221;, i), read.delim2(file_path, sep = &#8221; &#8220;))<\/p>\n<p>}<\/p>\n<p>#\u5c06\u6570\u636e\u5bfc\u5165Seurat\uff0c\u8fdb\u884cPCA\uff0cUMAP\u5206\u6790<\/p>\n<p># \u7528\u4e00\u4e2a\u5411\u91cf\u5b58\u50a8\u6570\u636e\u6846\u540d<\/p>\n<p>data_frames &lt;- c(&#8220;dA4&#8221;, &#8220;dA5&#8221;, &#8220;dA10&#8221;, &#8220;dA12&#8221;)<\/p>\n<p># \u7528\u4e00\u4e2a\u5411\u91cf\u5b58\u50a8\u989c\u8272\u540d<\/p>\n<p>colors &lt;- list(c(&#8216;orange&#8217;,&#8217;paleturquoise4&#8242;, &#8216;red&#8217;, &#8216;orchid&#8217;, &#8216;seagreen2&#8217;, &#8216;darkgreen&#8217;, &#8216;slateblue1&#8242;,&#8217;yellow&#8217;,&#8217;pink&#8217;),<\/p>\n<p>c(&#8216;orange&#8217;,&#8217;paleturquoise4&#8242;, &#8216;orchid&#8217;, &#8216;seagreen2&#8242;,&#8217;slateblue1&#8242;,&#8217;red&#8217;,&#8217;yellow&#8217;),<\/p>\n<p>c(&#8216;orange&#8217;,&#8217;paleturquoise4&#8242;,&#8217;red&#8217;,&#8217;darkgreen&#8217;,&#8217;orchid&#8217;,&#8217;blue&#8217;,&#8217;cyan&#8217;),<\/p>\n<p>c(&#8216;red&#8217;,&#8217;darkgreen&#8217;, &#8216;orange&#8217;,&#8217;paleturquoise4&#8242;, &#8216;orchid&#8217;,&#8217;blue&#8217;))<\/p>\n<p># \u7528\u4e00\u4e2a\u5faa\u73af\u5bf9\u6bcf\u4e2a\u6570\u636e\u6846\u8fdb\u884c\u5206\u6790<\/p>\n<p>for (i in 1:4) {<\/p>\n<p>sample &lt;- CreateSeuratObject(counts = get(data_frames[i]), project = &#8220;ST_HGSOC&#8221;, min.cells = 2, min.features = 200)<\/p>\n<p>#\u6570\u636e\u8fdb\u884c\u6807\u51c6\u5316\u548c\u53d8\u6362<\/p>\n<p>sample &lt;- SCTransform(sample, verbose = FALSE, return.only.var.genes = FALSE)<\/p>\n<p>#\u4e3b\u6210\u5206\u5206\u6790<\/p>\n<p>sample &lt;- RunPCA(sample, assay = &#8220;SCT&#8221;, verbose = FALSE) # return top 50 PCs<\/p>\n<p>#\u805a\u7c7b\u5206\u6790<\/p>\n<p>sample &lt;- FindNeighbors(sample, reduction = &#8220;pca&#8221;, dims = 1:10) %&gt;%<\/p>\n<p>FindClusters(verbose = FALSE) # default k.param = 30 for the k-nearest neighbor algorithm<\/p>\n<p>#\u8fdb\u884c\u964d\u7ef4\u548c\u53ef\u89c6\u5316<\/p>\n<p>sample &lt;- RunUMAP(sample, reduction = &#8220;pca&#8221;, dims = 1:10) %&gt;%<\/p>\n<p>DimPlot(reduction = &#8220;umap&#8221;, label = F, cols = colors[[i]])<\/p>\n<p>}<\/p>\n<p>## 2.\u67e5\u627eDEG\uff08\u5dee\u5f02\u8868\u8fbe\u57fa\u56e0\uff09\u5e76\u7ed8\u5236\u70ed\u56fe\uff0c\u5229\u7528UMAP\u7ed8\u5236\u7c07<\/p>\n<p>#\u8ba1\u7b97\u6bcf\u4e2a\u6837\u672c\u4e2d\u7684\u5e73\u5747\u57fa\u56e0<\/p>\n<p># data=sample12@assays$RNA<\/p>\n<p># temp = 0<\/p>\n<p># for (i in seq(1,dim(data)[2]))<\/p>\n<p># {temp = temp+sum(data[,i]==0)}<\/p>\n<p># avg1 = dim(data)[1]-temp\/dim(data)[2]<\/p>\n<p>## 3.\u4fdd\u5b58Seurate\u6587\u4ef6<\/p>\n<p>fnm = paste0(save_dir,&#8217;\/seurat_object.RData&#8217;)<\/p>\n<p>save(sample4,sample5,sample10,sample12, file = fnm)<\/p>\n<p>## 4.\u4fdd\u5b58\u6bcf\u4e2a\u7c07\u7684\u5dee\u5f02\u8868\u8fbe\u57fa\u56e0<\/p>\n<p>folder = paste0(save_dir,&#8217;\/ST differentially expresssed genes up and down&#8217;)<\/p>\n<p>if (!file.exists(folder)){<\/p>\n<p>dir.create(folder)<\/p>\n<p>}<\/p>\n<p>samples = c(sample4,sample5,sample10,sample12)<\/p>\n<p>sample_names = c(&#8216;A4&#8242;,&#8217;A5&#8242;,&#8217;A10&#8242;,&#8217;A12&#8242;)<\/p>\n<p>for (j in seq(1,length(samples))){<\/p>\n<p>tmp1 = samples[[j]]<\/p>\n<p>fnm_pt1 = sample_names[j]<\/p>\n<p>tmp = tmp1@meta.data$seurat_clusters<\/p>\n<p>n_clu = nlevels(tmp)<\/p>\n<p>for (i in seq(0,n_clu-1,by = 1)){<\/p>\n<p>fnm = paste0(folder,&#8217;\/&#8217;,fnm_pt1,&#8217;_c&#8217;,i,&#8217;.xls&#8217;)<\/p>\n<p>tmp_marker &lt;- FindMarkers(tmp1, ident.1 = i, min.pct = 0.25, only.pos = FALSE,logfc.threshold = 0)<\/p>\n<p>tmp_marker$gene &lt;- rownames(tmp_marker)<\/p>\n<p>tmp_mk &lt;- tmp_marker %&gt;% select(gene, everything())<\/p>\n<p>tmp_mk &lt;- tmp_mk[order(-tmp_mk$avg_logFC),]<\/p>\n<p>tmp_mk &lt;- tmp_mk[tmp_mk$p_val&lt;0.05,]<\/p>\n<p>write.table(tmp_mk,fnm,quote=F,sep=&#8221;\\t&#8221;,row.names = F)<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>## 5.\u4fdd\u5b58\u6bcf\u4e2a\u7c07\u7684\u6570\u91cf<\/p>\n<p>find_cluster_numbers &lt;- function(SOE, SID) {<\/p>\n<p>SOE@meta.data %&gt;%<\/p>\n<p>count(seurat_clusters) %&gt;%<\/p>\n<p>mutate(name = paste0(SID, &#8220;_c&#8221;, seurat_clusters)) %&gt;%<\/p>\n<p>select(name, n) %&gt;%<\/p>\n<p>column_to_rownames(&#8220;name&#8221;)<\/p>\n<p>}<\/p>\n<p>ss &lt;- bind_rows(<\/p>\n<p>find_cluster_numbers(sample4, &#8220;A4&#8221;),<\/p>\n<p>find_cluster_numbers(sample5, &#8220;A5&#8221;),<\/p>\n<p>find_cluster_numbers(sample10, &#8220;A10&#8221;),<\/p>\n<p>find_cluster_numbers(sample12, &#8220;A12&#8221;)<\/p>\n<p>)<\/p>\n<p>colnames(ss) &lt;- &#8220;spots&#8221;<\/p>\n<p># \u521b\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\u6765\u4fdd\u5b58\u7ed3\u679c<\/p>\n<p>folder &lt;- file.path(save_dir, &#8220;ligand_receptor&#8221;)<\/p>\n<p>dir.create(folder, showWarnings = FALSE)<\/p>\n<p>file_name &lt;- file.path(folder, &#8220;ligand_receptor_node_attribute.csv&#8221;)<\/p>\n<p>write.csv(ss, file_name)<\/p>\n<p>\u4e0b\u56fe\u662f\u6211\u4eec\u805a\u7c7b\u4e4b\u540e\u7684\u7ec6\u80de\u7c07\u5206\u5e03\u6570\u636e\uff0c\u6587\u4ef6\u5b58\u50a8\u4e86\u6bcf\u4e2a\u7ec6\u80de\u7c07\u7684\u8282\u70b9\u5c5e\u6027\uff0c\u5176\u4e2d\u7b2c\u4e00\u5217\u662f\u7ec6\u80de\u7c07\u7684\u540d\u79f0\uff0c\u800c\u7b2c\u4e8c\u5217\u662f\u7ec6\u80de\u7c07\u4e2d\u7684\u7ec6\u80de\u6570\u3002\u6211\u4eec\u4ee5\u7b2c\u4e00\u4e2a\u6837\u672c\u4e3a\u4f8b\uff0c\u67098\u4e2a\u7ec6\u80de\u7c07\uff0c\u5206\u522b\u547d\u540d\u4e3aA4_c0\u5230A4_c7\uff0c\u5176\u4e2d\u7684\u7ec6\u80de\u6570\u4ece27\u5230240\u4e0d\u7b49\uff0c\u8fd9\u4e3a\u6211\u4eec\u540e\u7eed\u7684MIA\u5206\u6790\u6253\u4e0b\u4e86\u57fa\u7840\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"732\" class=\"wp-image-27781\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-3.png?resize=640%2C732\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-3.png?w=791 791w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-3.png?resize=262%2C300 262w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-3.png?resize=768%2C879 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-3.png?resize=600%2C686 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>ligand_receptor_node_attribute.csv<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff0c\u5c06Seurat\u5bf9\u8c61\u4e2d\u7684\u805a\u7c7b\u7ed3\u679c\u6620\u5c04\u5230\u7ec6\u80de\u7684\u7a7a\u95f4\u4f4d\u7f6e\u4e2d<\/p>\n<p>Seurat\u5305\u662f\u8fdb\u884c\u751f\u4fe1\u5206\u6790\u975e\u5e38\u91cd\u8981\u7684\u5de5\u5177\uff0c\u5c0f\u679c\u5728\u4e4b\u524d\u7684\u6587\u7ae0\u4e2d\u5df2\u7ecf\u548c\u5927\u5bb6\u4ecb\u7ecd\u8fc7Seurat\u7684\u8be6\u7ec6\u4f7f\u7528\u65b9\u6cd5\u4e86\uff0c\u5c0f\u4f19\u4f34\u4eec\u5982\u679c\u6709\u9700\u8981\uff0c\u53ef\u4ee5\u5173\u6ce8\u516c\u4f17\u53f7\u8fdb\u884c\u641c\u7d22\u54e6\u3002<\/p>\n<p>#\u5bfc\u5165\u5305<\/p>\n<p>library(ggplotify)<\/p>\n<p>library(ggplot2)<\/p>\n<p>library(magick)<\/p>\n<p>library(scales)<\/p>\n<p>library(imager)<\/p>\n<p>save_dir = &#8216;\/results&#8217;<\/p>\n<p>image_dir = &#8216;\/data\/images&#8217;<\/p>\n<p>fnm = paste0(save_dir,&#8217;\/seurat_object.RData&#8217;)<\/p>\n<p>load(fnm)<\/p>\n<p>#\u7ed8\u5236\u65e0\u80cc\u666f\u7684\u805a\u7c7b\u7ed3\u679c<\/p>\n<p>plot_clu_nbg &lt;- function(SID,SOE,d,topleft,adjust_x,adjust_y,delta_x,delta_y,im){<\/p>\n<p>tmp = SOE@meta.data$seurat_cluster<\/p>\n<p>Nclu = length(levels(tmp))<\/p>\n<p>nspots = length(tmp)<\/p>\n<p>colorcode = hue_pal()(Nclu)<\/p>\n<p>colorcode = c(&#8216;orange&#8217;,&#8217;green&#8217;,&#8217;blue&#8217;,&#8217;red&#8217;,&#8217;cyan&#8217;,&#8217;magenta&#8217;,&#8217;yellow&#8217;,&#8217;brown&#8217;)<\/p>\n<p>mycols &lt;- c(rep(NA,length(tmp)))<\/p>\n<p>for (i in seq(1,nspots)){<\/p>\n<p>mycols[i] = colorcode[tmp[i]]<\/p>\n<p>}<\/p>\n<p>filenm = paste0(folder,&#8217;\/A&#8217;,SID,&#8217;noBG.png&#8217;)<\/p>\n<p>png(filenm, width = 512, height = 512)<\/p>\n<p>par(mar = c(0,0,0,0)) # set zero margins on all 4 sides<\/p>\n<p>plot(x = NULL, y = NULL, xlim = c(0,dim(im)[1]), ylim = c(0,dim(im)[2]), pch = &#8221;,<\/p>\n<p>xaxt = &#8216;n&#8217;, yaxt = &#8216;n&#8217;, xlab = &#8221;, ylab = &#8221;, xaxs = &#8216;i&#8217;, yaxs = &#8216;i&#8217;,<\/p>\n<p>bty = &#8216;n&#8217;) # plot empty figure<\/p>\n<p># rasterImage(im, xleft = 0, ybottom = 0, xright = dim(im)[1], ytop = dim(im)[2])<\/p>\n<p>#\u89e3\u9664\u672c\u884c\u6ce8\u91ca\u5373\u53ef\u7ed8\u5236\u6709\u80cc\u666f\u7684\u805a\u7c7b\u56fe<\/p>\n<p>points(topleft[1]+(d[,1]-1)*delta_x+apply(d,1,function(x){return(adjust_x(x[2]))}),<\/p>\n<p>topleft[2]-(d[,2]-1)*delta_y+apply(d,1,function(x){return(adjust_y(x[1]))}),<\/p>\n<p>col=mycols,pch=20,cex=2.8)<\/p>\n<p>dev.off()<\/p>\n<p>}<\/p>\n<p>#\u7ed8\u5236\u6bcf\u4e2a\u6837\u672c\u7684\u7c07\u56fe<\/p>\n<p>plot_clu &lt;- function(SID, SOE, d, topleft, adjust_x, adjust_y, delta_x, delta_y, im) {<\/p>\n<p>tmp &lt;- SOE@meta.data$seurat_cluster<\/p>\n<p>colorcode &lt;- c(&#8216;orange&#8217;,&#8217;green&#8217;,&#8217;blue&#8217;,&#8217;red&#8217;,&#8217;cyan&#8217;,&#8217;magenta&#8217;,&#8217;yellow&#8217;,&#8217;brown&#8217;)<\/p>\n<p>df &lt;- data.frame(<\/p>\n<p>x = topleft[1] + (d[, 1] &#8211; 1) * delta_x + apply(d, 1, function(x) adjust_x(x[2])),<\/p>\n<p>y = topleft[2] &#8211; (d[, 2] &#8211; 1) * delta_y + apply(d, 1, function(x) adjust_y(x[1])),<\/p>\n<p>col = colorcode[tmp]<\/p>\n<p>)<\/p>\n<p>filenm &lt;- file.path(folder, paste0(&#8220;A&#8221;, SID, &#8220;.png&#8221;))<\/p>\n<p>ggplot(df, aes(x, y, color = col)) +<\/p>\n<p>annotation_raster(im, xmin = 0, xmax = dim(im)[1], ymin = 0, ymax = dim(im)[2]) +<\/p>\n<p>geom_point(size = 1.7) +<\/p>\n<p>theme_void() +<\/p>\n<p>guides(color = FALSE) +<\/p>\n<p>ggsave(filenm, width = 512, height = 512, units = &#8220;px&#8221;)<\/p>\n<p>}<\/p>\n<p># \u8bfb\u53d6\u56fe\u50cf\u6587\u4ef6<\/p>\n<p>fnm &lt;- file.path(image_dir, &#8220;Sample_4_ds.jpg&#8221;)<\/p>\n<p>im &lt;- image_read(fnm)<\/p>\n<p># \u5c06\u56fe\u50cf\u8f6c\u6362\u4e3aggplot\u5bf9\u8c61<\/p>\n<p>p &lt;- as.ggplot(im)<\/p>\n<p># \u4f7f\u7528ggplot2\u7684\u529f\u80fd\u6765\u4fee\u6539\u56fe\u50cf<\/p>\n<p>p + ggtitle(&#8220;Sample 4&#8221;) + theme(plot.title = element_text(hjust = 0.5))<\/p>\n<p>#\u5c06\u6240\u6709\u805a\u7c7b\u5f97\u5230\u7684\u7c07\u7ed8\u5236\u5728\u80cc\u666f\u4e0a<\/p>\n<p>plot_clu(SID,SOE,d,topleft,adjust_x,adjust_y,delta_x,delta_y,im)<\/p>\n<p>plot_clu_nbg(SID,SOE,d,topleft,adjust_x,adjust_y,delta_x,delta_y,im)<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"501\" height=\"464\" class=\"wp-image-27782\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-4.jpeg?resize=501%2C464\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-4.jpeg?w=501 501w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-4.jpeg?resize=300%2C278 300w\" sizes=\"(max-width: 501px) 100vw, 501px\" data-recalc-dims=\"1\" \/> <img decoding=\"async\" loading=\"lazy\" width=\"512\" height=\"512\" class=\"wp-image-27783\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-5.png?resize=512%2C512\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-5.png?w=512 512w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-5.png?resize=300%2C300 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-5.png?resize=150%2C150 150w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-5.png?resize=100%2C100 100w\" sizes=\"(max-width: 512px) 100vw, 512px\" data-recalc-dims=\"1\" \/><\/p>\n<p>A4.png<\/p>\n<p>A4noBG.png<\/p>\n<p>\u5982\u56fe\uff0c\u6211\u4eec\u5c06\u6765\u81ea\u5375\u5de2\u764c\u60a3\u8005\u6837\u672c\u7684\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u6570\u636e\u4e0e\u516c\u5f00\u53ef\u7528\u7684\u5355\u7ec6\u80deRNA\u6d4b\u5e8f\u6570\u636e\u8fdb\u884c\u4e86\u6574\u5408\u3002\u5e76\u5c06\u6bcf\u4e2a\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u7ec4\u7ec7\u51b7\u51bb\u5207\u7247\u90fd\u5b89\u88c5\u5728\u4e00\u4e2a\u7a7a\u95f4\u7f16\u7801\u7684\u5fae\u9635\u5217\u4e0a\u3002\u5fae\u9635\u5217\u4e0a\u7684\u6591\u70b9\u6839\u636e\u591a\u4e2a\u533a\u57df\u7684\u57fa\u56e0\u8868\u8fbe\u8fdb\u884c\u4e86\u6d4b\u5e8f\u548c\u805a\u7c7b\u3002\u5355\u7ec6\u80deRNA\u6d4b\u5e8f\u6570\u636e\u4e5f\u8fdb\u884c\u4e86\u805a\u7c7b\uff0c\u751f\u6210\u4e86\u591a\u79cd\u7ec6\u80de\u7c7b\u578b\u53ca\u5176\u7279\u5f02\u6027\u57fa\u56e0\u96c6\u3002<\/p>\n<p>\u901a\u8fc7\u8fd9\u4e00\u6b65\u6620\u5c04\uff0c\u5c31\u53ef\u4ee5\u6e05\u6670\u7684\u5229\u7528\u4e0d\u540c\u7684\u989c\u8272\u533a\u5206\u7279\u5f02\u7684\u57fa\u56e0\u96c6\u4e86\uff0c\u800c\u4e14\u7ed8\u5236\u51fa\u7684\u56fe\u7247\u4e5f\u662f\u975e\u5e38\u6709\u5bf9\u7167\u7279\u6027\u7684\u3002<\/p>\n<p>\u7b2c\u4e09\u6b65\uff0c\u8bbe\u5b9ascRNA\u7684\u7279\u5f81\u57fa\u56e0<\/p>\n<p>#\u5bfc\u5165\u5305<\/p>\n<p>library(ComplexHeatmap)<\/p>\n<p>library(stringr)<\/p>\n<p>library(RColorBrewer)<\/p>\n<p>data_dir = &#8216;\/data\/scRNAseq_data&#8217;<\/p>\n<p>save_dir = &#8216;\/results&#8217;<\/p>\n<p>folder = paste0(save_dir,&#8217;\/scRNAseq&#8217;)<\/p>\n<p>if (!file.exists(folder)){<\/p>\n<p>dir.create(folder)<\/p>\n<p>}<\/p>\n<p>#\u4ece scRNAseq Shih et al PLoS ONE 13(11): e0206785\u4e0b\u8f7d\u6570\u636e<\/p>\n<p>library(purrr)<\/p>\n<p># \u8bfb\u53d6\uff0c\u8f6c\u7f6e\u6570\u636e<\/p>\n<p>read_transpose &lt;- function(file) {<\/p>\n<p>data &lt;- read.csv(gzfile(file), check.names = FALSE)<\/p>\n<p>data &lt;- t(data)<\/p>\n<p>colnames(data) &lt;- data[1, ]<\/p>\n<p>data &lt;- data[-1, ]<\/p>\n<p>class(data) &lt;- &#8220;numeric&#8221;<\/p>\n<p>data<\/p>\n<p>}<\/p>\n<p>HG &lt;- c(<\/p>\n<p>&#8220;GSM3348305_589_Omentum_S1.counts.umiCounts.aboveBackground.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348309_TB10040580_S1.counts.umiCounts.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348310_TB10040580met_S1_1_.counts.umiCounts.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348311_TB10040589_4_S1.counts.umiCounts.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348312_TB10040589met_S1.counts.umiCounts.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348313_TB10040600_CD31_S1.counts.umiCounts.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348314_TB10040600_NP-1_S1.counts.umiCounts.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348315_TB10040600_NP-2_S1.counts.umiCounts.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348316_TB10040600_Tumor_S1.counts.umiCounts.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348319_V00331081_Primary_S1.counts.umiCounts.aboveBackground.table.csv.gz&#8221;,<\/p>\n<p>&#8220;GSM3348320_V00331151_Metastatic_S1.counts.umiCounts.aboveBackground.table.csv.gz&#8221;<\/p>\n<p>)<\/p>\n<p>#\u8bbe\u7f6e\u5de5\u4f5c\u76ee\u5f55<\/p>\n<p>setwd(file.path(data_dir, &#8220;GSE118828_RAW&#8221;))<\/p>\n<p>data &lt;- map_dfr(HG, read_transpose, .id = &#8220;file&#8221;)<\/p>\n<p>#\u5c06\u6570\u636e\u52a0\u8f7d\u5230 Seurat\u3001Clustering\u3001Cluster Annotation \u4e2d<\/p>\n<p>#tmp.index = grep(&#8220;_&#8221;,rownames(data))<\/p>\n<p>#rownames(data)[tmp.index] = lapply(rownames(data)[tmp.index],str_replace,pattern=&#8221;_&#8221;,replacement=&#8221;-&#8220;)<\/p>\n<p>D13_data &lt;- CreateSeuratObject(counts = data, project = &#8220;HGSOC&#8221;, min.cells = 3, min.features = 200)<\/p>\n<p>D13_data[[&#8220;percent.mt&#8221;]] &lt;- PercentageFeatureSet(D13_data, pattern = &#8220;^mt-&#8220;)<\/p>\n<p>VlnPlot(D13_data, features = c(&#8220;nFeature_RNA&#8221;, &#8220;nCount_RNA&#8221;, &#8220;percent.mt&#8221;), ncol = 3)<\/p>\n<p>D13_data &lt;- subset(D13_data, subset = nFeature_RNA &gt; 500 &amp; nFeature_RNA &lt; 10000 &amp; percent.mt &lt; 25)<\/p>\n<p>D13_data &lt;- NormalizeData(D13_data, normalization.method = &#8220;LogNormalize&#8221;, scale.factor = 10000)<\/p>\n<p>D13_data &lt;- FindVariableFeatures(D13_data, selection.method = &#8220;vst&#8221;, nfeatures = 3000)<\/p>\n<p>#\u4e3a\u6240\u6709\u7c07\u7ed8\u5236\u70ed\u56fe\u5e76\u8fdb\u884c\u8d28\u91cf\u63a7\u5236<\/p>\n<p>data0 &lt;- D13_data@assays$RNA@counts<\/p>\n<p>D13_data &lt;- CreateSeuratObject(counts = data0, min.cells = 3, min.features = 200)<\/p>\n<p>D13_data &lt;- NormalizeData(D13_data)<\/p>\n<p>D13_data &lt;- FindVariableFeatures(D13_data, selection.method = &#8220;vst&#8221;, nfeatures = 2000)<\/p>\n<p>VizDimLoadings(D13_data, dims = 1:4, reduction = &#8220;pca&#8221;)<\/p>\n<p>D13_data &lt;- RunPCA(D13_data)<\/p>\n<p>ElbowPlot(D13_data)<\/p>\n<p># \u5bfb\u627e\u76f8\u90bb\u7ec6\u80de<\/p>\n<p>D13_data &lt;- FindNeighbors(D13_data, dims = 1:10)<\/p>\n<p># \u5bfb\u627e\u7ec6\u80de\u7c07<\/p>\n<p>D13_data &lt;- FindClusters(D13_data, resolution = 0.5)<\/p>\n<p># \u8fd0\u884cUMAP<\/p>\n<p>D13_data &lt;- RunUMAP(D13_data, dims = 1:10)<\/p>\n<p># \u53ef\u89c6\u5316UMAP\u7ed3\u679c<\/p>\n<p>DimPlot(D13_data, reduction = &#8220;umap&#8221;, pt.size = 0.5)<\/p>\n<p>ctypes &lt;- c(&#8220;Ep_1&#8221;, &#8220;FB_1&#8221;, &#8220;T&#8221;, &#8220;Ep_2&#8221;, &#8220;Myeloid&#8221;, &#8220;Ep_3&#8221;, &#8220;FB_2&#8221;, &#8220;Ep_4&#8221;, &#8220;Endothelial&#8221;, &#8220;B&#8221;, &#8220;FB_3&#8221;)<\/p>\n<p>D13_data$ctypes &lt;- factor(ctypes[D13_data$seurat_clusters])<\/p>\n<p>Idents(D13_data) &lt;- &#8220;ctypes&#8221;<\/p>\n<p>DimPlot(D13_data, reduction = &#8220;umap&#8221;, pt.size = 0.5)<\/p>\n<p>D13_data.markers &lt;- FindAllMarkers(D13_data, only.pos = TRUE, min.pct = 0.25, logfc.threshold = 0.25)<\/p>\n<p>D13_data.markers &lt;- D13_data.markers[D13_data.markers$p_val &lt; 10^(-5), ]<\/p>\n<p>D13_data.markers$cell_type &lt;- ctypes[D13_data.markers$cluster]<\/p>\n<p>fnm &lt;- file.path(folder, &#8220;scRNAseq_differentially_expressed_genes_shih_2018_annotated.xls&#8221;)<\/p>\n<p>write.table(D13_data.markers, fnm, quote = FALSE, sep = &#8220;\\t&#8221;, row.names = FALSE)<\/p>\n<p>#\u4e3a\u6240\u6709\u7c07\u7ed8\u5236\u70ed\u56fe<\/p>\n<p>Tc.averages &lt;- AverageExpression(Tc, return.seurat=TRUE)<\/p>\n<p>temp = Tc.averages@assays$RNA@scale.data<\/p>\n<p>fnm = paste0(folder,&#8217;\/scRNAseq_differentially_expressed_genes_shih_2018.xls&#8217;)<\/p>\n<p>DE = read.table(fnm,header = TRUE, stringsAsFactors = F, check.names=F)<\/p>\n<p>top15 &lt;- DE %&gt;% group_by(cluster) %&gt;% top_n(n = 15, wt = avg_logFC)<\/p>\n<p># DE = DE[DE$avg_logFC&gt;1.8,]<\/p>\n<p>genelist = top15$gene<\/p>\n<p># genelist = DE$gene<\/p>\n<p>temp = temp[genelist,]<\/p>\n<p>my_palette &lt;- c(&#8220;black&#8221;, &#8220;white&#8221;, &#8220;brown&#8221;)<\/p>\n<p>data &lt;- data.matrix(temp)<\/p>\n<p>ht &lt;- Heatmap(data,<\/p>\n<p>name = &#8220;scaled value&#8221;,<\/p>\n<p>cluster_rows = FALSE,<\/p>\n<p>cluster_columns = FALSE,<\/p>\n<p>show_row_names = FALSE,<\/p>\n<p>show_column_names = TRUE,<\/p>\n<p>column_names_rot = 60,<\/p>\n<p>col = my_palette,<\/p>\n<p>heatmap_legend_param = list(title_position = &#8220;topleft&#8221;, legend_width = unit(4, &#8220;cm&#8221;))<\/p>\n<p>)<\/p>\n<p># \u4fdd\u5b58\u70ed\u56fe\u4e3apdf\u6587\u4ef6<\/p>\n<p>filename &lt;- file.path(folder, &#8220;scRNAseq differentially expresssed genes.pdf&#8221;)<\/p>\n<p>pdf(filename, 8, 8)<\/p>\n<p>draw(ht)<\/p>\n<p>dev.off()<\/p>\n<p>\u5982\u56fe\u6240\u793a\uff0c\u662f\u5c0f\u679c\u7ed8\u5236\u7684\u7ec6\u80de\u7c7b\u578b\u7279\u5f02\u6027\u57fa\u56e0\u96c6\uff0c\u7528\u4e8e\u5c55\u793a\u591a\u4e2a\u53d8\u91cf\u4e4b\u95f4\u7684\u5173\u7cfb\u3002\u5176\u4e2d\u7684\u7ea2\u8272\u4ee3\u8868\u8f83\u9ad8\u7684\u6bd4\u4f8b\u6570\u503c\uff0c\u767d\u8272\u4ee3\u8868\u4e2d\u7b49\u6570\u503c\uff0c\u7070\u8272\u4ee3\u8868\u8f83\u4f4e\u7684\u6570\u503c\u3002\u4e0b\u65b9\u7684\u6807\u7b7e\uff08T,B, Myeloid,Ep_1\u7b49\u7b49\uff09\u8868\u793a\u7684\u662f\u4e0d\u540c\u7684\u7ec6\u80de\u7c7b\u578b\u6216\u4e9a\u7fa4\uff0c\u53ea\u662f\u8fdb\u884cMIA\u5206\u6790\u6240\u5fc5\u9700\u7684\u6570\u636e\u3002\u800c\u53f3\u4fa7\u7684\u6807\u7b7e\uff08\u5982CD81, \uff2d\uff33\uff381\u7b49\uff09\u8868\u793a\u7684\u662f\u9009\u5b9a\u7684scRNA\u3002\u7ea2\u8272\u533a\u57df\u8868\u793a\u7ec6\u80de\u4e9a\u7fa4\u548cscRNA\u4e4b\u95f4\u5b58\u5728\u8f83\u5f3a\u7684\u76f8\u5173\u6027\u6216\u76f8\u4e92\u4f5c\u7528\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u56fe\u4e2d\u7684T\u7ec6\u80de\u548cB\u7ec6\u80de\u5206\u522b\u5728CD3D\u548cCD83\u57fa\u56e0\u4e0a\u6709\u8f83\u9ad8\u7684\u8868\u8fbe\uff0c\u800cEP 1-1\u7ec6\u80de\u548cEP 1-2\u7ec6\u80de\u5728ATHL1\u57fa\u56e0\u4e0a\u6709\u8f83\u9ad8\u7684\u8868\u8fbe\uff0c\u8fdb\u800c\u53cd\u6620\u4e86\u4e0d\u540c\u7ec6\u80de\u7c7b\u578b\u6216\u4e9a\u7fa4\u7684\u7279\u5f81\u548c\u529f\u80fd\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u975e\u5e38\u660e\u663e\u7684\u770b\u5230\u764c\u75c7\u75c5\u4eba\u7684\u7279\u5f02\u7684scRNA\u4e86\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"567\" height=\"650\" class=\"wp-image-27784\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-6.png?resize=567%2C650\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-6.png?w=567 567w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-6.png?resize=262%2C300 262w\" sizes=\"(max-width: 567px) 100vw, 567px\" data-recalc-dims=\"1\" \/><\/p>\n<p>ScRNA\u7279\u5f81\u57fa\u56e0\u7684DEG<\/p>\n<p>\u7b2c\u56db\u6b65\uff0cMIA\u5206\u6790<\/p>\n<p>\u63a5\u4e0b\u6765\u662f\u5c0f\u679c\u671f\u5f85\u5df2\u4e45\u7684MIA\u5206\u6790\uff01<\/p>\n<p>#\u5bfc\u5165\u5305<\/p>\n<p>library(tidyverse)<\/p>\n<p>save_dir = &#8216;\/results&#8217;<\/p>\n<p>fnm = paste0(save_dir,&#8217;\/seurat_object.RData&#8217;)<\/p>\n<p>load(fnm)<\/p>\n<p>folder = paste0(save_dir,&#8217;\/MIA&#8217;)<\/p>\n<p>if (!file.exists(folder)){<\/p>\n<p>dir.create(folder)<\/p>\n<p>}<\/p>\n<p>##1.\u4ece PLoS One. 2018; 13(11): e0206785 \u4e2d\u52a0\u8f7d scRNAseq \u7684 DEG\uff08\u5dee\u5f02\u8868\u8fbe\u57fa\u56e0\uff09<\/p>\n<p>load_scRNA_DEG &lt;- function(){<\/p>\n<p>fnm = paste0(save_dir,&#8217;\/scRNAseq\/scRNAseq_differentially_expressed_genes_shih_2018.xls&#8217;)<\/p>\n<p>tmp1 = read.table(fnm,header = TRUE, stringsAsFactors = F, check.names=F)<\/p>\n<p>scRNA = tmp1[tmp1$p_val&lt;10^(-5),]<\/p>\n<p>clusters = unique(scRNA$cluster)<\/p>\n<p>n_sc = length(clusters)<\/p>\n<p>scgenelist = list()<\/p>\n<p>for (i in seq(1,n_sc)){<\/p>\n<p>scgenelist[i] = list(scRNA[scRNA$cluster==clusters[i],&#8221;gene&#8221;])<\/p>\n<p>}<\/p>\n<p>return(scgenelist)<\/p>\n<p>}<\/p>\n<p>##2.\u52a0\u8f7d ST \u6570\u636e\u7684 DEG\uff08\u5dee\u5f02\u8868\u8fbe\u57fa\u56e0\uff09<\/p>\n<p>load_ST_DEG &lt;- function(SOE){<\/p>\n<p>tmp = SOE@meta.data$seurat_clusters<\/p>\n<p>n_st = nlevels(tmp)<\/p>\n<p>stgenelist = list()<\/p>\n<p>for (i in seq(0,n_st-1,by = 1)){<\/p>\n<p>tmp_marker &lt;- FindMarkers(SOE, ident.1 = i, min.pct = 0.25)<\/p>\n<p>tmp_marker$gene &lt;- rownames(tmp_marker)<\/p>\n<p>tmp_mk &lt;- tmp_marker %&gt;% select(gene, everything())<\/p>\n<p>tmp_mk &lt;- tmp_mk[order(-tmp_mk$avg_logFC),]<\/p>\n<p>tmp_mk &lt;- tmp_mk[tmp_mk$p_val&lt;0.01,]<\/p>\n<p>tmp_mk &lt;- tmp_mk[tmp_mk$avg_logFC&gt;0,]<\/p>\n<p>stgenelist[i+1] = list(tmp_mk$gene)<\/p>\n<p>}<\/p>\n<p>return(stgenelist)<\/p>\n<p>}<\/p>\n<p>##3.\u8ba1\u7b97 MIA\uff08\u591a\u6a21\u6001\u4ea4\u53c9\u5206\u6790\uff09<\/p>\n<p># \u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u6765\u8ba1\u7b97MIA\u503c<\/p>\n<p>compute_MIA &lt;- function(scgenelist, stgenelist, SOE, SID) {<\/p>\n<p>N_tot &lt;- SOE@assays$RNA@counts@Dim[1]<\/p>\n<p>MIA &lt;- matrix(0, nrow = length(scgenelist), ncol = length(stgenelist))<\/p>\n<p>MIA &lt;- apply(MIA, c(1, 2), function(i, j) {<\/p>\n<p># \u83b7\u53d6scRNA\u548cST\u7684\u57fa\u56e0\u6570<\/p>\n<p>N_scRNA &lt;- length(scgenelist[[i]])<\/p>\n<p>N_ST &lt;- length(stgenelist[[j]])<\/p>\n<p># \u83b7\u53d6\u4ea4\u96c6\u7684\u57fa\u56e0\u6570<\/p>\n<p>N_intersect &lt;- length(intersect(scgenelist[[i]], stgenelist[[j]]))<\/p>\n<p># \u8ba1\u7b97\u8d85\u51e0\u4f55\u5206\u5e03\u7684\u6982\u7387<\/p>\n<p>P &lt;- phyper(N_intersect, N_scRNA, N_tot &#8211; N_scRNA, N_ST, lower.tail = FALSE, log.p = FALSE)<\/p>\n<p># \u8ba1\u7b97MIA\u503c<\/p>\n<p>MIA_enrich &lt;- -log10(P)<\/p>\n<p>MIA_deplete &lt;- -log10(1 &#8211; P)<\/p>\n<p>if (MIA_enrich &gt;= MIA_deplete) {<\/p>\n<p>MIA_enrich<\/p>\n<p>} else {<\/p>\n<p>-MIA_deplete<\/p>\n<p>}<\/p>\n<p>})<\/p>\n<p>MIA &lt;- data.frame(MIA)<\/p>\n<p>rownames(MIA) &lt;- c(&#8220;Ep_1&#8221;, &#8220;FB_1&#8221;, &#8220;T&#8221;, &#8220;Ep_2&#8221;, &#8220;Myeloid&#8221;, &#8220;Ep_3&#8221;, &#8220;FB_2&#8221;, &#8220;Ep_4&#8221;, &#8220;Endothelial&#8221;, &#8220;B&#8221;, &#8220;FB_3&#8221;)<\/p>\n<p>colnames(MIA) &lt;- levels(SOE@meta.data$seurat_clusters)<\/p>\n<p># \u4fdd\u5b58\u7ed3\u679c<\/p>\n<p>fnm &lt;- paste0(folder, &#8220;\/&#8221;, SID, &#8220;.xls&#8221;)<\/p>\n<p>MIA &lt;- format(MIA, digits = 3)<\/p>\n<p>write.table(MIA, fnm, quote = FALSE, sep = &#8220;\\t&#8221;, col.names = NA)<\/p>\n<p>}<\/p>\n<p>scgenelist &lt;- load_scRNA_DEG()<\/p>\n<p>SOE &lt;- sample4<\/p>\n<p>SID &lt;- &#8220;A4&#8221;<\/p>\n<p>stgenelist &lt;- load_ST_DEG(SOE)<\/p>\n<p>compute_MIA(scgenelist, stgenelist, SOE, SID)<\/p>\n<p>##4.\u7ed8\u5236MIA\u7684\u70ed\u56fe<\/p>\n<p>load_MIA &lt;- function(SID){<\/p>\n<p>fnm = paste0(folder,&#8217;\/&#8217;,SID,&#8217;.xls&#8217;)<\/p>\n<p>temp1 = read.table(fnm,header = TRUE, stringsAsFactors = F, check.names=F)<\/p>\n<p>cnames = colnames(temp1)<\/p>\n<p>cnames1 = paste0(SID,&#8217;_c&#8217;,cnames)<\/p>\n<p>colnames(temp1) = cnames1<\/p>\n<p>return(temp1)<\/p>\n<p>}<\/p>\n<p>#\u5408\u5e76\u4e0d\u540c\u7684\u7c07<\/p>\n<p>temp = load_MIA(&#8216;A4&#8217;)<\/p>\n<p>for (id in c(&#8216;A5&#8242;,&#8217;A10&#8242;,&#8217;A12&#8217;)){<\/p>\n<p>temp1 = load_MIA(id)<\/p>\n<p>temp = merge(temp,temp1,by = 0)<\/p>\n<p>rownames(temp) = temp[,1]<\/p>\n<p>temp = temp[,-1]<\/p>\n<p>}<\/p>\n<p>#\u7ed8\u5236\u70ed\u56fe<\/p>\n<p>my_palette &lt;- c(&#8220;red&#8221;, &#8220;black&#8221;, &#8220;cyan&#8221;)<\/p>\n<p>data &lt;- data.matrix(temp)<\/p>\n<p>data[data &gt; 40] &lt;- 40<\/p>\n<p>filename &lt;- file.path(folder, &#8220;MIA_heatmap.pdf&#8221;)<\/p>\n<p>#\u4f7f\u7528pheatmap\u7ed8\u5236\u5e76\u4fdd\u5b58\u70ed\u56fe<\/p>\n<p>pheatmap(data,<\/p>\n<p>filename = filename,<\/p>\n<p>cluster_rows = FALSE,<\/p>\n<p>cluster_cols = FALSE,<\/p>\n<p>color = my_palette,<\/p>\n<p>legend = TRUE,<\/p>\n<p>legend_breaks = seq(0, 40, by = 5),<\/p>\n<p>legend_labels = c(&#8220;0&#8221;, &#8220;5&#8221;, &#8220;10&#8221;, &#8220;15&#8221;, &#8220;20&#8221;, &#8220;25&#8221;, &#8220;30&#8221;, &#8220;35&#8221;, &#8220;40&#8221;),<\/p>\n<p>cellwidth = 10,<\/p>\n<p>cellheight = 6,<\/p>\n<p>fontsize = 10,<\/p>\n<p>fontsize_row = 10,<\/p>\n<p>fontsize_col = 10,<\/p>\n<p>angle_col = 90,<\/p>\n<p>main = &#8220;P value (-log10)&#8221;,<\/p>\n<p>xlab = &#8220;ST clusters&#8221;<\/p>\n<p>\uff09<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"386\" class=\"wp-image-27785\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-7.png?resize=640%2C386\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-7.png?w=1436 1436w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-7.png?resize=300%2C181 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-7.png?resize=1024%2C617 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-7.png?resize=768%2C463 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-7.png?resize=600%2C361 600w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-27778-7.png?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>MIA\u5206\u6790\u70ed\u56fe<\/p>\n<p>\u5982\u56fe\u662f\u5c0f\u679c\u7ed8\u5236\u7684MIA\u56fe\uff0c\u8be5\u56fe\u663e\u793a\u4e86\u6240\u6709\u5355\u7ec6\u80deRNA\u6d4b\u5e8f\u8bc6\u522b\u7684\u7ec6\u80de\u7c7b\u578b\u548c\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u5b66\u5b9a\u4e49\u7684\u533a\u57df\uff0c\u5e76\u4e14\u8868\u793a\u4e86\u4e0d\u540cST\u96c6\u7fa4\u548c\u7ec6\u80de\u7c7b\u578b\u4e4b\u95f4\u7684P\u503c\u3002P\u503c\u662f\u7528\u4e8e\u8861\u91cf\u89c2\u5bdf\u5230\u7684\u6570\u636e\u4e0e\u5047\u8bbe\u4e4b\u95f4\u7684\u4e00\u81f4\u6027\u7684\u4e00\u4e2a\u68c0\u6d4b\u6807\u51c6\uff0cP\u503c\u8d8a\u5c0f\uff0c\u8868\u793a\u89c2\u5bdf\u5230\u7684\u6570\u636e\u4e0e\u5047\u8bbe\u4e4b\u95f4\u7684\u5dee\u5f02\u8d8a\u5927\u3002<\/p>\n<p>\u5728\u8fd9\u5e45\u56fe\u4e2d\uff0c\u7528\u989c\u8272\u6761\u6765\u8868\u793aP\u503c\u7684-log10\u8f6c\u6362\uff0c\u5176\u4e2d\u84dd\u8272\u8868\u793a\u8f83\u9ad8\u7684P\u503c\uff0c\u9ed1\u8272\u8868\u793a\u8f83\u4f4e\u7684P\u503c\u3002\u56fe\u4e2d\u7684\u84dd\u8272\u7684\u533a\u57df\u8868\u793aST\u96c6\u7fa4\u548c\u7ec6\u80de\u7c7b\u578b\u4e4b\u95f4\u6709\u663e\u8457\u7684\u5dee\u5f02\uff0c\u800c\u9ed1\u8272\u7684\u533a\u57df\u8868\u793aST\u96c6\u7fa4\u548c\u7ec6\u80de\u7c7b\u578b\u4e4b\u95f4\u6ca1\u6709\u663e\u8457\u7684\u5dee\u5f02\u3002\u4f8b\u5982Ep.2\u548cEp.3\u8fd9\u4e24\u79cd\u7ec6\u80de\u7c7b\u578b\u6709\u5f88\u9ad8\u7684P\u503c\uff0c\u8bf4\u660e\u5b83\u4eec\u4e0e\u5bf9\u7167\u7684\u6b63\u5e38\u7ec6\u80de\u4e4b\u95f4\u6709\u5f88\u5927\u7684\u5dee\u5f02\uff0c\u800c\u4e24\u4e2a\u6837\u672c\u4e4b\u95f4\u7684P\u503c\u53c8\u975e\u5e38\u76f8\u4f3c\uff0c\u8bf4\u660e\u8fd9\u4e24\u4e2a\u6837\u672c\u4e4b\u95f4\u5177\u6709\u8054\u7cfb\uff0c\u5f88\u53ef\u80fd\u662f\u6211\u4eec\u901a\u8fc7MIA\u5206\u6790\u8bc6\u522b\u51fa\u6765\u7684\u80bf\u7624\uff0c\u4e5f\u5c31\u662f\u80bf\u7624\u7c07\uff0c\u800cFB_1\u548cFB_2\u8fd9\u4e24\u79cd\u7ec6\u80de\u7c7b\u578b\u6709\u5f88\u4f4e\u7684P\u503c\uff0c\u8bf4\u660e\u5b83\u4eec\u548c\u6b63\u5e38\u7684\u7ec6\u80de\u7c7b\u578b\u4e4b\u95f4\u6ca1\u6709\u5f88\u5927\u7684\u5dee\u5f02\uff0c\u662f\u6b63\u5e38\u7ec6\u80de\uff0c\u4e5f\u5c31\u662f\u57fa\u8d28\u7c07\u3002\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u5c06\u80bf\u7624\u7ec6\u80de\u7684\u8054\u7cfb\u548c\u6b63\u5e38\u7684\u57fa\u8d28\u7ec6\u80de\u7684\u8054\u7cfb\u533a\u5206\u5f00\u6765\u4e86\u3002<\/p>\n<p>\u5c0f\u679c\u4eca\u5929\u7684\u5206\u4eab\u5c31\u5230\u8fd9\u91cc\u5566\uff0c\u5728\u672c\u6b21\u7684\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5b66\u4e60\u4e86\u4e00\u79cd\u65b0\u7684\u5bcc\u96c6\u5206\u6790\u65b9\u6cd5\u2014MIA\u5206\u6790\u5728\u764c\u75c7\u9886\u57df\u4e2d\u7684\u5e94\u7528\uff0c\u901a\u8fc7\u5bf9\u7ec6\u80de\u8fdb\u884c\u5bcc\u96c6\u5206\u6790\u8fdb\u800c\u201c\u62c6\u89e3\u201d\u7ec6\u80de\u7c7b\u578b\uff0c\u5bf9\u80bf\u7624\u7684\u7a7a\u95f4\u5f02\u8d28\u6027\u8fdb\u884c\u533a\u5206\uff0c\u8fd9\u4e5f\u662f\u764c\u75c7\u5206\u6790\u7684\u57fa\u7840\u3002\u5c0f\u4f19\u4f34\u4eec\u5982\u679c\u6ca1\u6709\u505a\u51fa\u6765\u56fe\u4e5f\u4e0d\u8981\u7070\u5fc3\uff0c\u53ef\u4ee5\u8bd5\u4e00\u8bd5\u6211\u4eec\u7684\u4e91\u751f\u4fe1\u5c0f\u5de5\u5177\u54df\uff0c\u53ea\u8981\u8f93\u5165\u5408\u9002\u7684\u6570\u636e\u5c31\u53ef\u4ee5\u76f4\u63a5\u7ed8\u5236\u60f3\u8981\u7684\u56fe\u5462\uff0c\u94fe\u63a5\uff1ahttp:\/\/www.biocloudservice.com\/home.html\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u968f\u7740\u764c\u75c7\u7684\u7a7a\u95f4\u8f6c\u5f55\u7ec4\u5206\u6790\u7684\u7206\u706b\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u80bf\u7624\u5b66TOP\u671f\u520a\u6536\u5f55\u4e86\u76f8\u5f53\u4e00\u90e8\u5206\u7684\u751f\u4fe1\u5206\u6790\u6587\u7ae0\uff0c\u5f88\u591a\u90fd\u5219\u7528\u5230\u4e86MIA [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","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\/27778"}],"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=27778"}],"version-history":[{"count":1,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/27778\/revisions"}],"predecessor-version":[{"id":27786,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/27778\/revisions\/27786"}],"wp:attachment":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27778"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}