Thank you very much Jason! This really helps me in doing what I want to do.
I will contact you again if I have questions!
Hena


On Tue, Nov 5, 2013 at 6:59 PM, Jason Hackney <hackney.jason@gene.com>wrote:

> Hi Hena,
>
> I am using the package ReportingTools and would like to know if is it
> possible to publish  t statistics in the report for differential expression
> analysis using limma?
>
>
> This depends quite a bit on what version of ReportingTools you are using.
> For the current release version, there are a couple of ways to do this. The
> most straightforward way is to write a custom function and override the
> toReportDF method for MArrayLM objects. There is a helper function in the
> package, ReportingTools:::.marrayLM.to.data.frame that might serve as a
> template for getting the t-statistic.
>
> Here's kind of a rough sketch that I would use, drawn heavily from that
> helper function, but missing some error checking:
>
> my.df.fn <- function (object, eSet = NULL, n = 1000, pvalueCutoff = 0.01,
>     lfc = 0, adjust.method = "BH", coef = NULL, make.plots = FALSE,
>     factor = NULL, ...)
> {
>     dat <- topTable(object, number = n, p.value = pvalueCutoff,
>         lfc = lfc, coef = coef, adjust.method = adjust.method)
>
>     selection <- rownames(dat)
>
>     padj <- apply(object$p.value, 2, p.adjust, method = adjust.method)
>     padj <- padj[selection, coef]
>
>     object <- object[selection, coef]
>     if (!missing(eSet) & !is.null(eSet)) {
>         eSet <- eSet[selection, ]
>         fdata <- ReportingTools:::annotate.genes(featureNames(eSet),
> annotation(eSet),
>             keytype = "PROBEID", cols = list(ProbeId = "PROBEID",
>                 EntrezId = "ENTREZID", Symbol = "SYMBOL", GeneName =
> "GENENAME"))
>     }
>
>     ret <- data.frame(fdata, Image = rep(NA, nrow(fdata)),
>         object$t, padj, stringsAsFactors = FALSE)
>     t.cols <- (ncol(fdata) + 2):(ncol(fdata) + 1 + ncol(object$t))
>     colnames(ret)[t.cols] <- paste(colnames(object), "t-Statistic")
>
>     pv.cols <- (ncol(fdata) + ncol(object$coef) + 2):ncol(ret)
>         colnames(ret)[pv.cols] <- paste(colnames(object),
>             "Adjusted p-Value")
>     return(ret)
> }
>
> Once you have your function for coercing an MArrayLM object to a
> data.frame, then you can pass it to the publish call in the .toDF argument:
>
> publish(my.fit, my.report, my.eset, n = 100, coef = 2, factor =
> my.eset$groups,
>     .toDF = my.df.fn)
>
> The rest should work as expected. Let me know if that helps, or if you
> have any further problems.
>
> Cheers,
>
> Jason
>
>
> Thanks!
>
>
>
> Hena Ramay, PhD
> Bioinformatician
> Swiss Institute of Bioinformatics
> Lausanne, Switzerland
>
>
>
> --
> Jason A. Hackney, Ph.D.
> Bioinformatics and Computational Biology
> Genentech
> hackney.jason@gene.com
> 650-467-5084
>
>

	[[alternative HTML version deleted]]

