drieslab / Giotto

Spatial omics analysis toolbox
https://drieslab.github.io/Giotto_website/
Other
258 stars 98 forks source link

Adjusting Batch effects in Merge Giotto object #317

Closed moutazhelal closed 1 year ago

moutazhelal commented 2 years ago

Dear Authors,

Thank you for reading my message.

I am using adjustGiottoMatrix to correct for batch correction and regressing covariate (nr_feats) storing The corrected matrix in custom slot

Giotto_ob = adjustGiottoMatrix(
        Giotto_ob ,
        batch_columns = "list_ID",
        covariate_columns = "nr_feats",
        return_gobject = TRUE,
        update_slot = c("custom"))

I am using expression_values = "custom" in all of my downstream analysis. when I run calculateHVF it returns a strang looking plot


Giotto_ob <- calculateHVF(gobject = Giotto_ob , expression_values = "custom",
                           save_param = list(save_name = '3_a_HVGplot'))

image

Am I doing something wrong? or this is how it suppose to look

Thank you very much

RubD commented 2 years ago

Hi @moutazhelal Apologies for the late reply. This function simply creates a linear model to test how expression is related to the batches and/or covariates, and then removes this relationship. This means that sometimes expression values can be negative, which obviously makes no biological sense. One quick, and maybe dirty, solution could be to change all negative values from the adjusted matrix ('custom' in your case) to 0. Hope this helps.