Comments (23)
@geosen Hi, you should convert ensembl gene id to official gene name before running CellChat.
from cellchat.
Hi @franciscogrisanti, your data.input contains negative values, which is not suitable as input of CellChat. CellChat requires the normalized data. data.input <- GetAssayData(LAPV.integrated, assay = "RNA", slot = "data")
from cellchat.
Thanks for the reply! It's working now. 💯
from cellchat.
Hi @sqjin! I'm having the same issue and don't know what todo,hoping you can help me
I running the code below:
data.input <- GetAssayData(scdata, assay = "RNA", slot = "data")
identity = data.frame(group =[email protected]$Predicted_labels,
row.names = names([email protected]$Predicted_labels))
unique(identity$group)
cellchat <- createCellChat(data = data.input)
cellchat <- addMeta(cellchat, meta = identity, meta.name = "labels")
cellchat <- setIdent(cellchat, ident.use = "labels")
identity
levels(cellchat@idents) # show factor levels of the cell labels
groupSize <- as.numeric(table(cellchat@idents)) # number of cells in each cell group
CellChatDB <- CellChatDB.mnouse
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling") # use Secreted Signaling for cell-cell communication analysis
cellchat@DB <- CellChatDB.use # set the used database in the object
cellchat <- subsetData(cellchat)
future::plan("multiprocess", workers = 4)
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
cellchat <- projectData(cellchat, PPI.mouse)
cellchat <- computeCommunProb(cellchat)
And get the error :
Error in data.use[RsubunitsV, ]: subscript out of bounds
from cellchat.
Hi @sqjin I have the same question as @caiquanyou mentioned. Could you help us with this? Thanks!
from cellchat.
@weihuaguo Can you please make sure you have correctly done the following? (1) Use the correct CellChatDB: either 'CellChatDB <- CellChatDB.mouse' or 'CellChatDB <- CellChatDB.human'; (2) Have the correct cell group information by checking 'unique(cellchat@idents)'; (3) Have the correct data matrix for cell-cell communication analysis: please check cellchat@data
and '[email protected]'
from cellchat.
Hi @sqjin ! Thank you for this tool! Seems excellent.
I'm also having a subscript out of bounds error. Let me describe the situation below. My samples are Human Bulk RNA-Seq from isolated populations of HSCs (15 samples) and MSCs (7 samples). My gene identifiers are ENSEMBL gene ids with no version number.
library(CellChat)
library(patchwork)
library(edgeR)
options(stringsAsFactors = FALSE)
setwd('directory')
#read expression data
exprData <- read.table('table.txt', header=TRUE, row.names = 1)
#normalize
exprDataN <- log2(cpm(exprData) + 1)
#read sample metadata
metadata <- read.table('metadata.txt', header = TRUE)
cellChat1 <- createCellChat(object = exprDataN, meta = metadata, group.by = "CellType")
cellChat1 <- setIdent(cellChat1, ident.use = "CellType") # set "labels" as default cell identity
levels(cellChat1@idents) # show factor levels of the cell labels
CellChatDB <- CellChatDB.human #use all CellChatDB for cell-cell communication analysis
CellChatDB.use <- CellChatDB # simply use the default CellChatDB
cellChat1@DB <- CellChatDB.use
cellChat1 <- subsetData(cellChat1, features = CellChatDB.human$geneInfo$Ensembl.Gene.ID) # end up with 36845 x22 matrix from an initial 58767 x 22 matrix
#cellChat1 <- subsetData(cellChat1) # !!!!! when using this command [email protected] ends up blank. Using Ensembl IDs (see above) fixed this.
#check subset results
[email protected]
dim([email protected])
#do parallel
future::plan("multiprocess", workers = 4) #normal warning will pop-up probably
cellChat1 <- identifyOverExpressedGenes(cellChat1)
cellChat1 <- identifyOverExpressedInteractions(cellChat1)
cellChat1 <- projectData(cellChat1, PPI.human)
cellChat1 <- computeCommunProb(cellChat1, raw.use = TRUE)
The result is:
cellChat1 <- computeCommunProb(cellChat1, raw.use = TRUE)
Error in data.use[RsubunitsV, ] : subscript out of bounds
Any suggestions? I will continue to troubleshoot this and return here if I find a solution.
Thank you in advance for your time!
from cellchat.
@sqjin Thank you so much for taking the time to answer me! That was the issue!
from cellchat.
@sqjin Thank you so much for taking the time to answer me! That was the issue!
@geosen Hi, I get the same error while analyzing bulk RNA-seq. And my gene identifiers are gene symbols. Could you please tell me How you fixed this error in more detail?
from cellchat.
Hello, I think I also encountered the same problem on "Computecommunprob".Here is my code:
RDS <- readRDS('/home/wangyu/students_catalogue/lxm/snRNA/pBAT/sWAT_TSNE.rds')
data.input <- RDS@assays$RNA@data
meta = [email protected]
identity = data.frame(group = meta$seurat_clusters, row.names = names(meta$seurat_clusters))
head(identity)
group
1 1
2 2
3 0
4 2
5 2
6 0
unique(identity$group)
[1] 1 2 0
Levels: 0 1 2
cellchat <- createCellChat(object = data.input, meta = meta, group.by = "seurat_clusters")
Create a CellChat object from a data matrix
Set cell identities for the new CellChat object
The cell groups used for CellChat analysis are 0 1 2
cellchat <- addMeta(cellchat, meta = meta)
cellchat <- setIdent(cellchat, ident.use = "seurat_clusters")
levels(cellchat@idents)
[1] "0" "1" "2"
groupSize <- as.numeric(table(cellchat@idents))
CellChatDB <- CellChatDB.human
showDatabaseCategory(CellChatDB)
dplyr::glimpse(CellChatDB$interaction)
Registered S3 method overwritten by 'cli':
method from
print.boxx spatstat.geom
Rows: 1,939
Columns: 11
$ interaction_name "TGFB1_TGFBR1_TGFBR2", "TGFB2_TGFBR1_TGFBR2", "TGFB…
$ pathway_name "TGFb", "TGFb", "TGFb", "TGFb", "TGFb", "TGFb", "TG…
$ ligand "TGFB1", "TGFB2", "TGFB3", "TGFB1", "TGFB1", "TGFB2…
$ receptor "TGFbR1_R2", "TGFbR1_R2", "TGFbR1_R2", "ACVR1B_TGFb…
$ agonist "TGFb agonist", "TGFb agonist", "TGFb agonist", "TG…
$ antagonist "TGFb antagonist", "TGFb antagonist", "TGFb antagon…
$ co_A_receptor "", "", "", "", "", "", "", "", "", "", "", "", "",…
$ co_I_receptor "TGFb inhibition receptor", "TGFb inhibition recept…
$ evidence "KEGG: hsa04350", "KEGG: hsa04350", "KEGG: hsa04350…
$ annotation "Secreted Signaling", "Secreted Signaling", "Secret…
$ interaction_name_2 "TGFB1 - (TGFBR1+TGFBR2)", "TGFB2 - (TGFBR1+TGFBR2)…
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling")
CellChatDB.use <- subsetDB(CellChatDB)
cellchat@DB <- CellChatDB.use
cellchat <- subsetData(cellchat)
future::plan("multiprocess", workers = 4)
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
cellchat <- projectData(cellchat, PPI.human)
cellchat <- computeCommunProb(cellchat)
Error in data.use[RsubunitsV, ] : subscript out of bounds
In addition: Warning message:
In max(data) : no non-missing arguments to max; returning -Inf
My cellchat@data has been standardized and no negative number exists. The gene name is the official gene name.
for example:
head(cellchat@data)
6 x 963 sparse Matrix of class "dgCMatrix"
[[ suppressing 963 column names ‘AAACCCAAGCACCCAC-1’, ‘AAACCCACAAGACCGA-1’, ‘AAACCCATCGACGATT-1’ ... ]]
RCAN1 . . . . . . . .
CBX3 . . . . . . . .
SMIM11A . . . . . . . .
MRPS6 . . 0.9947906 1.563694 1.906185 . 2.788075 .
ATP5PO . . 0.9947906 1.563694 . . . .
ITSN1 2.754954 . 2.5594811 2.779176 2.900439 2.992338 2.154648 2.312864
RCAN1 . . . 1.938575 . . . .
CBX3 . . . . . . . .
SMIM11A . . . . . 2.058039 . .
MRPS6 1.211823 . . 1.379879 . . . .
ATP5PO . . . . . . . .
ITSN1 2.089245 3.059502 2.116168 1.938575 3.715525 3.067672 2.70321 .
but,There may be some errors in this
[email protected]
0 x 963 sparse Matrix of class "dgCMatrix"
[[ suppressing 963 column names ‘AAACCCAAGCACCCAC-1’, ‘AAACCCACAAGACCGA-1’, ‘AAACCCATCGACGATT-1’ ... ]]
I would like to ask whether this caused the above mistakes, and how to solve these two problems.I really appreciate your time to help me solve the problem
from cellchat.
@1221li You should change your cell labels, which cannot be 0
. It should be at least starting from 1, e..g., 1,2,3,..
from cellchat.
Thank you very much for answering my question. I seem to have solved this problem. I have increased the number of seurat_clusters and there is no longer this mistake.However, at the step of NetAnalysis_ComputeCentrality, we have the following error
future::plan("multiprocess", workers = 4)
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
cellchat <- projectData(cellchat, PPI.human)
cellchat <- computeCommunProb(cellchat)
cellchat < - filterCommunication(cellchat,min.cells = 10)
Error: unexpected input in "cellchat < - filterCommunication("
cellchat <-filterCommunication(cellchat,min.cells = 10)
Error: unexpected input in "cellchat <-filterCommunication(cellchat,"
cellchat <-filterCommunication(cellchat,min.cells = 10)
cellchat <- computeCommunProbPathway(cellchat)
cellchat <- aggregateNet(cellchat)
cellchat <- netAnalysis_computeCentrality(cellchat, slot.name = "netP")
Fortran runtime error: Insufficient number of elements in TARRAY.
Fortran runtime error: Insufficient number of elements in TARRAY.
Fortran runtime error: Insufficient number of elements in TARRAY.
Error: Failed to retrieve the result of MulticoreFuture (future_sapply-1) from the forked worker (on localhost; PID 42646). Post-mortem diagnostic: No process exists with this PID, i.e. the forked localhost worker is no longer alive.
In addition: Warning message:
In mccollect(jobs = jobs, wait = TRUE) :
1 parallel job did not deliver a result
Fortran runtime error: Insufficient number of elements in TARRAY.
I don't know what caused this mistake, could you please help me solve it?
from cellchat.
@1221li I have no idea on this. Can you run the source codes of this function to figure out the reason?
from cellchat.
@1221li Did you figure out the problem with NetAnalysis_ComputeCentrality? I'm experiencing the same issue now.
from cellchat.
@1221li Did you figure out the problem with NetAnalysis_ComputeCentrality? I'm experiencing the same issue now.
from cellchat.
@libingnan11 (1) Run the source codes by yourself and check the reason (2) if you can share your object and I can run the source code.
from cellchat.
Hi @sqjin ! Hope you're doing good. I'm having an issue and I was hoping you can help me. After running the netAnalysis_computeCentrality function, it turns off R directly and displays Fortran runtime error: Insufficient number of elements in TARRAY.
What is the reason for this?
from cellchat.
On my case, Fortran runtime error: Insufficient number of elements in TARRAY.
seems cause by igraph
. When netAnalysis_computeCentrality()
call igraph
, the R session crash immediately. Downgrade my R version 4.2.2 to 4.0.3 could fix this problem.
from cellchat.
Hi Sqjin, I have a similar error, could you kindly help?
My cellchat@data has been standardized and no negative number exists. The gene name is the official gene name.
for example:
Xkr4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Gm1992 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Gm37381 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Rp1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sox17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Gm37323 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Xkr4 ......
Gm1992 ......
Gm37381 ......
Rp1 ......
Sox17 ......
Gm37323 ......
cellchat <- computeCommunProbPathway(cellchat)
Error in prob.pathways[, , pathways.sig, drop = FALSE] :
subscript out of bounds
traceback()
1: computeCommunProbPathway(cellchat)
from cellchat.
@1989ANSS Can you show your unique(cellchat@idents)
?
from cellchat.
Thank you for responding
unique(cellchat@idents)
[1] T_Cells Neutrophils NK_Cells Macrophages DCs B_Cells Fibroblast Cancer Basophils
[10] MCs Endo_Cells
Levels: B_Cells Basophils Cancer DCs Endo_Cells Fibroblast Macrophages MCs Neutrophils NK_Cells T_Cells
from cellchat.
@1989ANSS It looks good. Could you share your cellchat object so that I can replicate your error. If your file is too big, you can set cellchat@data = cellchat@data[1:2, ]
as I only need the [email protected]
from cellchat.
from cellchat.
Related Issues (20)
- Error netVisual_heatmap() on a merged object from Seurat
- netAnalysis_signalingRole_network cluster.cols and cluster.rows not working HOT 1
- error with identifyOverExpressedGenes(cellchat) HOT 1
- Error in if (dim(prob)[3] <= 25) { : argument is of length zero HOT 2
- NetP empty after running computeCommunProb HOT 1
- Missing Column `annotation` in LRsig after merge cellchat and celltalk L-R pair
- parameter "group.by" in subsetCellChat doesn't work
- Issue with installing CellChat package in R studio HOT 1
- Why haven't we utilized single-cell proteomics for cell communication recognition and prediction? HOT 1
- Error in createCellChat object
- [email protected] 0 x 12257 sparse Matrix of class "dgCMatrix" HOT 2
- rankingsimilarity - back to issue #160 HOT 1
- unused arguments (min.dist = 0.3, n.neighbors = k) HOT 1
- Using a two-species sample HOT 1
- Error in base::colSums(x, na.rm = na.rm, dims = dims, ...) : 'x' must be an array of at least two dimensions HOT 5
- could not find function "findEnrichedSignaling" HOT 1
- mergeCellChat
- explanation of the df from subsetCommunication HOT 4
- error in netVisual_bubble plotting HOT 4
- Incorrect documentation / use of thresh.pc argument HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cellchat.