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: Length mismatch in deconvolver #5

Open
WhaleGe opened this issue Dec 20, 2023 · 2 comments
Open

ValueError: Length mismatch in deconvolver #5

WhaleGe opened this issue Dec 20, 2023 · 2 comments

Comments

@WhaleGe
Copy link

WhaleGe commented Dec 20, 2023

Thank you very much for the tool you developed. But an error occurred when I applied it to calculate ESAI. I ruled out many possibilities, but still could not solve the problem. Can you take a look at it for me when you have time?

Traceback (most recent call last):
File "./SEVtras/calculator.py", line 55, in
SEVtras.ESAI_calculator(adata_ev_path='SEVtras/sEV_SEVtras_231219.h5ad', adata_cell_path='SEVtras/hm_Patient_hvg3000_PC30_res1_dist0.1_k20_S0_rawcount_231219.h5ad', out_path='SEVtras', Xraw=False, OBSsample='Sample', OBScelltype='subtype')
File "/Mn/conda/envs/sevtras/lib/python3.7/site-packages/SEVtras/main.py", line 187, in ESAI_calculator
celltype_e_number, adata_evS, adata_com = deconvolver(adata_ev, adata_cell, OBSsample, OBScelltype, OBSev, OBSMpca, cellN, Xraw, normalW)
File "/Mn/conda/envs/sevtras/lib/python3.7/site-packages/SEVtras/functional.py", line 128, in deconvolver
near_neighbor_dat.index = adata_ev.obs.index
File "/Mn/conda/envs/sevtras/lib/python3.7/site-packages/pandas/core/generic.py", line 5500, in setattr
return object.setattr(self, name, value)
File "pandas/_libs/properties.pyx", line 70, in pandas._libs.properties.AxisProperty.set
File "/Mn/conda/envs/sevtras/lib/python3.7/site-packages/pandas/core/generic.py", line 766, in _set_axis
self._mgr.set_axis(axis, labels)
File "/Mn/conda/envs/sevtras/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 216, in set_axis
self._validate_set_axis(axis, new_labels)
File "/Mn/conda/envs/sevtras/lib/python3.7/site-packages/pandas/core/internals/base.py", line 58, in _validate_set_axis
f"Length mismatch: Expected axis has {old_len} elements, new "
ValueError: Length mismatch: Expected axis has 135224 elements, new values have 144325 elements

@RuiqiaoHe
Copy link
Member

Please first check the version of SEVtras is at v0.2.8.
If it's already this version, this problem may be caused by the dimension of the input cell matrix not matching the SEV matrix in some samples. SEVtras deconvolver needs the corresponding sample information in the input cell matrix for each sEV. Thus, please check that the sample name in the sEV matrix matches the sample name in the cell matrix (this should be contained in adata.obs, default is key 'batch' in the sEV matrix and cell matrix).

@WhaleGe
Copy link
Author

WhaleGe commented Dec 21, 2023

Please first check the version of SEVtras is at v0.2.8. If it's already this version, this problem may be caused by the dimension of the input cell matrix not matching the SEV matrix in some samples. SEVtras deconvolver needs the corresponding sample information in the input cell matrix for each sEV. Thus, please check that the sample name in the sEV matrix matches the sample name in the cell matrix (this should be contained in adata.obs, default is key 'batch' in the sEV matrix and cell matrix).

Thank you very much. I found that there are two missing samples in cell matrix. There is a difference between batch in sev matrix and cell matrix. Thanks for the tip your provided

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