We introduce the formalism of flags to deal with this filtering issue: in the two following subsections, we describe the attributes and methods devoted to flag objects.
A flag object f is a list whose most important items are a function (f$FUN) that has to be applied to an object of class arrayCGH, and a character value (f$char) that will allow us to identify the flagged spots. Optionally further arguments can be passed to f$FUN via f$args, and a label can be added via f$label. The examples of this subsection use the function to.flag, which is explained in subsection 3.2.
> SNR.FUN <- function(arrayCGH, var.FG, var.BG, snr.thr) { + which(arrayCGH$arrayValues[[var.FG]] < arrayCGH$arrayValues[[var.BG]] * + snr.thr) + } > SNR.char <- "B" > SNR.label <- "Low signal to noise ratio" > SNR.flag <- to.flag(SNR.FUN, SNR.char, args = alist(var.FG = "REF_F_MEAN", + var.BG = "REF_B_MEAN", snr.thr = 3))
> global.spatial.FUN <- function(arrayCGH, var) { + if (!is.null(arrayCGH$arrayValues$Flag)) + arrayCGH$arrayValues$LogRatio[which(arrayCGH$arrayValues$Flag != + "")] <- NA + Trend <- arrayTrend(arrayCGH, var, span = 0.03, degree = 1, + iterations = 3) + arrayCGH$arrayValues[[var]] <- Trend$arrayValues[[var]] - + Trend$arrayValues$Trend + arrayCGH + } > global.spatial.flag <- to.flag(global.spatial.FUN, args = alist(var = "LogRatio"))
Any flag object therefore contains an argument called type, which defaults to "perm" (permanent) but can be set to "temp" in the case of a temporary flag. In the following example, chromosome.flag is a temporary flag that identifies clones correcponding to X and Y chromosome:
> chromosome.FUN <- function(arrayCGH, var) { + var.rep <- arrayCGH$id.rep + w <- which(!is.na(match(as.character(arrayCGH$cloneValues[[var]]), + c("X", "Y")))) + l <- arrayCGH$cloneValues[w, var.rep] + which(!is.na(match(arrayCGH$arrayValues[[var.rep]], as.character(l)))) + } > chromosome.char <- "X" > chromosome.label <- "Sexual chromosome" > chromosome.flag <- to.flag(chromosome.FUN, chromosome.char, type = "temp.flag", + args = alist(var = "Chromosome"), label = chromosome.label)
> args(to.flag) function (FUN, char = NULL, args = NULL, type = "perm.flag", label = NULL) NULL
> args(flag.arrayCGH) function (flag, arrayCGH) NULL
> args(flag.summary.arrayCGH) function (arrayCGH, flag.list, flag.var = "Flag", nflab = "not flagged", ...) NULL
or to plain spot-level information, by using the default method:
> args(flag.summary.default) function (spot.flags, flag.list, nflab = "not flagged", ...) NULL
Pierre Neuvial 2007-03-16