Browse code

Clean up of gsnap-command

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

Michael Lawrence authored on 17/08/2012 20:24:21
Showing 1 changed files

... ...
@@ -14,20 +14,24 @@ setMethod("gsnap", c("character", "characterORNULL", "GsnapParam"),
14 14
                    output = file_path_sans_ext(input_a, TRUE),
15 15
                    consolidate = TRUE, ...)
16 16
           {
17
+            output_dir <- dirname(output)
18
+            if (!file.exists(output_dir))
19
+              dir.create(output_dir, recursive = TRUE)
20
+
17 21
             params <- initialize(params, ...)
18 22
             params_list <- as.list(params)
19 23
             if (gsnap_split_output(params)) {
20 24
               params_list$split_output <- output
25
+              output_path <- output_dir
21 26
             } else {
22
-              params_list$.redirect <- paste0("> ", output, ".sam")
27
+              output_path <- paste0("> ", output, ".sam")
28
+              params_list$.redirect <- output_path
23 29
             }
24
-            output_dir <- dirname(output)
25
-            if (!file.exists(output_dir))
26
-              dir.create(output_dir, recursive = TRUE)
27 30
             
28 31
             do.call(.gsnap, c(.input_a = input_a, .input_b = input_b,
29 32
                               format = "sam", params_list))
30
-            gsnap_output <- GsnapOutput(path = output_dir, version = gsnapVersion(),
33
+            gsnap_output <- GsnapOutput(path = output_path,
34
+                                        version = gsnapVersion(),
31 35
                                         param = params)
32 36
             asBam(gsnap_output)
33 37
             if (consolidate)
... ...
@@ -71,8 +75,8 @@ setMethod("gsnap", c("character", "characterORNULL", "GsnapParam"),
71 75
                    sam_headers_batch = NULL, read_group_id = NULL,
72 76
                    read_group_name = NULL, version = FALSE,
73 77
                    .input_a = NULL, .input_b = NULL,
74
-                   .redirect = NULL, ## e.g., > gsnap.sam
75
-                   extra = NULL)
78
+                   .redirect = NULL ## e.g., > gsnap.sam
79
+                   )
76 80
 {
77 81
   formals <- formals(sys.function())
78 82
   problems <- do.call(c, lapply(names(formals), .valid_gmap_parameter, formals))
... ...
@@ -84,8 +88,6 @@ setMethod("gsnap", c("character", "characterORNULL", "GsnapParam"),
84 88
   batch <- match.arg(batch)
85 89
   mode <- match.arg(mode)
86 90
   quality_protocol <- match.arg(quality_protocol)
87
-    
88
-  if (identical(extra, list())) extra <- NULL
89 91
   
90 92
 ### TODO: if input_a is NULL, or split_output and .redirect are NULL:
91 93
 ###       return a pipe()