spacexr icon indicating copy to clipboard operation
spacexr copied to clipboard

The explanatory variable/covariates preparation for "run.CSIDE.replicates"

Open glzhang90095 opened this issue 1 year ago • 1 comments

Hi! This tool is so helpful to me. I have an issue when applying it to my data. My design is to compare the cell-type specific DEGs between control vs disease using 10x VISIUM, 2 replicates for each group. I assume the "run.CSIDE.replicates" can compute the DEGs across conditions, not only within the section shown in the tutorial. When trying"run.CSIDE.replicates", I had difficulties in the prep of the explanatory variable/covariates. As suggested in the tutorial, the covariate needs to be biologically relevant to the gene changes and is very critical in the CSIDE running. The barcode ids in each section are the same. In this case, I think the spatial barcode is not available for covariates. Any suggestions on the covariates setup? If the "run.CSIDE.replicates" was not designed to do this job, is there any alternative way?

Thanks! Guanglin

glzhang90095 avatar Aug 13 '22 18:08 glzhang90095

The function run.CSIDE.replicates looks for differential expression within each section, for genes that replicate across multiple replicates. For the task you are describing of finding DE genes across replicates, the best way would be to merge all of your samples into on SpatialRNA object. Then, the explanatory variable, for each pixel, would denote the condition of each sample. If you run into naming conflicts for the barcodes, I recommend adding a sample ID prefix to each barcode. You could also e.g. use run.CSIDE.replicates with multiple replicates each paired together, though this requires at least 3 replicates per condition.

Dylan

dmcable avatar Aug 16 '22 14:08 dmcable

Hi Dylan @Dylan, Forgive me for bringing this up again. I followed your suggestions: merge the sections with each barcode prefixed with the condition, and run.CSIDE.single to get the differentially expressed genes among Control vs Disease at the cell type level. Correct if this is wrong.

However, the number of DEGs is very few or zero for most cell types. So I was considering using the run.CSIDE.replicates to compare 4controls and 4 diseases. In the tutorial, you mentioned that "we have the option to assign different replicates to different groups ". But in another post, you said the use of group_ids for different groups is not available. I wondered if you could clarify which scenarios we can include different groups in run.CSIDE.replicates? Is run.CSIDE.replicates able to find DEGs across conditions in addition to the Z-test you mentioned in other posts?

Thanks a lot, Guanglin

glzhang90095 avatar Oct 11 '22 18:10 glzhang90095

The use of group_ids is intended for a different problem: estimating population DE (within samples) when there are multiple samples and multiple replicates within each sample. It does not apply to this problem of DE across conditions.

Yes, please refer to the Z-test method in other posts, as you identified, for an alternative way of accomplishing this task.

dmcable avatar Oct 11 '22 18:10 dmcable