sartorlab / methylSig

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

input methylRaw object #46

Closed anairlema closed 4 years ago

anairlema commented 4 years ago

Dear Raymond,

I am trying to run methylSig on ERRBS data. We have previously performed other ERRBS analysis using methylkit for statistics and then performing the differential analysis on MethylSig. We already have the CpGs files uploaded on methylkit and we have generated the methylRaw object as follow:

library(methylKit) file.list= list("Sample1_CpGfinal.txt", "Sample2_CpGfinal.txt", "Sample3_CpGfinal.txt", "Sample4_CpGfinal.txt", "Sample5_CpGfinal.txt", "Control1_CpGfinal.txt", "Control2_CpGfinal.txt", "Control3_CpGfinal.txt", "Control4_CpGfinal.txt", "Control5_CpGfinal.txt") myobj=methRead(file.list, sample.id=list("Sample1","Sample2","Sample3","Sample4","Sample5","Control1","Control2","Control3","Control4","Control5"), assembly="hg19",treatment=c(1,1,1,1,1,0,0,0,0,0),context="CpG") filtered.myobj=filterByCoverage(myobj,lo.count=10,lo.perc=NULL,hi.count=450,hi.perc=99.9) norm_myobj=normalizeCoverage(filtered.myobj) meth=unite(norm_myobj, destrand=TRUE)

I was wondering if it is possible to input this already create object on methylSig and avoid the Bismark methylation extractor run and the bsseq::read.bismark.

Thank you in advance for your help!

Anair

rcavalcante commented 4 years ago

Hi Anair,

The short answer is no, you can't use that object directly in methylSig.

Please see the documentation for methylSig (on Bioconductor).

methylSig starts from BSseq class objects from the bsseq package. And bsseq::read.bismark is the easiest way to achieve that. You don't have to use the Bismark Methylation Extractor for the data to be in the correct format to use bsseq::read.bismark. You need your data to have columns like:

<chromosome> <start position> <end position> <methylation percentage> <count methylated> <count unmethylated>

or, if you want bsseq::read.bismark to destrand your data:

<chromosome> <position> <strand> <count methylated> <count unmethylated> <C-context> <trinucleotide context>

Alternatively, you could use MethylDackel to generate methylation call files with columns of the first type. MethylDackel is incredibly fast, and allows you to destrand the data and give minimum cutoffs for coverage. It works with output from Bismark's alignment step.

Thanks, Raymond