Entering edit mode
Amin Moghaddasi
▴
130
@amin-moghaddasi-2163
Last seen 10.3 years ago
Hi list,
I am trying to call makeContrasts() in limma to accept character
vector
of all samples vs control. But it seems that makeContrasts() consider
only the first element in the contrast vector.
Basically what I've done is first to assign design matrix "dMatrix",
then make a contrast character vector "con" using paste() like:
> dMatrix <- model.matrix(~ -1+factor(c(1,1,2,2,3,3)))
> colnames(dMatrix) <- paste("s", 1:(dim(dMatrix)[2]), sep = "")
> con<-paste(rep('s'),sep="",3:1,"-s1")
> con
[1] "s3-s1" "s2-s1" "s1-s1"
Then call makeContrasts like:
> cMatrix <- makeContrasts(con, levels=dMatrix)
> cMatrix
Contrasts
Levels s3-s1
s1 0
s2 0
s3 0
The expected result is :
> cMatrix <- makeContrasts("s3-s1","s2-s1","s1-s1", levels=dMatrix)
> cMatrix
Contrasts
Levels s3-s1 s2-s1 s1-s1
s1 -1 -1 0
s2 0 1 0
s3 1 0 0
So any advise of what I'm doing wrong would be appreciated, Or how can
I
automatically call makeContrasts using a vector of all samples vs
control.
Thanks in advance,
Amin.