Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

A problem with a error message in identifyOverExpressedGenes in CellChat. #264

Open
weichloe opened this issue Aug 11, 2021 · 9 comments
Open
Labels
bug Something isn't working

Comments

@weichloe
Copy link

weichloe commented Aug 11, 2021

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 `object@data.signaling.
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 object@data.signaling and ensure that you have run subsetData and that the data matrix object@data.signaling looks OK.
Mouse.cellchat@data.signaling
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 = *)'
..............................

@sqjin
Copy link
Owner

sqjin commented Aug 14, 2021

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

@weichloe
Copy link
Author

weichloe commented Aug 16, 2021

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)

Mouse.cellchat@data.signaling
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 . . . . ......

@sqjin
Copy link
Owner

sqjin commented Aug 17, 2021

@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 sqjin added the bug Something isn't working label Aug 21, 2021
@Yijia-Jiang
Copy link

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?

@sqjin
Copy link
Owner

sqjin commented Dec 5, 2021

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

@wdg118
Copy link

wdg118 commented Feb 28, 2023

@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 cellchat@var.features:

Extract cell-level features

cell_features <- cellchat@var.features

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(cellchat@data.signaling) 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.

@AHerik
Copy link

AHerik commented Jun 10, 2023

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

@PXYXYXY
Copy link

PXYXYXY commented Dec 25, 2023

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(cellchat@data.signaling)“

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.

@sqjin
Copy link
Owner

sqjin commented Dec 29, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants