[BioC] Re: gcrma.bg.transformation missing
Zhijin Wu
zwu at jhsph.edu
Tue Nov 2 16:19:11 CET 2004
sorry about that. I've attached the missing file here and will try to
added to the devel package
On Tue, 2 Nov 2004, Matthew Hannah wrote:
> Hi,
>
> This has been asked a few times but I'm unable to find an answer. When
> you run
> >esetgcrma2 <- gcrma(data, fast=FALSE)
> #OR
> esetgcrma2 <- justGCRMA(fast=FALSE)
> #You get this error
> Adjusting for optical effect......Done.
> Adjusting for non-specific binding.Error in bg.adjust.fullmodel(pms[,
> i], mms[, i], pm.affinities, mm.affinities, :
> couldn't find function "gcrma.bg.transformation"
>
> I did some investigating and it seems that gcrma.bg.transformation
> called in the last lines of bg.adjust.fullmodel is not a defined
> function, whilst gcrma.bg.transformation.fast is. Is there a reason for
> this?
>
> This also happens in 1.9 and my previous 2.0 devel, but I've been
> waiting for the new release of BioC in case it had been fixed (I'm
> running 2.0, 1.5, win2k).
>
> Anyone provide a quick fix?
>
> Cheers,
> Matt
>
>
>
> > bg.adjust.fullmodel
> function (pms, mms, pm.affinities, mm.affinities, index.affinities,
> k = 6 * fast + 0.25 * (1 - fast), Q = 0.25, Qmm = 0.5, rho = 0.7,
> fast = TRUE)
> {
> parameters <- bg.parameters.ns(pms[index.affinities], pm.affinities,
>
> mm.affinities)
> mu.pm <- vector("numeric", length(pms))
> sigma <- vector("numeric", length(pms))
> mu.pm[index.affinities] <- parameters$bg.mu
> sigma[index.affinities] <- parameters$bg.sigma
> parameters <- bg.parameters.ns(mms[index.affinities], mm.affinities,
>
> mm.affinities)
> mu.mm <- vector("numeric", length(pms))
> mu.mm[index.affinities] <- parameters$bg.mu
> if (length(index.affinities) < length(pms)) {
> mu.pm[-index.affinities] <- median(mu.pm[index.affinities])
> mu.mm[-index.affinities] <- median(mu.mm[index.affinities])
> sigma[-index.affinities] <- median(sigma[index.affinities])
> }
> if (fast) {
> bhat <- exp(mu.pm + rho * (log(mms) - mu.mm) + 1/2 *
> (1 - rho^2) * sigma^2)
> var.y = exp(2 * mu.pm + sigma^2) * (exp(sigma^2) - exp(sigma^2 *
>
> rho^2))
> return(gcrma.bg.transformation.fast(pms, bhat, var.y,
> k = k))
> }
> else return(gcrma.bg.transformation(pms, mu.pm + rho * (log(mms) -
> mu.mm), sqrt(1 - rho^2) * sigma, k = k))
> }
>
>
> > gcrma.bg.transformation.fast
> function (x, bhat, var.y, k)
> {
> x <- x - bhat
> Index <- x > 0
> x[!Index] <- 0
> alpha <- rep(0, length(x))
> xplusk <- x[Index] + k
> logxplusk <- log(xplusk)
> alpha[Index] <- (logxplusk - log(k)) * (logxplusk - log(k) +
> k/xplusk)/((logxplusk - log(k) + k/xplusk)^2 +
> var.y[Index]/xplusk^2)
> y <- exp(alpha * log(x + k) + (1 - alpha) * log(k))
> }
>
>
> > gcrma.bg.transformation
> Error: Object "gcrma.bg.transformation" not found
>
-------------- next part --------------
gcrma.bg.transformation <- function(pms,mu,tau,k,lower.bound=.5,a=1,...){
step=60
base=exp(log(2^16)/step)#defult~=1.2
mylog=function(x) log(x,base)
K0=max(0,round(mylog(lower.bound))+1)
Ks=floor(mylog(pms))
posty <- function(xxx){
p=xxx[1];mu=xxx[2];tau=xxx[3];K=xxx[4]
pnorms=pnorm(log(p-base^(K0:K)),mu,tau)
diff.pnorms=pnorms[-length(pnorms)]-pnorms[-1]
g=(base^a+1)/base^(a*(K0:(K-1)+1))/2*diff.pnorms
g0=(1/lower.bound^a+1/base^(a*K0))/2*(pnorm(log(p-lower.bound),mu,tau)-pnorm(log(p-base^K0),mu,tau))
gn=(base^a+1)/base^(a*(K+1))*pnorm(log(p-base^K),mu,tau)
f=g*log(base^(K0:(K-1))*(base+1)/2);f2=g*log(base^(K0:(K-1))*(base+1)/2)^2
f0=g0*log(lower.bound/2+base^K0/2);f02=g0*log(lower.bound/2+base^K0/2)^2
fn=gn*log(base^K/2+p/2);fn2=gn*log(base^K/2+p/2)^2
(sum(f)+f0+fn)/(sum(g)+g0+gn)
}
pm=apply(cbind(pms,mu,tau,Ks),1,posty)
pm=exp(pm)
pm[is.na(pm)]=lower.bound #with extreme mm>>>pm it's possible to get NaN
pm
}
More information about the Bioconductor
mailing list