satijalab / sctransform

R package for modeling single cell UMI expression data using regularized negative binomial regression
GNU General Public License v3.0
208 stars 33 forks source link

diff_mean_test on batch-corrected Seurat object #102

Closed peterras1985 closed 3 years ago

peterras1985 commented 3 years ago

Hej Christoph, I am following your vignette for the conserved marker finding in Seurat object after integration. My samples are quite different in nCount_RNA because the cell quantification was off ~5-fold and sequencing was done in equimolar pool. I am working with Seurat objects and integration workflow. In your vignette, you are saying that "_When working with data where there is a stark discrepancy between sequencing depth, one should make sure that the corrected counts used for differential expression testing were generated using the same ‘target’ depth. Since this is not supported by Seurat::SCTransform it requires running sctransform::correct() with identical cell meta data for all samples and setting the asis parameter to TRUE.". Maybe I misunderstood SCTransform in Seurat, but is the result not the same (corrected UMI counts in "counts") if I run Seurat::SCTransform after integration on the full count matrix in the RNA assay? e.g. SCTransform -> FindIntegrationAnchors -> IntegrateData -> SCTransform(assay = "RNA") Thank you!

ChristophH commented 3 years ago

Hello,

Now that I re-read that paragraph in the vignette, I realize that the statement is an error. The point I was trying to make is that the corrected counts (in the example accessed via GetAssayData(immune.combined.sct, assay = "SCT", slot = "counts")) are not directly comparable between samples that have been sequenced to different depth. This is the case because in the context of integration SCTransform is run per sample and the corrected counts are based on the median depth. However, when running diff_mean_test_conserved we are testing for DE genes within each sample and then combine the test results. Since there are no between-sample comparisons, the difference in depth does not matter.

I hope this makes sense. In short, ignore the paragraph and run the integration as outlined in the Seurat vignette and the DE test as outlined in my DE vignette

Edit: To answer your question, running SCTransform after integration on the full count matrix in the RNA assay is identical to running it on the merge object (no integration). The counts in the RNA assay are not changed during integration.

peterras1985 commented 3 years ago

Hej Christoph - thank you for the fast reply! Makes perfect sense on the diff_mean_test_conserved()!