Skip to content

Instantly share code, notes, and snippets.

@al2na
Created February 6, 2014 22:19
Show Gist options
  • Save al2na/8853690 to your computer and use it in GitHub Desktop.
Save al2na/8853690 to your computer and use it in GitHub Desktop.
methylKit unite chromosome by chromosome
subsetByChr<-function(methylRawList.obj,my.chr="chr21"){
sub=lapply(methylRawList.obj, function(x) x[x$chr==my.chr] )
new("methylRawList",sub,treatment=methylRawList.obj@treatment)
}
my.chrs= unique(methylRawList.obj[[1]]$chr)
result=data.frame()
for(my.chr in my.chrs){
my.subset=subsetByChr(methylRawList.obj,my.chr)
result=rbind(result, getData(unite(my.subset)))
}
obj=new("methylBase",result,sample.ids=sapply(methylRawList.obj,function(x) [email protected] ),
assembly="mm9",context="CpG",
treatment=methylRawList.obj@treatment,
coverage.index=seq(5,by=3,length.out=length(methylRawList.obj@treatment)),
numCs.index=seq(5,by=3,length.out=length(methylRawList.obj@treatment)) +1 ,
numTs.index=seq(5,by=3,length.out=length(methylRawList.obj@treatment)) +2,
destranded=FALSE,resolution="base" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment