satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.24k stars 902 forks source link

Cell-cycle scoring Alternate Workflow and SCTransform (related to issue #1679) #6493

Closed jjacob12 closed 1 year ago

jjacob12 commented 1 year ago

Hi Satija lab, I want to get the order right for cell cycle regression and the SCTransform step in my scRNA-seq analysis workflow. For my purposes I found the 'Alternate Workflow' section in https://satijalab.org/seurat/articles/cell_cycle_vignette.html preferable to regressing out all cell cycle signals. This is the order of what I did on a 10X scRNA-seq dataset (1 condition only) filtered for quality thresholds, e.g. mitochondrial percent: NormalizeData FindVariableFeatures ScaleData RunPCA CellCycleScoring RunPCA(seurat_obj, features=c(s.genes, g2m.genes) DimPlot(seurat_obj, reduction='pca', group.by='Phase') which gave the below plot that clearly shows clustering by cell cycle phase:

Screenshot 2022-10-04 at 10 08 28

To regress out cell cycle differences I did the following, as per the vignette:

seurat_obj$CC.difference <- seurat_obj$S.Score - seurat_obj$G2M.Score
seurat_obj <- ScaleData(seurat_obj, vars.to.regress = "CC.difference", features = rownames(seurat_obj))
seurat_obj <- RunPCA(seurat_obj, features = c(s.genes, g2m.genes))
DimPlot(seurat_obj,  reduction = "pca", group.by = "Phase")

this worked exactly as I hoped it would, producing this plot where G2/M and S phase cells no longer cluster separately:

Screenshot 2022-10-04 at 10 30 06

So the seurat_obj now has the type of cell cycle regression I want. Can I apply SCTransform on this object, or should I have applied SCTransform at an earlier stage? Assuming what I did is correct, then as per the vignette should I next run:

seurat_obj <- SCTransform(seurat_obj, vst.flavor = "v2", verbose = FALSE) %>%
    RunPCA(npcs = XX, verbose = FALSE)

the above code on each condition, before going on to do an integrated analysis with multiple conditions?

Many thanks.

jjacob12 commented 1 year ago

Got this working now, so closed the issue.

AFrolicOfFerns commented 2 months ago

HI @jjacob12 , which order of operations did you end up going with? SCTransform before or after cell cycle regression? Thanks! :)

jjacob12 commented 2 months ago

Hi, SCTransform(YourSeuratObject, vars.to.regress = "CC.difference", method = "glmGamPoi", verbose = FALSE) for Seurat v4