Browse code

try to create the output dir anyway in makeCNEDensity

Ge Tan authored on 20/09/2016 15:37:28
Showing 2 changed files

... ...
@@ -99,7 +99,10 @@ makeCNEDensity <- function(x, outputDir=".",
99 99
   if(seqlengthsNA(x)){
100 100
     stop("seqlengths must be provided in `x`!")
101 101
   }
102
-  
102
+  if(length(x) == 0L){
103
+    warning("No CNEs in `x`!")
104
+    return(FALSE)
105
+  }
103 106
   ## make the bed files
104 107
   message("Making bed files...")
105 108
   bedFirst <- first(x)
... ...
@@ -219,6 +222,7 @@ makeAncoraFiles <- function(cne, outputDir=".",
219 222
                       mcols(cne)$score,
220 223
                       mcols(cne)$cigar)
221 224
   }
225
+  dir.create(outputDir, showWarnings=FALSE, recursive=TRUE)
222 226
   write.table(ans, file=file.path(outputDir, fileName), 
223 227
               sep="\t", quote=FALSE, row.names=FALSE,
224 228
               col.names=FALSE)
... ...
@@ -21,7 +21,7 @@
21 21
   }
22 22
   \item{outputDir}{
23 23
     \code{character}(1): the output directory of 
24
-    \sQuote{Bed} and \sQuote{BigWig} files.
24
+    \sQuote{Bed}, \sQuote{bedGraph} and \sQuote{BigWig} files.
25 25
   }
26 26
   \item{genomeFirst,genomeSecond}{
27 27
     \code{character}(1): the genome name of the first and second species.