Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug running harmony batch correction with multiple covariates #370

Open
joseverdezoto opened this issue Dec 13, 2024 · 1 comment
Open

Comments

@joseverdezoto
Copy link

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!

@jpmcga
Copy link

jpmcga commented Dec 13, 2024

I've encountered the same error when trying to access multiple .obs columns on a backed SnapATAC2.AnnData/AnnDataSet object. Sorry if I'm stating what you already know, but I think this is due to the SnapATAC2's 'out-of-core' implementation of AnnData objects, wherein .obs is a 'DataFrame element' not a pandas DataFrame.

See https://kzhang.org/epigenomics-analysis/anndata.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants