R语言学习小计--SeuratV5版本中跑cellchat遇到这个问题

第一个报错:
> data.input <- GetAssayData(seurat_sample, slot = "data", assay = "SCT")
警告信息:
The `slot` argument of `GetAssayData()` is deprecated as of SeuratObject 5.0.0.
ℹ Please use the `layer` argument instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. 

这个应该改为:

data.input <- GetAssayData(seurat_sample, layer  = "data", assay = "SCT")

第二个报错:


> cellchat <- CellChat::computeCommunProb( + cellchat, + type = "truncatedMean", + trim = 1, + distance.use = TRUE, + scale.distance = 0 + ) truncatedMean is used for calculating the average gene expression per cell group. 错误: 函数‘queryKNN’标签‘X = "data.frame"’找不到继承方法

这个应该改为:

cellchat <- createCellChat(
  object = data.input,
  meta = meta,
  group.by = "labels",
  datatype = "spatial",
  coordinates = data.matrix(spatial.locs),
  scale.factors = scale.factors  # 添加 scale.factors 参数
)

第三个报错:

> cellchat <- computeCommunProb(
+   cellchat,
+   type = "truncatedMean",
+   trim = 1,
+   distance.use = TRUE,
+   scale.distance = 1
+ )
truncatedMean is used for calculating the average gene expression per cell group. 
[1] ">>> Run CellChat on spatial imaging data using distances as constraints <<< [2025-03-08 15:43:35.765162]"
The suggested minimum value of scaled distances is in [1,2], and the calculated value here is  0.2828427 
错误于computeCommunProb(cellchat, type = "truncatedMean", trim = 1, : 
  Please increase the value of `scale.distance` and check the suggested values in the parameter description (e.g., 1, 0.1, 0.01, 0.001, 0.11, 0.011)

这个scale.distance的参数其实要远大点,我选了132

cellchat <- computeCommunProb(cellchat, type = "truncatedMean", trim = 0.1, 
                              distance.use = TRUE, interaction.length = 200, scale.distance = 132)
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值