{"id":716,"date":"2026-09-23T09:07:57","date_gmt":"2026-09-23T01:07:57","guid":{"rendered":"https:\/\/www.kz-hub.tech\/?p=716"},"modified":"2026-09-23T10:10:13","modified_gmt":"2026-09-23T02:10:13","slug":"scissor-%e5%88%a9%e7%94%a8%e5%8d%95%e7%bb%86%e8%83%9e%e6%96%b9%e6%b3%95%e9%89%b4%e5%ae%9a%e4%ba%9a%e7%be%a4%e5%b9%b6%e4%b8%8e%e6%95%b4%e4%bd%93%e6%a0%b7%e6%9c%ac%e8%a1%a8%e5%9e%8b%e7%9b%b8%e5%85%b3","status":"publish","type":"post","link":"https:\/\/www.kz-hub.tech\/index.php\/2026\/09\/23\/scissor-%e5%88%a9%e7%94%a8%e5%8d%95%e7%bb%86%e8%83%9e%e6%96%b9%e6%b3%95%e9%89%b4%e5%ae%9a%e4%ba%9a%e7%be%a4%e5%b9%b6%e4%b8%8e%e6%95%b4%e4%bd%93%e6%a0%b7%e6%9c%ac%e8%a1%a8%e5%9e%8b%e7%9b%b8%e5%85%b3\/","title":{"rendered":"Scissor-\u5229\u7528\u5355\u7ec6\u80de\u65b9\u6cd5\u9274\u5b9a\u4e9a\u7fa4\u5e76\u4e0e\u6574\u4f53\u6837\u672c\u8868\u578b\u76f8\u5173\u6027"},"content":{"rendered":"<p>\u5b98\u7f51\u94fe\u63a5\uff1a<a href=\"https:\/\/github.com\/sunduanchen\/Scissor\">https:\/\/github.com\/sunduanchen\/Scissor<\/a><br \/>\n\u5b98\u65b9\u6559\u7a0b\uff1a<a href=\"https:\/\/sunduanchen.github.io\/Scissor\/vignettes\/Scissor_Tutorial.html\">https:\/\/sunduanchen.github.io\/Scissor\/vignettes\/Scissor_Tutorial.html<\/a><\/p>\n<p>Conda\u73af\u5883\u8bbe\u7f6e\uff1a<\/p>\n<pre><code>mamba install -c conda-forge -c bioconda r-base==4.1.2 r-qs r-devtools r-rlang==1.1.0 bioconductor-preprocesscore r-progress -y<\/code><\/pre>\n<p>\u8fd0\u884c\u4ee3\u7801\uff1a<\/p>\n<pre><code>library(Scissor)\nlibrary(Seurat)\nlibrary(qs)\nlibrary(readxl)\nlibrary(dplyr)\nlibrary(tidyr)\nlibrary(Matrix)\n\n## 57.0 \u8bbe\u7f6e\u53c2\u6570 ####\nproteomics_path &lt;- &quot;\/Users\/zhoukaiwen\/Desktop\/Breast_Phyllodes_Tumor\/Bioinfo\/Proteomics\/pg_mtx_minhalf_drop.txt&quot;\ngroup_path &lt;- &quot;\/Users\/zhoukaiwen\/Desktop\/Breast_Phyllodes_Tumor\/Bioinfo\/sample_group.xlsx&quot;\nsc_path &lt;- &quot;\/Users\/zhoukaiwen\/Desktop\/Breast_Phyllodes_Tumor\/Bioinfo\/R_base\/26samples_Merged_AllCells_Annotated_Final_CellType_Minor.qs&quot;\n\nmerge_downgraded &lt;- F  # TRUE\uff1aStable + Downgraded\uff1bFALSE\uff1a\u4ec5 Stable\uff0c\u6392\u9664 Downgraded\nproteomics_tissue &lt;- &quot;M&quot;  # \u9009\u62e9 &quot;E&quot; \u6216 &quot;M&quot;\uff1b\u4e24\u8005\u90fd\u7528\u65f6\u6539\u4e3a c(&quot;E&quot;, &quot;M&quot;)\nstopifnot(length(proteomics_tissue) &gt; 0, all(proteomics_tissue %in% c(&quot;E&quot;, &quot;M&quot;)))\nscissor_celltypes &lt;- &quot;Fibroblasts&quot;\n# \u670d\u52a1\u5668\u5206\u6790\u539f\u5148\u6307\u5b9a\u7684\u5168\u90e8\u5927\u7c7b\u65f6\uff0c\u5c06\u4e0a\u4e00\u884c\u6539\u4e3a\uff1a\n# scissor_celltypes &lt;- c(&quot;Fibroblasts&quot;, &quot;Pericytes&quot;, &quot;VSMCs&quot;, &quot;Endothelials&quot;, &quot;BCells&quot;, &quot;TCells&quot;, &quot;Myeloids&quot;)\nscissor_alpha &lt;- 0.05  # \u9884\u5148\u56fa\u5b9a\uff0c\u4e0d\u6839\u636e MP2 \u5bcc\u96c6\u7684 P \u503c\u6311\u9009\u53c2\u6570\n\n## 57.1 \u63d0\u53d6\u86cb\u767d\u77e9\u9635 ####\n# \u86cb\u767d\u77e9\u9635\u5df2\u7ecf log2 \u8f6c\u6362\u5e76\u586b\u8865\u7f3a\u5931\uff0c\u4e0d\u518d\u91cd\u590d log2\uff1b\u6309\u6240\u9009 E\/M \u7b5b\u9009\u539f\u53d1\u7076\u3002\nproteomics &lt;- as.matrix(read.delim(proteomics_path, row.names = 1, check.names = FALSE))\nsample_group &lt;- readxl::read_xlsx(group_path)\nnonprogression_groups &lt;- if (merge_downgraded) c(&quot;Stable&quot;, &quot;Downgraded&quot;) else &quot;Stable&quot;\nprimary_group &lt;- sample_group %&gt;%\n  dplyr::filter(SampleTime == &quot;Primary&quot;,\n                TissueType %in% proteomics_tissue,\n                Group_Progression %in% c(&quot;Progression&quot;, nonprogression_groups)) %&gt;%\n  dplyr::mutate(Scissor_group = ifelse(Group_Progression == &quot;Progression&quot;, &quot;Progression&quot;, &quot;Non-progression&quot;))\nstopifnot(!anyDuplicated(primary_group$SampleName),\n          all(primary_group$SampleName %in% colnames(proteomics)))\nbulk_dataset &lt;- proteomics[, primary_group$SampleName, drop = FALSE]\nphenotype &lt;- as.integer(primary_group$Scissor_group == &quot;Progression&quot;)  # 0=\u4e0d\u8fdb\u5c55\uff0c1=\u8fdb\u5c55\nstopifnot(identical(colnames(bulk_dataset), primary_group$SampleName),\n          setequal(phenotype, 0:1), all(is.finite(bulk_dataset)))\nprint(table(primary_group$Group_Progression, primary_group$TissueType))\n\n## 57.2 \u63d0\u53d6\u5355\u7ec6\u80de\u77e9\u9635 ####\nscissor_seu &lt;- qs::qread(sc_path)\nscissor_seu &lt;- subset(scissor_seu, subset = CellType_Major %in% scissor_celltypes)\nprint(table(scissor_seu$CellType_Major))\n\nsc_dataset &lt;- GetAssayData(scissor_seu, assay = &quot;RNA&quot;, layer = &quot;counts&quot;)\n\nsc_dataset &lt;- Seurat_preprocessing(sc_dataset, verbose = T)\n\nclass(sc_dataset)\nnames(sc_dataset)\n\nDimPlot(sc_dataset, \n        reduction = &#039;umap&#039;, \n        label = T, \n        label.size = 10)\n\nScissor_V5 &lt;- function (bulk_dataset, sc_dataset, phenotype, tag = NULL, alpha = NULL, \n                        cutoff = 0.2, family = c(&quot;gaussian&quot;, &quot;binomial&quot;, &quot;cox&quot;), \n                        Save_file = &quot;Scissor_inputs.RData&quot;, Load_file = NULL) \n{\n  library(Seurat)\n  library(Matrix)\n  library(preprocessCore)\n  if (is.null(Load_file)) {\n    common &lt;- intersect(rownames(bulk_dataset), rownames(sc_dataset))\n    if (length(common) == 0) {\n      stop(&quot;There is no common genes between the given single-cell and bulk samples.&quot;)\n    }\n    if (class(sc_dataset) == &quot;Seurat&quot;) {\n      sc_exprs &lt;- as.matrix(sc_dataset@assays$RNA@layers$data)\n      network &lt;- as.matrix(sc_dataset@graphs$RNA_snn)\n    }\n    else {\n      sc_exprs &lt;- as.matrix(sc_dataset)\n      Seurat_tmp &lt;- CreateSeuratObject(sc_dataset)\n      Seurat_tmp &lt;- FindVariableFeatures(Seurat_tmp, selection.method = &quot;vst&quot;, \n                                         verbose = F)\n      Seurat_tmp &lt;- ScaleData(Seurat_tmp, verbose = F)\n      Seurat_tmp &lt;- RunPCA(Seurat_tmp, features = VariableFeatures(Seurat_tmp), \n                           verbose = F)\n      Seurat_tmp &lt;- FindNeighbors(Seurat_tmp, dims = 1:10, \n                                  verbose = F)\n      network &lt;- as.matrix(Seurat_tmp@graphs$RNA_snn)\n    }\n    diag(network) &lt;- 0\n    network[which(network != 0)] &lt;- 1\n    dataset0 &lt;- cbind(bulk_dataset[common, ], sc_exprs[common, \n    ])\n    dataset1 &lt;- normalize.quantiles(dataset0)\n    rownames(dataset1) &lt;- rownames(dataset0)\n    colnames(dataset1) &lt;- colnames(dataset0)\n    Expression_bulk &lt;- dataset1[, 1:ncol(bulk_dataset)]\n    Expression_cell &lt;- dataset1[, (ncol(bulk_dataset) + \n                                     1):ncol(dataset1)]\n    X &lt;- cor(Expression_bulk, Expression_cell)\n    quality_check &lt;- quantile(X)\n    print(&quot;|**************************************************|&quot;)\n    print(&quot;Performing quality-check for the correlations&quot;)\n    print(&quot;The five-number summary of correlations:&quot;)\n    print(quality_check)\n    print(&quot;|**************************************************|&quot;)\n    if (quality_check[3] &lt; 0.01) {\n      warning(&quot;The median correlation between the single-cell and bulk samples is relatively low.&quot;)\n    }\n    if (family == &quot;binomial&quot;) {\n      Y &lt;- as.numeric(phenotype)\n      z &lt;- table(Y)\n      if (length(z) != length(tag)) {\n        stop(&quot;The length differs between tags and phenotypes. Please check Scissor inputs and selected regression type.&quot;)\n      }\n      else {\n        print(sprintf(&quot;Current phenotype contains %d %s and %d %s samples.&quot;, \n                      z[1], tag[1], z[2], tag[2]))\n        print(&quot;Perform logistic regression on the given phenotypes:&quot;)\n      }\n    }\n    if (family == &quot;gaussian&quot;) {\n      Y &lt;- as.numeric(phenotype)\n      z &lt;- table(Y)\n      if (length(z) != length(tag)) {\n        stop(&quot;The length differs between tags and phenotypes. Please check Scissor inputs and selected regression type.&quot;)\n      }\n      else {\n        tmp &lt;- paste(z, tag)\n        print(paste0(&quot;Current phenotype contains &quot;, \n                     paste(tmp[1:(length(z) - 1)], collapse = &quot;, &quot;), \n                     &quot;, and &quot;, tmp[length(z)], &quot; samples.&quot;))\n        print(&quot;Perform linear regression on the given phenotypes:&quot;)\n      }\n    }\n    if (family == &quot;cox&quot;) {\n      Y &lt;- as.matrix(phenotype)\n      if (ncol(Y) != 2) {\n        stop(&quot;The size of survival data is wrong. Please check Scissor inputs and selected regression type.&quot;)\n      }\n      else {\n        print(&quot;Perform cox regression on the given clinical outcomes:&quot;)\n      }\n    }\n    save(X, Y, network, Expression_bulk, Expression_cell, \n         file = Save_file)\n  }\n  else {\n    load(Load_file)\n  }\n  if (is.null(alpha)) {\n    alpha &lt;- c(0.005, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, \n               0.6, 0.7, 0.8, 0.9)\n  }\n  for (i in 1:length(alpha)) {\n    set.seed(123)\n    fit0 &lt;- APML1(X, Y, family = family, penalty = &quot;Net&quot;, \n                  alpha = alpha[i], Omega = network, nlambda = 100, \n                  nfolds = min(10, nrow(X)))\n    fit1 &lt;- APML1(X, Y, family = family, penalty = &quot;Net&quot;, \n                  alpha = alpha[i], Omega = network, lambda = fit0$lambda.min)\n    if (family == &quot;binomial&quot;) {\n      Coefs &lt;- as.numeric(fit1$Beta[2:(ncol(X) + 1)])\n    }\n    else {\n      Coefs &lt;- as.numeric(fit1$Beta)\n    }\n    Cell1 &lt;- colnames(X)[which(Coefs &gt; 0)]\n    Cell2 &lt;- colnames(X)[which(Coefs &lt; 0)]\n    percentage &lt;- (length(Cell1) + length(Cell2))\/ncol(X)\n    print(sprintf(&quot;alpha = %s&quot;, alpha[i]))\n    print(sprintf(&quot;Scissor identified %d Scissor+ cells and %d Scissor- cells.&quot;, \n                  length(Cell1), length(Cell2)))\n    print(sprintf(&quot;The percentage of selected cell is: %s%%&quot;, \n                  formatC(percentage * 100, format = &quot;f&quot;, digits = 3)))\n    if (percentage &lt; cutoff) {\n      break\n    }\n    cat(&quot;\\n&quot;)\n  }\n  print(&quot;|**************************************************|&quot;)\n  return(list(para = list(alpha = alpha[i], lambda = fit0$lambda.min, \n                          family = family), Coefs = Coefs, Scissor_pos = Cell1, \n              Scissor_neg = Cell2))\n}\n\ntag &lt;- c(&#039;Stable&#039;, &#039;Progression-related&#039;)\ninfos1 &lt;- Scissor_V5(bulk_dataset, \n                              sc_dataset, \n                              phenotype, \n                              tag = tag,\n                              alpha = scissor_alpha, \n                              family = &quot;binomial&quot;, \n                              Save_file = &#039;Scissor_Fibro_PvsS.RData&#039;)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b98\u7f51\u94fe\u63a5\uff1ahttps:\/\/github.com\/sunduanchen\/Scissor \u5b98\u65b9\u6559\u7a0b\uff1ahttps:&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-716","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/716","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/comments?post=716"}],"version-history":[{"count":3,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/716\/revisions"}],"predecessor-version":[{"id":719,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/716\/revisions\/719"}],"wp:attachment":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/media?parent=716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/categories?post=716"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/tags?post=716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}