Browse code

version 1.9.41

Fix the case of no CNEs returned during query

Ge Tan authored on 04/10/2016 16:37:56
Showing 4 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: CNEr 
2
-Version: 1.9.40
3
-Date: 2016-09-20
2
+Version: 1.9.41
3
+Date: 2016-10-04
4 4
 Title: CNE Detection and Visualization
5 5
 Description: Large-scale identification and advanced visualization 
6 6
              of sets of conserved noncoding elements.
... ...
@@ -42,6 +42,7 @@ readAncora <- function(fn, assembly=NULL,
42 42
                                    name=paste0(cne[[4]], ":", 
43 43
                                                (cne[[5]]+1), "-", cne[[6]]),
44 44
                                    itemRgb=chr2colour(cne[[4]]),
45
+                                   seqnames2=cne[[4]],
45 46
                                    seqinfo=seqinfoTarget),
46 47
                      second=GRanges(seqnames=cne[[4]],
47 48
                                   ranges=IRanges(start=cne[[5]]+1,
... ...
@@ -49,6 +50,7 @@ readAncora <- function(fn, assembly=NULL,
49 50
                                   strand="*",
50 51
                                   name=paste0(cne[[1]], ":", 
51 52
                                               (cne[[2]]+1), "-", cne[[3]]),
53
+                                  seqnames2=cne[[1]],
52 54
                                   itemRgb=chr2colour(cne[[1]]),
53 55
                                   seqinfo=seqinfoQuery)
54 56
                      )
... ...
@@ -2,11 +2,19 @@
2 2
 ### make GRBs from CNEs
3 3
 ### Exported!
4 4
 makeGRBs <- function(x, winSize=NULL, genes=NULL, ratio=1, 
5
-                     background=c("chromosome", "genome")){
5
+                     background=c("chromosome", "genome")){#,
6
+                     #byChrom=FALSE
6 7
   if(!is(x, "GRangesList")){
7 8
     stop("The input `x` must be a `GRangesList` object!")
8 9
   }
9 10
   background <- match.arg(background)
11
+  # if(isTRUE(byChrom)){
12
+  #   if(!all(sapply(cneList, 
13
+  #                  function(x){"seqnames2" %in% colnames(mcols(x))}))){
14
+  #     stop("`x` must have metacolum of `seqnames2` to do",
15
+  #          "byChrom GRB prediction!")
16
+  #   }
17
+  # }
10 18
   
11 19
   xList <- x
12 20
   if(is.null(names(xList))){
... ...
@@ -283,6 +283,12 @@ readCNERangesFromSQLite <- function(dbName, tableName,
283 283
     seqinfoQuery <- seqinfoFn(qAssemblyFn)
284 284
   }
285 285
   
286
+  # Return empty GRangePairs when no CNEs are returned.
287
+  if(nrow(fetchedCNE) == 0L){
288
+    return(GRangePairs(first=GRanges(seqinfo=seqinfoTarget),
289
+                       second=GRanges(seqinfo=seqinfoQuery)))
290
+  }
291
+  
286 292
   firstGRanges <- GRanges(seqnames=fetchedCNE[ ,1],
287 293
                           ranges=IRanges(start=fetchedCNE[ ,2],
288 294
                                          end=fetchedCNE[,3]),