scanpy icon indicating copy to clipboard operation
scanpy copied to clipboard

scipy.spatial.sKDTree does not have a keyword argument 'n_jobs'

Open yjkweon24 opened this issue 2 years ago • 4 comments

  • [x] I have checked that this issue has not already been reported.
  • [x] I have confirmed this bug exists on the latest version of scanpy.
  • [ ] (optional) I have confirmed this bug exists on the master branch of scanpy.

Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Minimal code sample (that we can copy&paste without having any data)

sce.pp.mnn_correct(adata_ref_batch0, adata_ref_batch1, adata_ref_batch2, batch_categories = ['batch0', 'batch1', 'batch2'])
![Screenshot 2023-03-05 at 18 18 05](https://user-images.githubusercontent.com/22848603/222991823-36da6d04-44ca-4504-a030-b2b4256bfa9c.png)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_1797574/3779544909.py in <module>
----> 1 sce.pp.mnn_correct(adata_ref_batch0, adata_ref_batch1, adata_ref_batch2, batch_categories = ['batch0', 'batch1', 'batch2'])

/mnt/md0/jin/anaconda3/lib/python3.9/site-packages/scanpy/external/pp/_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)
    133 
    134     n_jobs = settings.n_jobs if n_jobs is None else n_jobs
--> 135     datas, mnn_list, angle_list = mnn_correct(
    136         *datas,
    137         var_index=var_index,

/mnt/md0/jin/anaconda3/lib/python3.9/site-packages/mnnpy/mnn.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)
    120         if var_subset is not None and set(adata_vars) == set(var_subset):
    121             var_subset = None
--> 122         corrected = mnn_correct(*(adata.X for adata in datas), var_index=adata_vars,
    123                                 var_subset=var_subset, k=k, sigma=sigma, cos_norm_in=cos_norm_in,
    124                                 cos_norm_out=cos_norm_out, svd_dim=svd_dim, var_adj=var_adj,

/mnt/md0/jin/anaconda3/lib/python3.9/site-packages/mnnpy/mnn.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)
    176             new_batch_out = out_batches[target]
    177         print('  Looking for MNNs...')
--> 178         mnn_ref, mnn_new = find_mutual_nn(data1=ref_batch_in, data2=new_batch_in, k1=k, k2=k,
    179                                           n_jobs=n_jobs)
    180         print('  Computing correction vectors...')

_ckdtree.pyx in scipy.spatial._ckdtree.cKDTree.query()

_ckdtree.pyx in scipy.spatial._ckdtree.get_num_workers()

TypeError: Unexpected keyword argument {'n_jobs': 48}
---------------------------------------------------------------------------

Versions

python 3.9

The function scanpy.external.pp.mnn_correct has a n_jobs for the argument, but scipy.spatial.sKDTree does not have a keyword argument 'n_jobs'. I think you should remove it. It keeps showing an error.

[Paste the output of scanpy.logging.print_versions() leaving a blank line after the details tag]

yjkweon24 avatar Mar 05 '23 23:03 yjkweon24

Would you be willing to file a PR for this? Thank you!

Zethson avatar Mar 10 '23 10:03 Zethson

Hi Lukas,

I am sorry, but what is a PR?

Best Jin

On Fri, Mar 10, 2023 at 5:02 AM Lukas Heumos @.***> wrote:

Would you be willing to file a PR for this? Thank you!

— Reply to this email directly, view it on GitHub https://github.com/scverse/scanpy/issues/2436#issuecomment-1463561536, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFOKIW345IGREVLPLR7F6BLW3L32JANCNFSM6AAAAAAVQOJ5FE . You are receiving this because you authored the thread.Message ID: @.***>

yjkweon24 avatar Mar 12 '23 22:03 yjkweon24

A pull request that fixes this :)

See https://scanpy.readthedocs.io/en/stable/dev/index.html

Zethson avatar Mar 13 '23 09:03 Zethson

I have been trying but I am not sure how to do it in an appropriate way.

Can you teach me how to do it? I am not super familiar with git stuff since I am not really using it. ᐧ

On Mon, Mar 13, 2023 at 5:10 AM Lukas Heumos @.***> wrote:

A pull request that fixes this :)

See https://scanpy.readthedocs.io/en/stable/dev/index.html

— Reply to this email directly, view it on GitHub https://github.com/scverse/scanpy/issues/2436#issuecomment-1465764371, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFOKIW6MR6MSUCKJ2YTVG53W33P75ANCNFSM6AAAAAAVQOJ5FE . You are receiving this because you authored the thread.Message ID: @.***>

yjkweon24 avatar Mar 22 '23 15:03 yjkweon24