calc_weight {DAMEfinder} | R Documentation

## Calculate Weight for ASM Score

### Description

This function calculates a weight which reflects MM to UU balance, where M stands for methylated and U for unmethylated. Given the MM and UU counts for a particular tuple, the weight is obtained using the `link{pbeta}` function.

### Usage

    calc_weight(MM, UU, beta = 0.5, a = 0.2)

### Arguments

`MM` | The read counts for where pos1 and pos2 of the tuple were both methylated.
`UU` | The read counts for where pos1 and pos2 of the tuple were both unmethylated.
`beta` | parameter for the beta distribution. In B(alpha,beta), we set alpha=beta=0.5 by default.
`a` | parameter for how far from 0.5 we go as a measure of allele-specific methylation. The weight is the probability that the MM:(MM+UU) ratio is between 0.5-a and 0.5+a. The default is set to 0.2.

### Details

For a given tuple with MM and UU counts, the weight that reflects allele-scpecificity is calculated as follows:

- Prior:

  p(θ|α,β) \sim Beta(α,β),

  where θ = \frac{MM}{MM+UU} and α = β = 0.5. p(θ|α,β) represents our prior belief which is that tuples are either fully methylated or fully unmethylated, rather than allele-specifically methylated which is a much rarer event.

- Likelihood:

  p(x|α,β) \propto θ^{MM}(1-θ)^{UU},

  where x is our observation (the MM and UU counts).

- Posterior:

  p(θ|x) \propto p(x|θ)*p(θ|α,β)

  p(θ|x) \propto θ^{MM-0.5}(1-θ)^{UU-0.5},

  where α = β = 0.5. This posterior also follows a beta distribution \sim Beta(α'=MM+0.5, β'=UU+0.5)

### Value

A number that reflects allele-specificity given MM and UU counts for a CpG pair. This is used as a weight that is multiplied by the log odds ratio to give the final ASM score of that tuple.

#calc_weight(MM=50, UU=50) #0.9999716

#calc_weight(MM=20, UU=60) #0.1646916

[Package DAMEfinder version 1.2.0 Index]