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

mhg_cython in python 3.9 and above #7

Open
zhengrongbin opened this issue Jun 3, 2022 · 3 comments
Open

mhg_cython in python 3.9 and above #7

zhengrongbin opened this issue Jun 3, 2022 · 3 comments

Comments

@zhengrongbin
Copy link

Hello, thank you very much for developing xlmhg! I found a problem when using xlmhg in python above 3.8. The mhg_cython seems likely can be installed in python 3.9 but everything looks perfect in python 3.8.

Under python 3.9, I got warning:
Warning (xlmhg): Failed to import "mhg_cython" C extension.
Warning (xlmhg): Failed to import the "mhg_cython" C extension.Falling back to the pure Python implementation, which is very slow.

and I got error report if I run xlmhg testing:
File ~/miniconda3/envs/mebocost/lib/python3.9/site-packages/xlmhg/test.py:207, in get_xlmhg_test_result(N, indices, X, L, exact_pval, pval_thresh, escore_pval_thresh, table, use_alg1, tol)
201 raise ValueError('Supplied array for dynamic programming table not'
202 'large enough. It is: %d x %d, but must be at least '
203 '%d x %d ((K+1) x (W+1)).'
204 % (table.shape[0], table.shape[1], K+1, W+1))
206 ### Step 1: Calculate XL-mHG test statistic.
--> 207 stat, cutoff = mhg_cython.get_xlmhg_stat(indices, N, K, X, L, tol)
208 assert 0.0 <= stat <= 1.0
210 # check for special cases

TypeError: get_xlmhg_stat() takes from 3 to 4 positional arguments but 6 were given

Do you have any solution to this? Thank you very much!

@semenko
Copy link

semenko commented Sep 3, 2022

I'm working on patching this so mebocost can run -- looks like the pure python implementation is broken in Py3.8 as well, and you'll get the same error if you forcably use it, e.g. by adjusting the test runner at:
https://github.com/flo-compbio/xlmhg/blob/master/xlmhg/test.py#L14

@GuyTeichman
Copy link

@zhengrongbin If you still require xlmhg, I have recently released a fork of this repository that supports Python>=3.8 and addresses some of the issues with the pure Python implementation of the algorithm.
https://github.com/GuyTeichman/xlmhglite
https://pypi.org/project/xlmhglite

@zhengrongbin
Copy link
Author

Thank you! I am incorporating xlmhglite into MEBOCOST updates to replace xlmhg. I will keep you posted if I met anything. Appreciate your help.

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