seurat icon indicating copy to clipboard operation
seurat copied to clipboard

SCTransform some variable features absent from scale.data

Open ggruenhagen3 opened this issue 9 months ago • 9 comments

After using the SCTransform function, I found that some of my variable features are not in scale.data. This is best illustrated in the example below. From other posts (https://github.com/satijalab/seurat/issues/4877#issuecomment-894454625, https://github.com/satijalab/seurat/issues/3598#issuecomment-739111462, https://github.com/satijalab/seurat/issues/6987#issuecomment-1457736097), I thought that all of them should be. Shouldn't all variable features be in scale.data? Secondly, if they're not, does that mean that those genes aren't being used downstream for PCA, etc?

For more context, my dataset is an immune scRNA-seq dataset with ~23k genes and ~12k cells. Additionally, it has 3 layers from the 3 batches. I tried changing return.only.var.genes, but there were still variable features missing in scale.data. I suspect that this issue might be due to how SCTransform integrates multiple layers. Version information: R v4.3.1 and Seurat v5.0.2.

big_obj = Seurat::SCTransform(big_obj, method="glmGamPoi", vars.to.regress=c("pct_mt", "pct_hb", "pct_plat"), variable.features.n=3000, verbose=verbose, return.only.var.genes=TRUE, ncells=5000, conserve.memory=FALSE, vst.flavor="v2")
hvg = VariableFeatures(big_obj)
length(hvg1) # -> 3000
length(which( !hvg %in% rownames(big_obj[["SCT"]]$scale.data) )) # -> 47, this is unexpected

ggruenhagen3 avatar May 10 '24 14:05 ggruenhagen3