git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@69298 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -10,7 +10,7 @@ Description: GSNAP and GMAP are a pair of tools to align short-read |
10 | 10 |
to work with GMAP and GSNAP from within R. In addition, it provides |
11 | 11 |
methods to tally alignment results on a per-nucleotide basis using |
12 | 12 |
the bam_tally tool. |
13 |
-Version: 0.99.15 |
|
13 |
+Version: 0.99.16 |
|
14 | 14 |
Depends: R (>= 2.15.0), methods, GenomicRanges |
15 | 15 |
Imports: IRanges, Rsamtools (>= 1.7.4), rtracklayer (>= 1.17.15), GenomicRanges, |
16 | 16 |
GenomicFeatures, Biostrings, VariantAnnotation, tools, Biobase |
... | ... |
@@ -8,6 +8,7 @@ importFrom(Biobase, createPackage) |
8 | 8 |
import(IRanges) |
9 | 9 |
import(GenomicRanges) |
10 | 10 |
import(parallel) |
11 |
+import(LungCancerLines) |
|
11 | 12 |
importFrom(Biostrings, getSeq, read.DNAStringSet) |
12 | 13 |
importFrom(GenomicRanges, genome, seqinfo) |
13 | 14 |
importMethodsFrom(GenomicRanges, seqnames, strand) |
... | ... |
@@ -34,17 +34,24 @@ setMethod("gsnap", c("character", "characterORNULL", "GsnapParam"), |
34 | 34 |
} |
35 | 35 |
} |
36 | 36 |
|
37 |
- do.call(.gsnap, |
|
38 |
- c(list(.input_a = input_a, .input_b = input_b, |
|
39 |
- format = "sam"), |
|
40 |
- params_list)) |
|
41 |
- gsnap_output <- GsnapOutput(path = output_path, |
|
42 |
- version = gsnapVersion(), |
|
43 |
- param = params) |
|
44 |
- asBam(gsnap_output) |
|
45 |
- if (consolidate) |
|
46 |
- consolidate(gsnap_output) |
|
47 |
- gsnap_output |
|
37 |
+ res <- do.call(.gsnap, |
|
38 |
+ c(list(.input_a = input_a, .input_b = input_b, |
|
39 |
+ format = "sam"), |
|
40 |
+ params_list)) |
|
41 |
+ ##users can provide a function to the "gmapRSysCall" |
|
42 |
+ ##option. If this has happened, the return value of .gsnap |
|
43 |
+ ##(and consequently .system) is returned instead of a |
|
44 |
+ ##GsnapOutput object |
|
45 |
+ if (is.null(getOption("gmapRSysCall"))) { |
|
46 |
+ gsnap_output <- GsnapOutput(path = output_path, |
|
47 |
+ version = gsnapVersion(), |
|
48 |
+ param = params) |
|
49 |
+ asBam(gsnap_output) |
|
50 |
+ if (consolidate) |
|
51 |
+ consolidate(gsnap_output) |
|
52 |
+ res <- gsnap_output |
|
53 |
+ } |
|
54 |
+ return(res) |
|
48 | 55 |
}) |
49 | 56 |
|
50 | 57 |
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
... | ... |
@@ -81,16 +81,34 @@ commandLine <- function(binary = "gsnap", |
81 | 81 |
on.exit(options(scipen = scipen)) |
82 | 82 |
|
83 | 83 |
unnamedUserArgs <- sapply(userArgs[!named], as.character) |
84 |
- namedUserArgs <- paste(ifelse(nchar(names(userArgs[named])) > 1, "--", "-"), |
|
85 |
- gsub("_", "-", names(userArgs[named])), sep = "") |
|
84 |
+ ##long-form args have double dashes. Short-form args (single char) |
|
85 |
+ ##have single dashes. |
|
86 |
+ dashes <- ifelse(nchar(names(userArgs[named])) > 1, "--", "-") |
|
87 |
+ namedUserArgs <- paste(dashes, |
|
88 |
+ gsub("_", "-", names(userArgs[named])), |
|
89 |
+ sep = "") |
|
86 | 90 |
toggle_arg <- sapply(userArgs[named], isTRUE) |
87 | 91 |
namedUserArgs[!toggle_arg] <- |
88 | 92 |
paste(namedUserArgs[!toggle_arg], |
89 |
- sapply(userArgs[named][!toggle_arg], as.character)) |
|
93 |
+ sapply(userArgs[named][!toggle_arg], as.character), |
|
94 |
+ sep="=") |
|
90 | 95 |
if (!is.null(path)) |
91 | 96 |
binary <- file.path(path, binary) |
92 | 97 |
paste(binary, paste(c(namedUserArgs, unnamedUserArgs), collapse = " ")) |
93 | 98 |
} |
94 | 99 |
|
95 | 100 |
## at some point, mxbay want to customize this |
96 |
-.system <- function(...) system(...) |
|
101 |
+.system <- function(...) { |
|
102 |
+ |
|
103 |
+ sysopt <- getOption("gmapRSysCall") |
|
104 |
+ |
|
105 |
+ if (is.null(sysopt)) { |
|
106 |
+ res <- system(...) |
|
107 |
+ } else if (class(sysopt) == "function") { |
|
108 |
+ res <- sysopt(...) |
|
109 |
+ } else { |
|
110 |
+ stop("If the gmapRSysCall option is provided, it must be a function.") |
|
111 |
+ } |
|
112 |
+ |
|
113 |
+ return(res) |
|
114 |
+} |