cnio-bu / beyondcell

Beyondcell is a computational methodology for identifying tumour cell subpopulations with distinct drug responses in single-cell RNA-seq and Spatial Transcriptomics data.
Other
40 stars 4 forks source link

error in bcRegressout #149

Open Lukadon77 opened 6 months ago

Lukadon77 commented 6 months ago

when I regressout the bc S4 object bcRegressOut(bc, add.DSS = T, vars.to.regress = c("nFeature_RNA")) it stops with the following error:

Error in rep(1, ncol(dist)) : nvalid 'times' argument.

How can I fix this bug?

Jojojo-1990 commented 3 months ago

I met the same question!!! Do you figure out how to fix it? I actually don't really know what steps should be done to get the correct rds file as the input for beyondcell.

SGMartin commented 3 months ago

@Lukadon77 @Jojojo-1990

Hey, sorry for the late reply

Unfortunately, this is a common issue caused by the imputation step of the regression. At the moment, we suggest just replacing the NaN values with 0s. See the following code snippet:

 # Do not allow NaNs
    bc@normalized[is.na(bc@normalized)] <- 0
    bc <- bcRecompute(bc, slot = "normalized")
    bc <- bcRegressOut(bc = bc, vars.to.regress = c("nFeature_RNA"))