theislab / scib

Benchmarking analysis of data integration tools
MIT License
283 stars 62 forks source link

Fix PCA regression error for sparse matrices #364

Closed mumichae closed 1 year ago

mumichae commented 1 year ago

Closes #291

Error occurs in scib.me.cell_cycle and is rooted in scib.me.pc_regression.

When the number of features of the input matrix is smaller or equal to the number of PCA components (n_comps) the svd_solver is set to "full", which doesn't work with sparse matrices.

Solution Whenever n_comps >= min(matrix.shape), convert to dense matrix

codecov[bot] commented 1 year ago

Codecov Report

Merging #364 (fbaa568) into main (c42935b) will increase coverage by 0.15%. The diff coverage is 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #364 +/- ## ========================================== + Coverage 53.18% 53.34% +0.15% ========================================== Files 22 22 Lines 1852 1854 +2 ========================================== + Hits 985 989 +4 + Misses 867 865 -2 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `53.34% <100.00%> (+0.15%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/theislab/scib/pull/364?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab) | Coverage Δ | | |---|---|---| | [scib/metrics/pcr.py](https://codecov.io/gh/theislab/scib/pull/364?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-c2NpYi9tZXRyaWNzL3Bjci5weQ==) | `81.94% <100.00%> (+3.37%)` | :arrow_up: |