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

ValueError: cannot reindex from a duplicate axis #82

Closed
DUAN-GAO opened this issue Nov 22, 2021 · 7 comments
Closed

ValueError: cannot reindex from a duplicate axis #82

DUAN-GAO opened this issue Nov 22, 2021 · 7 comments

Comments

@DUAN-GAO
Copy link

Hi,when I execute this code :
adata = adata.concatenate(adata_tmp, batch_key='sample_id')
I got below error,
ValueError: cannot reindex from a duplicate axis

could u help, many thanks

@LuckyMD
Copy link
Contributor

LuckyMD commented Nov 22, 2021

Hey! Are you getting this error with the tutorial data or your own data? It looks like you might have a barcode that is both in adata.obs_names and adata_tmp.obs_names. Or otherwise, check your adata.var and adata_tmp.var for columns with the same name.

@DUAN-GAO
Copy link
Author

Mr Malte, I used the sample dataset GEO set GSE92332_RAW, but soon after second GEO data read, when it tried to combine with the first GEO data, it told me cannot reindex from a duplicate axis

@onsamoylova
Copy link

Any updates? Did you managed this problem? (Same here, with tutorial dataset)

@onsamoylova
Copy link

after line:
adata.var = genes
Add:
adata.var_names_make_unique()

@LuckyMD
Copy link
Contributor

LuckyMD commented Dec 6, 2021

Thanks for the solution. I believe it's reported in another issue as well. It is fixed in the latest version which is only available in PR #58 though.

@LuckyMD LuckyMD closed this as completed Dec 6, 2021
@Lavieenrose123
Copy link

Lavieenrose123 commented Mar 10, 2022

Thanks for the solution. I believe it's reported in another issue as well. It is fixed in the latest version which is only available in PR #58 though.

Hi, I performed the code from your latest notebook (1906) but I still encountered the same problem. I found the problem is due to non-unique index of adata.var. Maybe the reason is, I guess, you didn't make the gene_symbol, i.e., the index of adata.var, to be unique for the first mouse cell (code in jupyter cell #5). It seems that you should also add adata.var_names_make_unique() there.

BTW, cound you please tell me why the same gene_symbol shared different gene_id in that dataset? Thanks!

@LuckyMD
Copy link
Contributor

LuckyMD commented Mar 12, 2022

Hi @Lavieenrose123,

This is exactly the fixthat is in PR #58 as mentioned.

BTW, cound you please tell me why the same gene_symbol shared different gene_id in that dataset? Thanks!

I think this occurs as when you map reads to the transcriptome during alignment, you might be aligning to two different transcripts that map to the same gene (e.g., isoforms).

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

4 participants