Repository: satijalab/seurat

Issue #2539: Supervised clustering on a subset of integrated object (best practices?)
Created: 2020-01-24T01:34:27Z
Hello Seurat team!
I have seen some other similar issues about this (such as #326, #127, #1883), but I am not sure how relevant those answers are in my case.
I integrated 12 different 10x scRNAseq runs using rpca approach and created a combined object in the first pass analysis. I'd like to subset all the T cell clusters into a separate object and then perform re-clustering using a user-defined list of genes. My goal is using certain genes (based on biological knowledge) and try to see if they can differentiate T cell subsets in a meaningful way.
I got something to work but I'm not sure if it is the best way of doing what I'm trying to do. Please see my code below and let me know if you see anything wrong.
dim(combined)
# > 17306 52643

DefaultAssay(combined)
# > "RNA"

tcell <- subset(combined, idents="T cell")

dim(tcell)
# > 17306 24859 

# Genes to use for clustering and dimensionality reduction
genes <- c( "Havcr2",  "Tigit",   "Lag3" ,   "Pdcd1" ,  "Ctla4",   "Prdm1" ,  "Fasl"  ,  "Ifng" ,  
 "Tnf",     "Cxcr5",   "Ccr7" ,   "Bcl6",    "Tcf7" ,   "Irf8"  ,  "Cx3cr1" , "Lef1" ,  
 "Klrg1",   "Myc" ,    "Slamf7" , "Ifitm1",  "Ifitm2" , "Isg20",   "Il12rb1" ,"Zeb1" ,  
 "Tbx21" ,  "Prf1" ,   "Gzmb" ,   "Gzma",    "Gzmk" ,   "Sell" ,   "Il7r",    "Mki67" )

tcell <- FindVariableFeatures(tcell)

tcell <- ScaleData(tcell)

dims <- 5

tcell <- RunPCA(tcell, 
                features = genes,
                approx=F, npcs = dims)

#> The following 16 features requested have not been scaled (running reduction without them): 
Tigit, Lag3, Pdcd1, Prdm1, Fasl, Cxcr5, Bcl6, Slamf7, Il12rb1, Zeb1, Foxo3, Id2, Cd3e, Cd3g, Cd8a, Tbx21

tcell <- RunTSNE(tcell, 
                 check_duplicates=F, 
                 features = genes, dims = 1:dims)

tcell <- RunUMAP(tcell, features = genes, umap.method="uwot")

tcell <- FindNeighbors(tcell,
                       features = genes)

tcell <- FindClusters(tcell, resolution = 0.5)


My specific questions are below. Although I realize that some answers may depend on the experimental context, I'm trying to develop a general sense of how I can perform this analysis in the best way possible. I apologize in advance if some of these questions are too basic.
1- Am I correct in using RNA as the DefaultAssay for subsetting the tcell object and downstream applications?
2- If my goal is to drive clustering/dim reduction with a list of genes, do I still need to calculate variable genes?
3- Do I need to perform ScaleData step again if I want to change parameters in PCA/tSNE/UMAP steps (I wouldn't think so, but I remember reading a post about this previously)?
4- How many dimensions should one calculate when using a list of genes like I'm trying to do here? Is there a rough number for a short vs large list of user-defined genes?
5- Why am I getting the warning about genes not being scaled and left out of PCA calculation?
6- Which steps are the appropriate places to pass the user-defined gene list? Here I used in all three of the PCA-tSNE-UMAP steps. If I understand it correctly, passing a custom feature list to RunTSNE and RunUMAP will change the overall "look" of the clusters, while passing it to FindNeighbors will change how the clusters will be determined. So, one can use two different sets of genes (ie variable genes vs user-provided shortlist) to change topography and the composition of the output. Is this right?
7- Does calculating more than one dim reductions (i.e. both tSNE and UMAP) impact the clustering step?
Alternatively, would you recommend using all variable genes in the subsetted object to perform dim reduction?
I greatly appreciate everything you do for this awesome software solution!
Best,
Atakan

Duplicate issue #4675: Clustering by individual tissue population post integration of two datasets
Created: 2021-06-21T21:22:07Z
Hi Seurat Developers
Sorry if this question has been asked. Post batch correction and integration of two datasets, where cells of multiple different tissue types are present, I want to run clustering on cells of corresponding tissue types between the two datasets. Should I simply subset the integrated object to get each tissue type, scale the data and run PCA and then run clustering on it?
Thanks so much for the clarifications.

Closing comment (2021-06-25T16:28:23Z): Hi, This is similar to #2539. Yes, you should subset, scale and run PCA.