Thanks for your input.
Yes, the cell types are closely related. Both cell types have already been identified in multiple single cell papers. How they are related is what we are trying to understand.
All the pre-processing, filtering, clustering, marker identification, etc... was done in Seurat. Before subset. I ran again Seurat's PCA on the new object after subsetting the data.
I did not re-run the clustering in the SingleCellExperiment object or anything else. I just inherited the metadata from the Seurat object. And then ran PCAv2.
From you chunk of code we can only trust you on the default assay selected as well as the variable features selection.
AFAIK, both the Seurat and the SCE object are using the same assay and data:
### Seurat
> sub
An object of class Seurat
52986 features across 9084 samples within 2 assays
Active assay: SCT (20701 features, 5000 variable features) <------- SCT
3 layers present: counts, data, scale.data
1 other assay present: RNA
7 dimensional reductions calculated: pca, umap.unintegrated, integrated.cca, umap, umap.SCT, tsne, ...
### SCE
> sce.sub
class: SingleCellExperiment
dim: 20701 9084
metadata(0):
assays(3): counts logcounts scaledata
rownames(20701): Xkr4 Gm1992 ... CAAA01147332.1 AC149090.1
rowData names(0):
colnames(9084): .....
colData names(64): orig.ident nCount_RNA ... ident label
reducedDimNames(7): PCA UMAP.SCT ... UMAP PCAv2
mainExpName: SCT <-------- SCT
altExpNames(1): RNA
... are Seurat::RunPCA and scater::runPCA using both the default assay and layer? (SCT-data in seurat / SCT-logcounts in SCE).
The variable features selected should be identical, because I explicitly called to the same function in both PCAs:
Seurat's PCA
sub <- RunPCA(sub, features = VariableFeatures(object = sub))SCE + scater
sce.sub <- runPCA(sce.sub, subset_row=VariableFeatures(object = sub), name="PCAv2", scale=F, ntop=Inf )
Aren't these two options equivalent?
As for the loadings. Converting the Seurat object into SCE does not transfer the feature loadings. I retrieved them both using:
### Seurat
> pca.seurat.loadings <- Loadings(sub, reduction = "pca")
### SCE + scater
> pca.scater.loadings <- attr(reducedDims(sce.sub)[["PCAv2"]],"rotation")
It seems that scater removed a few (42) genes, but the rest are the same in both methods:
> dim(pca.seurat.loadings)
[1] 5000 51
> dim(pca.scater.loadings)
[1] 4958 51
> sum(! pca.scater.loadings$gene %in% pca.seurat.loadings$gene)
[1] 0
And then I compared them for PCs 1-4:
Seurat's PCA loadings are clearly more dispersed, and with outliers. Most of these genes are very relevant for the cell types studied.
The UMAPs are obviously different, because they come from PCAs with different results. However, when I say that the slingshot results are different, I am looking at the distribution of the pseudotime values to each cell / subtype / cell type, and how they are assigned to branches. For example, for one specific branch, in the slingshot results derived from Seurat's PCA, the subtypes are ordered like: A1 > A2 > B1 > A3. However, the equivalent branch in scater's PCA results has B1 > A1 > A2 > (a bit of B1 again) > A3.
I did previously some exploration of the slingshot results using scater's PCA, and I could find some "structure" in the data in PC3, driving the proposed trajectories. And the plot of PC3's loadings shows that they are pretty different between PCA methods.
I spent quite a long time analyzing slingshot results using scater::runPCA. We even made some convincing tests and had interesting biological explanations. However, now I see that those results disappear if I don't re-run the PCA after converting to SCE before slingshot.
What is happening here? Which method is right and which is wrong? Are scater::runPCA's underlying assumptions/method incompatible with SCT transformation?
Again, thanks for your input.