{"id":30042,"date":"2024-02-27T18:08:44","date_gmt":"2024-02-27T10:08:44","guid":{"rendered":"http:\/\/www.biocloudservice.com\/wordpress\/?p=30042"},"modified":"2024-02-27T18:08:46","modified_gmt":"2024-02-27T10:08:46","slug":"pca%ef%bc%9a%e4%bd%a0%e7%9a%84%e5%8d%95%e7%bb%86%e8%83%9e%e6%95%b0%e6%8d%ae%e4%b8%bb%e6%88%90%e5%88%86%e5%88%86%e6%9e%90%e5%a4%a7%e5%b8%88","status":"publish","type":"post","link":"http:\/\/www.biocloudservice.com\/wordpress\/?p=30042","title":{"rendered":"PCA\uff1a\u4f60\u7684\u5355\u7ec6\u80de\u6570\u636e\u4e3b\u6210\u5206\u5206\u6790\u5927\u5e08"},"content":{"rendered":"<p><strong>PCA\uff1a\u4f60\u7684\u5355\u7ec6\u80de\u6570\u636e\u4e3b\u6210\u5206\u5206\u6790\u5927\u5e08<\/strong><\/p>\n<p>\u5728\u5904\u7406\u5355\u7ec6\u80de\u6d4b\u5e8f\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5982\u4f55\u5bf9\u6570\u636e\u77e9\u9635\u8fdb\u884c\u964d\u7ef4\u662f\u6211\u4eec\u201c\u5fc5\u7ecf\u201d\u7684\u6b65\u9aa4\u4e4b\u4e00\uff0c\u90a3\u4e48\u4f60\u77e5\u9053\u6700\u5e38\u7528\u7684\u6570\u636e\u964d\u7ef4\u65b9\u6cd5\u6709\u54ea\u4e9b\u561b\uff1f\u63a5\u4e0b\u6765\u5c0f\u679c\u5c06\u6559\u5927\u5bb6\u6700\u5e38\u7528\u7684\u6570\u636e\u964d\u7ef4\u65b9\u6cd5\uff0c\u4e00\u8d77\u6765\u548c\u5c0f\u679c\u770b\u770b\u5427\uff01<\/p>\n<ul>\n<li><strong>\u6570\u636e\u96c6\u51c6\u5907<\/strong><\/li>\n<\/ul>\n<p>library(scRNAseq)<br \/>\ndata(fluidigm)<br \/>\nfluidigm&lt;-ReprocessedFluidigmData()<br \/>\nct &lt;- floor(assays(fluidigm)$rsem_counts) #\u751f\u6210\u6570\u636e\u77e9\u9635<br \/>\nct[1:4,1:4]<br \/>\nsample_ann &lt;- as.data.frame(colData(fluidigm))<br \/>\nDT::datatable(sample_ann)<br \/>\nView(ct)<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"298\" class=\"wp-image-30043\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-108.png?resize=640%2C298\" alt=\"\u8868\u683c\n\n\u63cf\u8ff0\u5df2\u81ea\u52a8\u751f\u6210\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-108.png?w=1927 1927w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-108.png?resize=300%2C140 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-108.png?resize=1024%2C477 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-108.png?resize=768%2C357 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-108.png?resize=1536%2C715 1536w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-108.png?resize=600%2C279 600w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-108.png?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/> \u8fd8\u662f\u8001\u89c4\u77e9\uff0c\u548c\u5c0f\u679c\u7b80\u5355\u770b\u4e00\u4e0b\u6211\u4eec\u751f\u6210\u7684\u6570\u636e\u77e9\u9635\u5427\uff01<\/p>\n<ul>\n<li><strong>\u6570\u636e\u5904\u7406<\/strong><\/li>\n<\/ul>\n<p>\u56e0\u4e3a\u672c\u7bc7\u6559\u7a0b\u4e3b\u8981\u9488\u5bf9\u6570\u636e\u964d\u7ef4\u7684\u65b9\u6cd5\uff0c\u5c0f\u679c\u5728\u8fd9\u91cc\u5c31\u4e0d\u7ec6\u7ec6\u9610\u8ff0\u4e2d\u95f4\u5bf9\u6570\u636e\u5904\u7406\u7684\u8fc7\u7a0b\u5566\uff01\u5c0f\u679c\u628a\u6570\u636e\u5904\u7406\u7684\u4ee3\u7801\u8d34\u5728\u4e0b\u9762\u4f9b\u540c\u978b\u4eec\u53c2\u8003\uff0c\u5305\u62ec\u6570\u636e\u8fc7\u6ee4\u3001\u6570\u636e\u77eb\u6b63\u3002<\/p>\n<p>#\u6570\u636e\u8fc7\u6ee4<br \/>\nchose_gene= apply(counts,1,function(x) sum(x&gt;0) )&gt;0<br \/>\ntable(chose_gene)<br \/>\ncounts &lt;- counts[chose_gene,]<\/p>\n<p>#\u6570\u636e\u77eb\u6b63<br \/>\ndata &lt;- log2(edgeR::cpm(counts) +1)<\/p>\n<ul>\n<li><strong>\u6570\u636e\u964d\u7ef4\u5904\u7406<\/strong>\n<ul>\n<li><strong>\u6570\u636e\u964d\u7ef4\u6709\u54ea\u4e9b\u65b9\u6cd5\uff1f<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u5728\u8fdb\u884c\u5177\u4f53\u64cd\u4f5c\u4e4b\u524d\uff0c\u5c0f\u679c\u5148\u5411\u5927\u5bb6\u79d1\u666e\u4e00\u4e9b\u5e38\u7528\u7684\u6570\u636e\u964d\u7ef4\u65b9\u6cd5\u5427\uff01<\/p>\n<p>1.PCA\uff08\u4e3b\u6210\u5206\u5206\u6790\u6cd5\uff09<\/p>\n<p>2.MDS\uff08\u591a\u7ef4\u7f29\u653e\uff09<\/p>\n<p>3.t-SNE<\/p>\n<p>4.LLE\uff08\u5c40\u90e8\u7ebf\u5d4c\u5165\uff09<\/p>\n<ul>\n<li>\n<ul>\n<li><strong>\u4ec0\u4e48\u662fPCA\u4e3b\u6210\u5206\u5206\u6790\uff1f<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>PCA\uff08Principal Components Analysis\uff09\u3002\u5176\u5b9e\u5c31\u662f\u627e\u51fa\u5904\u7406\u6570\u636e\u4e2d\u4e00\u4e2a\u6700\u4e3b\u8981\u7684\u7279\u5f81\uff0c\u7136\u540e\u8fdb\u884c\u6df1\u5165\u5206\u6790\u3002\u5c0f\u679c\u6765\u7ed9\u5927\u5bb6\u4e3e\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\u7406\u89e3\u4e00\u4e0b\uff1a\u73b0\u5728\u8981\u8003\u5bdf\u516c\u53f8\u4e2d\u4e00\u4e2a\u5458\u5de5\u7684\u6574\u4f53\u80fd\u529b\u6c34\u5e73\uff0c\u6211\u4eec\u76ee\u524d\u7684\u53c2\u8003\u56e0\u7d20\u6709\u4ed6\u7684\u4e1a\u7ee9\u3001\u51fa\u52e4\u65f6\u95f4\u3001\u9ad8\u8003\u6210\u7ee9\u3001\u5de5\u8d44\u6c34\u5e73\u7b49\u7b49\u56e0\u7d20\uff0c\u90a3\u4e48\u6211\u4eec\u4e3a\u4e86\u66f4\u5feb\u901f\u5730\u505a\u51fa\u5224\u65ad\uff0c\u6211\u4eec\u53ea\u8981\u63d0\u53d6\u4ed6\u5730\u4e1a\u7ee9\u6765\u5206\u6790\u5373\u53ef\u3002<\/p>\n<ul>\n<li>\n<ul>\n<li><strong>R\u8bed\u8a00\u5b9e\u73b0PCA\u4e3b\u6210\u5206\u5206\u6790<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>install.packages(c(&#8220;FactoMineR&#8221;, &#8220;factoextra&#8221;)) #\u4e0b\u8f7dPCA()\u51fd\u6570\u6240\u9700\u5bfc\u5165\u7684R\u5305<br \/>\n#PCA\u964d\u7ef4<br \/>\ndat &lt;- data_back #\u5bfc\u5165\u4e0a\u9762\u5904\u7406\u540e\u7684\u77e9\u9635<br \/>\ndat &lt;- t(dat)<br \/>\ndat &lt;- as.data.frame(dat) #\u751f\u6210\u8868\u683c<br \/>\nplate &lt;- sample_ann$Biological_Condition # \u5b9a\u4e49\u5206\u7ec4\u4fe1\u606f<br \/>\ndat &lt;- cbind(dat,plate) #\u5408\u5e76\u5217<br \/>\ndat[1:4,1:4]<br \/>\ntable(dat$plate) #\u5206\u7ec4\u4fe1\u606f\u5c55\u793a<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"603\" height=\"130\" class=\"wp-image-30044\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-109.png?resize=603%2C130\" alt=\"\u6587\u672c\n\n\u4f4e\u53ef\u4fe1\u5ea6\u63cf\u8ff0\u5df2\u81ea\u52a8\u751f\u6210\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-109.png?w=603 603w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-109.png?resize=300%2C65 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-109.png?resize=600%2C129 600w\" sizes=\"(max-width: 603px) 100vw, 603px\" data-recalc-dims=\"1\" \/> \u73b0\u5728\u5c55\u793a\u7684\u662f\u6309\u7167Biological_Condition\u5bf9\u6570\u636e\u77e9\u9635\u5206\u7ec4\u540e\u7684\u7edf\u8ba1\u4fe1\u606f\u54e6\uff01<\/p>\n<p>library(FactoMineR)<br \/>\nlibrary(factoextra)<br \/>\ndat.pca &lt;- PCA(dat[,-ncol(dat)],graph = FALSE) #PCA\u964d\u7ef4\u5904\u7406<br \/>\nhead(dat.pca$ind$coord) #\u6bcf\u4e2a\u7ec6\u80de\u7684\u524d5\u4e2a\u4e3b\u6210\u5206\u53d6\u503c<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"338\" class=\"wp-image-30045\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-110.png?resize=640%2C338\" alt=\"\u6587\u672c\n\n\u63cf\u8ff0\u5df2\u81ea\u52a8\u751f\u6210\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-110.png?w=895 895w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-110.png?resize=300%2C159 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-110.png?resize=768%2C406 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-110.png?resize=600%2C317 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/> PCA\u51fd\u6570\u964d\u7ef4\u540e\uff0c\u5927\u5bb6\u548c\u5c0f\u679c\u5148\u4e00\u8d77\u6765\u770b\u4e0b\u6bcf\u4e2a\u7ec6\u80de\u4e2d\u524d5\u4e2a\u4e3b\u6210\u5206\u7684\u5206\u503c\u5427\uff01<\/p>\n<p>\u5f97\u5230\u4e86\u4ee5\u4e0a\u7684\u5206\u6790\u7ed3\u679c\uff0c\u6211\u4eec\u5982\u4f55\u5c06PCA\u5206\u6790\u540e\u7684\u7ed3\u679c\u53ef\u89c6\u5316\u5c55\u793a\u5462\uff0c\u548c\u5c0f\u679c\u4e00\u8d77\u6765\u5b66\u4e00\u4e0b\u5427\uff01<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"391\" class=\"wp-image-30046\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?resize=640%2C391\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?w=2500 2500w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?resize=300%2C183 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?resize=1024%2C625 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?resize=768%2C469 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?resize=1536%2C938 1536w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?resize=2048%2C1251 2048w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?resize=600%2C366 600w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?w=1280 1280w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/word-image-30042-4.png?w=1920 1920w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/> #PCA\u964d\u7ef4\u53ef\u89c6\u5316<br \/>\nfviz_pca_ind(<br \/>\ndat.pca,<br \/>\ngeom.ind = &#8220;point&#8221;,<br \/>\ncol.ind = dat$plate,<br \/>\naddEllipses = TRUE,<br \/>\nlegend.title = &#8220;Groups&#8221;<br \/>\n)<\/p>\n<p>\u597d\u5566\uff0c\u8fd8\u6709\u66f4\u591a\u7684\u6570\u636e\u964d\u7ef4\u65b9\u6cd5\u7b49\u7740\u5927\u5bb6\u53bb\u5b66\u4e60\u548c\u4f7f\u7528\uff0c\u540c\u5b66\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u60c5\u51b5\u81ea\u884c\u9009\u62e9\u53bb\u4e86\u89e3\uff0c\u5728\u8fd9\u91cc\u5927\u5bb6\u4e5f\u53ef\u4ee5\u79fb\u6b65\u6211\u4eec\u7684\u4e91\u751f\u4fe1\u5e73\u53f0\u7684\u753b\u56fe\u4e13\u7248\u53bb\u6df1\u5165\u5b66\u4e60\u54e6\uff01<\/p>\n<p>\u5c0f\u679c\u4e91\u751f\u4fe1\u5e73\u53f0\uff1a<a href=\"http:\/\/www.biocloudservice.com\/home.html\">\u4e91\u751f\u4fe1 \u00a0&#8211; \u5b66\u751f\u7269\u4fe1\u606f\u5b66 (biocloudservice.com)<\/a><\/p>\n<p>\u5c0f\u679c\u4e91\u751f\u4fe1\u5e73\u53f0\u753b\u56fe\u4e13\u7248\uff1a<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"640\" height=\"519\" class=\"wp-image-30047\" src=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-111.png?resize=640%2C519\" alt=\"\u8868\u683c\n\n\u63cf\u8ff0\u5df2\u81ea\u52a8\u751f\u6210\" srcset=\"https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-111.png?w=1513 1513w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-111.png?resize=300%2C243 300w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-111.png?resize=1024%2C831 1024w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-111.png?resize=768%2C623 768w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-111.png?resize=600%2C487 600w, https:\/\/i0.wp.com\/www.biocloudservice.com\/wordpress\/wp-content\/uploads\/2024\/02\/unnamed-file-111.png?w=1280 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u4e91\u751f\u4fe1pca\u56fe\u7ed8\u5236\u5c0f\u5de5\u5177\uff1a<a href=\"http:\/\/www.biocloudservice.com\/443\/443.php\">www.biocloudservice.com\/443\/443.php<\/a><\/p>\n<p>\u4eca\u5929\u5c0f\u679c\u6559\u4f60\u7684\u964d\u7ef4\u65b9\u6cd5\u5b66\u4f1a\u4e86\u5417\uff01\u66f4\u591a\u751f\u4fe1\u5c0f\u6280\u5de7\u8bf7\u7ee7\u7eed\u5173\u6ce8\u5c0f\u679c\u5427\uff01~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PCA\uff1a\u4f60\u7684\u5355\u7ec6\u80de\u6570\u636e\u4e3b\u6210\u5206\u5206\u6790\u5927\u5e08 \u5728\u5904\u7406\u5355\u7ec6\u80de\u6d4b\u5e8f\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5982\u4f55\u5bf9\u6570\u636e\u77e9\u9635\u8fdb\u884c\u964d\u7ef4\u662f\u6211\u4eec\u201c\u5fc5\u7ecf\u201d\u7684\u6b65\u9aa4 [&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\/30042"}],"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=30042"}],"version-history":[{"count":1,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/30042\/revisions"}],"predecessor-version":[{"id":30048,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/30042\/revisions\/30048"}],"wp:attachment":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=30042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=30042"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=30042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}