sartorlab / methylSig

R package for DNA methylation analysis
17 stars 5 forks source link

Error with methylSigTile #16

Closed ArsenaultResearch closed 5 years ago

ArsenaultResearch commented 8 years ago

Hey, I am using MethylSig version 0.4.4 and R version 3.2.2 (2015-08-14) : "Fire Safety"

I have been attempting to get the methylSigTile function to take a preset list of windows as an input and have received the error below:

kit_tiler=methylSigTile(meth,tiles=test2) Tiling by regions Error in colSums(meth@data.numCs[whichVlist[whichSTART[i]:whichEND[i]], : 'x' must be an array of at least two dimensions the meth variable does not seem to cause any problems when I run kit_tiler=methylSigTile(meth,win.size=200) instead so I do think it is the problem.

I have included a sample of the test2 variable below: chr start end scaffold1 1 200 scaffold1 201 400 scaffold1 401 600 scaffold1 601 800 scaffold1 801 1000 scaffold1 1001 1200 scaffold1 1201 1400 scaffold1 1401 1600 (Tab-delimited). I load this variable into R as a data.frame and pass it to methylSigTile. Do you have any suggestions? Thanks, Sam

rcavalcante commented 8 years ago

Hi Sam,

Thanks for using methylSig. I wonder if you can attach an .RData to this thread with the meth object loaded so I can play around with it a little more?

Thanks, Raymond

rcavalcante commented 8 years ago

Hi Sam,

Thanks for your patience, I discovered the source of the problem with user-supplied tiles. We use colSums() in that case, to aggregate over the sites in the region, but when only one CpG is in the region, colSums() fails because it needs a matrix with more than one row. I've fixed that problem.

In the course of doing that I've found an indexing problem that caused aggregation over tiles to be done incorrectly, and am testing my fix for that. Unfortunately our unit tests didn't catch it. Expect a bugfix for this issue by tomorrow.

Again, thanks for your patience, and for helping to uncover this problem.

Raymond

rcavalcante commented 8 years ago

Hi Sam,

I've fixed the methylSigTile() function for when users supply their own tiles. There is still an issue when using win.sizes, so I would recommend not using that at the moment.

I haven't released a new version of methylSig because we're still working on that problem. But you can install the version with the fix with:

devtools::install_github('sartorlab/methylSig@v0.4.5-beta')

Let me know if you run into any other issues.

Raymond

Milad76 commented 7 years ago

Hi rcavalcant, I am using MethylSig version 0.4.5 and R version 3.1.3 (2015-08-14) : I have been attempting to get the methylSigTile function to test the predfine region (tile) and have received the error below: Tiling by regions Error in checkAtAssignment("methylSigData", "data.start", "NULL") : assignment of an object of class “NULL” is not valid for @‘data.start’ in an object of class “methylSigData”; is(value, "numeric") is not TRUE

head(Tile) data.chr data.start data.end 1 chr1 9996884 10000447 2 chr1 99956 101653 3 chr1 10023919 10026262 4 chr1 10053630 10055678 5 chr1 10067567 10069133 6 chr1 1011179 1013343 I have attched the data and the cond with predefined region.

I appreiciate all your help

arab.seedlings.2trt.all.01.txt region.txt

code.txt

rcavalcante commented 7 years ago

Hello,

Sorry for the delay in response. In working through your code, I determined three issues:

  1. The columns for the tiles in methylSigTile() should be named chr,start, and end. This is what was throwing the error initially because the methylSigTile() function was trying to access tiles$chr, but the tiles object had no such column.
  2. Your Acolal1 object should be sorted on the chromosome and start columns.
    Acolal1 = Acolal1[order(Acolal1[,1],Acolal1[,2]),]
  3. The Tile object also needs to be sorted on the chromosome and start columns.
    Tile = Tile[order(Tile[,1],Tile[,2]),]

I encountered the last two problems after fixing the first problem. In general, it's always a good idea to sort the data.

After doing those things, I was able to do methylSigTile().

Give that a shot and let me know if that works. Again, I'm very sorry for the delay.

bmreilly commented 6 years ago

Hay Raymond, Did the issue with methylSigTile() and colSums get pushed in a final fix? I just reinstalled from github and ran into this issue again. Do I Need to install a beta version to get this fix? Thanks, Brian

rcavalcante commented 6 years ago

Hi Brian,

I've mostly completed a refactor of methylSig that uses Bioconductor classes and methods (e.g. BSseq and GRanges objects) instead of the classes and methods from the original implementation. It is available in the v0.5.0-beta branch, and all features have been migrated except for the methylSigPlot function, which I will add back soon.

The refactor has made the package more reliable, and should take care of the bugs that have been causing people grief.

Please give it a shot by installing it with: devtools::install_github('sartorlab/methylSig@v0.5.0-beta')

There are some changes to the parameters used in methylSigReadData, methylSigTile, and methylSigCalc, and the documentation reflects that. The vignette has also been updated, so you can use that to follow an example from data input to differential methylation testing.

Let me know if you run into any problems.

Thanks, Raymond

bmreilly commented 6 years ago

Hi Raymond,

Thanks for the quick response. Great work on the refactoring, I agree that using Bioconductor methods will make methylSig much more robust. I installed the new beta version and everything is working fine for me so far. Thanks! -Brian