Closed TobiTekath closed 2 years ago
Hi Tobi,
thanks for the report and the detailed description which made it easy to understand what is happening. The easiest way to avoid that error is actually to use
test_de(fit, contrast = "`annot$grpB`")
Note the ticks `
around annot$grpB
. This is necessary to make sure that the contrast is indeed interpretated as a name and not some R expression.
I am not sure that this is a problem that I would be able to detect in parse_contrast
. However, if you have a suggestion to provide a more meaningful error message, I would be happy to hear :)
Hi Constantin,
thank you for the immediate feedback. You are absolutely right, the backticks are a very elegant way to prevent evaluation. Thanks.
Hi Constantin,
I just came across an error in the handling of contrast names in
test_de()
. The error appears when using a model.matrix with "complex" names (see below)Code to reproduce:
Error:
I traced the Error to https://github.com/const-ae/glmGamPoi/blob/b595fd7fbdba98a89ca57dbcbb38baa151e4c767/R/parse_contrast.R#L38 which returns NULL in this context (and not the correct column name as supposed).
The error can be circumvented by defining the model.matrix more elegantly (
model.matrix(~grp, annot)
), but as the matrices themselves are identical (except for the column names), I still think this might be an error you want to catch.Best, Tobi