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

Issue with scgen.batch_removal function #1

Closed
nhuhoa opened this issue Mar 17, 2019 · 2 comments
Closed

Issue with scgen.batch_removal function #1

nhuhoa opened this issue Mar 17, 2019 · 2 comments

Comments

@nhuhoa
Copy link

nhuhoa commented Mar 17, 2019

Dear Naghipourfar and M0hammadL,

Thanks for very nice work. It will be very useful for my work.
I have tested scGen and there is a small bug at the "batch_removal" function. So I just want to let you know here.

I just test scGen with 2 batches, batch 0 and batch 1 and only one cell type with index 1. Training process goes well, but the batch removal step has a bug:
The bug is at line 291 of util.py:
all_shared_ann = sc.AnnData.concatenate(*shared_ct, batch_key="concat_batch")
// after concatenate function, we suppose to have a pandas dataframe: all_shared_ann.obs["concat_batch"], but the program do not return this dataframe, only return all_shared_ann.obs["batch"], and all_shared_ann.obs["cell_type"].

So at the next line:
del all_shared_ann.obs["concat_batch"]
// this dataframe does not exist, program throw error here.

The same idea with the line 301 of util.py:
del all_corrected_data.obs["concat_batch"]

When I comment 2 bugs above, the program works well and give me a corrected matrix.
The versions of package I use are:
scgen: 1.0.0.dev25+347e176
anndata: 0.6.18
scanpy: 1.4
numpy: 1.14.5

Thanks,
Hoa Tran

@mumichae
Copy link
Contributor

I'm having the same issue while working with 2 batches (0 and 1). The problem probably comes from the fact, that there is only 1 object in shared_ct, so that the key concat_batch is not created during concatenation and can therefore not be removed. This then throws the error. I fixed this issue by simply adding a statement checking whether the concat_batch key is contained as a column before deleting it.

@M0hammadL
Copy link
Member

Hi, Thanks for mentioning this, now it should be fixed.

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

3 participants