Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distance_matrix.py - avoid that config:heatmap:n_observations default causes error #58

Open
bednarsky opened this issue Nov 15, 2024 · 1 comment · May be fixed by #63
Open

distance_matrix.py - avoid that config:heatmap:n_observations default causes error #58

bednarsky opened this issue Nov 15, 2024 · 1 comment · May be fixed by #63
Labels
enhancement New feature or request

Comments

@bednarsky
Copy link

  • I ran the unsupervised analysis leaving many of the default parameters unchanged
  • One of them causes an error for my pseudobulks with less that that number of cells
heatmap:
    metrics: ['correlation','cosine']
    hclust_methods: ['complete']
-    n_observations: 1000 # random sampled proportion float (0-1] or absolute number as integer
+    n_observations: 1 # random sampled proportion float (0-1] or absolute number as integer
    n_features: 0.5 # highly variable features proportion float (0-1] or absolute number as integer
  • alternative could also be to make the respective line defensive
    # downsample observations
    if data_or_feature == "observations":
    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)
# downsample observations
if data_or_feature == "observations":
     if isinstance(n_observations, float) or n_observations==1:
        n_observations = int(math.floor(n_observations * data.shape[0]))
+    if n_observations < data.shape[0]:
        data = data.sample(n=n_observations, random_state=42)
@bednarsky bednarsky changed the title Improve heatmap: n_observations default to avoid potential error Improve heatmap: avoid that n_observations default causes error Nov 16, 2024
@bednarsky bednarsky changed the title Improve heatmap: avoid that n_observations default causes error heatmap: avoid that n_observations default causes error Nov 16, 2024
@bednarsky bednarsky changed the title heatmap: avoid that n_observations default causes error distance_matrix.py - avoid that config:heatmap:n_observations default causes error Nov 16, 2024
@sreichl
Copy link
Collaborator

sreichl commented Nov 18, 2024

both changes make sense, feel free to PR if tested.

@sreichl sreichl added the enhancement New feature or request label Nov 18, 2024
@bednarsky bednarsky linked a pull request Nov 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants