[BioC] limma: makeContrasts()

Gordon K Smyth smyth at wehi.EDU.AU
Sun Aug 6 03:36:40 CEST 2006


Dear Jay,

Actually makeContrasts() will recognize an expression or character string, but it won't always
correctly parse a character-valued variable.

The reason is that makeContrasts() expects to get expressions.  Although it does also allow
character strings to define the expressions, it is too difficult to correctly distinguish
character vectors from expressions and to correctly determine which environment the expression is
to be evaluated in.

To solve these problems, I have made a new version of makeContrasts() in limma 2.7.9 which should
be available from CRAN in a couple of days.  makeContrasts() now has a new argument 'contrasts'
which will solve your problem.

Best wishes
Gordon

On Thu Aug 3 17:26:02 CEST 2006, "Jay Shin" <jay.shin at pharma.ethz.ch> wrote:
>Dear Marcus and group,
>Thanks for the information!
>However, for some odd reason, when I try to run makeContrasts() in a
>function, it cannot recognize the expression or a character string,
>in this case "difference"...
>It works well when I run it directly on a console, but not as a
>function. Do you know why this could happen?
>thank you.
>
>Jay
>
>On Aug 3, 2006, at 1:37 AM, Marcus Davy wrote:
>> Hi,
>> member[2] - member[3] is going to give an error os the binary
>> operator "-"
>> cannot operate on strings,
>>
>>> member[2] - member[3]
>> Error in member[2] - member[3] : non-numeric argument to binary
>> operator
>>
>> try,
>>
>> design <- diag(3)[rep(1:3, each=2),]
>> colnames(design) <- member
>> member <- LETTERS[1:3]
>>
>> difference <- paste(member[2],"-",member[3], sep="")
>> makeContrasts(difference,levels=design)
>>
>>
>> Marcus
>>
>>
>> On 8/2/06 7:00 PM, "Jay Shin" <jay.shin at pharma.ethz.ch> wrote:
>>
>>> Hello,
>>> I am trying to run a makeConstrasts() function to compute eBayes t-
>>> test with the following design list (six hybridizations and three
>>> samples -in duplicates):
>>> A   B    C
>>> 1    1   0    0
>>> 2    1   0    0
>>> 3    0   1    0
>>> 4    0   1    0
>>> 5    0   0    1
>>> 6    0   0    1
>>>
>>> I would like to compare sample "B-C", so when I run:
>>>> contrasts.matrix<-makeContrasts(B-C, levels=design)
>>> it works great!
>>>
>>> However, I have B and C stored in 'member' (e.g. member[1] = B,
>>> member
>>> [2] = C).
>>> So, when I try to run:
>>>> member1<-member[1]
>>>> member2<-member[2]
>>>> contrasts.matrix<-makeContrasts(member1-member2, levels=design)
>>>
>>>   I get a following error message:
>>> Error in eval(expr, envir, enclos) : object "member1" not found
>>>
>>> Can you please help me how I can directly compare the content of the
>>> 'member' in makeContrasts() function?
>>> Thank you,
>>> Jay



More information about the Bioconductor mailing list