kdkorthauer / dmrseq

R package for Inference of differentially methylated regions (DMRs) from bisulfite sequencing
MIT License
54 stars 14 forks source link

matchCovariate can't be used when testCovariate is not a 2-group factor #16

Closed jtomah closed 5 years ago

jtomah commented 5 years ago

Hi

I got the following error on a dataset where the test covariate is a 2-group factor:

matchCovariate can't be used when testCovariate is not a 2-group factor

I rolled back from dmrseq 1.3.3 to 1.3.1 and it worked. I think it comes from the commit of the 21 nov 2018 that adds the following code

# check for incompatible args
if (fact & !is.null(matchCovariate))
    stop("matchCovariate can't be used when testCovariate is not a 2-group ",
           "factor. Perhaps you'd like to add an adjustCovariate instead?")

If I understand the code correctly, 'fact' will be true even if the test covariate is a 2-group factor.

Thank you for this package and for your attention

kdkorthauer commented 5 years ago

Hi @jtomah,

You are correct; thanks for spotting and reporting this. The newly added if statement was missing a check for more than 2 groups. I have pushed a fix to devel (master).

Best, Keegan