scverse / scverse/SnapATAC2

Bug running harmony batch correction with multiple covariates

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

Nobody has claimed this yet.

Dominant language
Python
Stars
323
Forks
43
PR merge metrics
No merged PRs in 30d

Description

Thanks for making this awesome package! I'm having some problems when running sc.pp.harmony. I previously had v2.7.0 installed and ran into an issue when defining multiple covariates in the batch argument. I updated the package installation to v2.7.1 and the function works as expected with a single covariate. However, if I provide a list of covariates, I get the following error:

image

My coworker and I tracked down the problem to trying to create a pandas df with pd.DataFrame(adata.obs[batch]). If you simply run pd.DataFrame(adata.obs) without using the slicing operator to retrieve specific columns, the df is created properly. We also tried pd.DataFrame(adata.obs[:][batch]) and the df with the batch covariates is properly created. Not sure if we're right, but we think this is related to snapatac2 trying to use a reference to the actual data for making the covariate df.

Would love to hear your thoughts. Thanks so much for your help!

Contributor guide

No contributing guide indexed for this repository

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 by reproducing the failure in sc.pp.harmony with multiple covariates in the batch argument, comparing pd.DataFrame(adata.obs[batch]) with the working alternatives described in the report. Trace the covariate DataFrame construction and verify that multiple covariates complete without the reported error while preserving the single-covariate behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.