macs3-project / MACS

MACS -- Model-based Analysis of ChIP-Seq
https://macs3-project.github.io/MACS/
BSD 3-Clause "New" or "Revised" License
712 stars 268 forks source link

ppois signal track problem #265

Open YiqunCao opened 6 years ago

YiqunCao commented 6 years ago

Hi, I used the following command to generate FE ppois signal track:

macs2 bdgcmp -t E1-H3K27ac_treat_pileup.bdg -c E1-H3K27ac_control_lambda.bdg -m FE -o E1-H3K27ac_FE.bdg macs2 bdgcmp -t E1-H3K27ac_treat_pileup.bdg -c E1-H3K27ac_control_lambda.bdg -m ppois -o E1-H3K27ac_ppois.bdg

The FE signal track looks correct. But the ppois signal track is quite different from the FE and seems incorrect (see the figure below). What could be the reason? Thank you!

ppois_signal

taoliu commented 6 years ago

@YiqunCao There is a bug in ScoreTrack.pyx, where when calculating p-value score, the pseudocount was not correctly applied. You can check the line 725 of MACS2/IO/ScoreTrack.pyx file. Before the next MACS2 release, a simple fix on your end is to manually add pseudocount to your bedGraph file:

$ macs2 bdgopt -i treat.bdg -m add -p 0.1 -o treat_0.1.bdg $ macs2 bdgopt -i control.bdg -m add -p 0.1 -o control_0.1.bdg

then run bdgcmp without setting the pseudocount:

$ macs2 bdgcmp -t treat_0.1.bdg -c control_0.1.bdg -m ppois -o ppois.bdg

YiqunCao commented 6 years ago

Thanks for help! "macs2 bdgopt" works for my issue in #259.

But for this issue that I started from bam files, although pseudocount 0.1 was added to both treat and control bdg using "macs2 bdgopt", the ppois signal track is still quite different from FE signal track (see figure blow). What could be wrong here? Thanks!

screen shot 2018-10-25 at 4 43 29 pm

taoliu commented 6 years ago

@YiqunCao Poisson pvalue scores won't work the same way as fold-enrichment, especially in terms of continuity of the values. The Poisson CDF is more close to an exponential function that can't be compared to a simple division between two values. Also in order to calculate p-values, the observation, ie the treatment pileup, should be rounded to an integer. Therefore if the background has little difference, then pileup 1.5 and pileup 1.2 will give you similar p-values. After log transformation ( our p-score=-log10(p-value), the difference will be even more smaller.

callum-b commented 3 months ago

@taoliu you recommend using

$ macs2 bdgopt -i treat.bdg -m add -p 0.1 -o treat_0.1.bdg $ macs2 bdgopt -i control.bdg -m add -p 0.1 -o control_0.1.bdg

But would this line

$ macs3 bdgopt -i control.bdg -m max -p 0.01 -o control_nozero.bdg

also work? Or is it risky modifying only one data file in your opinion? Will the poisson law behave strangely if the lambda is very low?