macs3-project / MACS

MACS -- Model-based Analysis of ChIP-Seq
https://macs3-project.github.io/MACS/
BSD 3-Clause "New" or "Revised" License
699 stars 268 forks source link

Paired input vs. control NameError: 'righ_pos' is not defined #249

Open reskejak opened 6 years ago

reskejak commented 6 years ago

I've tried installing MACS2 with both pip and from source, but neither will satisfy this command. MACS2 successfully calls peaks with single samples, but I have not been able to successfully supply control samples in the same command.

Example:

callpeak -t treat1.bedpe treat2.bedpe \
-c control1.bedpe control2.bedpe \
-f BEDPE \
-n foo_broad \
-g mm \
--broad \
--broad-cutoff 0.05 \
--keep-dup all

Here's an example of the output error:

...
# Broad region calling is on
# Paired-End mode is on

INFO  @ Mon, 16 Jul 2018 17:25:17: #1 read fragment files...
INFO  @ Mon, 16 Jul 2018 17:25:17: #1 read treatment fragments...
INFO  @ Mon, 16 Jul 2018 17:25:19:  1000000
INFO  @ Mon, 16 Jul 2018 17:25:21:  2000000
INFO  @ Mon, 16 Jul 2018 17:25:23:  3000000
INFO  @ Mon, 16 Jul 2018 17:25:25:  4000000
INFO  @ Mon, 16 Jul 2018 17:25:26:  5000000
INFO  @ Mon, 16 Jul 2018 17:25:28:  6000000
INFO  @ Mon, 16 Jul 2018 17:25:30:  7000000
INFO  @ Mon, 16 Jul 2018 17:25:32:  8000000
INFO  @ Mon, 16 Jul 2018 17:25:34:  9000000
INFO  @ Mon, 16 Jul 2018 17:25:35:  10000000
INFO  @ Mon, 16 Jul 2018 17:25:37:  11000000
INFO  @ Mon, 16 Jul 2018 17:25:39:  12000000
INFO  @ Mon, 16 Jul 2018 17:25:41:  13000000
INFO  @ Mon, 16 Jul 2018 17:25:43:  14000000
INFO  @ Mon, 16 Jul 2018 17:25:44:  15000000
INFO  @ Mon, 16 Jul 2018 17:25:46:  16000000
INFO  @ Mon, 16 Jul 2018 17:25:48:  17000000
INFO  @ Mon, 16 Jul 2018 17:25:50:  18000000
INFO  @ Mon, 16 Jul 2018 17:25:52:  19000000
INFO  @ Mon, 16 Jul 2018 17:25:53:  20000000
INFO  @ Mon, 16 Jul 2018 17:25:55:  21000000
Traceback (most recent call last):
  File "/mnt/home/reskejak/.local/bin/macs2", line 617, in <module>
    main()
  File "/mnt/home/reskejak/.local/bin/macs2", line 57, in main
    run( args )
  File "/mnt/home/reskejak/.local/lib/python2.7/site-packages/MACS2/callpeak_cmd.py", line 72, in run
    if options.PE_MODE: (treat, control) = load_frag_files_options (options)
  File "/mnt/home/reskejak/.local/lib/python2.7/site-packages/MACS2/callpeak_cmd.py", line 364, in load_frag_files_options
    treat = tp.append_petrack( treat )
  File "MACS2/IO/Parser.pyx", line 421, in MACS2.IO.Parser.BEDPEParser.append_petrack (MACS2/IO/Parser.c:7748)
  File "MACS2/IO/Parser.pyx", line 448, in MACS2.IO.Parser.BEDPEParser.append_petrack (MACS2/IO/Parser.c:7536)
NameError: name 'righ_pos' is not defined

I appreciate any suggestions. Thank you.

jayoung commented 6 years ago

I have the same issue. I think maybe it has been fixed in the master code but not in the "release" versions available on github and/or PyPi. see https://github.com/taoliu/MACS/commit/1b5f37a5c93102eede9112bd1b6eed2a53b6da74

@taoliu - any plans to put out a new release on github and/or PyPi? it looks like you've fixed quite a few issues since the last release. I think our sysadmin people here prefer to install release versions.

reskejak commented 6 years ago

What's strange is that I have already noted that correction and fixed the typo in Parser.cyx, however the bug still persists. I think there must be some other duplicate file from another build being called somewhere in my system. Perhaps it's an artifact from trying to reinstall MACS2. I'll have to figure out how to deeply clean any file relics from previous builds.

reskejak commented 6 years ago

Solved the issue by editing Parser.pyx as stated above prior to installation (from source; cannot use PyPi or conda!), in addition to installing MACS2 with Cython to regenerate the .c files (using setup_w_cython.py).

Note: for others with troubles successfully installing, make sure Python2.7 is firstly configured for UCS2 encoding, e.g. ./configure --enable-unicode=ucs2.

Edit: I was going to close this issue, but as @jayoung mentioned, this fix really should be pushed to PyPi and source releases to avoid hassle.

taoliu commented 5 years ago

Will upload a new release soon. Sorry I was swamped and didn't spend enough time to maintain MACS2 source code.