[BioC] Subtraction with NA values
Gordon Smyth
smyth at wehi.edu.au
Wed Feb 11 05:02:36 MET 2004
This is pretty standard analysis with linear models (limma package):
dat <- cbind(M', M)
fit <- lmFit(dat, design=c(1,-1))
Then fit$coef contains the combined log-ratios you want.
Gordon
At 02:54 PM 11/02/2004, A.J. Rossini wrote:
>"Daniel F. Simola" <simola at mail.med.upenn.edu> writes:
>
> > Hello,
> >
> > I have a microarray experiment using dye-swapped slides. I am trying
> > to combine (average) the intensities of a gene from a slide and its
> > dye-swapped pair, but just discovered that the subtraction operator in
> > R does not work the way I would like it to for missing (NA) values.
> >
> > I am doing: ( M - M' ) / 2, where M is an array of intensities for
> > genes, and M' is the same, except dye-swapped.
> >
> > Say I want the result of " 5 - NA ", where 5 is the intensity of one
> > spot and NA is that of the same spot on the dye-swapped slide, then I
> > get NA for an answer. Because I want to average the values ( 5 - NA /
> > 2 ), then I would like my average value to be 5, instead of NA. Thus
> > it's better to make use of the available data than disregard a gene
> > completely.
> >
> > So, does anyone know either of a workaround for this, or of a function
> > that I can use to perform element-wise subtraction over a matrix that
> > will work how I want (or that will let me define my own function to be
> > applied on an element wise basis)?
>
>Comments:
>
>1. you could impute 5 by replacing the missing values with the values
>from the other slide. Judicious application of is.na and assignment
>will help with this.
>
>2. Do you really want to do this? The end result will be some
>dye-corrected genes, and some dye-non-corrected genes (don't get me
>started on whether this is a reasonable thing to do, I still think the
>jury is out). and then you want to compare how extreme they are
>(so you've got some genes with more inherent variance in the measure,
>not being averages, and if there is a gene by dye effect...
>
>Now, I wish I had a positive suggestion, and would appreciate hearing
>any (rather than the negative one I have above!).
>
>best,
>-tony
More information about the Bioconductor
mailing list