Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is Regressing Covariates in Both ScaleData and RunHarmony Redundant and Potentially Problematic? #262

Open
vertesy opened this issue Nov 5, 2024 · 0 comments

Comments

@vertesy
Copy link

vertesy commented Nov 5, 2024

Hello,

Thank you for this cool method, I had very nice results with it!

When I'm analyzing scRNA-seq data using Seurat and Harmony, I'm regressing out covariates (e.g., library, sample type) at two steps:

  1. During Scaling:
# pseudocode
NormalizeData(obj) |> 
ScaleData(obj, vars.to.regress = c('library', 'sample_type')) |> 
PCA(obj) 
  1. During Batch Correction with Harmony:

library_sample_type = paste0('library', 'sample_type')

RunHarmony(obj, group.by.vars = c('library_sample_type')) -> result

This means I'm addressing the covariates twice—once in ScaleData and again in RunHarmony. My questions are:

  • Is this redundancy problematic?
    • Specifically, could correcting for covariates at both steps lead to overcorrection?
  • What are the potential consequences of regressing out covariates in both steps?
    • Could it affect downstream analyses like clustering or differential expression by reducing variability too much?
  • What would be the recommended best practice?
    • Should I regress out covariates only during RunHarmony or OK to use them in both?
    • E.g. marker heatmap plots are based on ScaleData, that is one reason to correct already at scaling (of course I could redo scaling and PCA after Harmony).

I'd appreciate any guidance on whether I should adjust my workflow to correct for covariates in just one of these steps to avoid problems that you can foresee.

Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant