Python 3.7.3 issuing a TypeError for acf.py
Trying to run comb-p on python 3.7.3. After converting the code from 2 to 3.7 I could finally get it running up to this point where I get a TypeError on the use of ">". However the line in acf.py (32) where the error is issued does not contain any ">". Do you know how to handle this issue?
comb-p acf -d 1:500:100 -c 5 MethylationComparison.bed >acf.txt
Traceback (most recent call last):
File "comb-p", line 4, in
try:
max_lag = max(a[1] for a in acfs if a[1] is not None)
please open a PR when you have it working on python 3
Thanks!
That seems to have worked but now I am getting another TypeError. Let me explain the context. When I first tried to run the program I've got "module not found" errors in many of the algorithms. One of them was regarding the use of "zip". So, after doing some digging I changed the import line (2nd line below) to this:
from itertools import groupby, zip_longest as zip, chain
#from itertools import groupby, zip, chain
It worked.
However now I get the following error (after I changed line 32 as you suggested):
comb-p acf -d 1:300:100 -c 5 MethylationComparison.bed >acf.txt Traceback (most recent call last): File "comb-p", line 4, in <module> __import__('pkg_resources').run_script('cpv==0.48', 'comb-p') File "site-packages/pkg_resources/__init__.py", line 666, in run_script self.require(requires)[0].run_script(script_name, ns) File "site-packages/pkg_resources/__init__.py", line 1446, in run_script exec(code, namespace, namespace) File "site-packages/cpv-0.48-py3.7.egg/EGG-INFO/scripts/comb-p", line 38, in <module> main() File "site-packages/cpv-0.48-py3.7.egg/EGG-INFO/scripts/comb-p", line 35, in main module.main() File "site-packages/cpv-0.48-py3.7.egg/cpv/acf.py", line 172, in main return run(args) File "site-packages/cpv-0.48-py3.7.egg/cpv/acf.py", line 142, in run args.full)) File "site-packages/cpv-0.48-py3.7.egg/cpv/acf.py", line 100, in acf acfs = merge_acfs(unmerged_acfs) File "site-packages/cpv-0.48-py3.7.egg/cpv/acf.py", line 67, in merge_acfs zip(merged, um): TypeError: zip_longest argument #1 must support iteration
I would use:
try:
from itertools import izip as zip # and other imports
except:
pass
I still get the same error with that:
TypeError: zip argument #1 must support iteration
I have modified slightly line 67 from
for (glag_min, glag_max, gxys), (ulag_min, ulag_max, uxys) in zip(merged, um):
to
for (glag_min, glag_max, gxys), (ulag_min, ulag_max, uxys) in zip(itertools.repeat(merged), um):
but now I get the same error with the second argument:
TypeError: zip argument #2 must support iteration
If I use the same itertools.repeat function on "um", I get:
TypeError: cannot unpack non-iterable int object
I've decided to install it with python 3 rather than 3.7.3. It's working so far. Thanks