Skip to content

Commit

Permalink
Merge branch 'no_marker_error', add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hannaml committed Oct 29, 2019
2 parents ea3b296 + d858bc6 commit 875782d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/cluster_diffex.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ def _get_distance_label(metric):
running_prefix.append('markers')
redux = norm.iloc[marker_ix]

# check that all cells have some marker expression
marker_per_cell = redux.astype(bool).sum()
if np.any(marker_per_cell == 0):
ncells_nomark = np.sum(marker_per_cell == 0)
msg = '{} of {} cells'.format(ncells_nomark, redux.shape[1])
msg += ' do not express any of the {}'.format(len(marker_ix))
msg += ' marker genes. Either remove these cells or alter thresholds'
msg += ' to increase the number of molecules.'
raise ValueError(msg)

# get distance
metric_label = _get_distance_label(args.distance)
running_prefix.append(metric_label)
Expand Down

0 comments on commit 875782d

Please sign in to comment.