Open leonfodoulian opened 6 months ago
Well, if you SCTransform each individual dataset and then merge it shouldnt have the same output as if you SCT all your datasets together. You have different data input when you conduct the normilization. Except if you merge but still individualy SCT each layer which should have the same output as before merging each one.
Hi @NeuralBind,
The code I provided above splits the merged object before computing Seurat::SCTransform()
. Therefore, Seurat::SCTransform()
should run on each dataset individually. These two approaches should yield the same results. And as a matter of fact, if the datasets contain the same genes, the results match between the two approaches. This issue is due to the merge
function of Seurat
mishandling data with different sets of genes.
Best, Leon
Well i first tried it couple day ago, i merged two SCT transformed datasets (it kept the each single layer SCT$count1, SCT$count2 etc.), but by the time you run SCT again it transforms the whole dataset (and not individualy) and overwrites with a single layer for the whole set. Which is something you want in order to visualize the variations of similar groups for different conditions etc. You can try to play a bit with the Join layers function (for joining or spliting) and look what SCT does to the merged set. In the vignettes this part was a bit trivial so i just trial an error to see the function. For the different gene set it shouldnt be a problem as it will add more genes but they will be no expressed in a part of your dataset, so they will be transformed based on that.
Hi @NeuralBind,
I think you misunderstood the problem. Let us wait for an answer from the Seurat team regarding this issue.
Best, Leon
Hi,
I believe there is an issue with the
merge
function ofSeurat
. The problem lies in the waySeurat
handles thefeature.attributes
andscale.data
slots of two objects with different sets of expressed genes (though with a high overlap) on whichSeurat::SCTransform()
was computed. Running the code in two different ways (but essentially identical in terms of the expected outcome) results in very different results:Seurat
objects then runSeurat::SCTransform()
(referred to as the "standardSeurat
version 5 workflow" in the code);Seurat::SCTransform()
then merge the objects (referred to as the "lapply approach" in the code).For reproducibility, please check the code below:
Here is also my
sessionInfo()
:Best, Leon