# [BioC] Defining Weights in marrayNorm.

Yuk Fai Leung YFLeung at cgr.harvard.edu
Wed Aug 20 13:30:47 MEST 2003

```Hi there,

I have encountered the same problem of using different weights to normalize
my data recently. As a naïve biologist with limited programming skills, I
modified the maNormMain, maNormLoess and maNormMAD in a "dirty way" so that
I may use the respective weights for each array.

maNormMain <- function ( ... some codes omitted...

for (i in 1:ncol(maM(mbatch))) {
globali <<- i

... more codes omitted
}

maNormLoess <- function (x = "maA", y = "maM", z = "maPrintTip", w = NULL,
subset = TRUE,
span = 0.4, ...)
{
function(m) {
if (is.character(z))
maLoess(x = eval(call(x, m)), y = eval(call(y, m)),
z = eval(call(z, m)), w = w, subset = subset[,globali],
span = span, ...)
else maLoess(x = eval(call(x, m)), y = eval(call(y, m)),
z = TRUE, w = w, subset = subset[,globali], span = span, ...)
}
}

maNormMAD <- function (x = NULL, y = "maM", geo = TRUE, subset = TRUE)
{
function(m) {
if (is.character(x))
maMAD(x = eval(call(x, m)), y = eval(call(y, m)),
geo = geo, subset = subset[,globali])
else maMAD(x = TRUE, y = eval(call(y, m)), geo = geo,
subset = subset[,globali])
}
}

After setting these commands, I can do my normalization using those
non-control spots and weight >=0

flag <- maControls(array.raw) == "N" & maW(array.raw) >= 0
array.norm.ps <- maNormMain(array.raw, f.loc = list(maNormLoess(subset =
flag)), f.scale = list(maNormMAD(x = "maPrintTip", subset = flag)), echo =
TRUE)

Best regards,
Fai
________
Yuk Fai Leung
Bauer Center for Genomics Research
Harvard University
7 Divinity Avenue
Cambridge, MA 02138
Tel: 617-496-7134
Fax: 617-495-2196
email: yfleung at cgr.harvard.edu; yfleung at genomicshome.com
URL: http://genomicshome.com

```