Skip to content

Commit 019afb8

Browse files
committed
apply destranding per chromosome
1 parent e0f64a5 commit 019afb8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

R/methylDBFunctions.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ unite.methylRawListDB <- function(object,destrand=FALSE,min.per.group=NULL,
701701

702702
message("destranding...")
703703

704-
destrandFun <- function(obj){
704+
destrandFun <- function(obj, mc.cores=1){
705705

706706
## if resolution is not base or if strand is * then return object
707707
if(obj@resolution != "base" || any(headTabix(obj@dbpath)$strand == "*")) {return(obj)}
@@ -726,23 +726,24 @@ unite.methylRawListDB <- function(object,destrand=FALSE,min.per.group=NULL,
726726
tabixHead = tabixHead)
727727

728728
# need to use .CpG.dinuc.unifyOld because output needs to be ordered
729-
newdbpath <- applyTbxByChunk(obj@dbpath,
730-
chunk.size = chunk.size,
731-
dir=dir,filename = filename,
729+
newdbpath <- applyTbxByChr(obj@dbpath,
730+
dir=dir,
731+
filename = filename,
732732
return.type = "tabix",
733733
FUN = function(x) {
734734
.CpG.dinuc.unify(
735735
.setMethylDBNames(x,"methylRawDB")
736736
)},
737-
tabixHead = tabixHeadString)
737+
tabixHead = tabixHeadString,
738+
mc.cores = mc.cores)
738739

739740
readMethylRawDB(dbpath = newdbpath,dbtype = "tabix",
740741
sample.id = obj@sample.id,
741742
assembly = obj@assembly, context = obj@context,
742743
resolution = obj@resolution)
743744

744745
}
745-
new.list=suppressMessages(lapply(object,destrandFun))
746+
new.list=suppressMessages(lapply(object,destrandFun, mc.cores = mc.cores))
746747
object <- new("methylRawListDB", new.list,treatment=object@treatment)
747748

748749
## on exit remove all destrand files

0 commit comments

Comments
 (0)