scanpy icon indicating copy to clipboard operation
scanpy copied to clipboard

Added intercept to regress_out()

Open ggit12 opened this issue 1 year ago • 6 comments

Added the boolean argument "add_intercept" to regress_out, and implemented code to optionally add the intercept back to the residuals in the result of regress_out().

  • [x] Closes https://github.com/theislab/single-cell-tutorial/issues/35
  • [ ] Tests included or not required because:
  • [ ] Release notes not necessary because:

ggit12 avatar Nov 06 '23 00:11 ggit12

@LuckyMD

ggit12 avatar Nov 06 '23 00:11 ggit12

Codecov Report

Merging #2731 (5b9bc72) into master (b23229f) will decrease coverage by 0.01%. The diff coverage is 86.95%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2731      +/-   ##
==========================================
- Coverage   72.87%   72.87%   -0.01%     
==========================================
  Files         110      110              
  Lines       12100    12107       +7     
==========================================
+ Hits         8818     8823       +5     
- Misses       3282     3284       +2     
Files Coverage Δ
scanpy/preprocessing/_simple.py 82.03% <86.95%> (-0.19%) :arrow_down:

codecov[bot] avatar Nov 06 '23 00:11 codecov[bot]

Hi! Can you explain a bit what use cases this helps people with? When would one want to set this to True?

Once we have a good example, you can use that to write a small test that checks if it works as intended.

flying-sheep avatar Nov 07 '23 09:11 flying-sheep

Hi,

I believe @LuckyMD detailed one use case here https://github.com/theislab/single-cell-tutorial/issues/35.

Is this enough to get started?

ggit12 avatar Nov 07 '23 20:11 ggit12

Thanks for implementing this! I used it to regress out total counts and cell cycle scores before highly variable gene selection, and it worked well. The clusters are better separated without artifacts, unlike running regressing function after HVG.

danielee0707 avatar Nov 08 '23 00:11 danielee0707

Is this enough to get started?

For sure, thank you for the context!

Is it possible to add a unit test that checks that with this set to True, clusters are better separated?

flying-sheep avatar Nov 09 '23 08:11 flying-sheep