al2na / methylKit

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

Reading BedGraph file using methRead() #293

Closed ANGEL-D-SAMUEL closed 1 year ago

ANGEL-D-SAMUEL commented 1 year ago

I am trying to use BedGraph file format as an input for the methylkit() using methRead() function. However, i am getting error? Is thi how we give 'pipeline' or do i need to change it ?

d <- methRead(assembly = "hg38", header = FALSE, context = "CpG", skip = 1, treatment = c(0,1), sep = "\t", sample.id = "R88002685.dedup_hg38_CpG.bedGraph","R88002695.dedup_hg38_CpG.bedGraph", resolution = "base",dbtype = "tabix",dbdir = getwd(), mincov = 10,pipeline =list("chr","start","end","per_meth","n_meth","un_meth") )

Received single location.
Reading file.
|--------------------------------------------------|
|==================================================|
Error in .check.pipeline.list(pipeline) : 
  Miss components for pipeline for the generic read.Try amp, or bismark, or a list in the correct format forfor generic methylation file reading!

if i am using 'read.table' function

bedfile <- read.table(file = "R88002685.dedup_hg38_CpG.bedGraph", header = FALSE, sep = "\t", col.names = c("chr","start","end", "perc_meth","N_meth","Un_meth"), fill = TRUE)

This works for me

alexg9010 commented 1 year ago

HI @ANGEL-D-SAMUEL ,

This is not how to use the pipeline argument. The use of the pipeline is clearly explained in the help of methRead function (see help(methRead)or ?methRead). You may check the examples section of the help to learn how you can read that generic file as a methylKit object.

See here for an example.

Best, Alex