MACS icon indicating copy to clipboard operation
MACS copied to clipboard

pair-ended data in BAMPE and BEDPE do not produce the same results

Open MariusGheorghe opened this issue 8 years ago • 6 comments

Using the same data set in BAMPE format and converting the BAMPE to a BEDPE via samtools sort -l 0 -n -O bam <input_bampe_file> | samtools view -bf 0x2 | bedtools bamtobed -bedpe -i - > <temp_bedpe_file> and subsequently cut -f 1,2,6 <temp_bedpe_file> | sort -k1,1 -k2,2n -k3,3n > <bedpe_file> and running MACS with /macs2/bin/macs2 callpeak -t ./<input_bampe_file> -f BAMPE -g hs -n bampe and /macs2/bin/macs2 callpeak -t <bedepe_file> -f BEDPE -g hs -n bedpe I get different resulting peak files. This is not the case if I run single-end reads data in both BAM and BED format.

MariusGheorghe avatar Apr 06 '17 09:04 MariusGheorghe

Hi @MariusGheorghe I put a note in MACS2 help:

Also please note that the BEDPE only contains three columns, and is NOT the same BEDPE format used by BEDTOOLS.

Here is more description on BEDPE from MACS2 readme:

The BEDPE format is a simplified and more flexible BED format, which only contains the first three columns defining the chromosome name, left and right position of the fragment from Paired-end sequencing. Note, this is NOT the same format used by BEDTOOLS, and BEDTOOLS version of BEDPE is actually not in a standard BED format.

taoliu avatar May 05 '17 18:05 taoliu

HI, so the reason for the different results is just the wrong input? According to the piece of code that @MariusGheorghe posted, he correctly cut the fields 1,2 and 6 to convert the BEDTOOLS BEDPE format to the MACS2 BEDPE format.

Am I missing something? I would really hear your opinion about the different results using the two different options.

Thanks

emattei avatar May 23 '17 19:05 emattei

@emattei Sorry I haven't noticed that @MariusGheorghe had cut the 1, 2 and 6th columns. The difference actually is caused by the filtering criteria used in MACS2. We removed any alignments that show sign of problem, and the corresponding "samtools view" command to simulate MACS2 behavior should be:

samtools view -b -f 2 -F 4 -F 8 -F 256 -F 512 -F 2048

Instead of

samtools view -bf 0x2

taoliu avatar May 23 '17 20:05 taoliu

Oh I see. Thank you very much !

emattei avatar May 23 '17 20:05 emattei

I actually got same results, i.e. calling using BEDPE gives same peaks as calling using BAMPE, with calling randsampleinstead of bamtobed on both the bam with and without samtools view -b -f 2 -F 4 -F 8 -F 256 -F 512 -F 2048. Does calling randsample as in below automatically perform those bam view filters?

macs2 randsample -i SRR891268_shift.tmp.bam -f BAMPE -p 100 -o SRR891268_shifted_pe.bed #correct bed shifted not using samtools view

Meaning does randsample call samtools view -b -f 2 -F 4 -F 8 -F 256 -F 512 -F 2048 first?

BJWiley233 avatar Dec 19 '20 21:12 BJWiley233

I also found that the bed files converted from the same bam file using macs2 randsample and bedtools bamtobed were not identical, but I don't why...

Probably this is why you got different results, because the macs2 callpeak results of < macs2 randsample resulting bed file > and of < bam file > are identical.

jordan841220 avatar Sep 07 '23 10:09 jordan841220