Browse code

version 1.11.2

makeGRBs returns the coordinates of CNEs as a meta data column

Ge Tan authored on 19/10/2016 16:46:29
Showing 2 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: CNEr 
2
-Version: 1.9.44
3
-Date: 2016-10-18
2
+Version: 1.11.2
3
+Date: 2016-10-19
4 4
 Title: CNE Detection and Visualization
5 5
 Description: Large-scale identification and advanced visualization 
6 6
              of sets of conserved noncoding elements.
... ...
@@ -94,9 +94,22 @@ makeGRBs <- function(x, winSize=NULL, genes=NULL, ratio=1,
94 94
   for(i in 1:length(xList)){
95 95
     hitsCNEs <- findOverlaps(xList[[i]], clusterRanges,
96 96
                              ignore.strand=TRUE, type="within")
97
+    
98
+    ## Add the number of CNEs
97 99
     cnes <- lengths(split(queryHits(hitsCNEs), subjectHits(hitsCNEs)))
98 100
     mcols(clusterRanges)[[names(xList)[i]]] <- 0L
99 101
     mcols(clusterRanges)[[names(xList)[i]]][as.integer(names(cnes))] <- cnes
102
+    
103
+    ## Add the CNE ranges
104
+    cnes <- split(xList[[i]][queryHits(hitsCNEs)], subjectHits(hitsCNEs))
105
+    missingCNEs <- setdiff(seq_len(length(clusterRanges)),
106
+                           subjectHits(hitsCNEs))
107
+    for(j in missingCNEs){
108
+      ## This is really a bad implementation. 
109
+      cnes[[as.character(j)]] <- GRanges()
110
+    }
111
+    mcols(clusterRanges)[[paste(names(xList)[i], "CNE")]] <- 
112
+      cnes[order(as.integer(names(cnes)))]
100 113
   }
101 114
   
102 115
   # Filter out the GRBs with few CNEs