[BioC] limma topTable question

Sean Davis sdavis2 at mail.nih.gov
Tue Apr 5 05:14:02 CEST 2005

----- Original Message ----- 
From: "Cyrus Harmon" <ch-bioc at bobobeach.com>
To: <bioconductor at stat.math.ethz.ch>
Sent: Monday, April 04, 2005 5:22 PM
Subject: [BioC] limma topTable question

> Dear bioconductors,
> Forgive me if this is in the limma user's guide, but I'd like to be able 
> to find the top, say, 100 probe sets in topTable sorted by M, not abs(M). 
> I understand that I can do this with sort and resort and then filter out 
> the negative ones, but this seems a bit clunky and in a sense isn't quite 
> what I've asked, as the top 100 probe sets sorted by M after filtering by 
> abs(M) aren't guaranteed to be the same thing, unless there are <= 100 
> probe sets. Yes, I can take the whole resorted table and take the top 100 
> rows, but that seems to be sort of defeating the purpose of topTable.
> Would it be possible to add another option for M instead of abs(M) for 
> sort.by?

The beauty of R and BioConductor is that YOU can modify option M:

If you type topTable (without any parentheses or arguments), you will see 
that topTable is a VERY thin wrapper around a call to the function toptable. 
If you do the same for toptable (type it without any parentheses or 
arguments), you will see about half way down the definition of the function 
a line that looks like:

ord <- switch(sort.by, M=(order(abs(M), decreasing=TRUE), ....

You can make a copy of toptable called my.toptable by:

my.toptable <- toptable

Then, change the order for 'M' in my.toptable to be:

ord <- switch(sort.by, M=(order(M, decreasing=TRUE),....

If you make a copy of topTable called my.topTable by:

my.topTable <- topTable

and change it so that it calls my.toptable instead of toptable, you now have 
your own function called my.topTable that does what you want.  You can of 
course make any other changes to the functions that you want--add your own 
options, etc.  The simple task of looking at others' code is quite powerful 
when dealing with issues like the one you bring up.  I would encourage all 
who use bioconductor and R to try it whenever possible; even if it doesn't 
all make sense, it is a very good way to learn.

> (Combining my question and my gripe, a sort by "m" that didn't do abs(M) 
> would seem useful to me, but perhaps I'm missing something.)

If you are not typically a programmer in bioconductor, this seems like a 
good chance to try your hand at it.  If you get something that you like 
better than what Gordon has offered in Limma, send him the modified code. 
He, like most of bioconductor/R developers, is remarkably receptive and 
responsive to criticism/improvements.

Hope this helps.


More information about the Bioconductor mailing list