al2na / methylKit

R package for DNA methylation analysis
https://bioconductor.org/packages/release/bioc/html/methylKit.html
210 stars 96 forks source link

Error during methylkit unite #290

Open manjumoorthy95 opened 1 year ago

manjumoorthy95 commented 1 year ago

While performing the Unite function on CHG context files in methylkit, I get the following error :

Error in bmerge. Incompatible join types.

I have posted the screenshot of error below.

What could be the reason? IMG-20230710-WA0001

alexg9010 commented 1 year ago

Hi @manjumoorthy95 ,

Thanks for reporting the error.

The reason could be that the chr column of one sample is formatted as character while the other is formatted as integer. This might have happened during the reading of the files, since we are using data.table::fread to parse the file and automatically determine column types. Here, if the chromosome names in the file are numbers, they will be imported as integers.

This is unexpected and should not really happen, but for now, you could manually convert the chr into character type columns using the following code:

for (i in seq_along(myobj)) myobj[[i]]$chr <- as.character(myobj[[i]]$chr)

I hope this helps for now.

I was able to reproduce your error and will be working on a fix.

Best, Alex