Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Properly interrupt workflow if no variable genes found
Browse files Browse the repository at this point in the history
  • Loading branch information
dweemx committed Apr 16, 2020
1 parent 6092226 commit 1258d61
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/feature_selection/sc_find_variable_genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import os
import scanpy as sc
import warnings

parser = argparse.ArgumentParser(description='')

Expand Down Expand Up @@ -90,6 +91,13 @@
min_disp=args.min_disp,
max_disp=args.max_disp
)
num_variable_genes = sum(adata.var["highly_variable"])
if num_variable_genes == 0:
raise Exception("No variable genes found. Make sure the following options (minMean, maxMean, minDisp, maxDisp) are in the right range of your data.")
if num_variable_genes < 100:
warnings.warn(
"Low number of variables genes found. Make sure the following options (minMean, maxMean, minDisp, maxDisp) are in the right range of your data."
)
else:
raise Exception("VSN ERROR: Method does not exist.")

Expand Down

0 comments on commit 1258d61

Please sign in to comment.