HVG by cell_ranger flavor, n_top_genes not working
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
Hi,
Im using scanpy 1.4.2 to analyze my data, using the following command:
sc.pp.highly_variable_genes(heart_cmc, flavor = 'cell_ranger', n_top_genes = 1000)
However, instead of getting 1000 HVG, it reports 1488 HVG. Similar thing happens with higher numbers of HVG (e.g. n_top_genes = 2000 returns 1999).
The scaling then fails with a following error:
ValueError: The first guess on the deviance function returned a nan. This could be a boundary problem and should be reported.
Any suggestions on how to fix it? When I dont specify n_top_genes, the thing runs without problems.
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with scanpy 1.4.2 using sc.pp.highly_variable_genes(..., flavor='cell_ranger', n_top_genes=1000) on a comparable dataset. Start at the highly_variable_genes entry point and inspect how the cell_ranger flavor selects genes; compare its result with the subsequent scaling step. Done means the requested gene count is handled consistently and scaling no longer fails for this case.
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
- Mostly clear
- Newbie friendliness
- 35/100