Synthetically valid name error in "MakeContracts" in Limma
1
0
Entering edit mode
2.0 years ago
Jakpa ▴ 50

Hi,

I have a design matrix that looks like this

design matrix

    fit <- lmFit(expressionData_2, design = design)

fit <- eBayes(fit)

Then, I want comparing each subtype to all the other subtypes using MakeContracts function. I wrote this code:

  ` contrast_matrix <- makeContrasts(

  `"MS1avsOther" = MS1a - (MS1b + MS2a_1 + MS2a_2 + MS2b_1 + MS2b2_1 + MS2b2_2) / 6,`

  `"MS1bvsOther" = MS1b - (MS1a + MS2a_1 + MS2a_2 + MS2b_1 + MS2b2_1 + MS2b2_2) / 6,`

  `"MS2a_1vsOther" = MS2a_1 - (MS1b + MS1b + MS2a_2 + MS2b_1 + MS2b2_1 + MS2b2_2) / 6,`

  `"MS2a_2vsOther" = MS2a_2 - (MS1b + MS2a_1 + MS2a_1 + MS2b_1 + MS2b2_1 + MS2b2_2) / 6,`

  `"MS2b_1vsOther" = MS2b_1 - (MS1b + MS2a_1 + MS2a_2 + MS2b_1 + MS2b2_1 + MS2b2_2) / 6,`

   `"MS2b2_1vsOther"  = MS2b2_1 - (MS1b + MS2a_1 + MS2a_2 + MS2b_1 + MS2b_1 + MS2b2_2) / 6,`

   `"MS2b2_2vsOther" = MS2b2_2 - (MS1b + MS2a_1 + MS2a_2 + MS2b_1 + MS2b2_1 + MS1a) / 6,`

    'levels = design`
)

i got this error: The levels must by syntactically valid names in R, see help(make.names). Non-valid names: MS1a, MS1b, MS2a_1, MS2a_2, MS2b_1, MS2b2_1, MS2b2_2

I read the make.name documentation and from what I understood, my naming is correct. initially, the MS2b_1, MS2b_2 were MS2b.1, MS2b.2 I was not expecting to see same error after renaming.

Please, I need assistance on this.

Regards,

Matrix limma GeneExpression R • 1.4k views
ADD COMMENT
1
Entering edit mode

Could you share dput(design) instead of a picture ?

ADD REPLY
0
Entering edit mode

Basti , I could not send the output of dput(design) . I clicked of save button but it did not deliver. I think the its because the output is too long

ADD REPLY
0
Entering edit mode

dput(design[1:6,1:7]) should do the trick

ADD REPLY
0
Entering edit mode

Basti ,

Thank you for your response.

This is the output:

    `structure(c(0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0), dim = 6:7, dimnames = list(c("GSM814052", "GSM814053", 
"GSM814054", "GSM814055", "GSM814056", "GSM814057"), c(" MS1a", 
" MS1b", " MS2a_1", " MS2a_2", " MS2b_1", " MS2b2_1", " MS2b2_2"
)))`
ADD REPLY
0
Entering edit mode

Basti ,

Thank you for the observation. After remove the space, its works perfectly :)

ADD REPLY
3
Entering edit mode
2.0 years ago
Basti ★ 2.0k

Well now you can see that you have a space in the beggining of each of your colnames, this is why it does not work ;)

ADD COMMENT

Login before adding your answer.

Traffic: 1973 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6