# ATAC-Seq Analysis Using MACS2 Callpeak

**URL:** <https://help.galaxyproject.org/t/atac-seq-analysis-using-macs2-callpeak/13888>\
**Category:** usegalaxy.org support\
**Tags:** gtn-tutorial, atac-seq, picard\_markduplicates\
**Created:** [November 12, 2024, 4:18pm UTC](https://help.galaxyproject.org/t/atac-seq-analysis-using-macs2-callpeak/13888 "2024-11-12T16:18:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shgalaxyuser](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@shgalaxyuser](https://help.galaxyproject.org/u/shgalaxyuser)\
**Post date:** [November 12, 2024, 4:18pm UTC](https://help.galaxyproject.org/t/atac-seq-analysis-using-macs2-callpeak/13888/1 "2024-11-12T16:18:28Z")

</div>

Hello everyone! I am new to Galaxy and I am trying to work my way through the ATAC-seq tutorial ([Hands-on: ATAC-Seq data analysis / ATAC-Seq data analysis / Epigenetics](https://training.galaxyproject.org/training-material/topics/epigenetics/tutorials/atac-seq/tutorial.html#trimming-reads)). I am at the MACS2 Callpeak step, but keep receiving an error. Any and all insight is extremely appreciated! Thank you.

What I Input:

| Number | 73 |
| --- | --- |
| Name | MACS2 callpeak on data 62 (Peaks in tabular format) |
| Created | Tuesday Nov 12th 9:19:05 2024 GMT-5 |
| Filesize | **-** |
| Dbkey | mm10 |
| Format | tabular |
| File contents | [contents](https://usegalaxy.org/api/histories/bbd44e69cb8906b5392a7444d65eb960/contents/f9cad7b01a4721354ef60effa34ef599/display) |
| History Content API ID | f9cad7b01a4721354ef60effa34ef599 |
| History API ID | bbd44e69cb8906b5392a7444d65eb960 |
| UUID | 858aa35b-c60e-49d3-bcf7-54024dba6a08 |
| Full Path | /corral4/main/objects/8/5/8/dataset\_858aa35b-c60e-49d3-bcf7-54024dba6a08.dat |

## Tool Parameters

| Input Parameter | Value |
| --- | --- |
| Are you pooling Treatment Files? | 0 |
| ChIP-Seq Treatment File | 62: MarkDuplicates on data 57: BAM (as BED) |

#SRR891268\_R1

#SRR891268\_R2|  
|Do you have a Control File?|0|  
|Format of Input Files|Single-end BAM|  
|Effective genome size|1870000000|  
|Build Model|nomodel|  
|Set extension size|200|  
|Set shift size|-100|  
|Peak detection based on|qvalue|  
|Minimum FDR (q-value) cutoff for peak detection|0.05|  
|Additional Outputs|Peaks as tabular file (compatible wih MultiQC) Peak summits Scores in bedGraph files (–bdg)|  
|advanced\_options||  
|When set, scale the small sample up to the bigger sample|0|  
|Use fixed background lambda as local lambda for every peak region|0|  
|Save signal per million reads for fragment pileup profiles|0|  
|When set, use a custom scaling ratio of ChIP/control (e.g. calculated using NCIS) for linear scaling|Not available.|  
|The small nearby region in basepairs to calculate dynamic lambda|Not available.|  
|The large nearby region in basepairs to calculate dynamic lambda|Not available.|  
|Composite broad regions|nobroad|  
|Use a more sophisticated signal processing approach to find subpeak summits in each enriched peak region|1|  
|How many duplicate tags at the exact same location are allowed?|all|  
|Minimum fragment size in basepair|20|  
|Buffer size|100000|

The Error I Received:

| Galaxy Tool ID | toolshed.g2.bx.psu.edu/repos/iuc/macs2/macs2\_callpeak/2.2.9.1+galaxy0 |
| --- | --- |
| Job State | error |
| Command Line | export PYTHON\_EGG\_CACHE=`pwd` && (macs2 callpeak -t ‘/corral4/main/objects/e/8/c/dataset\_e8caa316-80eb-411d-8233-08819f152174.dat’ --name MarkDuplicates\_on\_data\_57\_\_BAM\_\_as\_BED\_ --format BAM --gsize ‘1870000000’ --call-summits --keep-dup ‘all’ --d-min 20 --buffer-size 100000 --bdg --qvalue ‘0.05’ --nomodel --extsize ‘200’ --shift ‘-100’ 2\>&1 \> macs2\_stderr) && cp MarkDuplicates\_on\_data\_57\_\_BAM\_\_as\_BED\_\_peaks.xls ‘/corral4/main/jobs/062/436/62436865/outputs/dataset\_858aa35b-c60e-49d3-bcf7-54024dba6a08.dat’ && exit\_code\_for\_galaxy=$? && cat macs2\_stderr 2\>&1 && (exit $exit\_code\_for\_galaxy) |
| Tool Standard Output | INFO @ Tue, 12 Nov 2024 14:19:09: # Command line: callpeak -t /corral4/main/objects/e/8/c/dataset\_e8caa316-80eb-411d-8233-08819f152174.dat --name MarkDuplicates\_on\_data\_57\_\_BAM\_\_as\_BED\_ --format BAM --gsize 1870000000 --call-summits --keep-dup all --d-min 20 --buffer-size 100000 --bdg --qvalue 0.05 --nomodel --extsize 200 --shift -100 # ARGUMENTS LIST: # name = MarkDuplicates\_on\_data\_57\_\_BAM\_\_as\_BED\_ # format = BAM # ChIP-seq file = [‘/corral4/main/objects/e/8/c/dataset\_e8caa316-80eb-411d-8233-08819f152174.dat’] # control file = None # effective genome size = 1.87e+09 # band width = 300 # model fold = [5, 50] # qvalue cutoff = 5.00e-02 # The maximum gap between significant sites is assigned as the read length/tag size. # The minimum length of peaks is assigned as the predicted fragment length “d”. # Larger dataset will be scaled towards smaller dataset. # Range for calculating regional lambda is: 10000 bps # Broad region calling is off # Paired-End mode is off # Searching for subpeak summits is on INFO @ Tue, 12 Nov 2024 14:19:09: #1 read tag files… INFO @ Tue, 12 Nov 2024 14:19:09: #1 read treatment tags… struct.error: unpack requires a buffer of 4 bytes Exception ignored in: ‘MACS2.IO.Parser.BAMParser.tsize’ Traceback (most recent call last): File “/usr/local/lib/python3.10/site-packages/MACS2/callpeak\_cmd.py”, line 389, in load\_tag\_files\_options ttsize = tp.tsize() struct.error: unpack requires a buffer of 4 bytes Traceback (most recent call last): File “/usr/local/bin/macs2”, line 653, in main() File “/usr/local/bin/macs2”, line 51, in main run( args ) File “/usr/local/lib/python3.10/site-packages/MACS2/callpeak\_cmd.py”, line 65, in run else: (treat, control) = load\_tag\_files\_options (options) File “/usr/local/lib/python3.10/site-packages/MACS2/callpeak\_cmd.py”, line 391, in load\_tag\_files\_options treat = tp.build\_fwtrack() File “MACS2/IO/Parser.pyx”, line 1169, in MACS2.IO.Parser.BAMParser.build\_fwtrack File “MACS2/IO/Parser.pyx”, line 1181, in MACS2.IO.Parser.BAMParser.build\_fwtrack File “MACS2/IO/Parser.pyx”, line 1166, in MACS2.IO.Parser.BAMParser.get\_references struct.error: unpack requires a buffer of 4 bytes |
| Tool Standard Error | _empty_ |
| Tool Exit Code | 1 |
| Job Messages | Job Message 1: |

- **desc:** Fatal error: Exit code 1 ()
- **error\_level:** 3
- **exit\_code:** 1
- **type:** exit\_code

* * *

Job Message 2:

- **desc:** Fatal error: Matched on error:
- **error\_level:** 3
- **match:** error:
- **stream:** stdout
- **type:** regex|  
|Job API ID|bbd44e69cb8906b5410c5d52606a7d81|

---

<div class="post-metadata">

**Author:** ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)\
**Post date:** [November 12, 2024, 5:41pm UTC](https://help.galaxyproject.org/t/atac-seq-analysis-using-macs2-callpeak/13888/2 "2024-11-12T17:41:29Z")

</div>

Hi @shgalaxyuser !!

Double check your target genome to map against at this step in the tutorial → [Hands-on: ATAC-Seq data analysis / ATAC-Seq data analysis / Epigenetics](https://training.galaxyproject.org/training-material/topics/epigenetics/tutorials/atac-seq/tutorial.html#mapping) (mapping)

Notice how that step is against the hg38 human genome, but your BAM dataset was mapped against the mouse mm10 genome. How can I tell? Because the assigned database “dbeky” is for mouse. If you click on your input BAM dataset on that same job details view you are copy/pasting from, you can see it.

> [@shgalaxyuser](#):
>
> Dbkey mm10

Your form is set up correctly for human here:

> [@shgalaxyuser](#):
>
> |Effective genome size|1870000000|

That “mismatch” is what the tool is reporting with this part of the error message. It was expecting the human chromosome identifiers but found the mouse chromosome identifiers in the BAM.

> [@shgalaxyuser](#):
>
> Fatal error: Matched on error:

* * *

This means that you will need to back up and re-do the mapping step again. It looks like you have deleted this dataset already, so I’m guessing that you maybe already found the problem and are doing that now?

And, great that you posted all of the details! Very helpful. Next time you can go ahead and also include the history share link – that will allow even more people to help! Since you are following a tutorial, the data shouldn’t have any privacy concerns. Even if this was your own data, you can always share for help then unshare after.

Please let us know how this goes and if you need more help! 🙂

---

<div class="post-metadata">

**Author:** ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)\
**Post date:** [August 25, 2025, 11:03pm UTC](https://help.galaxyproject.org/t/atac-seq-analysis-using-macs2-callpeak/13888/3 "2025-08-25T23:03:39Z")

</div>



---

<div class="post-metadata">

**Author:** ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)\
**Post date:** [August 25, 2025, 11:08pm UTC](https://help.galaxyproject.org/t/atac-seq-analysis-using-macs2-callpeak/13888/4 "2025-08-25T23:08:50Z")

</div>


