[BioC] Problem with write.fit in limma package
Gordon Smyth
smyth at wehi.edu.au
Wed Aug 24 00:08:42 CEST 2005
>Date: Mon, 22 Aug 2005 17:05:27 +0200
>From: Sabine Trochim <sabine at biosolveit.de>
>Subject: [BioC] Problem with write.fit in limma package
>To: bioconductor at stat.math.ethz.ch
>
>Hi,
>
>I get an error message when trying to store a fitted model with
>write.fit():
>
>"Fehler in round(x, digits) : Nicht-numerisches Argument f?r
>mathematische Funktion"
>
>in english this may be something like:
>
>"error in round(x, digits): non-numerical argument for mathematical
>function"
>
>As I am using limma for the first time I am not sure if there is a bug
>or if I did something wrong. Here is what I have tried.
>
>I use the data set GDS1036 from GEO, which contains intensities from 24
>Affymetrix arrays (rows=probe sets, columns=arrays)
>http://www.ncbi.nlm.nih.gov/geo/gds/gds_browse.cgi?gds=1036
>
>4 samples
>2 conditions (control and treatment with IFNG)
>3 time points (1hour, 6hours, 24hours after treatment).
>I summarized the data for the 4 samples being interested in comparison
>between treatment and control and time points (see below).
>
> >library(limma)
Giving the limma version number would help. Type
packageDescription("limma")
># read data table, rownames contained in first column,
># column names in header row,
># second column is skipped (colClass="NULL")
> > Data <- read.table("GDS1036_minusheader.soft", header=TRUE,
>row.names=1, colClasses=c("character","NULL",rep("numeric",24)))
>
># transform raw intensities to log10 intensities
> > Data <- log10(Data)
>
># read targets matrix
># this looks like
> array target
>1 GSM26926 C.1
>2 GSM26925 C.1
>3 GSM26927 C.1
>4 GSM26928 C.1
>5 GSM26929 C.6
>6 GSM26930 C.6
>7 GSM26931 C.6
>8 GSM26932 C.6
>9 GSM26933 C.24
>10 GSM26934 C.24
>11 GSM26936 C.24
>12 GSM26937 C.24
>13 GSM23887 IFNG.1
>14 GSM23893 IFNG.1
>15 GSM23895 IFNG.1
>16 GSM23899 IFNG.1
>17 GSM23903 IFNG.6
>18 GSM23904 IFNG.6
>19 GSM23908 IFNG.6
>20 GSM23912 IFNG.6
>21 GSM23916 IFNG.24
>22 GSM23919 IFNG.24
>23 GSM23921 IFNG.24
>24 GSM23922 IFNG.24
>
> > targets <- readTargets("Targets.txt")
>
># build factor of target names
> > targetnames <- c(rep("C.1",4), rep("C.6",4), rep("C.24",4),
>rep("IFNG.1",4), rep("IFNG.6",4), rep("IFNG.24",4))
>
> > targetnames <- factor(targetnames, levels=c("C.1", "C.6", "C.24",
>"IFNG.1", "IFNG.6", "IFNG.24"))
>
>[1] C.1 C.1 C.1 C.1 C.6 C.6 C.6 C.6 C.24
>[10] C.24 C.24 C.24 IFNG.1 IFNG.1 IFNG.1 IFNG.1 IFNG.6 IFNG.6
>[19] IFNG.6 IFNG.6 IFNG.24 IFNG.24 IFNG.24 IFNG.24
>Levels: C.1 C.6 C.24 IFNG.1 IFNG.6 IFNG.24
>
># build model matrix with one column per target level
> > design <- model.matrix(~0+targetnames)
>colnames(design) <- levels(targetnames)
>
># fit model
> > fit <- lmFit(Data, design)
>
>#======================================================#
># Time course of log ratios between control and IFNG
> #
>#======================================================#
> > cont.ratios <- makeContrasts(
>+ T1=IFNG.1-C.1,
>+ T6=IFNG.6-C.6,
>+ T24=IFNG.24-C.24,
>+ levels=design)
>
> > fit5 <- contrasts.fit(fit, cont.ratios)
> > fit5 <- eBayes(fit5)
>
># write linear model to file
> > write.fit(fit5, results=NULL, FStat=NULL, "Ratios.mat", digits=5,
>adjust="fdr")
Checking the input to write.fit() would help. Type
show(fit5)
>This function exits with the following error message:
>
>"error in round(x, digits): non-numerical argument for mathematical
>function"
>
>Does anyone has an idea what could be wrong? Is this a bug in
>write.fit() or did I miss anything?
My guess is that write.fit() is expecting to get a column Amean in fit5 but
is not finding it. This is because limma doesn't know whether your data is
log-ratios or log-intensities, and hence doesn't know how to compute
average intensities.
>Is there otherwise a workaround how I could store the matrix in a file?
>I need ratios and p-values for each contrast.
Try typing
fit5$Amean <- rowMeans(Data)
and then try the write.fit() function again.
Gordon
>Thanks for your help.
>
>Regards,
> Sabine
>
>==================================================================
>BioSolveIT GmbH - An der Ziegelei 75 - 53757 St.Augustin - Germany
>Dr. Sabine Trochim trochim at biosolveit.de
>Phone: +49-2241-2525-0 / Fax: -525 www.biosolveit.de
More information about the Bioconductor
mailing list