I'm trying to run MACS2 on a merged ATAC-seq BAM file (because I have two replicates. The Pipeline I'm using involves PECA, which doesn't allow me to merge replicates after this point.).
When I run MACS2 on one of the BAM file replicates, it works without any issue. When I run MACS2 on the merged file, I get this error:
INFO @ Fri, 18 Nov 2022 16:04:05: #1 read treatment tags... Traceback (most recent call last):
File "/opt/apps/python/3.8.0/bin/macs2", line 653, in <module>
main()
File "/opt/apps/python/3.8.0/bin/macs2", line 51, in main
run( args )
File "/opt/apps/python/3.8.0/lib/python3.8/site-packages/MACS2/callpeak_cmd.py", line 65, in run
else: (treat, control) = load_tag_files_options (options)
File "/opt/apps/python/3.8.0/lib/python3.8/site-packages/MACS2/callpeak_cmd.py", line 387, in load_tag_files_options
tp = options.parser(options.tfile[0], buffer_size=options.buffer_size)
File "MACS2/IO/Parser.pyx", line 1063, in MACS2.IO.Parser.BAMParser.__init__
File "/opt/apps/python/3.8.0/lib/python3.8/gzip.py", line 58, in open
binary_file = GzipFile(filename, gz_mode, compresslevel)
File "/opt/apps/python/3.8.0/lib/python3.8/gzip.py", line 173, in __init__
fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '../../Input/ListerMEF.sh.bam'
cat: ListerMEF.sh_peaks.narrowPeak: No such file or directory
To merge replicates I used samtools like so.
samtools merge ListerMEF.bam SRR5870466-M-dups-black.sorted.bam SRR5870472-M-dups-black.sorted.bam
#merged file #replicate 1 #replicate 2
I checked the bam files with flagstat like so.
[cthangav@hpc3-l18-05:/share/crsp/lab/tnordenk/share/PECA-master/Input] $samtools flagstat ListerMEF.bam
160300293 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
145757737 + 0 mapped (90.93% : N/A)
160300293 + 0 paired in sequencing
80150265 + 0 read1
80150028 + 0 read2
145757737 + 0 properly paired (90.93% : N/A)
145757737 + 0 with itself and mate mapped
0 + 0 singletons (0.00% : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
[cthangav@hpc3-l18-05:/share/crsp/lab/tnordenk/share/PECA-master/Input] $samtools flagstat SRR5870466-M-dups-black.sorted.bam
85547051 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
76902397 + 0 mapped (89.89% : N/A)
85547051 + 0 paired in sequencing
42773527 + 0 read1
42773524 + 0 read2
76902397 + 0 properly paired (89.89% : N/A)
76902397 + 0 with itself and mate mapped
0 + 0 singletons (0.00% : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
[cthangav@hpc3-l18-05:/share/crsp/lab/tnordenk/share/PECA-master/Input] $samtools flagstat SRR5870472-M-dups-black.sorted.bam
74753242 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
68855340 + 0 mapped (92.11% : N/A)
74753242 + 0 paired in sequencing
37376738 + 0 read1
37376504 + 0 read2
68855340 + 0 properly paired (92.11% : N/A)
68855340 + 0 with itself and mate mapped
0 + 0 singletons (0.00% : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
I'm trying to figure out what the difference between the merge and individual files is thats causing this error. I did not generate read groups, or include the index while merging- I am not sure if that is the issue.