scverse / scverse/scanpy

sc.tl.paga_expression_entropies(adata)

Open
#367 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.6k
Forks
779
Avg merge
1d 4h
Merged PRs (30d)
27

Description

I calculated sc.tl.paga(adata, groups='cell_ontology_class') without problems but I couldn't run sc.tl.paga_expression_entropies(adata).

I've modified the original code and it now runs - if this looks good you can perhaps update the original code? also, if it doesn't let me know so I don't carry over the mistakes!

from scipy.stats import entropy
groups_order, groups_masks = sc.utils.select_groups(tiss, key=tiss.uns['paga']['groups'])
entropies = []
for mask in groups_masks:
    X_mask = tiss.X[mask].todense()
    x_median = np.nanmedian(X_mask, axis=1,overwrite_input=True)
    x_probs = (x_median - np.nanmin(x_median)) / (np.nanmax(x_median) - np.nanmin(x_median))
    entropies.append(entropy(x_probs))
entropies

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the sc.tl.paga_expression_entropies(adata) entry point and reproduce the failure after running sc.tl.paga with the cell_ontology_class groups. Compare the existing behavior with the reported modification and establish a documented, working entropy result for grouped data.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
bioinformatics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.