fix the error when no CNEs in CNEDensity
... | ... |
@@ -31,6 +31,16 @@ CNEDensity <- function(dbName, tableName, chr, start, end, |
31 | 31 |
rangesPair <- readCNERangesFromSQLite(dbName, tableName, chr, |
32 | 32 |
context_start, context_end, |
33 | 33 |
whichAssembly, minLength) |
34 |
+ ## When no CNEs are returned |
|
35 |
+ if(length(rangesPair) == 0L){ |
|
36 |
+ ans <- GRanges(seqnames=chr, |
|
37 |
+ ranges=IRanges(start=context_start, |
|
38 |
+ end=context_end), |
|
39 |
+ strand="*", |
|
40 |
+ score=0) |
|
41 |
+ return(ans) |
|
42 |
+ } |
|
43 |
+ |
|
34 | 44 |
if(whichAssembly == "first"){ |
35 | 45 |
ranges <- first(rangesPair) |
36 | 46 |
}else if(whichAssembly == "second"){ |