scverse / scverse/scanpy

sc.tl.score_genes use_raw = None does not default to True

Open
#1,970 0 comments 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 have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the master branch of scanpy.

Hi, in sc.tl.score_genes, there's nothing to catch use_raw=None before this line:
https://github.com/theislab/scanpy/blob/4e4e6abe9f073bcf87db4f3f3d9c8964765c8921/scanpy/tools/_score_genes.py#L102
Hence use_raw = None is the same as use_raw = False, even if _check_raw happens later.
The current description says:

use_raw 
         Whether to use `raw` attribute of `adata`. Defaults to `True` if `.raw` is present. 

Linking the relevant code from the start of function to line of issue:
https://github.com/theislab/scanpy/blob/4e4e6abe9f073bcf87db4f3f3d9c8964765c8921/scanpy/tools/_score_genes.py#L40-L111

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 in scanpy/tools/_score_genes.py at the sc.tl.score_genes code around the linked line. Reproduce the behavior with use_raw=None when an AnnData object has raw data, then verify the documented default is honored and add regression coverage for that case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.