Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a61d5b0
Showing
25 changed files
with
1,768 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Package: enRich | ||
Type: Package | ||
Title: An R package for analysis of multiple ChIP-seq data | ||
Version: 1.0 | ||
Date: 2013-05-22 | ||
Author: Yanchun Bao <yanchun.bao@brunel.ac.uk>, Veronica | ||
Vinciotti<veronica.vinciotti@brunel.ac.uk> | ||
Maintainer: Yanchun Bao <yanchun.bao@brunel.ac.uk> | ||
Description: enRich is an R package for joint statistical modelling of | ||
ChIP-seq data, accounting for technical/biological replicates, | ||
multiple conditions and different ChIP efficiencies of the | ||
individual experiments. | ||
Depends: R(>= 2.14), parallel | ||
License: GPL (>= 2) | ||
LazyLoad: yes | ||
Packaged: 2013-05-31 12:00:04 UTC; masryyb | ||
NeedsCompilation: no | ||
Repository: CRAN | ||
Date/Publication: 2013-05-31 14:22:44 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
73191c776a0d570e7d09da07f3b57729 *DESCRIPTION | ||
8ccb633701f57d5020c962e5a68931ab *NAMESPACE | ||
c2d161145fe5f54aaf850dd0b86b24b7 *R/FDR.R | ||
0de35362a72a63dae57766d58329d476 *R/IPE.R | ||
b9b79fd941de0876c76cfeefe19deac1 *R/NBlike_phi_offset.R | ||
1e36698d0ceaf5bfe3174e2267056c9b *R/enrich.mix.R | ||
a8efc832733c327427778a866133bb17 *R/mix.R | ||
b6b15cddafa3097b4c1dbc74d5a11edf *R/mix.joint.R | ||
00f90607b7e2d8aab26eeaeeae286d40 *R/mix_offset.R | ||
3e673636f87af251956b7b63ee1b5a16 *R/mix_single.R | ||
041321ec3173ac886ef5efe78023bbff *R/mix_srsp1.R | ||
00f90607b7e2d8aab26eeaeeae286d40 *R/mixfit_offset.R | ||
257d3aaf3ebe645a537cc452c0d2c639 *R/mloglike_offsetNB.R | ||
cb8c5f8392eb06ee89f5df9750d90fac *R/mloglike_offsetpois.R | ||
9cb4b5212ff81b46d91c07733506e438 *R/pprob.R | ||
76e34f89608959cbe3c821ed057edaf0 *R/pprob_joint.R | ||
91637870bd91aa78972be5d2e3e937e9 *data/p300cbp.1000bp.rda | ||
b4a38667ca28859ecb5a237bd01ec1c5 *man/FDR.Rd | ||
0dd607094201c7fe4e65b060045af624 *man/IPE.Rd | ||
35b21f3f1aa099551c359db4b149c89f *man/enRich-package.Rd | ||
8a6580e5cce23f7580da332410d93852 *man/enrich.mix.Rd | ||
28f3499c42b1c79e62b739a03ceb1d84 *man/mix.Rd | ||
78b118a4cb8bd7f631349bc4d81d9a1c *man/mix.joint.Rd | ||
494ad59e5cb59d8c588bde57d032c170 *man/p300cbp.1000bp.Rd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export(enrich.mix, FDR, IPE, mix.joint, mix) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FDR <- | ||
function(prob0, cr=0.05) | ||
{ | ||
## prob0 is the posterior probability of X=0 | ||
S=length(prob0) | ||
Pvalue=prob0 | ||
sortPvalue=Pvalue[order(Pvalue)] | ||
positionp2=order(Pvalue) | ||
newPvalue=rep(0, S) | ||
positionp1=order(Pvalue) | ||
tempp=sortPvalue[1] | ||
newPvalue[1]=tempp/1 | ||
for (s in 2:S) | ||
{ | ||
tempp=tempp+sortPvalue[s] | ||
newPvalue[s]=tempp/s | ||
} | ||
newPvalueback=newPvalue[order(positionp1)] | ||
tempX<-ifelse(newPvalueback<=cr, 1,0) | ||
cpoint=sum(tempX) | ||
T_BH=ifelse(cpoint==0, 0, sortPvalue[cpoint]) #Threshold | ||
tempX<-ifelse(Pvalue<=T_BH, 1, 0) ## Consider the tie | ||
FDR_t=ifelse(sum(tempX)==0, 0, sum(Pvalue[Pvalue<=T_BH])/sum(tempX)) | ||
result<-list(X=tempX) | ||
return(result) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
IPE <-function(para, method=NULL) | ||
{ | ||
## para is the fitting results of one experiment | ||
## method is "Poisson" or "NB" | ||
|
||
#1. Check data, method and initialpara are consistent | ||
if (sum(method=="Poisson")+sum(method=="NB")==0) | ||
{ | ||
stop('A method must be given, either "Poisson" or "NB"!', call.=FALSE) | ||
} | ||
|
||
## we need to use interpolation since the discrete distribution will give some larger mass on some particular value | ||
## we interpolate between all values below cut | ||
T=10000 | ||
cut=100 | ||
n=500 | ||
sum1=0 | ||
sum2=0 | ||
if (method=="Poisson") | ||
K=4 | ||
if (method=="NB") | ||
K=6 | ||
for (i in para[K]:cut) | ||
{ | ||
if (method=="Poisson") | ||
{ | ||
X.bg<-approx(x=c(i, i+1),y=c(dpois(i,para[3]),dpois(i+1,para[3])), n=n) | ||
Step<-X.bg$x[2]- X.bg$x[1] | ||
sum2=sum2+sum(ppois(i-para[K], para[2])*X.bg$y)*Step | ||
} | ||
if (method=="NB") | ||
{ | ||
X.bg<-approx(x=c(i, i+1),y=c(dnbinom(i,para[5], ,para[4]),dnbinom(i+1,para[5], ,para[4])), n=n) | ||
Step<-X.bg$x[2]- X.bg$x[1] | ||
sum2=sum2+sum(pnbinom(i-para[K], para[3],,para[2])*X.bg$y)*Step | ||
} | ||
} | ||
if (method=="Poisson") | ||
{ | ||
sum2=sum2+ sum(ppois(c((cut+1-para[K]):(T-para[K])), para[3])*dpois(c((cut+1):T), para[2])) | ||
} | ||
if (method=="NB") | ||
{ | ||
sum2=sum2+ sum(pnbinom(c((cut+1-para[K]):(T-para[K])), para[3],, para[2])*dnbinom(c((cut+1):T), para[5],,para[4])) | ||
} | ||
IPE=round(1-sum2, digits=4) | ||
return(IPE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
NBlike_phi_offset <- | ||
function(para, data1, ppr1, ppr0, mus,mub, k=k) | ||
{ | ||
#Log-likelihood based on mixture of NB(mu, size), maximised using optim() function | ||
N=length(data) | ||
phis=para[1] | ||
phib=para[2] | ||
temp1=sum(ppr1*ifelse(data1<k, 0, dnbinom(data1-k, phis, ,mus, log=TRUE))) | ||
temp2=sum(ppr0*dnbinom(data1, phib, ,mub, log=TRUE)) | ||
logl=temp1+temp2 | ||
return(-logl) | ||
} |
Oops, something went wrong.