A problem with a error message in identifyOverExpressedGenes in CellChat.
Hi @sqjin, Fantastic work and package. I am a novice at using R programming. I encountered a problem when I use the function: identifyOverExpressedGenes in CellChat. After looking in the web, I confirmed I did the subsetData and checked `[email protected]. I found my data.signaling matrix only has 2 x 2252. It looks like the gene names are disappeared. How did I solve this problem? I am looking forward to your response. Thank you so much for your help.
The error message is shown as bellows.
Mouse.cellchat <- subsetData(Mouse.cellchat) Mouse.cellchat <- identifyOverExpressedGenes(Mouse.cellchat) Error in identifyOverExpressedGenes(Mouse.cellchat) : Please check
[email protected]and ensure that you have runsubsetDataand that the data matrix[email protected]looks OK. [email protected] 2 x 2252 sparse Matrix of class "dgCMatrix" [[ suppressing 54 column names ‘AAACCCACAATACAGA-1_1’, ‘AAACCCACATGAATCC-1_1’, ‘AAACCCACATTGCTGA-1_1’ ... ]]
F2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.6931472 . . . . . . . . . . . . . . . . . . . . . . C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F2 ...... C3 ......
.....suppressing 2198 columns in show(); maybe adjust 'options(max.print= *, width = *)' ..............................
@weichloe It is surprising that there are only two rows in your data. Can you show me the codes related to the database?
Hi @sqjin, Thanks so much for your reply. I re-created the metadata and re-run the CellChatDB. The problem seems to be resolved. But the mouse CellChatDB still has the following genes ( H2-Q8 H2-T9 H2-T18 H2-Q9 H2-L H2-BI H2-D H60a H2-Ea-ps ) in our data matrix not to be identified.
weichloe
#Set the ligand-receptor interaction database CellChatDB<- CellChatDB.mouse showDatabaseCategory(CellChatDB)
use all CellChatDB for cell-cell communication analysis
CellChatDB.use <- CellChatDB # simply use the default CellChatDB
Mouse.cellchat@DB <- CellChatDB.use Mouse.cellchat <- subsetData(Mouse.cellchat)
Issue identified!! Please check the official Gene Symbol of the following genes:
H2-Q8 H2-T9 H2-T18 H2-Q9 H2-L H2-BI H2-D H60a H2-Ea-ps
future::plan("multiprocess", workers = 4) # do parallel Mouse.cellchat <- identifyOverExpressedGenes(Mouse.cellchat) Mouse.cellchat<- identifyOverExpressedInteractions(Mouse.cellchat) Mouse.cellchat <- projectData(Mouse.cellchat, PPI.mouse)
[email protected] 639 x 2252 sparse Matrix of class "dgCMatrix" [[ suppressing 53 column names ‘AAACCCACAATACAGA-1_1’, ‘AAACCCACATGAATCC-1_1’, ‘AAACCCACATTGCTGA-1_1’ ... ]] [[ suppressing 53 column names ‘AAACCCACAATACAGA-1_1’, ‘AAACCCACATGAATCC-1_1’, ‘AAACCCACATTGCTGA-1_1’ ... ]]
Epha4 . . . . . . . . 0.6931472 . . . . . . . . . . . . . . . . . . . . . . . . . . . Lamc2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lamc1 . 1.609438 . . . 1.609438 . . 1.0986123 . . . 0.6931472 . . . . . . . . . . . . . . . . . . . . . 1.098612 . Col4a4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inhbb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lefty2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lefty1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Angptl1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Il17f . . . . . . . . . . . . . . . 0.6931472 . . . . . . . . . . . . . . . . . . . .
Epha4 . . . . . . . . . . . 1.3862944 . . . . . ...... Lamc2 . 0.6931472 . . . . . . . . . 0.6931472 . . . . . ...... Lamc1 1.098612 . . 1.098612 . . 1.098612 . . . . 1.0986123 . . . 0.6931472 . ...... Col4a4 . . . . . . . . . . . . . . . . . ...... Inhbb . . . . . . . . . . . . . . . . . ...... Lefty2 . . . . . . . . . . . . . . . . . ...... Lefty1 . . . . . . . . . . . . . . . . . ...... Angptl1 . . . . . . . . . . . . . . . . . ...... Il17f . . . . . . . . . . . . . . . . . ......
.............................. ........suppressing 2199 columns and 621 rows in show(); maybe adjust 'options(max.print= *, width = *)' .............................. [[ suppressing 53 column names ‘AAACCCACAATACAGA-1_1’, ‘AAACCCACATGAATCC-1_1’, ‘AAACCCACATTGCTGA-1_1’ ... ]]
Lrp5 . . . . . . . . . . . . . . . . . . . . 0.6931472 . . . 0.6931472 . Nrxn2 . . . . . . . . . . . . . . . . . . . . . . . . . . Entpd1 . . . . 1.609438 . . 1.098612 . . . . . . . . . . 0.6931472 . . . . 1.098612 . . Sfrp5 . . . . . . . . . . . . . . . . . . . . . . . . . . Sema4g . . . . . . . . . . . . . . . . . . . . . . . . . . Fgf8 . . . . . . . . . . . . . . . . . . . . . . . . . . Anxa1 . . . . . . . . . . . . . . . . . . . . . . . . . . Clcf1 . . . . . . . . . . . . . . . . . . . . . . . . . . Vegfb . . . . . . . . 0.6931472 . . . . . . . . . . . . 1.098612 . . . .
Lrp5 . . . 0.6931472 . . . . . 1.098612 . . . . . . . . . . . . . Nrxn2 . . . . . . . . . . . . . . . . . . . . . . . Entpd1 0.6931472 . . 1.3862944 . . . . . . 1.098612 1.3862944 . . 0.6931472 . . . . . . . . Sfrp5 . . . . . . . . . . . . . . . . . . . . . . . Sema4g . . . . . . . . . . . 0.6931472 . . . . 0.6931472 . 0.6931472 . . . . Fgf8 . . . . . . . . . . . . . . . . . . . . . . . Anxa1 . . . . . . . . . . . . . . . . . . . . . . . Clcf1 . . . . . . . . . . . . . . . . . . . . . . . Vegfb . . . . . . . . . 1.098612 . . . 1.098612 . . . . . . . . .
Lrp5 0.6931472 . . . ...... Nrxn2 . . . . ...... Entpd1 . . . . ...... Sfrp5 . . . . ...... Sema4g . . . . ...... Fgf8 . . . . ...... Anxa1 . . . . ...... Clcf1 . . . . ...... Vegfb . . . . ......
@weichloe I think there are some issues for these gene names. I will fix them in the next version. If you are really concerned about these gene names, you can manually correct these gene names.
I cannot run identifyOverExpressedGenes function, so I run manually and get error: Error in (function (cl, name, valueClass) : assignment of an object of class “character” is not valid for @‘var.features’ in an object of class “CellChat”; is(value, "list") is not TRUE. Any suggestions on how to deal with this?
@aj088 I suggest to check your input data including both data matrix and cell labels.
@sqjin I have a similar issue to @weichloe
I ran the source code for identifyOverExpressedGenes, and I get the error:
Error in (function (cl, name, valueClass) : assignment of an object of class “character” is not valid for @‘var.features’ in an object of class “CellChat”; is(value, "list") is not TRUE Traceback:
- identifyOverExpressedGenes(cellchat)
- (function (cl, name, valueClass)
. {
. ClassDef <- getClass(cl)
. slotClass <- ClassDef@slots[[name]]
. if (is.null(slotClass))
. stop(gettextf("%s is not a slot in class %s", sQuote(name),
. dQuote(cl)), domain = NA)
. if (.identC(slotClass, valueClass))
. return(TRUE)
. ok <- possibleExtends(valueClass, slotClass, ClassDef2 = getClassDef(slotClass,
. where = .classEnv(ClassDef)))
. if (isFALSE(ok))
. stop(gettextf("assignment of an object of class %s is not valid for @%s in an object of class %s; is(value, "%s") is not TRUE",
. dQuote(valueClass), sQuote(name), dQuote(cl), slotClass),
. domain = NA)
. TRUE
. })(structure("CellChat", package = "CellChat"), "var.features",
. "character") # at line 38 of file
- stop(gettextf("assignment of an object of class %s is not valid for @%s in an object of class %s; is(value, "%s") is not TRUE", . dQuote(valueClass), sQuote(name), dQuote(cl), slotClass), . domain = NA)
I then inspected [email protected]:
Extract cell-level features
cell_features <- [email protected]
Print the number of cell-level features
print(length(cell_features)
and got:
[1] 0
So for some reason I have no features.
I also ran View([email protected]) and got: 2 x 30807 sparse Matrix of class "dgCMatrix"
where my genes disappeared
I read in a Seurat object and followed the tutorial to make a cellchat object.
Hi @weichloe how did you re-create your meta data? I have the exact same problem as you, only 2 rows of genes (C3 and F2).
Hi @sqjin, Fantastic work and package. I am a novice at using R programming. I encountered a problem when I use the function: identifyOverExpressedGenes in CellChat.
I had run “cellchat = subsetData(cellchat) ”
but,then when I run ”str([email protected])“
there is Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int(0) ..@ p : int [1:8308] 0 0 0 0 0 0 0 0 0 0 ... ..@ Dim : int [1:2] 0 8307 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ..@ x : num(0) ..@ factors : list() Thank you so much for your help.
@PXYXYXY It seems that you did not use the correct input data matrix or the L-R database such as human or mouse