[BioC] variable as argument to makeContrasts (limma)

Georg Otto georg.otto at tuebingen.mpg.de
Thu Jun 4 17:39:56 CEST 2009


Martin Morgan <mtmorgan at fhcrc.org> writes:

> Georg Otto wrote:
>> Martin Morgan <mtmorgan at fhcrc.org>
>> writes:
>> 

>>> One way is to aim for
>>>
>>>   do.call(makeConstrasts, myargs)
>>>
>>> where the 'myargs' is a list that you can construct any way you
>>> like, e.g.,
>>>
>>>   myargs = list("B-A", "C-B", "C-A", levels=design)
>>>   do.call(makeContrasts, myargs)
>>>
>> 
>> thanks a lot, that helps, but there comes up another problem:
>> 
>> I start with a character vector, from which I have to construct the
>> list:
>> 
>> contrast.vector [1] "First=B-A" "Second=D-C"
>
> I'm not sure that you want to start from there?
>
>  myargs <- list(First="B-A", Second="D-C")
>
> or
>
>  x <- c("First=B-A", "Second=D-C") namecontr <- strsplit(x, "=")
>  myargs <- lapply(namecontr, "[[", 2) names(myargs) <-
>  sapply(namecontr, "[[", 1) myargs[["levels"]] <- design
>
> but I wonder a bit what the 'bigger picture' is, since these kinds of
> manipulations are not what one would do in a typical analysis.
>
> Martin
>
>
>> 
>> How do I get from there to:
>> 
>> myargs = list(First="B-A", Second="D-C", levels=design)

well, maybe I should have explained this before: the "bigger picture"
is, that I want to programmatically construct calls to the limma lmFit
function, to be able to analyze subsets of data a large collection od
data. I got most of it to work but I have difficulties with the way the
parameters are passed to makeContrasts.

In my function I have is a vector with strings which are the contrasts
that I want to analyse:

 contrast.vector [1] "First=B-A" "Second=D-C"

and the design object.

from this I want to programatically construct the contrast matrix, that
can be passed to another function that does the lmFit.

I think the way you suggested is the way to go, I was a little bit too
complicated in my thinking, by trying all kinds of parse/deparse/eval
constructs

Thanks,

Georg



More information about the Bioconductor mailing list