struct.error in MACS2 callpeak
0
0
Entering edit mode
2.9 years ago
ty0017 • 0

Hi all,

I am trying to callpeaks on sorted and subsampled BAM files from the results of my ChIP-seq program. When I do callpeaks, I get the following error after the read treatment tags step, and I have no idea what it means/how to solve it:

 (macs2_use) [f0036r2@polaris MACS2_R1]$ macs2 callpeak -t /scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam -c /scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_IgG_S10_R1_001_aln_sorted.bam -f BAM -g 1.2e+8 -n SE_def_S12 -B  --outdir /scratch-nfs/f0036r2/FASTQ_R1/BAMout/MACS2_R1
    INFO  @ Sun, 23 May 2021 10:50:27: 
    # Command line: callpeak -t /scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam -c /scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_IgG_S10_R1_001_aln_sorted.bam -f BAM -g 1.2e+8 -n SE_def_S12 -B --outdir /scratch-nfs/f0036r2/FASTQ_R1/BAMout/MACS2_R1
    # ARGUMENTS LIST:
    # name = SE_def_S12
    # format = BAM
    # ChIP-seq file = ['/scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam']
    # control file = ['/scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_IgG_S10_R1_001_aln_sorted.bam']
    # effective genome size = 1.20e+08
    # 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: 1000 bps and 10000 bps
    # Broad region calling is off
    # Paired-End mode is off

    INFO  @ Sun, 23 May 2021 10:50:27: #1 read tag files... 
    INFO  @ Sun, 23 May 2021 10:50:27: #1 read treatment tags... 
    struct.error: unpack requires a buffer of 4 bytes
    Exception ignored in: 'MACS2.IO.Parser.BAMParser.tsize'
    struct.error: unpack requires a buffer of 4 bytes
    Traceback (most recent call last):
      File "/dartfs-hpc/rc/home/2/f0036r2/.conda/envs/macs2_use/bin/macs2", line 653, in <module>
        main()
      File "/dartfs-hpc/rc/home/2/f0036r2/.conda/envs/macs2_use/bin/macs2", line 51, in main
        run( args )
      File "/dartfs-hpc/rc/home/2/f0036r2/.conda/envs/macs2_use/lib/python3.6/site-packages/MACS2/callpeak_cmd.py", line 65, in run
        else:       (treat, control) = load_tag_files_options  (options)
      File "/dartfs-hpc/rc/home/2/f0036r2/.conda/envs/macs2_use/lib/python3.6/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

Here is the result of samtools quickcheck:

(macs2_use) [f0036r2@polaris MACS2_R1]$ samtools quickcheck -qvvv /scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam
verbosity set to 3
checking /scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam
opened /scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam
/scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam is sequence data
/scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam had no targets in header.
/scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam cannot be checked for EOF block because its filetype does not contain one.
/scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam

And this is the result of samtools flagstat:

(macs2_use) [f0036r2@polaris MACS2_R1]$ samtools flagstat /scratch-nfs/f0036r2/FASTQ_R1/BAMout/BAMsorted/Lee_w_Fe_GFP_2_S12_R1_001_aln_sorted.bam
[E::sam_parse1] missing SAM header
[W::sam_read1] Parse error at line 1
[bam_flagstat_core] Truncated file? Continue anyway.
0 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
0 + 0 mapped (N/A : N/A)
0 + 0 paired in sequencing
0 + 0 read1
0 + 0 read2
0 + 0 properly paired (N/A : N/A)
0 + 0 with itself and mate mapped
0 + 0 singletons (N/A : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)

Thanks in advance!

ChIP-seq MACS2 • 1.7k views
ADD COMMENT
0
Entering edit mode

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. If your code has long lines with a single command, break those lines into multiple lines with proper escape sequences so they're easier to read and still run when copy-pasted. I've done it for you this time.
code_formatting

ADD REPLY
0
Entering edit mode

Thanks! I'm new to all this, so thanks for telling me and fixing the problem.

ADD REPLY
0
Entering edit mode

Please add your command line and the output of samtools quickcheck -qvvv your.bam & samtools flagstat your.bam.

ADD REPLY
0
Entering edit mode

Post updated as requested! Am I correct in believing that the file is actually empty after looking at those outputs?

ADD REPLY

Login before adding your answer.

Traffic: 2664 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6