# Detection of enriched and differentially bound regions for fitting results of mix and mix.joint.

### Description

`enrich.mix`

returns the enriched regions or differentially bound regions using the `mix`

or the `mix.joint`

model, by controlling a given FDR level.
`enrich.mix`

also calculates the IP efficiencies for each experiment.

### Usage

1 2 | ```
enrich.mix(object, analysis = "joint", differential = FALSE,
diff.vec = NULL, cr = 0.05, crdiff = 0.05)
``` |

### Arguments

`object` |
The output of |

`analysis` |
A character variable. Default value is "joint" and the object should be the output of |

`differential` |
A logical variable. If TRUE, the function will compute the posterior probability of differential binding of any two experiments or two conditions, as specified by |

`diff.vec` |
A numeric vector. If differential = TRUE, diff.vec must be given to show which experiments are to be used in the comparison. At the moment, this is restricted to two conditions (e.g. two proteins at the same time point), so the value for diff.vec should be only 0, 1, 2, where 0 indicates which experiments are not to be used in the analysis, 1 and 2 stand for conditions 1 and 2, respectively. diff.vec should be of the same length as the number of experiments in object. |

`cr` |
A numeric variable. The level of FDR for identifying the enriched regions. |

`crdiff` |
A numeric variable. The level of FDR for identifying the differentially bound regions. |

### Value

`enrich` |
The list of enriched regions for each condition at the chosen FDR. Note that there is only one list of enriched regions for replicates, if a joint model is used. |

`diffenrich1` |
The list of regions bound only by condition 1. |

`diffenrich2` |
The list of regions bound only by condition 2. |

`ppx1` |
A n x p matrix of posterior probabilities of enrichment for each region and each condition. ppx0=1-ppx1. |

`X` |
A n x p matrix of enrichment for each region and each condition, at the given FDR cutoff (1: enriched, 0: not-enriched). |

`diffprob1` |
A n-dimensional vector of posterior probabilities of differential binding for the two conditions under study; diffprob0=1-diffprob1. |

`diffX1` |
A n-dimensional index of regions bound only by condition 1 (0: not bound, 1: bound). |

`diffX2` |
A n-dimensional index of regions bound only by condition 2. |

`IPE` |
A p-dimensional vector of estimated IP efficiency values for each experiment. |

### Author(s)

Yanchun Bao and Veronica Vinciotti

### References

Bao et al. Accounting for immunoprecipitation efficiencies in the statistical analysis of ChIP-seq data. BMC Bioinformatics 2013, 14:169 DOI:10.1186/1471-2105-14-169.

### See Also

See also `mix, mix.joint`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ```
data(p300cbp.1000bp)
exp.label=c("CBPT0", "CBPT301", "CBPT302", "p300T0",
"p300T301", "p300T302", "WangCBP", "Wangp300")
## Simple examples -- only two experiments and first 10000 observations
CBPT30=list()
CBPT30$region=p300cbp.1000bp$region[1:5000,]
CBPT30$count=p300cbp.1000bp$count[1:5000,2:3]
Poisfit.simple<-mix(CBPT30, method="Poisson", exp.label=exp.label[c(2,3)])
enrich.mix.simple<-enrich.mix(Poisfit.simple, analysis="separate")
## Not run:
##Separate analysis of single experiments using a Poisson latent mixture model for all 8 data sets
Poisfit.separate<-mix(p300cbp.1000bp, method="Poisson", exp.label=exp.label)
##Enriched regions for all conditions and differentially bound
## regions between CBP and p300 at T0 using 5
enrich.mix.sep<-enrich.mix(Poisfit.separate, analysis="separate",
differential=TRUE, diff.vec=c(1,0,0,2,0,0,0,0))
## Joint analysis combining technical replicates
## (CBPT301,CBPT302 and p300T301,p300T302)
Poisfit.joint1<-mix.joint(p300cbp.1000bp, Poisfit.separate$parameters, method="Poisson",
rep.vec=c(1,2,2,3,4,4,5,6), p.vec=c(1,2,2,3,4,4,5,6),
exp.label=exp.label)
##Enriched regions for all conditions and differentially bound
## regions between CBP and p300 at T30 using 5
enrich.mix.j<-enrich.mix(Poisfit.joint1, differential=TRUE,
diff.vec=c(0,1,1,0,2,2,0,0))
## End(Not run)
``` |