SydneyBioX / CellSPA

Cell Segmentation Performance Assessment
https://sydneybiox.github.io/CellSPA/
4 stars 1 forks source link

Consider setting use_nan = TRUE #4

Closed yulijia closed 1 month ago

yulijia commented 2 months ago

Hi,

I got a warning message while run calAggExpressionCorrelation

spe <- calAggExpressionCorrelation(spe,
                                       celltype = "mean_celltype_correlation",
                                       sce_ref = sce_ref,
                                       ref_celltype = "celltype",
                                       method = c("pearson"),
                                       spe_exprs_values = "logcounts",
                                       ref_exprs_values = "mean")

Warning message: x or y has vectors with zero standard deviation; consider setting use_nan = TRUE to set these values to NaN or use_nan = FALSE to suppress this warning

I am not sure why my datasets have zero standard deviation, but maybe we should consider adding use_nan=TRUE in proxyC::simil

https://github.com/SydneyBioX/CellSPA/blob/f54cc84cc4da58bcdc5d87cefdda1a069b728c45/R/expression_metrics.R#L318-L320

res <- proxyC::simil(as(t(ref_exprs), "CsparseMatrix"),
                             as(t(spe_agg_exprs), "CsparseMatrix"),
                             method = I,use_nan=TRUE)
YingxinLin commented 1 month ago

Thank you for the suggestions. I have incorporated in the latest commit.