Skip to content

Error in computeCommunProb - missing internal functions? #1

@daniannr

Description

@daniannr

Hi SpatialCellChat team,

I'm currently using SpatialCellChat 0.1.0 and having issues when running computeCommunProb. I ran the function and received this error:
SpatialCellChat <- computeCommunProb(SpatialCellChat, distance.use = TRUE, scale.distance = 1, contact.dependent = TRUE, interaction.range = 250, contact.range = 10)

Analyzing spatial transcriptomic data and preferring to infer interactions between individual cells...
Apply a predefined spatial distance threshold based on the interaction length(=250um)...
Contact range is set as 10um, to restrict the contact-dependent signaling.
Run CellChat on spatial transcriptomic data using distances as constraints <<< [2026-03-02 00:07:28.001226]
The input L-R pairs have both secreted signaling and contact-dependent signaling. Run CellChat in a contact-dependent manner for Cell-Cell Contact signaling, and in a diffusion manner based on the interaction.range for other L-R pairs.
Warning: Caught simpleError. Canceling all iterations ...
Error in geometricMean(data.use[RsubunitsV, , drop = F]) :
could not find function "geometricMean"

I tried troubleshooting by creating a new environment with the function:
`geometricMean <- function(x,na.rm=TRUE){
if (is.null(nrow(x))) {
exp(mean(log(x),na.rm=na.rm))
} else {
exp(apply(log(x),2L,mean,na.rm=na.rm))
}
}

new_computeExpr_complex <- SpatialCellChat:::computeExpr_complex
environment(new_computeExpr_complex) <- new.env(parent = asNamespace("SpatialCellChat"))
assign("geometricMean", geometricMean, envir = environment(new_computeExpr_complex))
assignInNamespace("computeExpr_complex", new_computeExpr_complex, ns = "SpatialCellChat")`

The error went away but another error popped up:
Warning: Caught simpleError. Canceling all iterations ... Error in HillFunctionFordataLR(dataLR = dataLR, Kh = Kh, n = n) : could not find function "HillFunctionFordataLR"

Please help! Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions