When I try to import the data using DESeq2 package:

dds <- DESeqDataSetFromTximport(txi, sampleTable, ~Group + Cre)

I am getting the error:

Error in validObject(.Object) : invalid class “DESeqDataSet” object: levels of factors in the design have non-unique level names after make.names() is applied. best to only uobject letters and numbers for levels of factors in the design

Here is how my sampleTable looks like:

    ID      Group Cre
1  Bla_36   IL4   -
2  Bla_38   IL4   -
3  Bla_11   IL4   -
4  Bla_17   IL4   -
5  Bla_20   IL4   +
6  Bla_21   IL4   +
7   Bla_8   IL4   +
8  Bla_22   IL4   +
9   Bla_7   IL4   +
10 Bla_35   PBS   -
11 Bla_37   PBS   -
12 Bla_13   PBS   -
13  Bla_1   PBS   -
14  Bla_9   PBS   +
15 Bla_23   PBS   +
16 Bla_19   PBS   +
17 Bla_24   PBS   +

What am I doing wrong here? And how to make it working?


2 Answers 2


There's a good reason to not allow + and - in the columns. It's because once you do that you get coefficients that can then start with a + or -, which is illegal in R and most other languages. In R, legal variable names consist of:

A syntactically valid name consists of letters, numbers and the dot or underline characters and starts with a letter or the dot not followed by a number.

That doesn't really explain the error message you saw, of course. That can be solved by thinking about what R does to invalid character in names. Namely, it replaces them by a dot. So + and - get converted to X. and X., which are of course identical and are what's really leading to the error message your saw. If you had used +cre and - it would have worked.

As an aside, you'll want to think in terms of positive and negative Cre if you talk to a biologist, since that's the appropriate terminology for it.


Weirdly enough, + and - are apparently not allowed in the column. After mapping them to longer strings it started to work:

cre_id = revalue(samples$cre, c('-' = 'minus', '+' = 'plus'))

sampleTable <- data.frame(
  ID = samples$id,
  Group = samples$group,
  Cre = cre_id

and it looks like that:

       ID   Group   Cre
1  Bla_36   IL4 minus
2  Bla_38   IL4 minus
3  Bla_11   IL4 minus
4  Bla_17   IL4 minus
5  Bla_20   IL4  plus
6  Bla_21   IL4  plus
7   Bla_8   IL4  plus
8  Bla_22   IL4  plus
9   Bla_7   IL4  plus
10 Bla_35   PBS minus
11 Bla_37   PBS minus
12 Bla_13   PBS minus
13  Bla_1   PBS minus
14  Bla_9   PBS  plus
15 Bla_23   PBS  plus
16 Bla_19   PBS  plus
17 Bla_24   PBS  plus

I do not understand though, why...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.