phipsonlab / speckle

R package for analysing single cell data
GNU General Public License v3.0
47 stars 6 forks source link

Batch normalised proportions #7

Open ConDem94 opened 1 year ago

ConDem94 commented 1 year ago

Is it possible to obtain batch normalized proportions using the propeller package? I have multiple samples from 5 different studies which are integrated using scvi. I would like to perform de novo clustering based on the proportions of 50-60 cell types. Is it possible to retrieve transformed proportions by regressing out the batch effects from the studies?

Thank you!

Best wishes, Constantinos

bphipson commented 1 year ago

Hi Constantinos

One way of doing this is to use the limma removeBatchEffect function. What I would do is get the transformed proportions by running the getTransformedProps function in speckle:

props <- getTransformedProps(sce$cluster, sce$sample, transform="logit")

and then passing the transformed proportions to removeBatchEffect

props.nobatch <- limma::removeBatchEffect(props$TransformedProps, batch=batch, design=design)

Have a read of the help for the removeBatchEffect function. The design matrix should include the covariates of interest, and exclude the batch variable.

?limma::removeBatchEffect

Then you could cluster props.nobatch.

Hope that helps.

Cheers, Belinda