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

Scrubblet module fails when running with less than 30 cells #124

Open
pcm32 opened this issue Oct 30, 2023 · 0 comments
Open

Scrubblet module fails when running with less than 30 cells #124

pcm32 opened this issue Oct 30, 2023 · 0 comments

Comments

@pcm32
Copy link
Member

pcm32 commented Oct 30, 2023

I guess this is not unexpected:

Traceback (most recent call last):
  File "/usr/local/bin/scanpy-multiplet", line 10, in <module>
    sys.exit(multiplet())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/scanpy_scripts/cmd_utils.py", line 46, in cmd
    func(adata, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/scanpy_scripts/lib/_scrublet.py", line 24, in scrublet
    sce.pp.scrublet(adata, adata_sim=adata_sim, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/scanpy/external/pp/_scrublet.py", line 239, in scrublet
    scrubbed = [
  File "/usr/local/lib/python3.9/site-packages/scanpy/external/pp/_scrublet.py", line 240, in <listcomp>
    _run_scrublet(
  File "/usr/local/lib/python3.9/site-packages/scanpy/external/pp/_scrublet.py", line 210, in _run_scrublet
    ad_obs = _scrublet_call_doublets(
  File "/usr/local/lib/python3.9/site-packages/scanpy/external/pp/_scrublet.py", line 434, in _scrublet_call_doublets
    sl.pipeline_pca(
  File "/usr/local/lib/python3.9/site-packages/scrublet/helper_functions.py", line 91, in pipeline_pca
    pca = PCA(n_components=n_prin_comps, random_state=random_state, svd_solver=svd_solver).fit(X_obs)
  File "/usr/local/lib/python3.9/site-packages/sklearn/decomposition/_pca.py", line 382, in fit
    self._fit(X)
  File "/usr/local/lib/python3.9/site-packages/sklearn/decomposition/_pca.py", line 459, in _fit
    return self._fit_truncated(X, n_components, self._fit_svd_solver)
  File "/usr/local/lib/python3.9/site-packages/sklearn/decomposition/_pca.py", line 543, in _fit_truncated
    raise ValueError(
ValueError: n_components=30 must be between 1 and min(n_samples, n_features)=21 with svd_solver='arpack'

We should have some logic that either filters out samples with less than 30 cells before running scrubblet or something that allow the user to indicate that this should fail like this if getting to this point.

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