seurat icon indicating copy to clipboard operation
seurat copied to clipboard

'NAs introduced by coercion' error in FindSpatiallyVariableFeatures()

Open vukojicic-nevena opened this issue 1 year ago • 2 comments

Hi, I'm having a strange error when computing Moran's I on Slide-seq data. FindSpatiallyVariableFeatures() function is failing with this error:

Error in sequence.default(n..1, from = seq.int(s.1, length(df), s.1),  : 'from' contains NAs
Calls: FindSpatiallyVariableFeatures ... as.matrix -> as.matrix -> as.matrix.dist -> sequence.default

In addition: Warning messages:
1: In dist(x = pos) : NAs introduced by coercion
2: In sequence.default(n..1, from = seq.int(s.1, length(df), s.1),  :
NAs introduced by coercion to integer range

Anyone know how to resolve this and what is causing it? Thanks!

vukojicic-nevena avatar Jul 05 '24 11:07 vukojicic-nevena

Hi @vukojicic-nevena ,

Thank you for reaching out! We’re always grateful when folks take the time to help make Seurat better 🙂

Unfortunately, with the details provided, we cannot reproduce your issue. To help us better understand and resolve this issue, please ensure that you provide the following information when reporting a bug:

  1. Describe your issue:

    • A clear and concise description of what the bug is — avoid just pasting in the error message.
  2. Reproducing Code Example:

    • Provide a minimal reproducible example that demonstrates the issue using one of the datasets available through SeuratData. Paste the code in a code block.
    • The code example should make use of pbmc_small or one of the datasets available through SeuratData.
  3. Error Message:

    • If any, paste the full error message (starting from line Traceback) in a code block.
    • If no error is raised, consider writing a simple test case that explicitly raises one
  4. System Information:

    • Run sessionInfo() and paste the result in a code block.

Once you’ve gathered these details we will be more than happy to help you resolve the problem.

dcollins15 avatar Jul 19 '24 19:07 dcollins15

I have encountered the same problem. test_data2 <- FindSpatiallyVariableFeatures(test_data2, assay = "SCT",

                               features = variable_top1000,
                               selection.method = "moransi",
                               verbose = T) #"markvariogram"

Computing Moran's I |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=13h 16m 23s 警告信息: In dist(x = pos) : NAs introduced by coercion

DEGs<- SpatiallyVariableFeatures(test_data2, method = "moransi",assay = "SCT") Error in xtfrm.data.frame(x) : cannot xtfrm data frames

liuzz2024 avatar Feb 27 '25 14:02 liuzz2024