Skip to content

Commit

Permalink
assert to runtime error
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Apr 29, 2024
1 parent df6a3af commit f9e7589
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scanpy/tools/_score_genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,8 @@ def score_genes(
r_genes = r_genes.to_series().sample(ctrl_size).index
control_genes = control_genes.union(r_genes)

assert len(control_genes) > 0, "No control genes found."
assert (
len(control_genes.intersection(gene_list)) == 0
), "Genes are in both gene_list and control_genes."
if len(control_genes) == 0:
raise RuntimeError("No control genes found in any cut.")

X_list = _adata[:, gene_list].X
if issparse(X_list):
Expand Down

0 comments on commit f9e7589

Please sign in to comment.