seurat icon indicating copy to clipboard operation
seurat copied to clipboard

"The following N features requested have not been scaled" warning after running SCTransform

Open wudustan opened this issue 9 months ago • 3 comments

I have the following Seurat v5 object:

An object of class Seurat 
15130 features across 215733 samples within 1 assay 
Active assay: RNA (15130 features, 0 variable features)
 130 layers present: counts.1.1, counts.10.1, counts.11.2, counts.12.2, counts.13.2, counts.14.2, counts.15.2, counts.16.2, counts.17.2, ... , counts.9.2, 

I then run:

sub.seurat <- SCTransform(sub.seurat,
                          assay = "RNA", 
                          new.assay.name = "SCT",
                          variable.features.n = 1500,
                          vars.to.regress = c("pMitochondrial_RNA", "Cycle.Score"))

And when I want to run RunPCA():

Warning message:
In PrepDR(object = object, features = features, verbose = verbose) :
  The following 577 features requested have not been scaled (running reduction without them): CCL4, CHI3L1, SERPINE1, CCL5, CCL3, FN1, CNTNAP2, SKAP1, CLDN5,  [... truncated]

The object that comes out of SCTransform():

An object of class Seurat 
30260 features across 215733 samples within 2 assays 
Active assay: SCT (15130 features, 1500 variable features)
 3 layers present: counts, data, scale.data
 1 other assay present: RNA

I can run:

>table(sub.seurat[["SCT"]]@var.features %in% rownames(sub.seurat[["SCT"]]@scale.data))
FALSE  TRUE 
  577   923 
> nrow(sub.seurat@[email protected])
[1] 6711

Is this a bugor intented behaviour?

Why is the scale.data object 6711 genes in size and not 1500 like the requested variable.feature.n? Why are the Layers joined instead of separate? Why are the 1500 variable genes not all included in the scale.data?

wudustan avatar May 17 '24 17:05 wudustan