Skip to content

Instantly share code, notes, and snippets.

@al2na
Created January 3, 2015 12:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al2na/fd618a612c6dfd72324c to your computer and use it in GitHub Desktop.
Save al2na/fd618a612c6dfd72324c to your computer and use it in GitHub Desktop.
read files in parallel
library(foreach)
library(methylKit)
library(doMC)
registerDoMC(2)
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") )
ids=c("test1","test2","ctrl1","ctrl2")
# read methylRaw objects to a list in parallel
x <- foreach(i=1:length(file.list)) %dopar% read(file.list[[i]],sample.id=ids[i],
assembly="hg18")
# make a new methylRawList object from the list x
myMethRawList=new("methylRawList",x,treatment=c(1,1,0,0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment