diff corr.R @ 12:f3e037496c18

its even checking the levels
author Ido Tamir <ido.tamir@imp.ac.at>
date Sun, 18 Aug 2013 21:33:43 +0200
parents 74bfa2464411
children de452b96da8e
line wrap: on
line diff
--- a/corr.R	Sun Aug 18 19:39:52 2013 +0200
+++ b/corr.R	Sun Aug 18 21:33:43 2013 +0200
@@ -146,10 +146,11 @@
   seqinfo <- mergeSeqInfo(coverages)
   lapply(coverages, function(cov){ 
 	  si <- as.data.frame(cov@seqinfo)
-      si <- data.frame(chr=rownames(si), si)
-	  sis <- subset(seqinfo, seqnames %in% si$chr) 
+      si <- data.frame(chr=rownames(si), si, stringsAsFactors=FALSE)
+	  sis <- subset(seqinfo, seqnames %in% si$chr)  
+	  sis <- sis[match(si$chr, sis$seqnames),]	  
 	  si <- Seqinfo(seqnames=as.character(sis$seqnames), seqlengths=sis$seqlengths, isCircular=sis$isCircular, genome=sis$genome)   
-      cov@seqinfo <- si
+	  cov@seqinfo <- si
 	  cov
   })
 }