# NOT RUN {
# this is a list of example files, ships with the package
# for your own analysis you will just need to provide set of paths to files
# you will not need the "system.file(..." part
file.list=list(
system.file("extdata", "test1.myCpG.txt", package = "methylKit"),
system.file("extdata", "test2.myCpG.txt", package = "methylKit"),
system.file("extdata", "control1.myCpG.txt", package = "methylKit"),
system.file("extdata", "control2.myCpG.txt", package = "methylKit")
)
# read the files to a methylRawList object: myobj
myobj=methRead(file.list,
sample.id=list("test1","test2","ctrl1","ctrl2"),
assembly="hg18",treatment=c(1,1,0,0))
# read one file as methylRaw object
myobj=methRead( file.list[[1]],
sample.id="test1",assembly="hg18")
# read a generic text file containing CpG methylation values
# let's first look at the content of the file
generic.file=system.file("extdata", "generic1.CpG.txt",package = "methylKit")
read.table(generic.file,header=TRUE)
# And this is how you can read that generic file as a methylKit object
myobj=methRead( generic.file,
pipeline=list(fraction=FALSE,chr.col=1,start.col=2,end.col=2,
coverage.col=4,strand.col=3,freqC.col=5),
sample.id="test1",assembly="hg18")
# This creates tabix files that save methylation data
# Without specified dbdir first creates a folder named the following
# in working directory:
# paste("methylDB",Sys.Date(),paste(sample(c(0:9, letters, LETTERS),3,
# replace=TRUE),collapse=""))
#
# Then, saves tabix files from methylKit objects there
myobj=methRead( file.list,
sample.id=list("test1","test2","ctrl1","ctrl2"),
assembly="hg18",treatment=c(1,1,0,0),
dbtype="tabix")
# This creates a single tabix files that saves methylation data
# first creates a "methylDB_objects" directory
# Then, saves tabix file from methylKit objects there
myobj=methRead(file.list[[1]],
sample.id="test1",
assembly="hg18",
dbtype="tabix",dbdir="methylDB_objects")
# tidy up
rm(myobj)
unlink(list.files(pattern = "methylDB",full.names = TRUE),recursive = TRUE)
# }
Run the code above in your browser using DataLab