This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Unexplainable missing values in single cell Seurat object

Hello,

While working on Seurat objects, I noticed a problem with some genes.

When I try to run a violin plot on them, I get the following error :

Error in if (all(data[, feature] == data[, feature][1])) { :    
missing value where TRUE/FALSE needed 
Warning : 1: Removing 70790 cells missing data for features requested  2: Removing 70790 cells missing data for vars requested

When I try a FeaturePlot on the same gene, instead of appearing grey it appears in dark grey for some reason, as if the value was missing.

I only get this thing on a handful of genes out of the thousands available, but this is problematic.

From what I understood in my research this would be linked to NA values, but isn't it weird that this happens on the exact same genes in two different datasets from two different projects?

Is there any way to fix this or is it a technical issue from the sequencing itself?

Thank you very much in advance

seurat single-cell

I'd say this is either and implementation error or bug in the Seurat function you are using or you need to find out why you have NA in your data, or both. For explanation, the situation is similar to this simple case causing the same exception.

if (all(c(NA,1) == 1)) 1
Error in if (all(c(NA, 1) == 1)) 1 :
missing value where TRUE/FALSE needed

If the function ever needed to expect NA in the data matrix, the NA case would have to be treated differently. The other question is then: why would you have NA's in your counts? Features with no counts should have 0 not NA.

  • Did you filter your data matrix outside of Seurat or did you set some values to NA?
  • Is the feature present in your count matrix even?
  • Extract the raw cell data for that gene.
  • Check the cell-ranger count matrix and look for the values for that feature.

I extracted the raw counts and indeed there are some NAs in there ... Any idea why ? Or more specifically, some counts return "TRUE" and some others "FALSE"

I didn't filter anything outside of Seurat

How did you import that? Please post the commands to load the data.

raw_counts <- seurat_object@assays$RNA@features["geneofinterest", , drop = FALSE]
raw_counts_df <- as.data.frame(raw_counts)
print(raw_counts_df)

Which gives TRUE for some counts, FALSE for others

Any other gene gives "TRUE" for every count as far as I can see

That would print a big mess on screen, but I don't get why there would be logical values instead of numeric values at all.

Therefore, I was asking how you created your Seurat object. You must have done something like:

  dat <- Read10X_h5('outs/filtered_feature_bc_matrix.h5')
  so <-  CreateSeuratObject(counts=dat,
                            min.cells=10,
                            min.features=300)

Oh, sorry.

I created individual Seurat objects with Read10x (reading filtered matrixes) and CreateSeuratObject(min.cells = 3, min.features = 200), then merged these objects and run a standard pipeline including SketchData downsampling to allow the computer to cope with the number of cells. I think I had also tried on an individual unmerged object without the downsampling and the same problem was there.

0 answers

No answers yet.

Log in to answer this question.