|
19 | 19 | #' @param outfile Character of length 1, the name of the log file (optional) |
20 | 20 | #' @param runname Character of length 1, the name of the run to be used in the |
21 | 21 | #' outfile (optional) |
| 22 | +#' @param ready_only Boolean, whether to only process endpoints marked as |
| 23 | +#' export_ready = 1. |
22 | 24 | #' |
23 | 25 | #' @details |
24 | 26 | #' The \code{tcplRun} function is the core processing function within the |
|
44 | 46 | #' @importFrom parallel detectCores |
45 | 47 | #' @export |
46 | 48 |
|
47 | | -tcplRun <- function(asid = NULL, slvl, elvl, id = NULL, type = "mc", |
48 | | - mc.cores = NULL, outfile = NULL, runname = NULL) { |
| 49 | +tcplRun <- function(asid = NULL, slvl, elvl, id = NULL, type = "mc", mc.cores = NULL, |
| 50 | + outfile = NULL, runname = NULL, ready_only = FALSE) { |
49 | 51 |
|
50 | 52 | ## Variable-binding to pass R CMD Check |
51 | 53 | # acid <- aeid <- NULL |
@@ -75,8 +77,17 @@ tcplRun <- function(asid = NULL, slvl, elvl, id = NULL, type = "mc", |
75 | 77 | stop ("Invalid 'type' value.") |
76 | 78 | } |
77 | 79 |
|
78 | | - if (!is.null(asid)) id <- tcplLoadAcid("asid", asid)$acid |
79 | | - if (length(id) == 0) stop("No asid or id given.") |
| 80 | + if (!is.null(asid)) { |
| 81 | + acid_tbl <- tcplLoadAcid("asid", asid, add.fld = "export_ready") |
| 82 | + id <- if (ready_only) acid_tbl[export_ready == 1]$acid else acid_tbl$acid |
| 83 | + } else if (ready_only) { |
| 84 | + if (slvl < 4L) { |
| 85 | + id <- tcplLoadAcid("acid", id, add.fld = "export_ready")[export_ready == 1]$acid |
| 86 | + } else { |
| 87 | + id <- tcplLoadAeid("aeid", id, add.fld = "export_ready")[export_ready == 1]$aeid |
| 88 | + } |
| 89 | + } |
| 90 | + if (length(id) == 0) stop("No asid or id(s) given, or given id(s) do not exist. Check if 'ready_only = TRUE'.") |
80 | 91 | id <- unique(id) |
81 | 92 |
|
82 | 93 | if (!is.null(outfile)) { |
@@ -185,7 +196,10 @@ tcplRun <- function(asid = NULL, slvl, elvl, id = NULL, type = "mc", |
185 | 196 | } |
186 | 197 |
|
187 | 198 | ## Change ids from acid to aeid, if necessary |
188 | | - if (slvl < 4L | !is.null(asid)) id <- tcplLoadAeid("acid", id)$aeid |
| 199 | + if (slvl < 4L | !is.null(asid)) { |
| 200 | + aeid_tbl <- tcplLoadAeid("acid", id, add.fld = "export_ready") |
| 201 | + id <- if (ready_only) aeid_tbl[export_ready == 1]$aeid else aeid_tbl$aeid |
| 202 | + } |
189 | 203 | names(id) <- paste0("AEID", id) |
190 | 204 | if (is.null(mc.cores)) ncores <- min(length(id), detectCores() - 1) |
191 | 205 |
|
@@ -300,7 +314,10 @@ tcplRun <- function(asid = NULL, slvl, elvl, id = NULL, type = "mc", |
300 | 314 | } |
301 | 315 |
|
302 | 316 | ## Change ids from acid to aeid, if necessary |
303 | | - if (slvl < 2L | !is.null(asid)) id <- tcplLoadAeid("acid", id)$aeid |
| 317 | + if (slvl < 2L | !is.null(asid)) { |
| 318 | + aeid_tbl <- tcplLoadAeid("acid", id, add.fld = "export_ready") |
| 319 | + id <- if (ready_only) aeid_tbl[export_ready == 1]$aeid else aeid_tbl$aeid |
| 320 | + } |
304 | 321 | names(id) <- paste0("AEID", id) |
305 | 322 | if (is.null(mc.cores)) ncores <- min(length(id), detectCores() - 1) |
306 | 323 |
|
|
0 commit comments