mnn_correct() ValueError: not enough values to unpack (expected 3, got 1)
See original GitHub issueHello,
I am having hard times using the batch correction function running matching mutual nearest neighbors.
I have an anndata with 3 batches. I want to point out that the batch correction using the sc.pp.combat() function works. On the other hand, if I run (on the uncorrected adata):
sce.pp.mnn_correct(adata,
var_index=None,
var_subset=None,
batch_key='batch',
index_unique='-',
batch_categories=None,
k=20,
sigma=1.0,
cos_norm_in=True,
cos_norm_out=True,
svd_dim=None,
var_adj=True,
compute_angle=False,
mnn_order=None,
svd_mode='rsvd',
do_concatenate=True,
save_raw=False,
n_jobs=None)
I get:
in …/site-packages/scanpy/preprocessing/_mnn_correct.py the man_correct function is:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-47-b453bc0c2cd4> in <module>
16 do_concatenate=True,
17 save_raw=False,
---> 18 n_jobs=None)
~/Library/Python/3.7/lib/python/site-packages/scanpy/preprocessing/_mnn_correct.py in mnn_correct(var_index, var_subset, batch_key, index_unique, batch_categories, k, sigma, cos_norm_in, cos_norm_out, svd_dim, var_adj, compute_angle, mnn_order, svd_mode, do_concatenate, save_raw, n_jobs, *datas, **kwargs)
97 batch_categories=batch_categories, k=k, sigma=sigma, cos_norm_in=cos_norm_in, cos_norm_out=cos_norm_out,
98 svd_dim=svd_dim, var_adj=var_adj, compute_angle=compute_angle, mnn_order=mnn_order, svd_mode=svd_mode,
---> 99 do_concatenate=do_concatenate, save_raw=save_raw, n_jobs=n_jobs, **kwargs)
100 return datas, mnn_list, angle_list
101 except ImportError:
ValueError: not enough values to unpack (expected 3, got 1)
I checked _mnn_correct.py. and it basically defines a function mnn_cor on the mnn_correct from mnnpy package:
def mnn_correct(*datas, var_index=None, var_subset=None, batch_key='batch', index_unique='-',
batch_categories=None, k=20, sigma=1., cos_norm_in=True, cos_norm_out=True,
svd_dim=None, var_adj=True, compute_angle=False, mnn_order=None, svd_mode='rsvd',
do_concatenate=True, save_raw=False, n_jobs=None, **kwargs):
try:
from mnnpy import mnn_correct as mnn_cor
n_jobs = settings.n_jobs if n_jobs is None else n_jobs
datas, mnn_list, angle_list = mnn_cor(
*datas, var_index=var_index, var_subset=var_subset, batch_key=batch_key, index_unique=index_unique,
batch_categories=batch_categories, k=k, sigma=sigma, cos_norm_in=cos_norm_in, cos_norm_out=cos_norm_out,
svd_dim=svd_dim, var_adj=var_adj, compute_angle=compute_angle, mnn_order=mnn_order, svd_mode=svd_mode,
do_concatenate=do_concatenate, save_raw=save_raw, n_jobs=n_jobs, **kwargs)
return datas, mnn_list, angle_list
except ImportError:
I think the point is that mnn_cor is not giving 3 values in this line:
datas, mnn_list, angle_list = mnn_cor(
Can you pleas help me with that?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
mnn_correct() ValueError: not enough values to unpack ...
Hello,. I am having hard times using the batch correction function running matching mutual nearest neighbors. I have an anndata with 3 batches....
Read more >ValueError: not enough values to unpack (expected 3, got 1 ...
The issue is that the input does not have enough delimited fragments to split into three pieces. You can play with this in...
Read more >How to fix "ValueError: not enough values to unpack ... - Biostars
The error message is fairly self-explanatory. Your program expects python split() to yield 3 elements, but in your case, it is only yielding...
Read more >ValueError: not enough values to unpack (expected 3, got 1)
This error caused by the mismatch between the number of values returned and the number of variables in the assignment statement. This error ......
Read more >Python ValueError: not enough values to unpack Solution
The ValueError: not enough values to unpack error is raised when you try to unpack too many values from an iterable.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ha, well, it was introduced in #1. Should be easy to fix.
Reproducible example:
It looks like
mnn_correct
is only returning one variable, through its documentation looks like it should return three. @chriscainx, could you offer some guidance here?As a workaround for now, you could just call
mnnpy.mnn_correct
with the same signature you’ve been using. It’ll return a one-tuple with a modified anndata object.