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

Bug: Error in SAMParser and ELANDParsers. #347

Closed
MafGal opened this issue Dec 6, 2019 · 7 comments
Closed

Bug: Error in SAMParser and ELANDParsers. #347

MafGal opened this issue Dec 6, 2019 · 7 comments
Assignees

Comments

@MafGal
Copy link

MafGal commented Dec 6, 2019

Hello,

Could you please give me a hend:
I installed macs2 by git cloning and then
sudo python3 setup.py install
which worked.
Then I updated the PYTHONPATH and PATH accordingly.

So when I do "macs2 callpeak -h" I see the help menu.
However, when I try to run macs2
macs2 callpeak -t $InDir1/chip1_alignment_1ms.sam -g $efg -n chip1_default --outdir $OutDir1
It gives the error below.
I think it's related with python3, but I needed to use it because with python2 it gave the CRITICAL error >=3.5.
If I run with
python(dflt is 2) PATH-to-macs2 ...
Then it works.

Do you have a suggestion?
Thank you in advance,
Mafalda.

(...)
TypeError: a bytes-like object is required, not 'str'
Exception ignored in: 'MACS2.IO.Parser.ELANDResultParser.__tlen_parse_line'
TypeError: a bytes-like object is required, not 'str'
TypeError: a bytes-like object is required, not 'str'
Exception ignored in: 'MACS2.IO.Parser.ELANDResultParser.__tlen_parse_line'
TypeError: a bytes-like object is required, not 'str'
TypeError: a bytes-like object is required, not 'str'
Exception ignored in: 'MACS2.IO.Parser.ELANDResultParser.__tlen_parse_line'
TypeError: a bytes-like object is required, not 'str'
TypeError: a bytes-like object is required, not 'str'
Exception ignored in: 'MACS2.IO.Parser.ELANDResultParser.__tlen_parse_line'
TypeError: a bytes-like object is required, not 'str'
TypeError: a bytes-like object is required, not 'str'
Exception ignored in: 'MACS2.IO.Parser.ELANDResultParser.__tlen_parse_line'
TypeError: a bytes-like object is required, not 'str'
TypeError: a bytes-like object is required, not 'str'
Exception ignored in: 'MACS2.IO.Parser.ELANDResultParser.__tlen_parse_line'
TypeError: a bytes-like object is required, not 'str'
TypeError: a bytes-like object is required, not 'str'
Exception ignored in: 'MACS2.IO.Parser.ELANDResultParser.__tlen_parse_line'
TypeError: a bytes-like object is required, not 'str'
ZeroDivisionError: float division
Exception ignored in: 'MACS2.IO.Parser.GenericParser.tsize'
ZeroDivisionError: float division
ZeroDivisionError: float division
Exception ignored in: 'MACS2.IO.Parser.GenericParser.tsize'
ZeroDivisionError: float division
INFO @ Fri, 06 Dec 2019 17:51:10: Detected format is: SAM
Traceback (most recent call last):
File "/usr/local/bin/macs2", line 4, in
import('pkg_resources').run_script('MACS2==2.2.6a2', 'macs2')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 658, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1438, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.6/dist-packages/MACS2-2.2.6a2-py3.6-linux-x86_64.egg/EGG-INFO/scripts/macs2", line 652, in
main()
File "/usr/local/lib/python3.6/dist-packages/MACS2-2.2.6a2-py3.6-linux-x86_64.egg/EGG-INFO/scripts/macs2", line 51, in main
run( args )
File "/usr/local/lib/python3.6/dist-packages/MACS2-2.2.6a2-py3.6-linux-x86_64.egg/MACS2/callpeak_cmd.py", line 65, in run
else: (treat, control) = load_tag_files_options (options)
File "/usr/local/lib/python3.6/dist-packages/MACS2-2.2.6a2-py3.6-linux-x86_64.egg/MACS2/callpeak_cmd.py", line 391, in load_tag_files_options
treat = tp.build_fwtrack()
File "MACS2/IO/Parser.pyx", line 191, in MACS2.IO.Parser.GenericParser.build_fwtrack
File "MACS2/IO/Parser.pyx", line 206, in MACS2.IO.Parser.GenericParser.build_fwtrack
File "MACS2/IO/Parser.pyx", line 721, in MACS2.IO.Parser.SAMParser.__fw_parse_line
File "/usr/lib/python3.6/re.py", line 222, in findall
return _compile(pattern, flags).findall(string)
TypeError: cannot use a string pattern on a bytes-like object

@taoliu
Copy link
Contributor

taoliu commented Dec 6, 2019

@MafGal Before setting the PYTHONPATH and PATH manually, check this: If you installed macs2 with "python3 setup.py install", the version of python bound to MACS2 is what this "python3" is for. Try to type "python3" to see what you get. A suggestion is to always use "virtualenv" to manage your python softwares. There can be multiple python versions in your system, and sometimes they are confusing. To use "virtualenv" make life easier.

PS, I will release macs2.2.6 as soon as possible so that you can have the option to install through pip or conda, in a more standard way.

@MafGal
Copy link
Author

MafGal commented Dec 6, 2019

Dear @taoliu ,
Thank you for replying!
This is what I get:
python3
Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux

So it's a problem with python3. But I'm supposed to run macs2 with python3, right?
I'm usually not using "virtualenv". Afterwards, is it always needed to use "activate"?
Thanks a lot.

@taoliu
Copy link
Contributor

taoliu commented Dec 8, 2019

OK. Now when I look back at the error msg, I feel the problem is not the installation, but the input file. Can you convert the SAM file to BAM using samtools and try again?

@MafGal
Copy link
Author

MafGal commented Dec 10, 2019

Great @taoliu , that did the trick! thank you very much.
So in general, we should run macs2 always with bam files!
Thank you!

@taoliu
Copy link
Contributor

taoliu commented Dec 10, 2019

@MafGal Let me add a SAM file for automatic testing. So I can address the issue. But in reality, try to use BAM format or BED format (you can directly use zipped BED file) file as input for MACS2. They are the most popular formats.

@taoliu taoliu self-assigned this Dec 10, 2019
@taoliu taoliu changed the title Q: error running macs2 2.2.6 installed with python3 Bug: Error in SAMParser and ELANDParsers. Dec 12, 2019
@taoliu taoliu mentioned this issue Dec 12, 2019
@taoliu
Copy link
Contributor

taoliu commented Dec 12, 2019

SAM file parser has been fixed, and testing cases for reading SAM file has been implemented in #345

@taoliu taoliu closed this as completed Dec 12, 2019
@MafGal
Copy link
Author

MafGal commented Dec 16, 2019

Very nice, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants