bedapub / bedapub/besca

bc.tl.rc.recluster() seems to calculate HVG from previous ones

Open
#384 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
50
Forks
17
Avg merge
1d 4h
Merged PRs (30d)
3

Description

When reclustering a given subset of cells with `bc.tl.rc.recluster()` function, it seems that the HVG are only computed from previous HVG genes (adata.var) instead of from all genes (`adata.raw.var`). Going back to the full set of genes is needed to give the algorithm a chance to find the genes that are most variable specifically within the subset of cells.

The problematic part of the function seems this one:
`cluster_subset.raw = cluster_subset` in line 97

Suggested fix:
```
# Create a new anndata object for the subcluster analysis.
# IMPORTANT: We use adata.raw to get the expression data for ALL genes.
cluster_subset = cluster_subset.raw.to_adata()
cluster_subset.raw = cluster_subset # create back a raw layer before running HVG. cluster_subset.raw.var will contain all genes, whereas cluster_subset.var only the newly identified HVG
```

Thanks for checking and fixing it
Best,
Llucia

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect bc.tl.rc.recluster() around line 97 and trace how the subset's expression data and raw.var are prepared before highly variable genes are computed. Verify that reclustering can consider all genes in adata.raw.var rather than only the previous HVG set. Done means the subset-specific HVG calculation uses the full gene set and preserves the raw layer needed afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.