Created
January 3, 2015 12:26
-
-
Save al2na/fd618a612c6dfd72324c to your computer and use it in GitHub Desktop.
read files in parallel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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