Closed hyjforesight closed 2 years ago
Hi YJ,
You should construct a cell-cell network slot in Seurat. i.e., @graphs$RNA_snn cannot be null.
You can use other ways to achieve this and I will update Scissor code to allow users to choose their desired slot name.
Hope this helps.
Best, Duanchen
On Sun, 6 Feb 2022 at 13:06, Yuanjian Huang @.***> wrote:
Hello Scissor, My scRNA-seq workflow is based on Scanpy. After Scanpy proceeded with my data, I saved it into h5ad file. Then, I use R Markdown to convert my hd5ad file into a Seurat object. Then run Scissor on it. However, I got Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x), : 'data' must be of a vector type, was 'NULL'. Could you please help me with this issue? Thanks! Best, YJ
attach R Markdown code
python code in R Markdownimport numpy as npimport pandas as pdimport scanpy as scACT_sub2 = sc.read('C:/Users/Park_Lab/Documents/ACT_sub2.h5ad')
sc.pl.umap(ACT_sub2, color='leiden', legend_loc='right margin', title='', frameon=False, use_raw=False)
R code in R Markdown
library(reticulate) Sys.setenv(LANG = "en_US") library(Seurat) library(ggplot2) library(sctransform) library(dplyr) library(patchwork) library(DT) memory.limit(512000) options(future.globals.maxSize = 256000*1024^2)
Get the expression matrixexprs <- t(py$ACT_sub2$X)
colnames(exprs) <- py$ACT_sub2$obs_names$to_list() rownames(exprs) <- py$ACT_sub2$var_names$to_list()# Create the Seurat objectseurat <- CreateSeuratObject(exprs)# Set the expression assayseurat <- SetAssayData(seurat, "data", exprs)# Add observation metadataseurat <- AddMetaData(seurat, py$ACT_sub2$obs)# Add fetaure metadataseurat[["RNA"]][["n_cells"]] <- py$ACT_sub2$var["n_cells"]# Add embeddingembedding <- py$ACT_sub2$obsm["X_umap"] rownames(embedding) <- py$ACT_sub2$obs_names$to_list() colnames(embedding) <- c("umap_1", "umap2")seurat[["umap"]] <- CreateDimReducObject(embedding, key = "umap")seuratACT_sub2 <- SetIdent(seurat, value = "leiden") DimPlot(ACT_sub2, reduction = "umap")
5. run Scissorphenotype <- TCGA_phenotype_inputtag <- c('0', '1') # name the phenotype 0 (uninterested) first, then phenotype 1 (interested)GeneMatrix_MGI_input <- as.matrix(GeneMatrix_MGI) # conver gene martix (data.frame) to 'matrix'infos <- Scissor(bulk_dataset=GeneMatrix_MGI_input, sc_dataset=ACT_sub2, phenotype=phenotype, tag = tag, alpha = 0.3, family = "binomial", Save_file = "ACT_sub2_Scissor.RData") # alpha should be tested to make Scissor selected cells<20%
— Reply to this email directly, view it on GitHub https://github.com/sunduanchen/Scissor/issues/22, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYQWDGQXCUD5WRQ5ZKYSETUZX6VRANCNFSM5NU3E6BQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hello @sunduanchen I gave it up and now I'm using Seurat to cluster my data and do Scissor. Thanks! Best, YJ
Hello @sunduanchen,
I've copied integrated_snn
slot to RNA_snn
slot.
Merge2.combined@graphs$RNA_snn=Merge2.combined@graphs$integrated_snn
Do I also need to copy integrated_nn
slot to RNA_nn
slot.
Merge2.combined@graphs$RNA_nn=Merge2.combined@graphs$integrated_nn
Thanks! Best, Yuanjian
Hello Scissor, My scRNA-seq workflow is based on Scanpy. After Scanpy proceeded with my data, I saved it into h5ad file. Then, I use R Markdown to convert my hd5ad file into a Seurat object. Then run Scissor on it. However, I got
Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x), : 'data' must be of a vector type, was 'NULL'
. Could you please help me with this issue? We'll cite your paper and make the acknowledgment when we publish our data. I've shared the h5ad file and its converted rds file with your gmail. Thanks! Best, YJattach R Markdown code