DEqMS make contrasts - non-valid names
2
0
Entering edit mode
mjensen2 • 0
@mjensen2-23924
Last seen 4.2 years ago

Hi guy, I am trying to use the DEqMS tool for my differential expression analysis. I followed the steps from the DEqMS-package-vignette until 2.1.4 - Make contrasts. This is the commands;

cond = as.factor(c(X1_Frozen,X2_Frozen,X3_Frozen,X4_Frozen,X11_RNAlater,X12_RNAlater,X13_RNAlater,X14_RNAlater)) #X1_Frozen etc. = equals row names/groups
design = model.matrix(~0+cond)
design = model.matrix(~0+cond)
colnames(design) = gsub("cond","",colnames(design))
contrast = makeContrasts(contrasts=x,levels=design)

When trying to run the contrast command I'll get the following error message:

Error in makeContrasts(contrasts = x, levels = design) : 
  The levels must by syntactically valid names in R, see help(make.names).  Non-valid names: -Inf,-4.00735369535212,-3.85423988827818,-3.57233660941963,-3.45430347451484,-3.44084465049062,-3.23991739765898,-3.13420477162754,-3.09740268774595,-3.06618643730488,-3.03005644431212,-3.01908649459226

etc. which seems like it can't handle negative value. However, I would expect negative values since it it log2 transformed and median centered, right? I appreciate any advice on how to potentially fix this. Thanks!

Cheers, Marlene

limma • 1.8k views
ADD COMMENT
1
Entering edit mode
Kevin Blighe ★ 4.0k
@kevin
Last seen 4 weeks ago
Republic of Ireland

Hey Marlene,

The problem is likely created in your very first line:

cond = as.factor(c(X1_Frozen,X2_Frozen,X3_Frozen,X4_Frozen,X11_RNAlater,X12_RNAlater,X13_RNAlater,X14_RNAlater))

What are X1_Frozen, X2_Frozen, et cetera? - I presume that they are supposed to be column names?

Your cond vector should probably be something like this:

c('Frozen', 'Frozen', 'Frozen', 'Frozen', 'RNAlater', 'RNAlater', 'RNAlater', 'RNAlater')

, and this vector should align (in length and order) with the columns of your expression matrix.

Also note that you have duplicated this line: design = model.matrix(~0+cond)

Finally, is there a reason for including an intercept term (~ 0)?

Kevin

ADD COMMENT
0
Entering edit mode

Hi Kevin, thank you for your response! Yes, X1_Frozen etc are column names...I replaced it the way you suggested and it seemed to work since I didn't receive the original error anymore. Thanks - I really appreciate your help with this!

However, there still seems to be a problem and I assume that refers to this part of your response "and this vector should align (in length and order) with the columns of your expression matrix" since I receive the following error now:

Error in cm[, j] <- eval(ej, envir = levelsenv) : number of items to replace is not a multiple of replacement length

Do you now how to fix that? I am definitely not familiar with this error.

The "~0" was suggested in the package-vignette and means no intercept for the linear model. However, I am not entirely sure why this should be included. Would you recommend to remove this paramater?

Thank you again!

Cheers, Marlene

ADD REPLY
0
Entering edit mode

It appears that you are analysing RNA expression, so it's not necessarily appropriate to follow the DEqMS package vignette, which is specifically for proteomics. You can just follow the limma User's Guide directly.

ADD REPLY
0
Entering edit mode

Hi Gordon, Thanks for your response! I am working with metaproteomics data so I am a little confused by your suggestion. Is any of the commands I ran so far specifically for RNA expression? I thought I need to run limma before using DEqMS. Did I get that wrong?

ADD REPLY
0
Entering edit mode

The commands are all generic but I noticed the factor levels "RNAlater". I thought that RNAlater is a preservative method specifically for RNA. On reading the RNAlater tech notes just now I see that it can be used for protein as well.

ADD REPLY
0
Entering edit mode
@gordon-smyth
Last seen 55 minutes ago
WEHI, Melbourne, Australia

All you actually need is:

cond <- factor( rep(c("Frozen","RNAlater"), each=4))
design <- model.matrix(~cond)

There's no need for a contrast or for any editing of the column names.

You don't need to use makeContrasts at all, but I will mention that the error message you report lists what appears to be raw expression values, something that should not be entered to that function. It is hard to see how this particular error message could arise from the code you give.

ADD COMMENT
0
Entering edit mode

Hm, thank you. I will try it and hopefully get it to work. However, I am still a little confused regarding the raw data you mentioned. I used NSAF (normalized spectral abundance factors) as input and log2 transformed that/ created centered means. Is that incorrect? Sorry for bombarding you with questions I just wanna make sure I'll get it right.

ADD REPLY
0
Entering edit mode

It is incorrect to input any sort of expression or abundance values to makeContrasts, normalized or otherwise. The purpose of the function is quite different. See or the documentation ?makeContrasts or the vignette examples.

ADD REPLY
0
Entering edit mode

Ok, thank you for you help! I appreciate it

ADD REPLY

Login before adding your answer.

Traffic: 655 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