[BioC] Subtraction with NA values

A.J. Rossini rossini at blindglobe.net
Wed Feb 11 04:54:39 MET 2004

"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)?


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!).


rossini at u.washington.edu            http://www.analytics.washington.edu/ 
Biomedical and Health Informatics   University of Washington
Biostatistics, SCHARP/HVTN          Fred Hutchinson Cancer Research Center
UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable
FHCRC  (M/W): 206-667-7025 FAX=206-667-4812 | use Email

CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}}

More information about the Bioconductor mailing list