scverse / scverse/scanpy

bbknn integrates multiple variables

Open
#2,004 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

Dear author,

Can bbknn integrate multiple variables?such as Platform and Individual.

Looking forward your reply
Siyu

sc.external.pp.bbknn(mydata, batch_key=["Platform","Individual_2"],n_pcs=50,set_op_mix_ratio=ratio)

computing batch balanced neighbors
Traceback (most recent call last):
File "", line 1, in
File "/home/scCell2/miniconda3/lib/python3.8/site-packages/scanpy/external/pp/_bbknn.py", line 134, in bbknn
return bbknn(
File "/home/scCell2/miniconda3/lib/python3.8/site-packages/bbknn/init.py", line 110, in bbknn
if batch_key not in adata.obs:
File "/home/scCell2/miniconda3/lib/python3.8/site-packages/pandas/core/generic.py", line 1721, in contains
return key in self._info_axis
File "/home/scCell2/miniconda3/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 4071, in contains
hash(key)
TypeError: unhashable type: 'list

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.external.pp.bbknn entry point and read scanpy/external/pp/_bbknn.py together with bbknn/init.py, the locations shown in the traceback. Run the reported call with multiple batch keys first; done means multiple variables are accepted without the shown TypeError and the integration behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.