Browse code

gsnap() derives default output path from the current working directory

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@85505 bc3139a8-67e5-0310-9ffc-ced21a209358

Michael Lawrence authored on 14/01/2014 19:12:06
Showing 1 changed files

... ...
@@ -11,12 +11,15 @@ setGeneric("gsnap", function(input_a, input_b = NULL, params, ...)
11 11
 
12 12
 setMethod("gsnap", c("character", "characterORNULL", "GsnapParam"),
13 13
           function(input_a, input_b, params,
14
-                   output = file_path_sans_ext(input_a, TRUE),
14
+                   output = file.path(getwd(),
15
+                     file_path_sans_ext(basename(input_a), TRUE)),
15 16
                    consolidate = TRUE, ...)
16 17
           {
17 18
             if (!is.null(input_b) && length(input_a) != length(input_b))
18 19
               stop("If 'input_b' is non-NULL, it must have the same length",
19 20
                    " as 'input_a'")
21
+            if (any(is.na(input_a)) || any(is.na(input_b)))
22
+              stop("'input_a' and 'input_b' must not contain NA's")
20 23
             if (length(input_a) > 1L) {
21 24
               return(GsnapOutputList(mapply(gsnap, input_a, input_b,
22 25
                                             MoreArgs = list(params, output,
... ...
@@ -30,7 +33,7 @@ setMethod("gsnap", c("character", "characterORNULL", "GsnapParam"),
30 33
             params <- initialize(params, ...)
31 34
             params_list <- as.list(params)
32 35
             if (gsnap_split_output(params)) {
33
-              params_list$split_output <- basename(output)
36
+              params_list$split_output <- output
34 37
               output_path <- output_dir
35 38
             } else {
36 39
               output_path <- paste0(output, ".sam")