Skip to content

Commit

Permalink
handle heatmap case of proportion==1
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichl committed Jul 1, 2024
1 parent 1f3993a commit 2f650ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions workflow/scripts/distance_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
# retain only highly variable features
if data_or_feature == "features":
variances = data.var(axis=1)
if isinstance(n_features, float):
if isinstance(n_features, float) or n_features==1:
n_features = int(math.floor(n_features * data.shape[0]))
top_features = variances.nlargest(n_features).index
data = data.loc[top_features,:]

# downsample observations
if data_or_feature == "observations":
if isinstance(n_observations, float):
if isinstance(n_observations, float) or n_observations==1:
n_observations = int(math.floor(n_observations * data.shape[0]))
data = data.sample(n=n_observations, random_state=42)

Expand Down

0 comments on commit 2f650ae

Please sign in to comment.