dmcable / spacexr

Spatial-eXpression-R: Cell type identification (including cell type mixtures) and cell type-specific differential expression for spatial transcriptomics
GNU General Public License v3.0
305 stars 73 forks source link

Performing CSIDE across samples of various conditions #145

Open Dillon214 opened 1 year ago

Dillon214 commented 1 year ago

Hi @dmcable,

I have a question about the solution you posted to the issue I had (#134). I checked out the vignette you linked and, while I think the functionality of population inference: meta regression is very useful, I don't think it addresses my previous question. The way I see it, meta regression seems more aimed at first performing cell type-specific DE on each sample based on some shared covariate, such as spatial position, then afterwards testing for differences in DE results based on sample condition. I am aiming for something a little more simple at the moment: performing cell type-specific DE between samples of different conditions, a la issue https://github.com/dmcable/spacexr/issues/113, preferably with an arbitrarily complex experimental design (as my original question mentioned, I have at least a 3 level design). So, while I think meta-regression is a great tool and one I would like to use later on in my analsis, I don't think it is right for my issues as they stand. Do you still stand by the advice you provided in issue https://github.com/dmcable/spacexr/issues/113, and do you think I could ammend said workflow to handle a 3-level experimental design? In a perfect world, I would like to test for differences in a specific cell type's response to disease while controlling for timepoint and differences in baseline gene expression levels between cell types in each tisuse. Your support and advice are greatly appreciated.

Also, if I am misinterpreting the function of meta-regression, please don't hesitate to let me know. I have yet to give it a proper test, so I might be mistaken.

Sincerely, Dillon Brownell

dmcable commented 1 year ago

I think if I'm understanding your question correctly, this functionality can still be handled by the meta regression procedure. If you would like to test for DE across conditions, then you can run C-SIDE on each sample with just an intercept term prior to plugging into the meta-regression across samples with arbitrary design matrix.

Best, Dylan

Dillon214 commented 1 year ago

Hi Dylan,

That is advice I will try. I have seen other issues dicussing the use of the plain intercept term to generate cell type specific counts, and going from there, but so far I have not attempted it myself. Thank you, I'll give it a shot. It might be worth adding some description of this process to the meta regression vignette section for less experienced users, so more are aware of this particular situation. Anyways, thank you again, I'll see about implementing this advice. Thank you. If possible, I'd prefer to keep this issue open until I've had time to attempt this, in case I need help with troubleshooting.

-Dillon

RobStrasser commented 9 months ago

Hi Dylan,

just to rule out a possible misunderstanding on my side:

"run.CSIDE.replicates with only intercept term --> CSIDE.population.inference with meta.regression on group-derived desgin matrix (e.g. c(0,0,0,1,1,1))" can be considered the more flexible successor workflow to the "run.CSIDE on intercept per sample --> z-score" approach described in https://github.com/dmcable/spacexr/issues/87#issuecomment-1192718351 , right? Based on the documentation and some threads here it seems so, but I might have missed some differences.

Thanks for the detailled documentation and resposiveness to the questions on the GitHub. Really helps a lot to navigate the tool independently 👍

Best, Rob