Question: MACS2 not working on bam files - possible error with alignment?
gravatar for staceyvincent13
22 months ago by
staceyvincent1310 wrote:

Hi all,

I have successfully called peaks on my bam files using earlier versions of MACS, however, in my first attempt at using MACS2 (using both the normal Galaxy instance and the Cistrome instance), I am getting fatal error messages when trying to use MACS2 callpeaks on my datasets. I have read in posts with errors similar to mine, that this could be due to the files not being aligned correctly. However, I have bam.bai outputs for both of my datasets, and have even successfully generated new ones using the IdxStats tool. Is is possible I need to merge these files in some way before running them through MACS2, or is there a Galaxy server error that could be causing this?

Any help would be much appreciated!

error tool macs2 bam • 1.1k views
ADD COMMENTlink modified 22 months ago by Jennifer Hillman Jackson25k • written 22 months ago by staceyvincent1310

Please post the entire error message.

ADD REPLYlink written 22 months ago by Devon Ryan1.9k

Fatal error: Exit code 1 ()

Traceback (most recent call last): File "/galaxy/main/deps/macs2/", line 5, in <module> pkg_resources.run_script('MACS2==', 'macs2') File "/galaxy-repl/main/venv/lib/python2.7/site-packages/", line 540, in run_script self.require(requires)[0].run_script(script_name, ns) File "/galaxy-repl/main/venv/lib/python2.7/site-packages/", line 1462, in run_script exec_(script_code, namespace, namespace) File "/galaxy-repl/main/venv/lib/python2.7/site-packages/", line 41, in exec_ exec("""exec code in globs, locs""") File "<string>", line 1, in <module> File "/galaxy/main/deps/macs2/", line 614, in <module>

File "/galaxy/main/deps/macs2/", line 56, in main

File "build/bdist.linux-x86_64/egg/MACS2/", line 261, in run File "MACS2/PeakDetect.pyx", line 105, in MACS2.PeakDetect.PeakDetect.call_peaks (MACS2/PeakDetect.c:1632) File "MACS2/PeakDetect.pyx", line 159, in MACS2.PeakDetect.PeakDetect.__call_peaks_w_control (MACS2/PeakDetect.c:1983) ZeroDivisionError: float division

ADD REPLYlink written 22 months ago by staceyvincent1310

Did your control sample have any alignments? What does it print out in the #2 Use XXXX as fragment length or #2 d: XXXX or #2 Since --fix-bimodal is set, MACS will use XXXX as fragment length lines (only one of these will be present)?

ADD REPLYlink written 22 months ago by Devon Ryan1.9k

Yes it does. It's saying to use 0 as fragment length, however I don't get this problem when I run the files as single-end. The data itself was processed using paired-end seq, but the files I have been given are in BAM format, instead of BAMPE. Do you think this could be causing the issue?

ADD REPLYlink written 22 months ago by staceyvincent1310

There have been bugs at various points with paired-end reads, this is presumably one of them. The "Use 0 as fragment length" is what's causing this crash that you're seeing, but you're not doing anything that's causing this to happen.

I suspect that you can get around this by specify "Do not build the shifting model" under "Build Model" and setting the "Arbitrary extension size in bp" to whatever the median fragment size is (you can use "bamPEFragmentSize" to get this). The results should be pretty close to what you'd get if you weren't running into this bug.

ADD REPLYlink written 22 months ago by Devon Ryan1.9k

Thank you so much! This worked perfectly.

ADD REPLYlink written 21 months ago by staceyvincent1310
gravatar for Jennifer Hillman Jackson
22 months ago by
United States
Jennifer Hillman Jackson25k wrote:


This tool does have an open issue concerning one of the parameters. Is your problem the same problem as in the ticket? (it includes a workaround - in short, to skip the problematic setting):

Jen, Galaxy team

ADD COMMENTlink written 22 months ago by Jennifer Hillman Jackson25k

Sorry, I have posted the error message above, and this does not appear to be the same one. Thank you anyway.

ADD REPLYlink written 22 months ago by staceyvincent1310
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 73 users visited in the last hour