CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

A problem with a error message in identifyOverExpressedGenes in CellChat.

Open weichloe opened this issue 4 years ago • 9 comments

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 run subsetData and 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 avatar Aug 11 '21 04:08 weichloe

@weichloe It is surprising that there are only two rows in your data. Can you show me the codes related to the database?

sqjin avatar Aug 14 '21 06:08 sqjin

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 avatar Aug 16 '21 14:08 weichloe

@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.

sqjin avatar Aug 17 '21 02:08 sqjin

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?

Yijia-Jiang avatar Dec 01 '21 20:12 Yijia-Jiang

@aj088 I suggest to check your input data including both data matrix and cell labels.

sqjin avatar Dec 05 '21 04:12 sqjin

@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:

  1. identifyOverExpressedGenes(cellchat)
  2. (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
  3. 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.

wdg118 avatar Feb 28 '23 09:02 wdg118

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).

AydinHerik avatar Jun 10 '23 20:06 AydinHerik

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 avatar Dec 25 '23 10:12 PXYXYXY

@PXYXYXY It seems that you did not use the correct input data matrix or the L-R database such as human or mouse

sqjin avatar Dec 29 '23 03:12 sqjin