Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

[SUGGESTION] Scanpy find markers step can fail when only one cluster found from clustering algorithm #48

Closed
dweemx opened this issue Nov 30, 2020 · 0 comments · Fixed by vib-singlecell-nf/vsn-pipelines#262 or #49
Assignees
Labels
enhancement New feature or request

Comments

@dweemx
Copy link
Contributor

dweemx commented Nov 30, 2020

Is your feature request related to a problem? Please describe.
Pipeline can fail at the Scanpy find markers step when clustering resolution is too low which leads to having a single cluster. Here, Leiden resolution 0.2 lead to 1 cluster.

Describe the solution you'd like
Error raised is not human readable:

Command error:
  /opt/venv/lib/python3.7/site-packages/louvain/Optimiser.py:349: SyntaxWarning: assertion is always true, perhaps remove parentheses?
    assert(issubclass(partition_type, LinearResolutionParameterVertexPartition),
  Traceback (most recent call last):
    File "/staging/leuven/stg_00002/lcb/dwmax/documents/aertslab/GitHub/vib-singlecell-nf/vsn-pipelines/src/scanpy/bin/cluster/sc_marker_genes.py", line 114, in <module>
      n_genes=ngenes
    File "/opt/venv/lib/python3.7/site-packages/scanpy/tools/_rank_genes_groups.py", line 367, in rank_genes_groups
      mean_rest, var_rest = _get_mean_var(X[mask_rest])  # for fold-change
    File "/opt/venv/lib/python3.7/site-packages/scanpy/preprocessing/_utils.py", line 10, in _get_mean_var
      mean = X.mean(axis=0)
    File "/opt/venv/lib/python3.7/site-packages/scipy/sparse/base.py", line 1091, in mean
      return (inter_self * (1.0 / self.shape[0])).sum(
  ZeroDivisionError: float division by zero

Describe alternatives you've considered
We should provide a better error to the user.

Additional context
/

@dweemx dweemx added the enhancement New feature or request label Nov 30, 2020
@dweemx dweemx self-assigned this Nov 30, 2020
dweemx added a commit that referenced this issue Nov 30, 2020
dweemx added a commit to vib-singlecell-nf/vsn-pipelines that referenced this issue Nov 30, 2020
@dweemx dweemx mentioned this issue Dec 3, 2020
KrisDavie pushed a commit to vib-singlecell-nf/vsn-pipelines that referenced this issue Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant