├── .BBSoptions ├── .Rbuildignore ├── .github ├── .gitignore └── workflows │ └── check-standard.yaml ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── NEWS ├── R ├── AllClasses.R ├── Rcwl-package.R ├── basilisk.R ├── cwl-requirements.R ├── cwlProcess.R ├── cwlProcessWorkflow-methods.R ├── cwlShiny.R ├── cwlStep.R ├── cwlWorkflow.R ├── install_cwltool.R ├── install_udocker.R ├── meta.R ├── plotCWL.R ├── readCWL.R ├── runCWL.R └── writeCWL.R ├── README.md ├── _pkgdown.yml ├── configure ├── configure.win ├── docs ├── 404.html ├── LICENSE-text.html ├── articles │ ├── Rcwl.html │ ├── Rcwl_files │ │ ├── DiagrammeR-styles-0.2 │ │ │ └── styles.css │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ ├── grViz-binding-1.0.6.1 │ │ │ └── grViz.js │ │ ├── header-attrs-2.6 │ │ │ └── header-attrs.js │ │ ├── header-attrs-2.7 │ │ │ └── header-attrs.js │ │ ├── htmlwidgets-1.5.3 │ │ │ └── htmlwidgets.js │ │ └── viz-1.8.2 │ │ │ └── viz.js │ ├── cwlShiny.png │ └── index.html ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── docsearch.css ├── docsearch.js ├── index.html ├── link.svg ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── AllClasses.html │ ├── InputArrayParam.html │ ├── InputParam.html │ ├── InputParamList.html │ ├── OutputArrayParam.html │ ├── OutputParam.html │ ├── OutputParamList.html │ ├── Rcwl-package.html │ ├── Rcwl.html │ ├── Rplot001.png │ ├── Step.html │ ├── cwl-requirements.html │ ├── cwlProcess-methods.html │ ├── cwlProcess.html │ ├── cwlShiny.html │ ├── cwlStep.html │ ├── cwlWorkflow-methods.html │ ├── cwlWorkflow.html │ ├── index.html │ ├── install_udocker.html │ ├── plotCWL.html │ ├── plus-cwlWorkflow-stepParam-method.html │ ├── readCWL.html │ ├── requirements.html │ ├── runCWL.html │ ├── runCWLBatch.html │ ├── runs.html │ ├── short.html │ ├── stepInParam.html │ ├── stepInParamList.html │ ├── stepParam.html │ ├── stepParamList.html │ ├── steps.html │ └── writeCWL.html └── sitemap.xml ├── man ├── AllClasses.Rd ├── Rcwl-package.Rd ├── addMeta.Rd ├── cwl-requirements.Rd ├── cwlProcess-methods.Rd ├── cwlProcess.Rd ├── cwlShiny.Rd ├── cwlStep.Rd ├── cwlWorkflow-methods.Rd ├── cwlWorkflow.Rd ├── env_Rcwl.Rd ├── install_cwltool.Rd ├── install_udocker.Rd ├── plotCWL.Rd ├── readCWL.Rd ├── runCWL.Rd ├── runCWLBP.Rd ├── runCWLBatch.Rd ├── stepInputs.Rd ├── stepOutputs.Rd └── writeCWL.Rd ├── tests ├── testthat.R └── testthat │ └── test_all.R └── vignettes ├── Rcwl.Rmd └── cwlShiny.png /.BBSoptions: -------------------------------------------------------------------------------- 1 | UnsupportedPlatforms: win 2 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^\.git$ 2 | ^\.github$ 3 | ^_pkgdown\.yml$ 4 | ^docs$ 5 | ^doc$ 6 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/workflows/check-standard.yaml: -------------------------------------------------------------------------------- 1 | # For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. 2 | # https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions 3 | on: [push, pull_request] 4 | 5 | name: R-CMD-check 6 | 7 | jobs: 8 | R-CMD-check: 9 | runs-on: ubuntu-latest 10 | container: bioconductor/bioconductor_docker:devel 11 | 12 | steps: 13 | - uses: actions/checkout@v1 14 | - name: Install system dependencies 15 | run: | 16 | wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ 17 | /bin/bash ~/miniconda.sh -b -p /opt/conda && \ 18 | rm ~/miniconda.sh && \ 19 | ln -s /opt/conda/bin/conda /usr/local/bin/ 20 | - name: Install dependencies 21 | run: | 22 | BiocManager::install(c("remotes", "rcmdcheck", "utils", "stats", "BiocParallel", "batchtools", "DiagrammeR", "shiny", "R.utils", "codetools", "basilisk")) 23 | remotes::install_deps(dependencies = TRUE) 24 | shell: Rscript {0} 25 | - name: Check 26 | run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") 27 | shell: Rscript {0} 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | doc 2 | Meta 3 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: Rcwl 2 | Title: An R interface to the Common Workflow Language 3 | Version: 1.21.1 4 | Authors@R: c(person("Qiang", "Hu", email = "qiang.hu@roswellpark.org", role = c("aut", "cre")), 5 | person("Qian", "Liu", email = "qian.liu@roswellpark.org", role = c("aut"))) 6 | Description: The Common Workflow Language (CWL) is an open standard for development of data analysis workflows that is portable and scalable across different tools and working environments. Rcwl provides a simple way to wrap command line tools and build CWL data analysis pipelines programmatically within R. It increases the ease of usage, development, and maintenance of CWL pipelines. 7 | Depends: R (>= 3.6), yaml, methods, S4Vectors 8 | Imports: utils, stats, BiocParallel, batchtools, DiagrammeR, shiny, R.utils, codetools, basilisk 9 | License: GPL-2 | file LICENSE 10 | Encoding: UTF-8 11 | LazyData: true 12 | Suggests: testthat, 13 | knitr, 14 | rmarkdown, 15 | BiocStyle 16 | VignetteBuilder: knitr 17 | RoxygenNote: 7.3.1 18 | biocViews: Software, WorkflowStep, ImmunoOncology 19 | StagedInstall: no 20 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export("arguments<-") 4 | export("baseCommand<-") 5 | export("cwlClass<-") 6 | export("cwlVersion<-") 7 | export("extensions<-") 8 | export("hints<-") 9 | export("meta<-") 10 | export("requirements<-") 11 | export("stdOut<-") 12 | export("steps<-") 13 | export(CondaTool) 14 | export(Dirent) 15 | export(InputArrayParam) 16 | export(InputParam) 17 | export(InputParamList) 18 | export(OutputArrayParam) 19 | export(OutputParam) 20 | export(OutputParamList) 21 | export(ShellScript) 22 | export(addMeta) 23 | export(arguments) 24 | export(baseCommand) 25 | export(condaPackage) 26 | export(cwlClass) 27 | export(cwlProcess) 28 | export(cwlShiny) 29 | export(cwlStep) 30 | export(cwlStepList) 31 | export(cwlVersion) 32 | export(cwlWorkflow) 33 | export(env_Rcwl) 34 | export(extensions) 35 | export(hints) 36 | export(inputs) 37 | export(install_cwltool) 38 | export(install_udocker) 39 | export(meta) 40 | export(outputs) 41 | export(plotCWL) 42 | export(readCWL) 43 | export(requireDocker) 44 | export(requireEnvVar) 45 | export(requireInitialWorkDir) 46 | export(requireJS) 47 | export(requireManifest) 48 | export(requireMultipleInput) 49 | export(requireNetwork) 50 | export(requireResource) 51 | export(requireRscript) 52 | export(requireScatter) 53 | export(requireShellCommand) 54 | export(requireShellScript) 55 | export(requireSoftware) 56 | export(requireStepInputExpression) 57 | export(requireSubworkflow) 58 | export(requirements) 59 | export(runCWL) 60 | export(runCWLBP) 61 | export(runCWLBatch) 62 | export(runs) 63 | export(short) 64 | export(stdOut) 65 | export(stepInParam) 66 | export(stepInParamList) 67 | export(stepInputs) 68 | export(stepOutputs) 69 | export(steps) 70 | export(writeCWL) 71 | exportClasses(InputArrayParam) 72 | exportClasses(InputParam) 73 | exportClasses(InputParamList) 74 | exportClasses(OutputArrayParam) 75 | exportClasses(OutputParam) 76 | exportClasses(OutputParamList) 77 | exportClasses(cwlProcess) 78 | exportClasses(cwlStep) 79 | exportClasses(cwlStepList) 80 | exportClasses(cwlWorkflow) 81 | exportClasses(stepInParam) 82 | exportClasses(stepInParamList) 83 | exportMethods("$") 84 | exportMethods("$<-") 85 | exportMethods("+") 86 | import(BiocParallel) 87 | import(batchtools) 88 | import(methods) 89 | import(shiny) 90 | import(utils) 91 | import(yaml) 92 | importFrom(DiagrammeR,add_edges_from_table) 93 | importFrom(DiagrammeR,add_nodes_from_table) 94 | importFrom(DiagrammeR,create_graph) 95 | importFrom(DiagrammeR,mermaid) 96 | importFrom(DiagrammeR,render_graph) 97 | importFrom(R.utils,commandArgs) 98 | importFrom(R.utils,createLink) 99 | importFrom(S4Vectors,SimpleList) 100 | importFrom(S4Vectors,wmsg) 101 | importFrom(basilisk,BasiliskEnvironment) 102 | importFrom(basilisk,basiliskStart) 103 | importFrom(basilisk,basiliskStop) 104 | importFrom(codetools,findGlobals) 105 | importFrom(stats,na.omit) 106 | importFrom(utils,.DollarNames) 107 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | Changes in version 1.7.12 (2021-02-24) 2 | + Use Basilisk to manage python dependencies (cwltool). 3 | + Rename of 'cwlParam' into 'cwlProcess', 'cwlStepParam' into 'cwlWorkflow'. 4 | + Add the support of wrapping R functions into Rcwl tools. 5 | 6 | Changes in version 1.1.12 (2019-09-09) 7 | + Add ExpressionTool, Extensions and Metadata 8 | 9 | Changes in version 1.1.7 (2019-07-25) 10 | + New feature, baseCommand works with R function 11 | -------------------------------------------------------------------------------- /R/Rcwl-package.R: -------------------------------------------------------------------------------- 1 | #' Rcwl-package 2 | #' 3 | #' An R package to wrap command line tools and build pipelines with 4 | #' Common Workflow Language (CWL). 5 | #' _PACKAGE 6 | #' @name Rcwl-package 7 | #' @rdname Rcwl-package 8 | #' @aliases Rcwl Rcwl,Rcwl-package 9 | #' @seealso \code{\link{cwlProcess}} 10 | #' @seealso \code{\link{cwlWorkflow}} 11 | #' @seealso \code{\link{cwlStep}} 12 | #' @seealso \code{\link{runCWL}} 13 | NULL 14 | -------------------------------------------------------------------------------- /R/basilisk.R: -------------------------------------------------------------------------------- 1 | #' Rcwl conda environment 2 | #' 3 | #' Rcwl conda envrionment to install `cwltool` by basilisk. 4 | #' @importFrom basilisk BasiliskEnvironment 5 | #' @export 6 | env_Rcwl <- basilisk::BasiliskEnvironment("env_Rcwl", pkgname="Rcwl", 7 | packages = "python==3.11", 8 | pip = "cwltool==3.1.20230719185429") 9 | -------------------------------------------------------------------------------- /R/cwlProcess.R: -------------------------------------------------------------------------------- 1 | #' Parameters for CWL 2 | #' 3 | #' The main CWL parameter class and constructor for command 4 | #' tools. More details: 5 | #' https://www.commonwl.org/v1.0/CommandLineTool.html 6 | #' @rdname cwlProcess 7 | #' @importFrom S4Vectors SimpleList 8 | #' @import methods 9 | #' @import utils 10 | #' @param cwlVersion CWL version 11 | #' @param cwlClass "CommandLineTool" 12 | #' @param baseCommand Specifies the program or R function to execute 13 | #' @param requirements A list of requirements that apply to either the 14 | #' runtime environment or the workflow engine that must be met in 15 | #' order to execute this process. 16 | #' @param hints Any or a list for the workflow engine. 17 | #' @param arguments Command line bindings which are not directly 18 | #' associated with input parameters. 19 | #' @param id The unique identifier for this process object. 20 | #' @param label A short, human-readable label of this process object. 21 | #' @param doc A documentation string for this object, or an array of 22 | #' strings which should be concatenated. 23 | #' @param inputs A object of `InputParamList`. 24 | #' @param outputs A object of `OutputParamList`. 25 | #' @param stdout Capture the command's standard output stream to a 26 | #' file written to the designated output directory. 27 | #' @param stdin A path to a file whose contents must be piped into the 28 | #' command's standard input stream. 29 | #' @param expression Javascripts for ExpressionTool class. 30 | #' @param extensions A list of extensions and metadata 31 | #' @param intent An identifier for the type of computational 32 | #' operation, of this Process. 33 | #' @export 34 | #' @details https://www.commonwl.org/v1.0/CommandLineTool.html 35 | #' @return A `cwlProcess` class object. 36 | #' @examples 37 | #' input1 <- InputParam(id = "sth") 38 | #' echo <- cwlProcess(baseCommand = "echo", inputs = InputParamList(input1)) 39 | cwlProcess <- function(cwlVersion = "v1.0", 40 | cwlClass = "CommandLineTool", 41 | baseCommand = character(), 42 | requirements = list(), hints = list(), 43 | arguments = list(), id = character(), 44 | label = character(), doc = character(), 45 | inputs = InputParamList(), 46 | outputs = OutputParamList(), 47 | stdout = character(), stdin = character(), 48 | expression = character(), extensions = list(), 49 | intent = list()){ 50 | new("cwlProcess", cwlVersion = cwlVersion, cwlClass = cwlClass, 51 | id = id, label = label, baseCommand = baseCommand, 52 | requirements = requirements, hints = hints, doc = doc, 53 | arguments = arguments, inputs = inputs, outputs = outputs, 54 | stdout = stdout, stdin = stdin, expression = expression, 55 | extensions = extensions, intent = intent) 56 | } 57 | -------------------------------------------------------------------------------- /R/cwlShiny.R: -------------------------------------------------------------------------------- 1 | .inputUI <- function(cwl, inputList, upload){ 2 | ilist <- inputs(cwl) 3 | dList <- lapply(ilist, function(x){ 4 | if(x@inputBinding$prefix != ""){ 5 | label <- paste0(x@id, " (", x@inputBinding$prefix, " ", x@type, ")") 6 | }else{ 7 | label <- paste0(x@id, " (", x@type, ")") 8 | } 9 | if(x@id %in% names(inputList)){ 10 | d <- selectInput(inputId = x@id, 11 | label = label, 12 | choices = inputList[[x@id]]) 13 | }else{ 14 | if(is(x@type, "InputArrayParam")){ 15 | d <- textAreaInput(inputId = x@id, 16 | label = label, 17 | value = x@default) 18 | }else if(x@type == "boolean"){ 19 | d <- selectInput(inputId = x@id, 20 | label = label, 21 | choices = list("TRUE" = TRUE, "FALSE" = FALSE)) 22 | }else if(x@type == "int"){ 23 | v <- ifelse(length(x@default) == 0, NA, x@default) 24 | d <- numericInput(inputId = x@id, 25 | label = label, 26 | value = v) 27 | }else if(x@type %in% c("string", "File", "Directory")){ 28 | if(x@type == "File" & upload){ 29 | d <- fileInput(inputId = x@id, 30 | label = label) 31 | }else{ 32 | d <- textInput(inputId = x@id, 33 | label = label, 34 | value = x@default) 35 | } 36 | }else if(grepl("\\[", x@type)){ 37 | d <- textAreaInput(inputId = x@id, 38 | label = label, 39 | value = x@default) 40 | }else{ 41 | d <- textInput(inputId = x@id, 42 | label = label, 43 | value = x @default) 44 | } 45 | } 46 | 47 | if(length(x@doc) > 0){ 48 | list(d, helpText(x@doc)) 49 | }else{ 50 | d 51 | } 52 | }) 53 | dList 54 | } 55 | 56 | #' cwlShiny 57 | #' 58 | #' Function to generate shiny app automaticlly for a `cwlProcess` 59 | #' object. 60 | #' @param cwl A cwlProcess object. 61 | #' @param inputList a list of choices for the inputs of cwl 62 | #' object. The name of the list must match the inputs of the cwl 63 | #' object. 64 | #' @param upload Whether to upload file. If FALSE, the upload field 65 | #' will be text input (file path) instead of file input. 66 | #' @param ... More options for `runCWL`. 67 | #' @import shiny 68 | #' @export 69 | #' @return A shiny webapp. 70 | #' @examples 71 | #' input1 <- InputParam(id = "sth") 72 | #' echo <- cwlProcess(baseCommand = "echo", inputs = InputParamList(input1)) 73 | #' echoApp <- cwlShiny(echo) 74 | 75 | cwlShiny <- function(cwl, inputList = list(), upload = FALSE, ...){ 76 | stopifnot(is(cwl, "cwlProcess")) 77 | tList <- titlePanel(cwl@id) 78 | if(length(cwl@label) > 0) tList <- list(tList, h3(cwl@label)) 79 | divList <- .inputUI(cwl, inputList, upload) 80 | 81 | ui <- fluidPage( 82 | tList, 83 | sidebarLayout( 84 | sidebarPanel(divList), 85 | mainPanel( 86 | actionButton("run", "Run"), 87 | tabsetPanel( 88 | tabPanel("Output", verbatimTextOutput("outPath")), 89 | tabPanel("Command", verbatimTextOutput("command")), 90 | tabPanel("Log", verbatimTextOutput("log")) 91 | ) 92 | ) 93 | ) 94 | ) 95 | 96 | ilist <- inputs(cwl) 97 | server <- function(input, output){ 98 | res <- eventReactive(input$run, { 99 | for(x in names(ilist)){ 100 | if(is(ilist[[x]]@type, "InputArrayParam") || 101 | grepl("\\[", ilist[[x]]@type)){ 102 | v <- unlist(strsplit(input[[x]], split = ",")) 103 | eval(parse(text=paste0("cwl$",x," <- v"))) 104 | }else{ 105 | if(ilist[[x]]@type == "File" & upload){ 106 | eval(parse(text=paste0("cwl$",x," <- input$", x, 107 | "$datapath"))) 108 | }else{ 109 | eval(parse(text=paste0("cwl$",x," <- input$", x))) 110 | } 111 | } 112 | } 113 | print("Running...") 114 | runCWL(cwl, ...) 115 | }) 116 | output$outPath <- renderText({ 117 | paste(res()$output, collapse = "\n") 118 | }) 119 | output$command <- renderText({ 120 | paste(res()$command, collapse = "\n") 121 | }) 122 | output$log <- renderText({ 123 | paste(res()$log, collapse = "\n") 124 | })} 125 | 126 | shinyApp(ui, server) 127 | } 128 | -------------------------------------------------------------------------------- /R/cwlStep.R: -------------------------------------------------------------------------------- 1 | #' cwlStep function 2 | #' @description Constructor function for `cwlStep` object. 3 | #' @param id A user-defined unique identifier for this workflow step. 4 | #' @param run A `cwlProcess` object for command line tool, or path to 5 | #' a CWL file. 6 | #' @param In A list of input parameters which will be constructed into 7 | #' `stepInParamList`. 8 | #' @param Out A list of outputs. 9 | #' @param scatter character or a list. The inputs to be scattered. 10 | #' @param scatterMethod required if scatter is an array of more than 11 | #' one element. It can be one of "dotproduct", 12 | #' "nested_crossproduct" and "flat_crossproduct". 13 | #' @param label A short, human-readable label of this object. 14 | #' @param doc A documentation string for this object, or an array of 15 | #' strings which should be concatenated. 16 | #' @param requirements Requirements that apply to either the runtime 17 | #' environment or the workflow engine. 18 | #' @param hints Hints applying to either the runtime environment or 19 | #' the workflow engine. 20 | #' @param when If defined, only run the step when the expression 21 | #' evaluates to true. If false the step is skipped. 22 | #' @export 23 | #' @return An object of class `cwlStep`. 24 | #' @details For more details: 25 | #' https://www.commonwl.org/v1.0/Workflow.html#WorkflowStep 26 | #' @examples 27 | #' s1 <- cwlStep(id = "s1") 28 | #' @seealso \code{\link{cwlWorkflow}} 29 | cwlStep <- function(id, run = cwlProcess(), 30 | In = list(), Out = list(), 31 | scatter = character(), scatterMethod = character(), 32 | label = character(), 33 | doc = character(), 34 | requirements = list(), 35 | hints = list(), 36 | when = character()) { 37 | 38 | ## add defaults to In 39 | ins <- names(inputs(run)) 40 | inL <- paste0(id, "_", ins) 41 | names(inL) <- ins 42 | if(length(In)>0){ 43 | inL[match(names(In), ins)] <- In 44 | } 45 | ## remove optional/default 46 | df <- unlist(lapply(inputs(run),function(x){ 47 | f1 <- FALSE 48 | if(is(x@type, "character")){ 49 | f1 <- grepl("\\?", x@type) 50 | } 51 | f1 | length(x@default)!=0 52 | })) 53 | if(any(df)){ 54 | df <- setdiff(names(inL)[df], names(In)) 55 | if(length(df)>0){ 56 | inL <- inL[-match(df, names(inL))] 57 | } 58 | } 59 | In <- inL 60 | 61 | if(is(run, "cwlProcess")){ 62 | if(length(ins) > 0){ 63 | stopifnot(names(In) %in% names(inputs(run))) 64 | } 65 | sout <- as.list(names(outputs(run))) 66 | }else if(is(run, "character")){ 67 | stopifnot(file.exists(run)) 68 | clist <- read_yaml(run) 69 | stopifnot(names(In) %in% names(clist$inputs)) 70 | sout <- as.list(names(clist$outputs)) 71 | } 72 | slist <- list() 73 | for(i in seq(In)) { 74 | if(is.list(In[[i]])) { 75 | si <- stepInParam(id = names(In)[i]) 76 | for(j in seq(In[[i]])){ 77 | slot(si, names(In[[i]])[j]) <- In[[i]][[j]] 78 | } 79 | }else{ 80 | si <- stepInParam(id = names(In)[i], 81 | source = In[[i]]) 82 | } 83 | slist[[i]] <- si 84 | } 85 | names(slist) <- names(In) 86 | new("cwlStep", 87 | id = id, 88 | run = run, 89 | In = do.call(stepInParamList, slist), 90 | Out = sout, 91 | scatter = scatter, 92 | scatterMethod = scatterMethod, 93 | label = label, 94 | doc = doc, 95 | requirements = requirements, 96 | hints = hints, 97 | when = when) 98 | } 99 | 100 | 101 | #' stepInputs 102 | #' 103 | #' @description prepare inputs for workflow from `cwlStep` objects 104 | #' @param stepList a list of `cwlStep` objects. 105 | #' @return InputParamList. 106 | #' @export 107 | stepInputs <- function(stepList){ 108 | ## keep unchanged inputs 109 | ss <- lapply(stepList, function(s){ 110 | unlist(lapply(s@In, function(x)x@source)) 111 | }) 112 | ss <- unlist(ss) 113 | ## update ids 114 | ins <- do.call(c, lapply(stepList, function(x){ 115 | i1 <- inputs(x@run) 116 | for(i in seq(i1)){ 117 | i1[[i]]@id <- paste0(x@id, "_", i1[[i]]@id) 118 | } 119 | names(i1) <- paste0(x@id, "_", names(i1)) 120 | i1 121 | })) 122 | idx <- names(ins) %in% ss 123 | return(ins[idx]) 124 | } 125 | 126 | 127 | #' stepOutputs 128 | #' 129 | #' @description prepare outputs for workflow from `cwlStep` objects 130 | #' @param stepList a list of `cwlStep` objects. 131 | #' @return OutputParamList. 132 | #' @export 133 | stepOutputs <- function(stepList){ 134 | os <- lapply(stepList, function(s1){ 135 | lapply(outputs(s1@run), sid = s1@id, function(x, sid){ 136 | OutputParam(id = paste0(sid, "_", x@id), type = x@type, 137 | outputSource = paste0(sid, "/", x@id)) 138 | }) 139 | 140 | }) 141 | outs <- do.call(OutputParamList, unlist(os)) 142 | outs <- outs[-match("output", names(outs))] 143 | return(outs) 144 | } 145 | -------------------------------------------------------------------------------- /R/cwlWorkflow.R: -------------------------------------------------------------------------------- 1 | #' cwlWorkflow function 2 | #' 3 | #' @description The constructor function for `cwlWorkflow` object, 4 | #' which connects multiple command line steps into a workflow. 5 | #' @param cwlVersion CWL version 6 | #' @param cwlClass "Workflow". 7 | #' @param requirements Requirements that apply to either the runtime 8 | #' environment or the workflow engine. 9 | #' @param hints Any or a list for the workflow engine. 10 | #' @param extensions A list of extensions and metadata. 11 | #' @param arguments Command line bindings which are not directly 12 | #' associated with input parameters. 13 | #' @param id A user-defined unique identifier for this workflow. 14 | #' @param label A short, human-readable label of this object. 15 | #' @param doc A documentation string for this object. 16 | #' @param inputs An object of `InputParamList`. 17 | #' @param outputs An object of `OutputParamList`. 18 | #' @param steps A list of `cwlStepList`. 19 | #' @param intent An identifier for the type of computational 20 | #' operation, of this Process. 21 | #' @export 22 | #' @return cwlWorkflow: An object of class `cwlWorkflow`. 23 | #' @seealso \code{\link{stepInParamList}} 24 | #' @examples 25 | #' input1 <- InputParam(id = "sth") 26 | #' echo1 <- cwlProcess(baseCommand = "echo", 27 | #' inputs = InputParamList(input1)) 28 | #' input2 <- InputParam(id = "sthout", type = "File") 29 | #' echo2 <- cwlProcess(baseCommand = "echo", 30 | #' inputs = InputParamList(input2), 31 | #' stdout = "out.txt") 32 | #' i1 <- InputParam(id = "sth") 33 | #' o1 <- OutputParam(id = "out", type = "File", outputSource = "echo2/output") 34 | #' wf <- cwlWorkflow(inputs = InputParamList(i1), 35 | #' outputs = OutputParamList(o1)) 36 | #' s1 <- cwlStep(id = "echo1", run = echo1, In = list(sth = "sth")) 37 | #' s2 <- cwlStep(id = "echo2", run = echo2, In = list(sthout = "echo1/output")) 38 | #' wf <- wf + s1 + s2 39 | cwlWorkflow <- function(cwlVersion = "v1.0", cwlClass = "Workflow", 40 | requirements = list(), id = character(), 41 | label = character(), doc = character(), intent = list(), 42 | hints = list(), arguments = list(), extensions = list(), 43 | inputs = InputParamList(), outputs = OutputParamList(), 44 | steps = cwlStepList()){ 45 | new("cwlWorkflow", cwlVersion = cwlVersion, cwlClass = cwlClass, 46 | requirements = requirements, id = id, label = label, 47 | doc = doc, intent = intent, hints = hints, 48 | arguments = arguments, inputs = inputs, outputs = outputs, 49 | steps = steps, extensions = extensions) 50 | } 51 | 52 | #' @rdname cwlWorkflow 53 | #' @param e1 A `cwlWorkflow` object. 54 | #' @param e2 A `cwlStep` object. 55 | #' @export 56 | 57 | ## setMethod("+", c("cwlWorkflow", "cwlStep"), function(e1, e2) { 58 | ## ##if (length(e1@steps) == 0) { 59 | ## ## e1@steps <- cwlStepList(e2) 60 | ## ##} else { 61 | ## e1@steps <- do.call(cwlStepList, c(e1@steps@listData, e2)) 62 | ## ##} 63 | ## return(e1) 64 | ## }) 65 | 66 | setMethod("+", c("cwlWorkflow", "cwlStep"), function(e1, e2) { 67 | ## first empty one 68 | if(length(inputs(e1))==0){ 69 | e1@inputs <- stepInputs(list(e2)) 70 | e1@outputs <- stepOutputs(list(e2)) 71 | ## if inputs are not pre-defined 72 | }else if(!all(names(stepInputs(list(e2))) %in% names(inputs(e1)))){ 73 | e1@inputs <- stepInputs(c(e1@steps@listData, e2)) 74 | e1@outputs <- stepOutputs(c(e1@steps@listData, e2)) 75 | } 76 | e1@steps <- do.call(cwlStepList, c(e1@steps@listData, e2)) 77 | 78 | return(e1) 79 | }) 80 | 81 | setGeneric("+") 82 | 83 | #' @rdname cwlWorkflow 84 | #' @description steps: Function to extract and assign workflow step 85 | #' slots. 86 | #' @param cwl A `cwlWorkflow` object. 87 | #' @param value A list of `cwlSteps` to assign. 88 | #' @export 89 | #' @return steps: A list of `cwlStep` objects. 90 | steps <- function(cwl) cwl@steps 91 | 92 | #' @rdname cwlWorkflow 93 | #' @export 94 | "steps<-" <- function(cwl, value){ 95 | cwl@steps <- value 96 | cwl 97 | } 98 | -------------------------------------------------------------------------------- /R/install_cwltool.R: -------------------------------------------------------------------------------- 1 | #' install cwltool 2 | #' 3 | #' To download and install cwltool using basilisk 4 | #' @export 5 | install_cwltool <- function(){ 6 | cl <- basiliskStart(env_Rcwl) 7 | basiliskStop(cl) 8 | return(Sys.which("cwltool")) 9 | } 10 | -------------------------------------------------------------------------------- /R/install_udocker.R: -------------------------------------------------------------------------------- 1 | #' install udocker 2 | #' 3 | #' To download and install udocker for python3. 4 | #' 5 | #' @param version The version of udocker. 6 | #' @importFrom R.utils createLink 7 | #' @export 8 | install_udocker <- function(version = "1.3.4"){ 9 | stopifnot(.Platform$OS.type != "windows") 10 | 11 | if(!file.exists(Sys.which("cwltool"))){ 12 | cl <- basiliskStart(env_Rcwl) 13 | on.exit(basiliskStop(cl)) 14 | } 15 | binPath <- Sys.which("cwltool") 16 | 17 | download.file(paste0("https://github.com/indigo-dc/udocker/releases/download/", version, "/udocker-", version, ".tar.gz"), 18 | file.path(dirname(binPath), "udocker.tar.gz")) 19 | untar(file.path(dirname(binPath), "udocker.tar.gz"), exdir = dirname(dirname(binPath))) 20 | system(paste0(dirname(dirname(binPath)), "/udocker/udocker install")) 21 | createLink(file.path(dirname(binPath), "udocker"), 22 | file.path(dirname(dirname(binPath)), "udocker", "udocker"), overwrite = TRUE) 23 | udocker_path <- Sys.which("udocker") 24 | message("udocker installed:", "\n", udocker_path) 25 | } 26 | -------------------------------------------------------------------------------- /R/meta.R: -------------------------------------------------------------------------------- 1 | #' @rdname addMeta 2 | #' @return `meta()`: return a list of all available meta information 3 | #' for the `cwl` object. 4 | #' @export 5 | #' 6 | meta <- function(cwl){ 7 | idoc <- lapply(cwl@inputs, function(x)list(label = x@label, doc = x@doc)) 8 | odoc <- lapply(cwl@outputs, function(x)list(label = x@label, doc = x@doc)) 9 | if(is(cwl, "cwlWorkflow")){ 10 | sdoc <- lapply(cwl@steps, function(x)list(label = x@label, doc = x@doc)) 11 | metalist <- list(label = cwl@label, 12 | doc = cwl@doc, 13 | inputs = idoc, 14 | outputs = odoc, 15 | steps = sdoc, 16 | extensions = cwl@extensions) 17 | }else{ 18 | metalist <- list(label = cwl@label, 19 | doc = cwl@doc, 20 | inputs = idoc, 21 | outputs = odoc, 22 | extensions = cwl@extensions) 23 | } 24 | return(metalist) 25 | } 26 | 27 | #' @rdname addMeta 28 | #' @param value A list of meta information to add to `cwl`. 29 | #' @export 30 | "meta<-" <- function(cwl, value){ 31 | if(!is.null(value$label)) 32 | cwl@label <- value$label 33 | if(!is.null(value$doc)) 34 | cwl@doc <- value$doc 35 | if(!is.null(value$extensions)) 36 | cwl@extensions <- value$extensions 37 | 38 | if(length(value$inputs)>0){ 39 | idx <- match(names(value$inputs), names(inputs(cwl))) 40 | for(i in idx){ 41 | cwl@inputs[[i]]@doc <- value$inputs[[i]]$doc 42 | cwl@inputs[[i]]@label <- value$inputs[[i]]$label 43 | } 44 | } 45 | if(length(value$outputs) > 0){ 46 | idx <- match(names(value$outputs), names(outputs(cwl))) 47 | for(i in idx){ 48 | cwl@outputs[[i]]@doc <- value$outputs[[i]]$doc 49 | cwl@outputs[[i]]@label <- value$outputs[[i]]$label 50 | } 51 | } 52 | if(length(value$steps) > 0){ 53 | idx <- match(names(value$steps), names(steps(cwl))) 54 | for(i in idx){ 55 | cwl@steps[[i]]@doc <- value$steps[[i]]$doc 56 | cwl@steps[[i]]@label <- value$steps[[i]]$label 57 | } 58 | } 59 | return(cwl) 60 | } 61 | 62 | #' addMeta 63 | #' Add or change meta information for a cwl recipe. 64 | #' @rdname addMeta 65 | #' @aliases addMeta meta 66 | #' @param cwl `cwlProcess` object for data or tool 67 | #' recipe. `cwlWorkflow` object for a pipeline recipe. 68 | #' @param label Character string specifying a label for the 69 | #' recipe. E.g., "bwa align", "gencode annotation". 70 | #' @param doc Character string describing the recipe. E.g, 71 | #' "Align reads to reference genome". 72 | #' @param inputLabels Vector of character string, specifying labels 73 | #' for each input parameter. 74 | #' @param inputDocs Vector of character string as descriptions for 75 | #' each input parameter. 76 | #' @param outputLabels Vector of character string, specifying labels 77 | #' for each output parameter. 78 | #' @param outputDocs Vector of character string as descriptions for 79 | #' each output parameter. 80 | #' @param stepLabels Vector of character string, specifying labels for 81 | #' each step. Use only if `cwl` is a `cwlWorkflow` object. 82 | #' @param stepDocs Vector of character string as description for each 83 | #' step. Use only if `cwl` is a `cwlWorkflow` object. 84 | #' @param extensions A list of character strings. Can be used to add 85 | #' meta information about the recipe. Generally, add fields of 86 | #' information that does not require execution as part of the 87 | #' recipe evaluation. for information about "author", "url", 88 | #' "date", "example", use the exact names as list names as shown 89 | #' in examples, so that they can be correctly passed into 90 | #' corresponding fields in markdown file when using 91 | #' `meta2md`. Other information can be added as a list element 92 | #' with arbitrary names. 93 | #' @return `addMeta()`: `cwlProcess` or `cwlWorkflow` object, with added meta 94 | #' information, which can be returned using `meta(cwl)`. Meta 95 | #' information can be converted into markdown file with `meta2md` 96 | #' function. 97 | #' @examples 98 | #' \dontrun{ 99 | #' library(RcwlPipelines) 100 | #' cwlSearch(c("bwa", "align")) 101 | #' bwaAlign <- RcwlPipelines::cwlLoad("pl_bwaAlign") 102 | #' bwaAlign <- addMeta( 103 | #' cwl = bwaAlign, 104 | #' label = "align", 105 | #' doc = "align reads to reference genome", 106 | #' inputLabels = c("threads", "readgroup", "reference", "read1", "read2"), 107 | #' inputDocs = c("number of threads", "read groups", 108 | #' "reference genome", "read pair1", "read pair2"), 109 | #' outputLabels = c("Bam", "Idx"), 110 | #' outputDocs = c("outputbam file", "index file"), 111 | #' stepLabels = c(bwa = "bwa"), 112 | #' stepDocs = c(bwa = "bwa alignment")) 113 | #' cat(meta2md(bwaAlign)) 114 | #' } 115 | #' 116 | #' \dontrun{ 117 | #' rcp <- ReUseData::recipeLoad("gencode_annotation") 118 | #' meta(rcp) 119 | #' rcp1 <- addMeta( 120 | #' cwl = rcp, 121 | #' label = "", 122 | #' doc = "An empty description line", 123 | #' inputLabels = c("input label1", "input label2"), 124 | #' inputDocs = c("input description 1", "input description 2"), 125 | #' outputLabels = c("output label1"), 126 | #' outputDocs = c("output description 1"), 127 | #' extensions = list( 128 | #' author = "recipe author's name", 129 | #' url = "http://ftp.ebi.ac.uk/pub/databases/gencode/", 130 | #' date = as.character(Sys.Date()), 131 | #' example = "An example")) 132 | #' meta(rcp1) 133 | #' cat(meta2md(rcp1)) 134 | #' } 135 | #' @export 136 | 137 | addMeta <- function(cwl, label = character(), doc = character(), 138 | inputLabels = character(), 139 | inputDocs = character(), 140 | outputLabels = character(), 141 | outputDocs = character(), 142 | stepLabels = character(), 143 | stepDocs = character(), 144 | extensions = list()){ 145 | stopifnot(length(inputLabels) == length(inputDocs)) 146 | stopifnot(length(outputLabels) == length(outputDocs)) 147 | stopifnot(length(stepLabels) == length(stepDocs)) 148 | ## inputs 149 | ilist <- list() 150 | for(i in seq(inputLabels)){ 151 | ilist[[i]] <- list(label = inputLabels[i], doc = inputDocs[i]) 152 | } 153 | 154 | if(length(inputs(cwl)) > 0){ 155 | if (all(!is.null(names(inputLabels)))){ 156 | names(ilist) <- names(inputLabels) 157 | }else if (length(inputLabels) == length(inputs(cwl))){ 158 | names(ilist) <- names(inputs(cwl)) 159 | } 160 | } 161 | ## outputs 162 | olist <- list() 163 | for(i in seq(outputLabels)){ 164 | olist[[i]] <- list(label = outputLabels[i], doc = outputDocs[i]) 165 | } 166 | 167 | if (all(!is.null(names(outputLabels)))){ 168 | names(olist) <- names(outputLabels) 169 | }else if (length(outputLabels) == length(outputs(cwl))){ 170 | names(olist) <- names(outputs(cwl)) 171 | } 172 | ## steps 173 | slist <- list() 174 | if(is(cwl, "cwlWorkflow")){ 175 | for(i in seq(stepLabels)){ 176 | slist[[i]] <- list(label = stepLabels[i], doc = stepDocs[i]) 177 | } 178 | 179 | if (all(!is.null(names(stepLabels)))){ 180 | names(slist) <- names(stepLabels) 181 | }else if (length(stepLabels) == length(steps(cwl))){ 182 | names(slist) <- names(steps(cwl)) 183 | } 184 | } 185 | meta(cwl) <- list(label = label, 186 | doc = doc, 187 | inputs = ilist, 188 | outputs = olist, 189 | steps = slist, 190 | extensions = list(`$rud` = extensions)) 191 | return(cwl) 192 | } 193 | -------------------------------------------------------------------------------- /R/plotCWL.R: -------------------------------------------------------------------------------- 1 | #' plotCWL 2 | #' 3 | #' Function to plot cwlWorkflow object. 4 | #' @param cwl A cwlWorkflow object to plot 5 | #' @param output A string specifying the output type. An option 6 | #' inherits from `render_graph` and can also be "mermaid". 7 | #' @param layout Layout from `render_graph`. 8 | #' @param ... other parameters from `mermaid` or `render_graph` 9 | #' function 10 | #' @importFrom DiagrammeR mermaid 11 | #' @importFrom DiagrammeR create_graph 12 | #' @importFrom DiagrammeR add_nodes_from_table 13 | #' @importFrom DiagrammeR add_edges_from_table 14 | #' @importFrom DiagrammeR render_graph 15 | #' @importFrom stats na.omit 16 | #' @export 17 | #' @return A workflow plot. 18 | #' @examples 19 | #' input1 <- InputParam(id = "sth") 20 | #' echo1 <- cwlProcess(baseCommand = "echo", 21 | #' inputs = InputParamList(input1)) 22 | #' input2 <- InputParam(id = "sthout", type = "File") 23 | #' echo2 <- cwlProcess(baseCommand = "echo", 24 | #' inputs = InputParamList(input2), 25 | #' stdout = "out.txt") 26 | #' i1 <- InputParam(id = "sth") 27 | #' o1 <- OutputParam(id = "out", type = "File", outputSource = "echo2/output") 28 | #' wf <- cwlWorkflow(inputs = InputParamList(i1), 29 | #' outputs = OutputParamList(o1)) 30 | #' s1 <- cwlStep(id = "echo1", run = echo1, In = list(sth = "sth")) 31 | #' s2 <- cwlStep(id = "echo2", run = echo2, In = list(sthout = "echo1/output")) 32 | #' wf <- wf + s1 + s2 33 | #' plotCWL(wf) 34 | plotCWL <- function(cwl, output = "graph", layout = "tree", ...){ 35 | if(output == "mermaid"){ 36 | plotMermaid(cwl, ...) 37 | }else{ 38 | plotGraph(cwl, output = output, layout = layout, ...) 39 | } 40 | } 41 | 42 | plotMermaid <- function(cwl, ...){ 43 | Inputs <- names(inputs(cwl)) 44 | Outputs <- names(outputs(cwl)) 45 | OutSource <- unlist(lapply(outputs(cwl), function(x)x@outputSource)) 46 | 47 | Steps <- steps(cwl) 48 | Snames <- names(Steps) 49 | ## all nodes 50 | nodes <- c(Inputs, Outputs, Snames) 51 | if(length(nodes) > 26){ 52 | nn <- length(nodes) - 26 53 | NodeID <- c(LETTERS, paste0(LETTERS[seq(nn)], seq(nn))) 54 | }else{ 55 | NodeID <- LETTERS[seq(length(nodes))] 56 | } 57 | names(nodes) <- NodeID 58 | 59 | mm <- c("graph TB") 60 | for(i in seq_along(Steps)){ 61 | s1 <- Steps[[i]] 62 | sid1 <- names(nodes)[match(Snames[i], nodes)] 63 | 64 | ## inputs 65 | input1 <- unlist(lapply(s1@In, function(x)x@source)) 66 | mIn <- c() 67 | for(j in seq_along(input1)){ 68 | if(input1[j] %in% Inputs){ 69 | id1 <- names(nodes)[match(input1[j], nodes)] 70 | mIn[j] <- paste0(id1, "(", input1[j], ")-->", 71 | sid1, "{", Snames[i], "}") 72 | }else if(input1[j] %in% OutSource){ 73 | in2os <- names(OutSource)[match(input1[j], OutSource)] 74 | id1 <- names(nodes)[match(in2os, nodes)] 75 | mIn[j] <- paste0(id1, "((", in2os, "))-->", 76 | sid1, "{", Snames[i], "}") 77 | }else{ 78 | sIn <- unlist(strsplit(input1[j], split = "/")) 79 | id1 <- names(nodes)[match(sIn[1], nodes)] 80 | mIn[j] <- paste0(id1, "{", sIn[1], "}-->|", sIn[2], 81 | "|", sid1, "{", Snames[i], "}") 82 | } 83 | } 84 | 85 | ## outputs 86 | output1 <- unlist(s1@Out) 87 | sout1 <- paste(Snames[i], output1, sep = "/") 88 | mOut <- c() 89 | for(j in seq_along(output1)){ 90 | if(sout1[j] %in% OutSource){ 91 | o1 <- names(OutSource)[match(sout1[j], OutSource)] 92 | oid1 <- names(nodes)[match(o1, nodes)] 93 | mOut[j] <- paste0(sid1, "{", Snames[i], "}", "-->", 94 | oid1, "((", o1, "))") 95 | } 96 | } 97 | mm <- c(mm, mIn, mOut) 98 | } 99 | ## remove orphan output nodes 100 | mm <- na.omit(mm) 101 | mermaid(paste(mm, collapse = "\n"), ...) 102 | } 103 | 104 | plotGraph <- function(cwl, layout = "tree", ...){ 105 | Inputs <- names(inputs(cwl)) 106 | Outputs <- names(outputs(cwl)) 107 | OutSource <- unlist(lapply(outputs(cwl), function(x)x@outputSource)) 108 | 109 | Steps <- steps(cwl) 110 | Snames <- names(Steps) 111 | ## all nodes 112 | nodes <- c(Inputs, Outputs, Snames) 113 | if(length(nodes) > 26){ 114 | nn <- length(nodes) - 26 115 | NodeID <- c(LETTERS, paste0(LETTERS[seq(nn)], seq(nn))) 116 | }else{ 117 | NodeID <- LETTERS[seq(length(nodes))] 118 | } 119 | shape <- rep(c("rectangle", "circle", "diamond"), 120 | c(length(Inputs), length(Outputs), length(Snames))) 121 | ntable <- data.frame(id = NodeID, label = nodes, shape = shape) 122 | ntable <- data.frame(ntable, id_ext = ntable$id) 123 | names(nodes) <- NodeID 124 | 125 | etable <- c() 126 | for(i in seq_along(Steps)){ 127 | s1 <- Steps[[i]] 128 | sid1 <- names(nodes)[match(Snames[i], nodes)] 129 | input1 <- unlist(lapply(s1@In, function(x)x@source)) 130 | mIn <- c() 131 | for(j in seq_along(input1)){ 132 | if(input1[j] %in% Inputs){ 133 | iid1 <- names(nodes)[match(input1[j], nodes)] 134 | e1 <- data.frame(from = iid1, to = sid1) 135 | }else if(input1[j] %in% OutSource){ 136 | in2os <- names(OutSource)[match(input1[j], OutSource)] 137 | iid1 <- names(nodes)[match(in2os, nodes)] 138 | e1 <- data.frame(from = iid1, to = sid1) 139 | }else{ 140 | sIn <- unlist(strsplit(input1[j], split = "/"))[1] 141 | iid1 <- names(nodes)[match(sIn[1], nodes)] 142 | e1 <- data.frame(from = iid1, to = sid1) 143 | } 144 | mIn <- rbind(mIn, e1) 145 | } 146 | 147 | output1 <- unlist(s1@Out) 148 | sout1 <- paste(Snames[i], output1, sep = "/") 149 | mOut <- c() 150 | for(j in seq_along(output1)){ 151 | if(sout1[j] %in% OutSource){ 152 | o1 <- names(OutSource)[match(sout1[j], OutSource)] 153 | oid1 <- names(nodes)[match(o1, nodes)] 154 | mOut <- rbind(mOut, data.frame(from = sid1, to = oid1)) 155 | } 156 | } 157 | etable <- rbind(etable, rbind(mIn, mOut)) 158 | } 159 | 160 | graph <- create_graph() 161 | graph <- add_nodes_from_table(graph, ntable, label_col = "label") 162 | graph <- add_edges_from_table(graph, etable, 163 | from_col = "from", to_col = "to", 164 | from_to_map = "id_ext") 165 | render_graph(graph, layout = layout, ...) 166 | } 167 | -------------------------------------------------------------------------------- /R/readCWL.R: -------------------------------------------------------------------------------- 1 | 2 | .readInputs <- function(cwl.origin, cwl){ 3 | inputList <- cwl.origin$inputs 4 | iList <- list() 5 | for(i in seq_along(inputList)){ 6 | if(cwlClass(cwl) == "Workflow"){ 7 | if(is.character(inputList[[i]])){ 8 | ilist <- list(id = names(inputList)[i], type = inputList[[i]]) 9 | }else{ 10 | ilist <- c(id = names(inputList)[i], inputList[[i]]) 11 | } 12 | }else{ 13 | ilist <- inputList[[i]] 14 | } 15 | if("inputBinding" %in% names(ilist)){ 16 | idx <- match("inputBinding", names(ilist)) 17 | ilist <- c(ilist[-idx], ilist[[idx]]) 18 | }else{ 19 | if(!is(ilist, "list") & is.null(names(ilist))){ 20 | ilist <- list(type = ilist) 21 | } 22 | ilist$position = -1 23 | } 24 | if(is(ilist$type, "list") && 25 | unlist(ilist$type)[["type"]] == "array"){ 26 | 27 | if(any(!names(ilist) %in% formalArgs(InputParam))){ 28 | idx <- names(ilist) %in% formalArgs(InputParam) 29 | warning(names(ilist)[!idx], " not imported") 30 | ilist <- ilist[idx] 31 | } 32 | idx <- names(ilist$type) %in% formalArgs(InputArrayParam) 33 | ilist$type <- do.call(InputArrayParam, ilist$type[idx]) 34 | } 35 | if(is.null(ilist$id)){ 36 | ilist$id <- names(inputList)[i] 37 | } 38 | iList[[i]] <- do.call(InputParam, ilist) 39 | } 40 | names(iList) <- names(inputList) 41 | return(iList) 42 | } 43 | 44 | 45 | .readOutputs <- function(cwl.origin, cwl){ 46 | outputList <- cwl.origin$outputs 47 | oList <- list() 48 | if(length(outputList) == 0){ 49 | return(oList) 50 | } 51 | for(i in seq_along(outputList)){ 52 | if(cwlClass(cwl) == "Workflow"){ 53 | olist <- c(id = names(outputList)[i], outputList[[i]]) 54 | }else if(is(outputList[[i]], "list")){ 55 | olist <- outputList[[i]] 56 | }else{ 57 | olist <- list(type = outputList[[i]]) 58 | } 59 | if("outputBinding" %in% names(olist)){ 60 | idx <- match("outputBinding", names(olist)) 61 | olist <- c(olist[-idx], olist[[idx]]) 62 | } 63 | if(any(!names(olist) %in% formalArgs(OutputParam))){ 64 | idx <- names(olist) %in% formalArgs(OutputParam) 65 | warning(names(olist)[!idx], " not imported") 66 | olist <- olist[idx] 67 | } 68 | if(is.null(olist$id)){ 69 | olist$id <- names(outputList)[i] 70 | } 71 | oList[[i]] <- do.call(OutputParam, olist) 72 | } 73 | names(oList) <- names(outputList) 74 | return(oList) 75 | } 76 | 77 | .readSteps <- function(cwl.origin, cwl){ 78 | Steps <- cwl.origin$steps 79 | for(s in seq_along(Steps)){ 80 | if(is.null(Steps[[s]]$id)){ 81 | id <- names(Steps)[s] 82 | sList <- c(id = id, Steps[[s]]) 83 | }else{ 84 | sList <- Steps[[s]] 85 | } 86 | run <- Steps[[s]]$run 87 | if(!grepl("^/", run)){ 88 | sList$run <- run #file.path(pwd, run) 89 | } 90 | 91 | In <- sList$"in" 92 | slist <- list() 93 | for(i in seq(In)) { 94 | if(is.null(names(In)[i])){ 95 | id <- In[[i]]$id 96 | }else{ 97 | id <- names(In)[i] 98 | } 99 | ## if(is.list(In[[i]])) { 100 | ## si <- stepInParam(id = id) 101 | ## for(j in seq(In[[i]])){ 102 | ## slot(si, names(In[[i]])[j]) <- In[[i]][[j]] 103 | ## } 104 | ## }else{ 105 | ## si <- stepInParam(id = id, 106 | ## source = In[[i]]) 107 | ## } 108 | slist[[i]] <- list(id = id, source = In[[i]]) 109 | } 110 | names(slist) <- names(In) 111 | sList$In <- slist # do.call(stepInParamList, slist) 112 | sList$Out <- as.list(sList$out) 113 | sList$"in" <- NULL 114 | sList$"out" <- NULL 115 | cwl <- cwl + do.call(cwlStep, sList) 116 | } 117 | return(cwl) 118 | } 119 | 120 | #' Read CWL 121 | #' Function to read CWL command or workflow files. 122 | #' @param cwlfile The cwl file to read. 123 | #' @export 124 | #' @return A object of class `cwlProcess` or `cwlWorkflow`. 125 | #' @examples 126 | #' input1 <- InputParam(id = "sth") 127 | #' echo <- cwlProcess(baseCommand = "echo", 128 | #' inputs = InputParamList(input1)) 129 | #' tf <- writeCWL(echo) 130 | #' readCWL(tf[1]) 131 | readCWL <- function(cwlfile){ 132 | float.handler <- function(x){ 133 | if(x == "."){ 134 | return(".") 135 | }else{ 136 | return(as.numeric(x)) 137 | } 138 | } 139 | handlers <- list("float#fix" = float.handler) 140 | cwl.origin <- read_yaml(cwlfile, handlers = handlers) 141 | ## fix listing 142 | if(("InitialWorkDirRequirement" %in% names(cwl.origin$requirements)) && 143 | is(cwl.origin$requirements$InitialWorkDirRequirement$listing, "character")){ 144 | cwl.origin$requirements$InitialWorkDirRequirement$listing <- 145 | list(cwl.origin$requirements$InitialWorkDirRequirement$listing) 146 | } 147 | 148 | names(cwl.origin)[names(cwl.origin)=="class"] <- "cwlClass" 149 | cwl.list1 <- cwl.origin[setdiff(names(cwl.origin), 150 | c("inputs", "outputs", "steps"))] 151 | idx <- names(cwl.list1) %in% formalArgs(cwlProcess) 152 | if(cwl.origin$cwlClass %in% c("CommandLineTool", "ExpressionTool")){ 153 | if(!is.null(cwl.list1$arguments)){ 154 | cwl.list1$arguments <- as.list(cwl.list1$arguments) 155 | } 156 | cwl <- do.call(cwlProcess, cwl.list1[idx]) 157 | }else if(cwl.origin$cwlClass == "Workflow"){ 158 | cwl <- do.call(cwlWorkflow, cwl.list1[idx]) 159 | }else { 160 | stop(cwl.origin$cwlClass, "is not supported!") 161 | } 162 | cwl@inputs@listData <- .readInputs(cwl.origin, cwl) 163 | cwl@outputs@listData <- .readOutputs(cwl.origin, cwl) 164 | 165 | if(cwl.origin$cwlClass == "Workflow"){ 166 | ## pwd <- dirname(normalizePath(cwlfile)) 167 | cwl <- .readSteps(cwl.origin, cwl) 168 | } 169 | 170 | if(any(!idx)){ 171 | cwl@extensions <- cwl.list1[!idx] 172 | } 173 | return(cwl) 174 | } 175 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rcwl 2 | 3 | The Rcwl package can be a simple and user-friendly way to manage command line tools and build data analysis pipelines in R using Common Workflow Language (CWL). 4 | 5 | ## Installation 6 | 7 | The package can be installed from Bioconductor (>= 3.9): 8 | 9 | ``` r 10 | if (!requireNamespace("BiocManager", quietly = TRUE)) 11 | install.packages("BiocManager") 12 | BiocManager::install("Rcwl") 13 | 14 | # Or from github 15 | BiocManager::install("rworkflow/Rcwl") 16 | ``` 17 | 18 | ## Hello world! 19 | ``` r 20 | library(Rcwl) 21 | inputs <- InputParamList( 22 | InputParam(id = "sth") 23 | ) 24 | echo <- cwlProcess(baseCommand = "echo", inputs) 25 | echo$sth <- "Hello World!" 26 | res <- runCWL(echo) 27 | ``` 28 | 29 | ## User Guide 30 | 31 | ``` r 32 | vignette(package = "Rcwl") 33 | ``` 34 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://rworkflow.github.io/Rcwl 2 | 3 | template: 4 | params: 5 | bootswatch: flatly 6 | ganalytics: UA-93043521-1 7 | 8 | home: 9 | title: "Rcwl" 10 | type: inverse 11 | 12 | 13 | navbar: 14 | right: 15 | - icon: fa-github 16 | href: https://github.com/rworkflow/Rcwl 17 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${R_HOME}/bin/Rscript -e "basilisk::configureBasiliskEnv()" 4 | -------------------------------------------------------------------------------- /configure.win: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe -e "basilisk::configureBasiliskEnv()" 4 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Page not found (404) • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 66 | 67 | 68 | 69 | 70 | 71 |
72 |
73 | 115 | 116 | 117 | 118 |
119 | 120 |
121 |
122 | 125 | 126 | Content not found. Please use links in the navbar. 127 | 128 |
129 | 130 | 135 | 136 |
137 | 138 | 139 | 140 | 150 |
151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /docs/articles/Rcwl_files/DiagrammeR-styles-0.2/styles.css: -------------------------------------------------------------------------------- 1 | .DiagrammeR,.grViz pre { 2 | white-space: pre-wrap; /* CSS 3 */ 3 | white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ 4 | white-space: -pre-wrap; /* Opera 4-6 */ 5 | white-space: -o-pre-wrap; /* Opera 7 */ 6 | word-wrap: break-word; /* Internet Explorer 5.5+ */ 7 | } 8 | 9 | .DiagrammeR g .label { 10 | font-family: Helvetica; 11 | font-size: 14px; 12 | color: #333333; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /docs/articles/Rcwl_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/Rcwl_files/grViz-binding-1.0.6.1/grViz.js: -------------------------------------------------------------------------------- 1 | HTMLWidgets.widget({ 2 | 3 | name: 'grViz', 4 | 5 | type: 'output', 6 | 7 | initialize: function(el, width, height) { 8 | 9 | return { 10 | // TODO: add instance fields as required 11 | }; 12 | }, 13 | 14 | renderValue: function(el, x, instance) { 15 | // Use this to sort of make our diagram responsive 16 | // or at a minimum fit within the bounds set by htmlwidgets 17 | // for the parent container 18 | function makeResponsive(el){ 19 | var svg = el.getElementsByTagName("svg")[0]; 20 | if (svg) { 21 | if (svg.width) {svg.removeAttribute("width")} 22 | if (svg.height) {svg.removeAttribute("height")} 23 | svg.style.width = "100%"; 24 | svg.style.height = "100%"; 25 | } 26 | } 27 | 28 | if (x.diagram !== "") { 29 | 30 | if (typeof x.config === "undefined"){ 31 | x.config = {}; 32 | x.config.engine = "dot"; 33 | x.config.options = {}; 34 | } 35 | 36 | try { 37 | 38 | el.innerHTML = Viz(x.diagram, format="svg", engine=x.config.engine, options=x.config.options); 39 | 40 | makeResponsive(el); 41 | 42 | if (HTMLWidgets.shinyMode) { 43 | // Get widget id 44 | var id = el.id; 45 | 46 | $("#" + id + " .node").click(function(e) { 47 | // Get node id 48 | var nodeid = e.currentTarget.id; 49 | // Get node text object and make an array 50 | var node_texts = $("#" + nodeid + " text"); 51 | //var node_path = $("#" + nodeid + " path")[0]; 52 | var text_array = node_texts.map(function() {return $(this).text(); }).toArray(); 53 | // Build return object *obj* with node-id, node text values and node fill 54 | var obj = { 55 | id: nodeid, 56 | //fill: node_path.attributes.fill.nodeValue, 57 | //outerHMTL: node_path.outerHTML, 58 | nodeValues: text_array 59 | }; 60 | // Send *obj* to Shiny's inputs (input$[id]+_click e.g.: input$vtree_click)) 61 | Shiny.setInputValue(id + "_click", obj, {priority: "event"}); 62 | }); 63 | } 64 | 65 | // set up a container for tasks to perform after completion 66 | // one example would be add callbacks for event handling 67 | // styling 68 | if (typeof x.tasks !== "undefined") { 69 | if ((typeof x.tasks.length === "undefined") || 70 | (typeof x.tasks === "function")) { 71 | // handle a function not enclosed in array 72 | // should be able to remove once using jsonlite 73 | x.tasks = [x.tasks]; 74 | } 75 | x.tasks.map(function(t){ 76 | // for each tasks add it to the mermaid.tasks with el 77 | t.call(el); 78 | }); 79 | } 80 | } catch(e){ 81 | var p = document.createElement("pre"); 82 | p.innerText = e; 83 | el.appendChild(p); 84 | } 85 | } 86 | 87 | }, 88 | 89 | resize: function(el, width, height, instance) { 90 | } 91 | }); 92 | -------------------------------------------------------------------------------- /docs/articles/Rcwl_files/header-attrs-2.6/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/Rcwl_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/cwlShiny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rworkflow/Rcwl/66ed8fb30bf0af6162ddc294a9234ddd6181d925/docs/articles/cwlShiny.png -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Articles • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 66 | 67 | 68 | 69 | 70 | 71 |
72 |
73 | 115 | 116 | 117 | 118 |
119 | 120 |
121 |
122 | 125 | 126 |
127 |

All vignettes

128 |

129 | 130 |
131 |
Rcwl: An R interface to the Common Workflow Language (CWL)
132 |
133 |
134 |
135 |
136 |
137 | 138 | 139 | 149 |
150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Authors • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 66 | 67 | 68 | 69 | 70 | 71 |
72 |
73 | 115 | 116 | 117 | 118 |
119 | 120 |
121 |
122 | 125 | 126 |
    127 |
  • 128 |

    Qiang Hu. Author, maintainer. 129 |

    130 |
  • 131 |
  • 132 |

    Qian Liu. Author. 133 |

    134 |
  • 135 |
136 | 137 |
138 | 139 |
140 | 141 | 142 | 143 | 153 |
154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | (function() { 6 | 'use strict'; 7 | 8 | window.Toc = { 9 | helpers: { 10 | // return all matching elements in the set, or their descendants 11 | findOrFilter: function($el, selector) { 12 | // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ 13 | // http://stackoverflow.com/a/12731439/358804 14 | var $descendants = $el.find(selector); 15 | return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); 16 | }, 17 | 18 | generateUniqueIdBase: function(el) { 19 | var text = $(el).text(); 20 | var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); 21 | return anchor || el.tagName.toLowerCase(); 22 | }, 23 | 24 | generateUniqueId: function(el) { 25 | var anchorBase = this.generateUniqueIdBase(el); 26 | for (var i = 0; ; i++) { 27 | var anchor = anchorBase; 28 | if (i > 0) { 29 | // add suffix 30 | anchor += '-' + i; 31 | } 32 | // check if ID already exists 33 | if (!document.getElementById(anchor)) { 34 | return anchor; 35 | } 36 | } 37 | }, 38 | 39 | generateAnchor: function(el) { 40 | if (el.id) { 41 | return el.id; 42 | } else { 43 | var anchor = this.generateUniqueId(el); 44 | el.id = anchor; 45 | return anchor; 46 | } 47 | }, 48 | 49 | createNavList: function() { 50 | return $(''); 51 | }, 52 | 53 | createChildNavList: function($parent) { 54 | var $childList = this.createNavList(); 55 | $parent.append($childList); 56 | return $childList; 57 | }, 58 | 59 | generateNavEl: function(anchor, text) { 60 | var $a = $(''); 61 | $a.attr('href', '#' + anchor); 62 | $a.text(text); 63 | var $li = $('
  • '); 64 | $li.append($a); 65 | return $li; 66 | }, 67 | 68 | generateNavItem: function(headingEl) { 69 | var anchor = this.generateAnchor(headingEl); 70 | var $heading = $(headingEl); 71 | var text = $heading.data('toc-text') || $heading.text(); 72 | return this.generateNavEl(anchor, text); 73 | }, 74 | 75 | // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). 76 | getTopLevel: function($scope) { 77 | for (var i = 1; i <= 6; i++) { 78 | var $headings = this.findOrFilter($scope, 'h' + i); 79 | if ($headings.length > 1) { 80 | return i; 81 | } 82 | } 83 | 84 | return 1; 85 | }, 86 | 87 | // returns the elements for the top level, and the next below it 88 | getHeadings: function($scope, topLevel) { 89 | var topSelector = 'h' + topLevel; 90 | 91 | var secondaryLevel = topLevel + 1; 92 | var secondarySelector = 'h' + secondaryLevel; 93 | 94 | return this.findOrFilter($scope, topSelector + ',' + secondarySelector); 95 | }, 96 | 97 | getNavLevel: function(el) { 98 | return parseInt(el.tagName.charAt(1), 10); 99 | }, 100 | 101 | populateNav: function($topContext, topLevel, $headings) { 102 | var $context = $topContext; 103 | var $prevNav; 104 | 105 | var helpers = this; 106 | $headings.each(function(i, el) { 107 | var $newNav = helpers.generateNavItem(el); 108 | var navLevel = helpers.getNavLevel(el); 109 | 110 | // determine the proper $context 111 | if (navLevel === topLevel) { 112 | // use top level 113 | $context = $topContext; 114 | } else if ($prevNav && $context === $topContext) { 115 | // create a new level of the tree and switch to it 116 | $context = helpers.createChildNavList($prevNav); 117 | } // else use the current $context 118 | 119 | $context.append($newNav); 120 | 121 | $prevNav = $newNav; 122 | }); 123 | }, 124 | 125 | parseOps: function(arg) { 126 | var opts; 127 | if (arg.jquery) { 128 | opts = { 129 | $nav: arg 130 | }; 131 | } else { 132 | opts = arg; 133 | } 134 | opts.$scope = opts.$scope || $(document.body); 135 | return opts; 136 | } 137 | }, 138 | 139 | // accepts a jQuery object, or an options object 140 | init: function(opts) { 141 | opts = this.helpers.parseOps(opts); 142 | 143 | // ensure that the data attribute is in place for styling 144 | opts.$nav.attr('data-toggle', 'toc'); 145 | 146 | var $topContext = this.helpers.createChildNavList(opts.$nav); 147 | var topLevel = this.helpers.getTopLevel(opts.$scope); 148 | var $headings = this.helpers.getHeadings(opts.$scope, topLevel); 149 | this.helpers.populateNav($topContext, topLevel, $headings); 150 | } 151 | }; 152 | 153 | $(function() { 154 | $('nav[data-toggle="toc"]').each(function(i, el) { 155 | var $nav = $(el); 156 | Toc.init($nav); 157 | }); 158 | }); 159 | })(); 160 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('[data-toggle="tooltip"]').tooltip(); 13 | 14 | var cur_path = paths(location.pathname); 15 | var links = $("#navbar ul li a"); 16 | var max_length = -1; 17 | var pos = -1; 18 | for (var i = 0; i < links.length; i++) { 19 | if (links[i].getAttribute("href") === "#") 20 | continue; 21 | // Ignore external links 22 | if (links[i].host !== location.host) 23 | continue; 24 | 25 | var nav_path = paths(links[i].pathname); 26 | 27 | var length = prefix_length(nav_path, cur_path); 28 | if (length > max_length) { 29 | max_length = length; 30 | pos = i; 31 | } 32 | } 33 | 34 | // Add class to parent
  • , and enclosing
  • if in dropdown 35 | if (pos >= 0) { 36 | var menu_anchor = $(links[pos]); 37 | menu_anchor.parent().addClass("active"); 38 | menu_anchor.closest("li.dropdown").addClass("active"); 39 | } 40 | }); 41 | 42 | function paths(pathname) { 43 | var pieces = pathname.split("/"); 44 | pieces.shift(); // always starts with / 45 | 46 | var end = pieces[pieces.length - 1]; 47 | if (end === "index.html" || end === "") 48 | pieces.pop(); 49 | return(pieces); 50 | } 51 | 52 | // Returns -1 if not found 53 | function prefix_length(needle, haystack) { 54 | if (needle.length > haystack.length) 55 | return(-1); 56 | 57 | // Special case for length-0 haystack, since for loop won't run 58 | if (haystack.length === 0) { 59 | return(needle.length === 0 ? 0 : -1); 60 | } 61 | 62 | for (var i = 0; i < haystack.length; i++) { 63 | if (needle[i] != haystack[i]) 64 | return(i); 65 | } 66 | 67 | return(haystack.length); 68 | } 69 | 70 | /* Clipboard --------------------------*/ 71 | 72 | function changeTooltipMessage(element, msg) { 73 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 74 | element.setAttribute('data-original-title', msg); 75 | $(element).tooltip('show'); 76 | element.setAttribute('data-original-title', tooltipOriginalTitle); 77 | } 78 | 79 | if(ClipboardJS.isSupported()) { 80 | $(document).ready(function() { 81 | var copyButton = ""; 82 | 83 | $(".examples, div.sourceCode").addClass("hasCopyButton"); 84 | 85 | // Insert copy buttons: 86 | $(copyButton).prependTo(".hasCopyButton"); 87 | 88 | // Initialize tooltips: 89 | $('.btn-copy-ex').tooltip({container: 'body'}); 90 | 91 | // Initialize clipboard: 92 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 93 | text: function(trigger) { 94 | return trigger.parentNode.textContent; 95 | } 96 | }); 97 | 98 | clipboardBtnCopies.on('success', function(e) { 99 | changeTooltipMessage(e.trigger, 'Copied!'); 100 | e.clearSelection(); 101 | }); 102 | 103 | clipboardBtnCopies.on('error', function() { 104 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 105 | }); 106 | }); 107 | } 108 | })(window.jQuery || window.$) 109 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.9.2.1 2 | pkgdown: 1.6.1 3 | pkgdown_sha: ~ 4 | articles: 5 | Rcwl: Rcwl.html 6 | last_built: 2021-02-25T03:43Z 7 | urls: 8 | reference: https://rworkflow.github.io/Rcwl/reference 9 | article: https://rworkflow.github.io/Rcwl/articles 10 | 11 | -------------------------------------------------------------------------------- /docs/reference/InputParamList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | InputParamList — InputParamList-class • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
    66 |
    67 | 104 | 105 | 106 | 107 |
    108 | 109 |
    110 |
    111 | 116 | 117 |
    118 |

    InputParamList

    119 |

    InputParamList 120 | A list of InputParam

    121 |

    inputs

    122 |
    123 | 124 |
    InputParamList(...)
    125 | 
    126 | inputs(cwl)
    127 | 128 |

    Arguments

    129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 |
    ...

    The InputParam objects.

    cwl

    A cwlProcess object

    140 | 141 |

    Value

    142 | 143 |

    An object of class `InputParamList`.

    144 |

    inputs: A list of `InputParam`.

    145 | 146 |

    Examples

    147 |
    input1 <- InputParam(id = "sth") 148 | InputParamList(input1) 149 |
    #> inputs: 150 | #> sth (string):
    ## Inputs 151 | input1 <- InputParam(id = "sth") 152 | echo <- cwlProcess(baseCommand = "echo", inputs = InputParamList(input1)) 153 | inputs(echo) 154 |
    #> inputs: 155 | #> sth (string):
    156 |
    157 | 162 |
    163 | 164 | 165 |
    166 | 169 | 170 |
    171 |

    Site built with pkgdown 1.6.1.

    172 |
    173 | 174 |
    175 |
    176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /docs/reference/Rcwl-package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Rcwl-package — Rcwl-package • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | 60 | 61 | 68 | 69 | 70 | 71 | 72 | 73 |
    74 |
    75 | 117 | 118 | 119 | 120 |
    121 | 122 |
    123 |
    124 | 129 | 130 |
    131 |

    An R package to wrap command line tools and build pipelines with 132 | Common Workflow Language (CWL).

    133 |
    134 | 135 | 136 | 137 |

    See also

    138 | 139 | 143 | 144 |
    145 | 150 |
    151 | 152 | 153 |
    154 | 157 | 158 |
    159 |

    Site built with pkgdown 1.6.1.

    160 |
    161 | 162 |
    163 |
    164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /docs/reference/Rcwl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Rcwl — Rcwl • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
    64 |
    65 | 102 | 103 | 104 | 105 |
    106 | 107 |
    108 |
    109 | 114 | 115 |
    116 |

    An R package to wrap command line tools and build pipelines with 117 | Common Workflow Language.

    118 |
    119 | 120 | 121 | 122 |

    See also

    123 | 124 | 126 | 127 |
    128 | 133 |
    134 | 135 | 136 |
    137 | 140 | 141 |
    142 |

    Site built with pkgdown 1.6.1.

    143 |
    144 | 145 |
    146 |
    147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rworkflow/Rcwl/66ed8fb30bf0af6162ddc294a9234ddd6181d925/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/Step.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Step function — Step • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 101 | 102 | 103 | 104 |
    105 | 106 |
    107 |
    108 | 113 | 114 |
    115 |

    Function to assign value to `stepParam` object.

    116 |
    117 | 118 |
    Step(
    119 |   id,
    120 |   run = cwlProcess(),
    121 |   In = list(),
    122 |   scatter = character(),
    123 |   scatterMethod = character()
    124 | )
    125 | 126 |

    Arguments

    127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 152 | 153 |
    id

    The id of `stepParam` object.

    run

    A `cwlProcess` object for command tool, or path to a CWL 136 | file.

    In

    one or two layes of list.

    scatter

    character or a list. The inputs to be scattered.

    scatterMethod

    required if scatter is an array of more than 149 | one element. It can be one of "dotproduct", 150 | "nested_crossproduct" and "flat_crossproduct". Details: 151 | https://www.commonwl.org/v1.0/Workflow.html#WorkflowStep

    154 | 155 |

    Value

    156 | 157 |

    An object of `stepParam`.

    158 |

    See also

    159 | 160 | 161 | 162 |
    163 | 168 |
    169 | 170 | 171 |
    172 | 175 | 176 |
    177 |

    Site built with pkgdown 1.6.1.

    178 |
    179 | 180 |
    181 |
    182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | -------------------------------------------------------------------------------- /docs/reference/cwlWorkflow-methods.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | cwlWorkflow methods — cwlWorkflow-methods • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 67 | 68 | 69 | 70 | 71 | 72 |
    73 |
    74 | 116 | 117 | 118 | 119 |
    120 | 121 |
    122 |
    123 | 128 | 129 |
    130 |

    runs: The function to access all runs of a `cwlWorkflow` object.

    131 |
    132 | 133 |
    runs(object)
    134 | 135 |

    Arguments

    136 | 137 | 138 | 139 | 140 | 141 | 142 |
    object

    A `cwlWorkflow` object.

    143 | 144 |

    Value

    145 | 146 |

    `cwlProcess` objects or paths of CWL file.

    147 | 148 |

    Examples

    149 |
    s1 <- cwlWorkflow() 150 | runs(s1) 151 |
    #> List of length 0 152 | #> names(0):
    s1 153 |
    #> class: cwlWorkflow 154 | #> cwlClass: Workflow 155 | #> cwlVersion: v1.0 156 | #> inputs: 157 | #> outputs: 158 | #> output: 159 | #> type: stdout 160 | #> steps: 161 | #> {}
    short(s1) 162 |
    #> inputs: [] 163 | #> outputs: output 164 | #> steps: []
    165 |
    166 | 171 |
    172 | 173 | 174 |
    175 | 178 | 179 |
    180 |

    Site built with pkgdown 1.6.1.

    181 |
    182 | 183 |
    184 |
    185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /docs/reference/install_udocker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | install udocker — install_udocker • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 67 | 68 | 69 | 70 | 71 | 72 |
    73 |
    74 | 116 | 117 | 118 | 119 |
    120 | 121 |
    122 |
    123 | 128 | 129 |
    130 |

    To download and install udocker for python3.

    131 |
    132 | 133 |
    install_udocker()
    134 | 135 | 136 | 137 |
    138 | 143 |
    144 | 145 | 146 |
    147 | 150 | 151 |
    152 |

    Site built with pkgdown 1.6.1.

    153 |
    154 | 155 |
    156 |
    157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /docs/reference/plus-cwlWorkflow-stepParam-method.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Pipeline — +,cwlWorkflow,stepParam-method • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
    64 |
    65 | 102 | 103 | 104 | 105 |
    106 | 107 |
    108 |
    109 | 114 | 115 |
    116 |

    To build a pipeline by connecting multiple `stepParam` to a 117 | `cwlWorkflow` object.

    118 |
    119 | 120 |
    # S4 method for cwlWorkflow,stepParam
    121 | +(e1, e2)
    122 | 123 |

    Arguments

    124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 |
    e1

    A `cwlWorkflow` object.

    e2

    A `stepParam` object.

    135 | 136 |

    Value

    137 | 138 |

    A `cwlWorkflow` object.

    139 |

    See also

    140 | 141 | 142 | 143 |
    144 | 149 |
    150 | 151 | 152 |
    153 | 156 | 157 |
    158 |

    Site built with pkgdown 1.6.1.

    159 |
    160 | 161 |
    162 |
    163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /docs/reference/runs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | runs — runs • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 101 | 102 | 103 | 104 |
    105 | 106 |
    107 |
    108 | 113 | 114 |
    115 |

    The function to access all runs of a cwlWorkflow object

    116 |
    117 | 118 |
    runs(object)
    119 | 120 |

    Arguments

    121 | 122 | 123 | 124 | 125 | 126 | 127 |
    object

    A cwlWorkflow object.

    128 | 129 |

    Value

    130 | 131 |

    cwlProcess objects or paths of CWL file.

    132 | 133 |

    Examples

    134 |
    s1 <- cwlWorkflow() 135 | runs(s1) 136 |
    #> List of length 0 137 | #> names(0):
    138 |
    139 | 144 |
    145 | 146 | 147 |
    148 | 151 | 152 |
    153 |

    Site built with pkgdown 1.6.1.

    154 |
    155 | 156 |
    157 |
    158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /docs/reference/short.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | short — short • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 101 | 102 | 103 | 104 |
    105 | 106 |
    107 |
    108 | 113 | 114 |
    115 |

    The function to show short summary of cwlProcess or cwlWorkflow

    116 |
    117 | 118 |
    short(object)
    119 | 120 |

    Arguments

    121 | 122 | 123 | 124 | 125 | 126 | 127 |
    object

    An cwlProcess or cwlWorkflow object

    128 | 129 |

    Value

    130 | 131 |

    A short summary of an object of cwlProcess or cwlWorkflow.

    132 | 133 |

    Examples

    134 |
    s1 <- cwlWorkflow() 135 | short(s1) 136 |
    #> inputs: [] 137 | #> outputs: output 138 | #> steps: []
    139 |
    140 | 145 |
    146 | 147 | 148 |
    149 | 152 | 153 |
    154 |

    Site built with pkgdown 1.6.1.

    155 |
    156 | 157 |
    158 |
    159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /docs/reference/stepInParam.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | stepInParam — stepInParam-class • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
    64 |
    65 | 102 | 103 | 104 | 105 |
    106 | 107 |
    108 |
    109 | 114 | 115 |
    116 |

    The input parameter of a workflow step. More details: 117 | https://www.commonwl.org/v1.0/Workflow.html#WorkflowStepInput

    118 |
    119 | 120 |
    stepInParam(
    121 |   id,
    122 |   source = character(),
    123 |   linkMerge = character(),
    124 |   default = character(),
    125 |   valueFrom = character()
    126 | )
    127 | 128 |

    Arguments

    129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 139 | 140 | 141 | 142 | 144 | 145 | 146 | 147 | 150 | 151 | 152 | 153 | 154 | 155 |
    id

    A unique identifier for this workflow input parameter.

    source

    Specifies one or more workflow parameters that will 138 | provide input to the underlying step parameter.

    linkMerge

    The method to use to merge multiple inbound links 143 | into a single array.

    default

    The default value for this parameter to use if 148 | either there is no source field, or the value produced by the 149 | source is null.

    valueFrom

    value from string or expression.

    156 | 157 |

    Value

    158 | 159 |

    An object of class `stepInParam`.

    160 | 161 |

    Examples

    162 |
    s1 <- stepInParam(id = "s1") 163 |
    164 |
    165 | 170 |
    171 | 172 | 173 |
    174 | 177 | 178 |
    179 |

    Site built with pkgdown 1.6.1.

    180 |
    181 | 182 |
    183 |
    184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /docs/reference/stepInParamList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | stepInParamList — stepInParamList-class • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
    64 |
    65 | 102 | 103 | 104 | 105 |
    106 | 107 |
    108 |
    109 | 114 | 115 |
    116 |

    stepInParamList

    117 |

    stepInParamList

    118 |
    119 | 120 |
    stepInParamList(...)
    121 | 122 |

    Arguments

    123 | 124 | 125 | 126 | 127 | 128 | 129 |
    ...

    A list of `stepInParam` objects.

    130 | 131 |

    Value

    132 | 133 |

    An object of class `stepInParamList`.

    134 | 135 |

    Examples

    136 |
    s1 <- stepInParam(id = "s1") 137 | stepInParamList(s1) 138 |
    #> stepInParamList of length 1 139 | #> names(1): s1
    140 |
    141 | 146 |
    147 | 148 | 149 |
    150 | 153 | 154 |
    155 |

    Site built with pkgdown 1.6.1.

    156 |
    157 | 158 |
    159 |
    160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /docs/reference/stepParamList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | stepParamList — stepParamList-class • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
    64 |
    65 | 102 | 103 | 104 | 105 |
    106 | 107 |
    108 |
    109 | 114 | 115 |
    116 |

    stepParamList

    117 |

    stepParamList

    118 |
    119 | 120 |
    stepParamList(...)
    121 | 122 |

    Arguments

    123 | 124 | 125 | 126 | 127 | 128 | 129 |
    ...

    A list of `stepParam`.

    130 | 131 |

    Value

    132 | 133 |

    An object of class `stepParamList`.

    134 | 135 |

    Examples

    136 |
    s1 <- stepParam(id = "s1") 137 | stepParamList(s1) 138 |
    #> steps: 139 | #> s1: 140 | #> run: s1.cwl
    141 |
    142 | 147 |
    148 | 149 | 150 |
    151 | 154 | 155 |
    156 |

    Site built with pkgdown 1.6.1.

    157 |
    158 | 159 |
    160 |
    161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/reference/steps.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Steps — steps • Rcwl 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 101 | 102 | 103 | 104 |
    105 | 106 |
    107 |
    108 | 113 | 114 |
    115 |

    Function to extract step slots

    116 |
    117 | 118 |
    steps(cwl)
    119 | 
    120 | steps(cwl) <- value
    121 | 122 |

    Arguments

    123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 |
    cwl

    A cwlWorkflow object.

    value

    A list of steps.

    134 | 135 |

    Value

    136 | 137 |

    steps: A list of stepParam objects.

    138 |

    See also

    139 | 140 | 141 | 142 |
    143 | 148 |
    149 | 150 | 151 |
    152 | 155 | 156 |
    157 |

    Site built with pkgdown 1.6.1.

    158 |
    159 | 160 |
    161 |
    162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https://rworkflow.github.io/Rcwl/index.html 5 | 6 | 7 | https://rworkflow.github.io/Rcwl/reference/AllClasses.html 8 | 9 | 10 | https://rworkflow.github.io/Rcwl/reference/Rcwl-package.html 11 | 12 | 13 | https://rworkflow.github.io/Rcwl/reference/cwl-requirements.html 14 | 15 | 16 | https://rworkflow.github.io/Rcwl/reference/cwlProcess-methods.html 17 | 18 | 19 | https://rworkflow.github.io/Rcwl/reference/cwlProcess.html 20 | 21 | 22 | https://rworkflow.github.io/Rcwl/reference/cwlShiny.html 23 | 24 | 25 | https://rworkflow.github.io/Rcwl/reference/cwlStep.html 26 | 27 | 28 | https://rworkflow.github.io/Rcwl/reference/cwlWorkflow-methods.html 29 | 30 | 31 | https://rworkflow.github.io/Rcwl/reference/cwlWorkflow.html 32 | 33 | 34 | https://rworkflow.github.io/Rcwl/reference/install_udocker.html 35 | 36 | 37 | https://rworkflow.github.io/Rcwl/reference/plotCWL.html 38 | 39 | 40 | https://rworkflow.github.io/Rcwl/reference/readCWL.html 41 | 42 | 43 | https://rworkflow.github.io/Rcwl/reference/runCWL.html 44 | 45 | 46 | https://rworkflow.github.io/Rcwl/reference/runCWLBatch.html 47 | 48 | 49 | https://rworkflow.github.io/Rcwl/reference/writeCWL.html 50 | 51 | 52 | https://rworkflow.github.io/Rcwl/articles/Rcwl.html 53 | 54 | 55 | -------------------------------------------------------------------------------- /man/AllClasses.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AllClasses.R 3 | \docType{class} 4 | \name{InputArrayParam-class} 5 | \alias{InputArrayParam-class} 6 | \alias{InputArrayParam} 7 | \alias{InputParam-class} 8 | \alias{InputParam} 9 | \alias{InputParamList-class} 10 | \alias{InputParamList} 11 | \alias{OutputArrayParam-class} 12 | \alias{OutputArrayParam} 13 | \alias{OutputParam-class} 14 | \alias{OutputParam} 15 | \alias{OutputParamList-class} 16 | \alias{OutputParamList} 17 | \alias{cwlProcess-class} 18 | \alias{stepInParam-class} 19 | \alias{stepInParam} 20 | \alias{stepInParamList-class} 21 | \alias{stepInParamList} 22 | \alias{cwlStep-class} 23 | \alias{cwlStepList-class} 24 | \alias{cwlStepList} 25 | \alias{cwlWorkflow-class} 26 | \title{All classes defined in the package of `Rcwl` and the class constructor functions.} 27 | \usage{ 28 | InputArrayParam( 29 | label = "", 30 | doc = character(), 31 | name = character(), 32 | type = "array", 33 | items = character(), 34 | prefix = "", 35 | separate = TRUE, 36 | itemSeparator = character(), 37 | valueFrom = character() 38 | ) 39 | 40 | InputParam( 41 | id, 42 | label = "", 43 | type = "string", 44 | doc = character(), 45 | secondaryFiles = character(), 46 | streamable = logical(), 47 | format = character(), 48 | loadListing = character(), 49 | loadContents = logical(), 50 | position = 0L, 51 | prefix = "", 52 | separate = TRUE, 53 | itemSeparator = character(), 54 | valueFrom = character(), 55 | shellQuote = logical(), 56 | default = character(), 57 | value = character() 58 | ) 59 | 60 | InputParamList(...) 61 | 62 | OutputArrayParam( 63 | label = character(), 64 | doc = character(), 65 | name = character(), 66 | type = "array", 67 | items = character() 68 | ) 69 | 70 | OutputParam( 71 | id = "output", 72 | label = character(), 73 | doc = character(), 74 | type = "stdout", 75 | format = character(), 76 | secondaryFiles = character(), 77 | streamable = logical(), 78 | glob = character(), 79 | loadContents = logical(), 80 | loadListing = character(), 81 | outputEval = character(), 82 | outputSource = character(), 83 | linkMerge = character(), 84 | pickValue = character() 85 | ) 86 | 87 | OutputParamList(out = OutputParam(), ...) 88 | 89 | stepInParam( 90 | id, 91 | source = character(), 92 | linkMerge = character(), 93 | pickValue = character(), 94 | loadContents = logical(), 95 | loadListing = character(), 96 | default = character(), 97 | valueFrom = character() 98 | ) 99 | 100 | stepInParamList(...) 101 | 102 | cwlStepList(...) 103 | } 104 | \arguments{ 105 | \item{label}{A short, human-readable label of this object.} 106 | 107 | \item{doc}{A documentation string for this object, or an array of 108 | strings which should be concatenated.} 109 | 110 | \item{name}{The identifier for this type.} 111 | 112 | \item{type}{Specify valid types of data that may be assigned to 113 | this parameter.} 114 | 115 | \item{items}{Defines the type of the array elements.} 116 | 117 | \item{prefix}{Command line prefix to add before the value.} 118 | 119 | \item{separate}{If true (default), then the prefix and value must 120 | be added as separate command line arguments; if false, prefix 121 | and value must be concatenated into a single command line 122 | argument.} 123 | 124 | \item{itemSeparator}{Join the array elements into a single string 125 | with the elements separated by by itemSeparator.} 126 | 127 | \item{valueFrom}{value from string or expression.} 128 | 129 | \item{id}{A unique identifier for this workflow input parameter.} 130 | 131 | \item{secondaryFiles}{Provides a pattern or expression specifying 132 | files or directories. Only valid when type: File or is an array 133 | of items: File.} 134 | 135 | \item{streamable}{A value of true indicates that the file is read 136 | or written sequentially without seeking. Only valid when type: 137 | File or is an array of items: File.} 138 | 139 | \item{format}{Only valid when type: File or is an array of items: 140 | File. This is the file format that will be assigned to the 141 | output File object.} 142 | 143 | \item{loadListing}{Only valid when type: Directory or is an array 144 | of items: Directory. "no_listing", "shallow_listing" or 145 | "deep_listing".} 146 | 147 | \item{loadContents}{Only valid when type: File or is an array of 148 | items: File.} 149 | 150 | \item{position}{The position for this parameter.} 151 | 152 | \item{shellQuote}{If ShellCommandRequirement is in the requirements 153 | for the current command, this controls whether the value is 154 | quoted on the command line (default is true).} 155 | 156 | \item{default}{The default value for this parameter to use if 157 | either there is no source field, or the value produced by the 158 | source is null.} 159 | 160 | \item{value}{Assigned value for this parameter} 161 | 162 | \item{...}{A list of `cwlStep` objects.} 163 | 164 | \item{glob}{Pattern to find files relative to the output directory.} 165 | 166 | \item{outputEval}{Evaluate an expression to generate the output 167 | value.} 168 | 169 | \item{outputSource}{Specifies one or more workflow parameters that 170 | supply the value of to the output parameter.} 171 | 172 | \item{linkMerge}{The method to use to merge multiple inbound links 173 | into a single array.} 174 | 175 | \item{pickValue}{The method to use to choose non-null elements 176 | among multiple sources. "first_non_null", "the_only_non_null", 177 | or "all_non_null".} 178 | 179 | \item{out}{The default stdout parameter.} 180 | 181 | \item{source}{Specifies one or more workflow parameters that will 182 | provide input to the underlying step parameter.} 183 | } 184 | \value{ 185 | InputArrayParam: An object of class `InputArrayParam`. 186 | 187 | An object of class `InputParam`. 188 | 189 | InputParamList: An object of class `InputParamList`. 190 | 191 | An object of class `OutputArrayParam`. 192 | 193 | OutputParam: An object of class `OutputParam`. 194 | 195 | OutputParamList: An object of class `OutputParamList`. 196 | 197 | stepInParam: An object of class `stepInParam`. 198 | 199 | An object of class `stepInParamList`. 200 | 201 | cwlStepList: An object of class `cwlStepList`. 202 | } 203 | \description{ 204 | InputArrayParam: Parameters for array inputs. To 205 | specify an array parameter, the array definition is nested 206 | under the type field with 'type: array' and items defining the 207 | valid data types that may appear in the array. 208 | 209 | InputParam: parameter for a command line tool. 210 | 211 | InputParamList: A list of `InputParam` objects. 212 | 213 | OutputArrayParam: Parameters for array outputs. 214 | 215 | OutputParam: An output parameter for a Command Line 216 | Tool. 217 | 218 | OutputParamList: A list of `InputParam` objects. 219 | 220 | stepInParam: The input parameter of a workflow step. 221 | 222 | stepInParamList: A list of `stepInParam` objects. 223 | 224 | cwlStepList: A list of `cwlStep` objects. 225 | } 226 | \details{ 227 | More details of `InputArrayParam`, see: 228 | https://www.commonwl.org/v1.0/CommandLineTool.html#CommandInputArraySchema 229 | 230 | More details for `InputParam`, see: 231 | https://www.commonwl.org/v1.0/CommandLineTool.html#CommandInputParameter 232 | 233 | More details for `OutputArrayParam`, see: 234 | https://www.commonwl.org/v1.0/CommandLineTool.html#CommandOutputArraySchema 235 | 236 | More details for `OutputParam`, see: 237 | https://www.commonwl.org/v1.0/CommandLineTool.html#CommandOutputParameter 238 | 239 | More details for `stepInParam`, see: 240 | https://www.commonwl.org/v1.0/Workflow.html#WorkflowStepInput 241 | } 242 | \examples{ 243 | InputArrayParam(items = "string", prefix="-B=", separate = FALSE) 244 | input1 <- InputParam(id = "sth") 245 | InputParamList(input1) 246 | OutputParam(id = "b", type = OutputArrayParam(items = "File"), glob = "*.txt") 247 | o1 <- OutputParam(id = "file", type = "File", glob = "*.txt") 248 | o1 249 | 250 | o1 <- OutputParam(id = "file", type = "File", glob = "*.txt") 251 | OutputParamList(o1) 252 | s1 <- stepInParam(id = "s1") 253 | 254 | s1 <- stepInParam(id = "s1") 255 | stepInParamList(s1) 256 | s1 <- cwlStep(id = "s1") 257 | cwlStepList(s1) 258 | } 259 | -------------------------------------------------------------------------------- /man/Rcwl-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Rcwl-package.R 3 | \name{Rcwl-package} 4 | \alias{Rcwl-package} 5 | \alias{Rcwl} 6 | \alias{Rcwl,Rcwl-package} 7 | \title{Rcwl-package} 8 | \description{ 9 | An R package to wrap command line tools and build pipelines with 10 | Common Workflow Language (CWL). 11 | _PACKAGE 12 | } 13 | \seealso{ 14 | \code{\link{cwlProcess}} 15 | 16 | \code{\link{cwlWorkflow}} 17 | 18 | \code{\link{cwlStep}} 19 | 20 | \code{\link{runCWL}} 21 | } 22 | -------------------------------------------------------------------------------- /man/addMeta.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/meta.R 3 | \name{meta} 4 | \alias{meta} 5 | \alias{meta<-} 6 | \alias{addMeta} 7 | \title{addMeta 8 | Add or change meta information for a cwl recipe.} 9 | \usage{ 10 | meta(cwl) 11 | 12 | meta(cwl) <- value 13 | 14 | addMeta( 15 | cwl, 16 | label = character(), 17 | doc = character(), 18 | inputLabels = character(), 19 | inputDocs = character(), 20 | outputLabels = character(), 21 | outputDocs = character(), 22 | stepLabels = character(), 23 | stepDocs = character(), 24 | extensions = list() 25 | ) 26 | } 27 | \arguments{ 28 | \item{cwl}{`cwlProcess` object for data or tool 29 | recipe. `cwlWorkflow` object for a pipeline recipe.} 30 | 31 | \item{value}{A list of meta information to add to `cwl`.} 32 | 33 | \item{label}{Character string specifying a label for the 34 | recipe. E.g., "bwa align", "gencode annotation".} 35 | 36 | \item{doc}{Character string describing the recipe. E.g, 37 | "Align reads to reference genome".} 38 | 39 | \item{inputLabels}{Vector of character string, specifying labels 40 | for each input parameter.} 41 | 42 | \item{inputDocs}{Vector of character string as descriptions for 43 | each input parameter.} 44 | 45 | \item{outputLabels}{Vector of character string, specifying labels 46 | for each output parameter.} 47 | 48 | \item{outputDocs}{Vector of character string as descriptions for 49 | each output parameter.} 50 | 51 | \item{stepLabels}{Vector of character string, specifying labels for 52 | each step. Use only if `cwl` is a `cwlWorkflow` object.} 53 | 54 | \item{stepDocs}{Vector of character string as description for each 55 | step. Use only if `cwl` is a `cwlWorkflow` object.} 56 | 57 | \item{extensions}{A list of character strings. Can be used to add 58 | meta information about the recipe. Generally, add fields of 59 | information that does not require execution as part of the 60 | recipe evaluation. for information about "author", "url", 61 | "date", "example", use the exact names as list names as shown 62 | in examples, so that they can be correctly passed into 63 | corresponding fields in markdown file when using 64 | `meta2md`. Other information can be added as a list element 65 | with arbitrary names.} 66 | } 67 | \value{ 68 | `meta()`: return a list of all available meta information 69 | for the `cwl` object. 70 | 71 | `addMeta()`: `cwlProcess` or `cwlWorkflow` object, with added meta 72 | information, which can be returned using `meta(cwl)`. Meta 73 | information can be converted into markdown file with `meta2md` 74 | function. 75 | } 76 | \description{ 77 | addMeta 78 | Add or change meta information for a cwl recipe. 79 | } 80 | \examples{ 81 | \dontrun{ 82 | library(RcwlPipelines) 83 | cwlSearch(c("bwa", "align")) 84 | bwaAlign <- RcwlPipelines::cwlLoad("pl_bwaAlign") 85 | bwaAlign <- addMeta( 86 | cwl = bwaAlign, 87 | label = "align", 88 | doc = "align reads to reference genome", 89 | inputLabels = c("threads", "readgroup", "reference", "read1", "read2"), 90 | inputDocs = c("number of threads", "read groups", 91 | "reference genome", "read pair1", "read pair2"), 92 | outputLabels = c("Bam", "Idx"), 93 | outputDocs = c("outputbam file", "index file"), 94 | stepLabels = c(bwa = "bwa"), 95 | stepDocs = c(bwa = "bwa alignment")) 96 | cat(meta2md(bwaAlign)) 97 | } 98 | 99 | \dontrun{ 100 | rcp <- ReUseData::recipeLoad("gencode_annotation") 101 | meta(rcp) 102 | rcp1 <- addMeta( 103 | cwl = rcp, 104 | label = "", 105 | doc = "An empty description line", 106 | inputLabels = c("input label1", "input label2"), 107 | inputDocs = c("input description 1", "input description 2"), 108 | outputLabels = c("output label1"), 109 | outputDocs = c("output description 1"), 110 | extensions = list( 111 | author = "recipe author's name", 112 | url = "http://ftp.ebi.ac.uk/pub/databases/gencode/", 113 | date = as.character(Sys.Date()), 114 | example = "An example")) 115 | meta(rcp1) 116 | cat(meta2md(rcp1)) 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /man/cwlProcess-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cwlProcessWorkflow-methods.R 3 | \name{cwlProcess-methods} 4 | \alias{cwlProcess-methods} 5 | \alias{cwlVersion} 6 | \alias{cwlVersion<-} 7 | \alias{cwlClass} 8 | \alias{cwlClass<-} 9 | \alias{baseCommand} 10 | \alias{baseCommand<-} 11 | \alias{arguments} 12 | \alias{arguments<-} 13 | \alias{hints} 14 | \alias{hints<-} 15 | \alias{requirements} 16 | \alias{requirements<-} 17 | \alias{inputs} 18 | \alias{$,cwlProcess-method} 19 | \alias{$<-,cwlProcess-method} 20 | \alias{outputs} 21 | \alias{stdOut} 22 | \alias{stdOut<-} 23 | \alias{extensions} 24 | \alias{extensions<-} 25 | \alias{short} 26 | \title{cwlProcess methods} 27 | \usage{ 28 | cwlVersion(cwl) 29 | 30 | cwlVersion(cwl) <- value 31 | 32 | cwlClass(cwl) 33 | 34 | cwlClass(cwl) <- value 35 | 36 | baseCommand(cwl) 37 | 38 | baseCommand(cwl) <- value 39 | 40 | arguments(cwl, step = NULL) 41 | 42 | arguments(cwl, step = NULL) <- value 43 | 44 | hints(cwl) 45 | 46 | hints(cwl) <- value 47 | 48 | requirements(cwl, step = NULL) 49 | 50 | requirements(cwl, step = NULL) <- value 51 | 52 | inputs(cwl) 53 | 54 | \S4method{$}{cwlProcess}(x, name) 55 | 56 | \S4method{$}{cwlProcess}(x, name) <- value 57 | 58 | outputs(cwl) 59 | 60 | stdOut(cwl) 61 | 62 | stdOut(cwl) <- value 63 | 64 | extensions(cwl) 65 | 66 | extensions(cwl) <- value 67 | 68 | short(cwl) 69 | } 70 | \arguments{ 71 | \item{cwl}{A `cwlProcess` (or `cwlWorkflow`) object.} 72 | 73 | \item{value}{To assign a list of `requirements` value.} 74 | 75 | \item{step}{To specifiy a step ID when `cwl` is a workflow.} 76 | 77 | \item{x}{A `cwlProcess` object.} 78 | 79 | \item{name}{One of input list.} 80 | } 81 | \value{ 82 | cwlVersion: cwl document version 83 | 84 | cwlClass: CWL class of `cwlProcess` or `cwlWorkflow` object. 85 | 86 | baseCommand: base command for the `cwlProcess` object. 87 | 88 | arguments: CWL arguments. 89 | 90 | hints: CWL hints. 91 | 92 | requirements: CWL requirments. 93 | 94 | inputs: A list of `InputParam`. 95 | 96 | `$`: the `InputParam` value for `cwlProcess` object. 97 | 98 | outputs: A list of `OutputParam`. 99 | 100 | stdOut: CWL stdout. 101 | 102 | extensions: A list of extensions or metadata. 103 | 104 | short: A short summary of an object of `cwlProcess` or `cwlWorkflow`. 105 | } 106 | \description{ 107 | Some useful methods for `cwlProcess` objects. 108 | 109 | `$`: Extract input values for `cwlProcess` 110 | object. (Can auto-complete the input names using tab) 111 | 112 | `$<-`: Set input values for `cwlProcess` object by name. 113 | 114 | outputs: The outputs of a `cwlProcess` object. 115 | 116 | stdOut: stdout of `cwlProcess` object. 117 | 118 | extensions: Extensions and metadata of `cwlProcess` object. 119 | 120 | short: The function to show a short summary of `cwlProcess` or 121 | `cwlWorkflow` object. 122 | } 123 | \examples{ 124 | ip <- InputParam(id = "sth") 125 | echo <- cwlProcess(baseCommand = "echo", inputs = InputParamList(ip)) 126 | cwlVersion(echo) 127 | cwlClass(echo) 128 | baseCommand(echo) 129 | hints(echo) 130 | requirements(echo) 131 | inputs(echo) 132 | outputs(echo) 133 | stdOut(echo) 134 | extensions(echo) 135 | 136 | s1 <- cwlWorkflow() 137 | runs(s1) 138 | s1 139 | short(s1) 140 | } 141 | -------------------------------------------------------------------------------- /man/cwlProcess.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cwlProcess.R 3 | \name{cwlProcess} 4 | \alias{cwlProcess} 5 | \title{Parameters for CWL} 6 | \usage{ 7 | cwlProcess( 8 | cwlVersion = "v1.0", 9 | cwlClass = "CommandLineTool", 10 | baseCommand = character(), 11 | requirements = list(), 12 | hints = list(), 13 | arguments = list(), 14 | id = character(), 15 | label = character(), 16 | doc = character(), 17 | inputs = InputParamList(), 18 | outputs = OutputParamList(), 19 | stdout = character(), 20 | stdin = character(), 21 | expression = character(), 22 | extensions = list(), 23 | intent = list() 24 | ) 25 | } 26 | \arguments{ 27 | \item{cwlVersion}{CWL version} 28 | 29 | \item{cwlClass}{"CommandLineTool"} 30 | 31 | \item{baseCommand}{Specifies the program or R function to execute} 32 | 33 | \item{requirements}{A list of requirements that apply to either the 34 | runtime environment or the workflow engine that must be met in 35 | order to execute this process.} 36 | 37 | \item{hints}{Any or a list for the workflow engine.} 38 | 39 | \item{arguments}{Command line bindings which are not directly 40 | associated with input parameters.} 41 | 42 | \item{id}{The unique identifier for this process object.} 43 | 44 | \item{label}{A short, human-readable label of this process object.} 45 | 46 | \item{doc}{A documentation string for this object, or an array of 47 | strings which should be concatenated.} 48 | 49 | \item{inputs}{A object of `InputParamList`.} 50 | 51 | \item{outputs}{A object of `OutputParamList`.} 52 | 53 | \item{stdout}{Capture the command's standard output stream to a 54 | file written to the designated output directory.} 55 | 56 | \item{stdin}{A path to a file whose contents must be piped into the 57 | command's standard input stream.} 58 | 59 | \item{expression}{Javascripts for ExpressionTool class.} 60 | 61 | \item{extensions}{A list of extensions and metadata} 62 | 63 | \item{intent}{An identifier for the type of computational 64 | operation, of this Process.} 65 | } 66 | \value{ 67 | A `cwlProcess` class object. 68 | } 69 | \description{ 70 | The main CWL parameter class and constructor for command 71 | tools. More details: 72 | https://www.commonwl.org/v1.0/CommandLineTool.html 73 | } 74 | \details{ 75 | https://www.commonwl.org/v1.0/CommandLineTool.html 76 | } 77 | \examples{ 78 | input1 <- InputParam(id = "sth") 79 | echo <- cwlProcess(baseCommand = "echo", inputs = InputParamList(input1)) 80 | } 81 | -------------------------------------------------------------------------------- /man/cwlShiny.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cwlShiny.R 3 | \name{cwlShiny} 4 | \alias{cwlShiny} 5 | \title{cwlShiny} 6 | \usage{ 7 | cwlShiny(cwl, inputList = list(), upload = FALSE, ...) 8 | } 9 | \arguments{ 10 | \item{cwl}{A cwlProcess object.} 11 | 12 | \item{inputList}{a list of choices for the inputs of cwl 13 | object. The name of the list must match the inputs of the cwl 14 | object.} 15 | 16 | \item{upload}{Whether to upload file. If FALSE, the upload field 17 | will be text input (file path) instead of file input.} 18 | 19 | \item{...}{More options for `runCWL`.} 20 | } 21 | \value{ 22 | A shiny webapp. 23 | } 24 | \description{ 25 | Function to generate shiny app automaticlly for a `cwlProcess` 26 | object. 27 | } 28 | \examples{ 29 | input1 <- InputParam(id = "sth") 30 | echo <- cwlProcess(baseCommand = "echo", inputs = InputParamList(input1)) 31 | echoApp <- cwlShiny(echo) 32 | } 33 | -------------------------------------------------------------------------------- /man/cwlStep.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cwlStep.R 3 | \name{cwlStep} 4 | \alias{cwlStep} 5 | \title{cwlStep function} 6 | \usage{ 7 | cwlStep( 8 | id, 9 | run = cwlProcess(), 10 | In = list(), 11 | Out = list(), 12 | scatter = character(), 13 | scatterMethod = character(), 14 | label = character(), 15 | doc = character(), 16 | requirements = list(), 17 | hints = list(), 18 | when = character() 19 | ) 20 | } 21 | \arguments{ 22 | \item{id}{A user-defined unique identifier for this workflow step.} 23 | 24 | \item{run}{A `cwlProcess` object for command line tool, or path to 25 | a CWL file.} 26 | 27 | \item{In}{A list of input parameters which will be constructed into 28 | `stepInParamList`.} 29 | 30 | \item{Out}{A list of outputs.} 31 | 32 | \item{scatter}{character or a list. The inputs to be scattered.} 33 | 34 | \item{scatterMethod}{required if scatter is an array of more than 35 | one element. It can be one of "dotproduct", 36 | "nested_crossproduct" and "flat_crossproduct".} 37 | 38 | \item{label}{A short, human-readable label of this object.} 39 | 40 | \item{doc}{A documentation string for this object, or an array of 41 | strings which should be concatenated.} 42 | 43 | \item{requirements}{Requirements that apply to either the runtime 44 | environment or the workflow engine.} 45 | 46 | \item{hints}{Hints applying to either the runtime environment or 47 | the workflow engine.} 48 | 49 | \item{when}{If defined, only run the step when the expression 50 | evaluates to true. If false the step is skipped.} 51 | } 52 | \value{ 53 | An object of class `cwlStep`. 54 | } 55 | \description{ 56 | Constructor function for `cwlStep` object. 57 | } 58 | \details{ 59 | For more details: 60 | https://www.commonwl.org/v1.0/Workflow.html#WorkflowStep 61 | } 62 | \examples{ 63 | s1 <- cwlStep(id = "s1") 64 | } 65 | \seealso{ 66 | \code{\link{cwlWorkflow}} 67 | } 68 | -------------------------------------------------------------------------------- /man/cwlWorkflow-methods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cwlProcessWorkflow-methods.R 3 | \name{cwlWorkflow-methods} 4 | \alias{cwlWorkflow-methods} 5 | \alias{runs} 6 | \title{cwlWorkflow methods} 7 | \usage{ 8 | runs(object) 9 | } 10 | \arguments{ 11 | \item{object}{A `cwlWorkflow` object.} 12 | } 13 | \value{ 14 | `cwlProcess` objects or paths of CWL file. 15 | } 16 | \description{ 17 | runs: The function to access all runs of a `cwlWorkflow` object. 18 | } 19 | \examples{ 20 | s1 <- cwlWorkflow() 21 | runs(s1) 22 | s1 23 | short(s1) 24 | } 25 | -------------------------------------------------------------------------------- /man/cwlWorkflow.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cwlWorkflow.R 3 | \name{cwlWorkflow} 4 | \alias{cwlWorkflow} 5 | \alias{+,cwlWorkflow,cwlStep-method} 6 | \alias{steps} 7 | \alias{steps<-} 8 | \title{cwlWorkflow function} 9 | \usage{ 10 | cwlWorkflow( 11 | cwlVersion = "v1.0", 12 | cwlClass = "Workflow", 13 | requirements = list(), 14 | id = character(), 15 | label = character(), 16 | doc = character(), 17 | intent = list(), 18 | hints = list(), 19 | arguments = list(), 20 | extensions = list(), 21 | inputs = InputParamList(), 22 | outputs = OutputParamList(), 23 | steps = cwlStepList() 24 | ) 25 | 26 | \S4method{+}{cwlWorkflow,cwlStep}(e1, e2) 27 | 28 | steps(cwl) 29 | 30 | steps(cwl) <- value 31 | } 32 | \arguments{ 33 | \item{cwlVersion}{CWL version} 34 | 35 | \item{cwlClass}{"Workflow".} 36 | 37 | \item{requirements}{Requirements that apply to either the runtime 38 | environment or the workflow engine.} 39 | 40 | \item{id}{A user-defined unique identifier for this workflow.} 41 | 42 | \item{label}{A short, human-readable label of this object.} 43 | 44 | \item{doc}{A documentation string for this object.} 45 | 46 | \item{intent}{An identifier for the type of computational 47 | operation, of this Process.} 48 | 49 | \item{hints}{Any or a list for the workflow engine.} 50 | 51 | \item{arguments}{Command line bindings which are not directly 52 | associated with input parameters.} 53 | 54 | \item{extensions}{A list of extensions and metadata.} 55 | 56 | \item{inputs}{An object of `InputParamList`.} 57 | 58 | \item{outputs}{An object of `OutputParamList`.} 59 | 60 | \item{steps}{A list of `cwlStepList`.} 61 | 62 | \item{e1}{A `cwlWorkflow` object.} 63 | 64 | \item{e2}{A `cwlStep` object.} 65 | 66 | \item{cwl}{A `cwlWorkflow` object.} 67 | 68 | \item{value}{A list of `cwlSteps` to assign.} 69 | } 70 | \value{ 71 | cwlWorkflow: An object of class `cwlWorkflow`. 72 | 73 | steps: A list of `cwlStep` objects. 74 | } 75 | \description{ 76 | The constructor function for `cwlWorkflow` object, 77 | which connects multiple command line steps into a workflow. 78 | 79 | steps: Function to extract and assign workflow step 80 | slots. 81 | } 82 | \examples{ 83 | input1 <- InputParam(id = "sth") 84 | echo1 <- cwlProcess(baseCommand = "echo", 85 | inputs = InputParamList(input1)) 86 | input2 <- InputParam(id = "sthout", type = "File") 87 | echo2 <- cwlProcess(baseCommand = "echo", 88 | inputs = InputParamList(input2), 89 | stdout = "out.txt") 90 | i1 <- InputParam(id = "sth") 91 | o1 <- OutputParam(id = "out", type = "File", outputSource = "echo2/output") 92 | wf <- cwlWorkflow(inputs = InputParamList(i1), 93 | outputs = OutputParamList(o1)) 94 | s1 <- cwlStep(id = "echo1", run = echo1, In = list(sth = "sth")) 95 | s2 <- cwlStep(id = "echo2", run = echo2, In = list(sthout = "echo1/output")) 96 | wf <- wf + s1 + s2 97 | } 98 | \seealso{ 99 | \code{\link{stepInParamList}} 100 | } 101 | -------------------------------------------------------------------------------- /man/env_Rcwl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/basilisk.R 3 | \docType{data} 4 | \name{env_Rcwl} 5 | \alias{env_Rcwl} 6 | \title{Rcwl conda environment} 7 | \format{ 8 | An object of class \code{BasiliskEnvironment} of length 1. 9 | } 10 | \usage{ 11 | env_Rcwl 12 | } 13 | \description{ 14 | Rcwl conda envrionment to install `cwltool` by basilisk. 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/install_cwltool.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/install_cwltool.R 3 | \name{install_cwltool} 4 | \alias{install_cwltool} 5 | \title{install cwltool} 6 | \usage{ 7 | install_cwltool() 8 | } 9 | \description{ 10 | To download and install cwltool using basilisk 11 | } 12 | -------------------------------------------------------------------------------- /man/install_udocker.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/install_udocker.R 3 | \name{install_udocker} 4 | \alias{install_udocker} 5 | \title{install udocker} 6 | \usage{ 7 | install_udocker(version = "1.3.4") 8 | } 9 | \arguments{ 10 | \item{version}{The version of udocker.} 11 | } 12 | \description{ 13 | To download and install udocker for python3. 14 | } 15 | -------------------------------------------------------------------------------- /man/plotCWL.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plotCWL.R 3 | \name{plotCWL} 4 | \alias{plotCWL} 5 | \title{plotCWL} 6 | \usage{ 7 | plotCWL(cwl, output = "graph", layout = "tree", ...) 8 | } 9 | \arguments{ 10 | \item{cwl}{A cwlWorkflow object to plot} 11 | 12 | \item{output}{A string specifying the output type. An option 13 | inherits from `render_graph` and can also be "mermaid".} 14 | 15 | \item{layout}{Layout from `render_graph`.} 16 | 17 | \item{...}{other parameters from `mermaid` or `render_graph` 18 | function} 19 | } 20 | \value{ 21 | A workflow plot. 22 | } 23 | \description{ 24 | Function to plot cwlWorkflow object. 25 | } 26 | \examples{ 27 | input1 <- InputParam(id = "sth") 28 | echo1 <- cwlProcess(baseCommand = "echo", 29 | inputs = InputParamList(input1)) 30 | input2 <- InputParam(id = "sthout", type = "File") 31 | echo2 <- cwlProcess(baseCommand = "echo", 32 | inputs = InputParamList(input2), 33 | stdout = "out.txt") 34 | i1 <- InputParam(id = "sth") 35 | o1 <- OutputParam(id = "out", type = "File", outputSource = "echo2/output") 36 | wf <- cwlWorkflow(inputs = InputParamList(i1), 37 | outputs = OutputParamList(o1)) 38 | s1 <- cwlStep(id = "echo1", run = echo1, In = list(sth = "sth")) 39 | s2 <- cwlStep(id = "echo2", run = echo2, In = list(sthout = "echo1/output")) 40 | wf <- wf + s1 + s2 41 | plotCWL(wf) 42 | } 43 | -------------------------------------------------------------------------------- /man/readCWL.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/readCWL.R 3 | \name{readCWL} 4 | \alias{readCWL} 5 | \title{Read CWL 6 | Function to read CWL command or workflow files.} 7 | \usage{ 8 | readCWL(cwlfile) 9 | } 10 | \arguments{ 11 | \item{cwlfile}{The cwl file to read.} 12 | } 13 | \value{ 14 | A object of class `cwlProcess` or `cwlWorkflow`. 15 | } 16 | \description{ 17 | Read CWL 18 | Function to read CWL command or workflow files. 19 | } 20 | \examples{ 21 | input1 <- InputParam(id = "sth") 22 | echo <- cwlProcess(baseCommand = "echo", 23 | inputs = InputParamList(input1)) 24 | tf <- writeCWL(echo) 25 | readCWL(tf[1]) 26 | } 27 | -------------------------------------------------------------------------------- /man/runCWL.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/runCWL.R 3 | \name{runCWL} 4 | \alias{runCWL} 5 | \title{run cwlProcess} 6 | \usage{ 7 | runCWL( 8 | cwl, 9 | outdir = ".", 10 | cwlRunner = "cwltool", 11 | cachedir = NULL, 12 | cwlTemp = NULL, 13 | cwlArgs = character(), 14 | stdout = TRUE, 15 | stderr = TRUE, 16 | showLog = FALSE, 17 | docker = TRUE, 18 | conda = FALSE, 19 | yml_prefix = deparse(substitute(cwl)), 20 | yml_outdir = tempfile(), 21 | ... 22 | ) 23 | } 24 | \arguments{ 25 | \item{cwl}{A `cwlProcess` or `cwlWorkflow` object.} 26 | 27 | \item{outdir}{Output directory, default is current working 28 | directory.} 29 | 30 | \item{cwlRunner}{The path to the `cwltool` or `cwl-runner`. If not 31 | exists, the cwltool package will be installed by `reticulate`.} 32 | 33 | \item{cachedir}{Directory to cache intermediate workflow outputs to 34 | avoid recomputing steps.} 35 | 36 | \item{cwlTemp}{File path to keep intermediate files. If a directory 37 | path is given, the intermediate files will be kept in the 38 | directory. Default is NULL to remove all intermediate files.} 39 | 40 | \item{cwlArgs}{The arguments for `cwltool` or `cwl-runner`. For 41 | example, "--debug" can work with `cwltool` to show debug 42 | information.} 43 | 44 | \item{stdout}{standard output from `system2`.} 45 | 46 | \item{stderr}{standard error from `system2`. By setting it to "", 47 | the detailed running logs will return directly.} 48 | 49 | \item{showLog}{Whether to show log details to standard 50 | out. i.e. stderr = "".} 51 | 52 | \item{docker}{Whether to use docker, or "sigularity" if use 53 | Singularity runtime to run container.} 54 | 55 | \item{conda}{Whether to install packages using conda if 56 | `SoftwareRequirement` is defined.} 57 | 58 | \item{yml_prefix}{The prefix of `.cwl` and `.yml` files that are to 59 | be internally executed.} 60 | 61 | \item{yml_outdir}{The output directory for the `.cwl` and `.yml` 62 | files.} 63 | 64 | \item{...}{The other options from `writeCWL` and `system2`.} 65 | } 66 | \value{ 67 | A list of outputs from tools and logs from cwltool. 68 | } 69 | \description{ 70 | Execute a cwlProcess object with assigned inputs. 71 | } 72 | \examples{ 73 | input1 <- InputParam(id = "sth") 74 | echo <- cwlProcess(baseCommand = "echo", 75 | inputs = InputParamList(input1)) 76 | echo$sth <- "Hello World!" 77 | ## res <- runCWL(echo) 78 | } 79 | -------------------------------------------------------------------------------- /man/runCWLBP.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/runCWL.R 3 | \name{runCWLBP} 4 | \alias{runCWLBP} 5 | \title{run CWL with BiocParallel} 6 | \usage{ 7 | runCWLBP(cwl, outdir, BPPARAM, ...) 8 | } 9 | \arguments{ 10 | \item{cwl}{cwl A `cwlProcess` or `cwlWorkflow` object.} 11 | 12 | \item{outdir}{Directory for output results} 13 | 14 | \item{BPPARAM}{The options for `BiocParallelParam`.} 15 | 16 | \item{...}{The other options from runCWL.} 17 | } 18 | \value{ 19 | Results from computing nodes and logs from cwltool. 20 | } 21 | \description{ 22 | Submit one CWL object with assigned values with BiocParallel. 23 | } 24 | -------------------------------------------------------------------------------- /man/runCWLBatch.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/runCWL.R 3 | \name{runCWLBatch} 4 | \alias{runCWLBatch} 5 | \title{run CWL with batchtools} 6 | \usage{ 7 | runCWLBatch( 8 | cwl, 9 | outdir = getwd(), 10 | inputList, 11 | paramList = list(), 12 | BPPARAM = BatchtoolsParam(workers = lengths(inputList)[1]), 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{cwl}{A `cwlProcess` or `cwlWorkflow` object.} 18 | 19 | \item{outdir}{Directory to output results} 20 | 21 | \item{inputList}{An input list to run in parallel. The list names 22 | must be in the inputs of cwl. Jobs will be submitted in 23 | parallel for each element in the list. The output directory of 24 | each job will be made using the name of each element under the 25 | `outdir`.} 26 | 27 | \item{paramList}{A parameter list for the cwl. The list names must 28 | be in the inputs of cwl.} 29 | 30 | \item{BPPARAM}{The options for `BiocParallelParam`.} 31 | 32 | \item{...}{The options from runCWL.} 33 | } 34 | \value{ 35 | Results from computing nodes and logs from cwltool. 36 | } 37 | \description{ 38 | run CWL with batchtools 39 | } 40 | -------------------------------------------------------------------------------- /man/stepInputs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cwlStep.R 3 | \name{stepInputs} 4 | \alias{stepInputs} 5 | \title{stepInputs} 6 | \usage{ 7 | stepInputs(stepList) 8 | } 9 | \arguments{ 10 | \item{stepList}{a list of `cwlStep` objects.} 11 | } 12 | \value{ 13 | InputParamList. 14 | } 15 | \description{ 16 | prepare inputs for workflow from `cwlStep` objects 17 | } 18 | -------------------------------------------------------------------------------- /man/stepOutputs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cwlStep.R 3 | \name{stepOutputs} 4 | \alias{stepOutputs} 5 | \title{stepOutputs} 6 | \usage{ 7 | stepOutputs(stepList) 8 | } 9 | \arguments{ 10 | \item{stepList}{a list of `cwlStep` objects.} 11 | } 12 | \value{ 13 | OutputParamList. 14 | } 15 | \description{ 16 | prepare outputs for workflow from `cwlStep` objects 17 | } 18 | -------------------------------------------------------------------------------- /man/writeCWL.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/writeCWL.R 3 | \name{writeCWL} 4 | \alias{writeCWL} 5 | \title{Write CWL} 6 | \usage{ 7 | writeCWL( 8 | cwl, 9 | prefix = deparse(substitute(cwl)), 10 | outdir = tempfile(), 11 | docker = TRUE, 12 | libPaths = TRUE, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{cwl}{A `cwlProcess` or `cwlWorkflow` object.} 18 | 19 | \item{prefix}{The prefix of `.cwl` and `.yml` files to be generated.} 20 | 21 | \item{outdir}{The output directory for the `.cwl` and `.yml` files.} 22 | 23 | \item{docker}{Whether to use docker.} 24 | 25 | \item{libPaths}{Whether to add local R libaray paths to R script.} 26 | 27 | \item{...}{Other options from `yaml::write_yaml`.} 28 | } 29 | \value{ 30 | A CWL file and A YML file. 31 | } 32 | \description{ 33 | write `cwlProcess` to cwl and yml. 34 | } 35 | \examples{ 36 | input1 <- InputParam(id = "sth") 37 | echo <- cwlProcess(baseCommand = "echo", 38 | inputs = InputParamList(input1)) 39 | writeCWL(echo) 40 | } 41 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(Rcwl) 3 | library(S4Vectors) 4 | library(yaml) 5 | test_check("Rcwl") 6 | -------------------------------------------------------------------------------- /tests/testthat/test_all.R: -------------------------------------------------------------------------------- 1 | 2 | ## test echo 3 | input1 <- InputParam(id = "sth") 4 | echo <- cwlProcess(baseCommand = "echo", inputs = InputParamList(input1)) 5 | echo$sth <- "Hello World!" 6 | install_cwltool() 7 | r1 <- runCWL(echo) 8 | test_that("simple echo", { 9 | expect_match(tail(r1$logs, 1), "success")}) 10 | 11 | out1 <- readLines(r1$output) 12 | test_that("simple echo", { 13 | expect_equal(out1, "Hello World!")}) 14 | 15 | ## no inputBinding 16 | p1 <- InputParam(id = "infiles", type = "File[]") 17 | p2 <- InputParam(id = "outfile", type = "string", 18 | default = "catout.txt", position = -1) 19 | Cat <- cwlProcess(baseCommand = "cat", 20 | inputs = InputParamList(p1, p2), 21 | stdout = "$(inputs.outfile)") 22 | writeCWL(Cat, prefix = "cat", outdir = tempdir()) 23 | Cat1 <- readCWL(file.path(tempdir(), "cat.cwl")) 24 | test_that("negative position", { 25 | expect_equal(inputs(Cat1)$outfile@inputBinding$position, -1)}) 26 | 27 | ## InputParam 28 | test_that("InputParam class", { 29 | expect_error(InputParam()) 30 | }) 31 | 32 | test_that("InputParamList class and element type", { 33 | expect_true(is(echo@inputs, "SimpleList")) 34 | expect_true(is(echo@inputs, "InputParamList")) 35 | expect_true(validObject(InputParamList())) 36 | expect_error(InputParamList(p1, p2, "test")) 37 | expect_error(InputParamList(p1, p2, OuputParam(id = "test"))) 38 | }) 39 | 40 | ## OutputParam 41 | o1 <- OutputParam(id = "file", type = "File", glob = "*.txt") 42 | test_that("InputParam class", { 43 | expect_true(validObject(OutputParam())) 44 | }) 45 | 46 | test_that("OutputParamList class and element type", { 47 | expect_true(is(echo@outputs, "SimpleList")) 48 | expect_true(is(echo@outputs, "OutputParamList")) 49 | expect_true(validObject(OutputParamList())) 50 | expect_error(OutputParamList(o1, "test")) 51 | expect_error(OutputParamList(o1, InputParam(id = "test"))) 52 | }) 53 | 54 | ## ## ExpressionTool, not pass check in bioc server 55 | ## p1 <- InputParam(id = "file1", type = "File") 56 | ## p2 <- InputParam(id = "file2", type = "File") 57 | ## o1 <- OutputParam(id = "out", type = "Directory") 58 | ## expression <- '${ 59 | ## return {"out": { 60 | ## "class": "Directory", 61 | ## "basename": "group", 62 | ## "listing": [inputs.file1, inputs.file2] 63 | ## }}; 64 | ## }' 65 | ## req <- list(class = "InlineJavascriptRequirement") 66 | ## groupFiles <- cwlProcess(cwlClass = "ExpressionTool", 67 | ## requirements = list(req), 68 | ## inputs = InputParamList(p1, p2), 69 | ## outputs = OutputParamList(o1), 70 | ## expression = expression) 71 | ## f1 <- tempfile() 72 | ## f2 <- tempfile() 73 | ## file.create(f1, f2) 74 | ## groupFiles$file1 <- f1 75 | ## groupFiles$file2 <- f2 76 | ## r1 <- runCWL(groupFiles, outdir = tempdir()) 77 | ## test_that("ExpressionTool", { 78 | ## expect_true(all(basename(r1$output) %in% 79 | ## c("group", basename(f1), basename(f2)))) 80 | ## }) 81 | 82 | ## extensions and metadata 83 | test_that("extensions", { 84 | ext <- list("$namespaces" = list( 85 | s = "https://schema.org/"), 86 | "s:author" = list( 87 | class = "s:Person", 88 | "s:name" = "Qiang H" 89 | )) 90 | extensions(echo) <- ext 91 | r1 <- runCWL(echo) 92 | writeCWL(echo, prefix = "echo", outdir = tempdir()) 93 | cwlfile <- file.path(tempdir(), "echo.cwl") 94 | 95 | expect_match(tail(r1$logs, 1), "success") 96 | expect_true(all(ext %in% read_yaml(cwlfile))) 97 | }) 98 | 99 | ## test R function 100 | fun1 <- function(x)x*2 101 | testFun <- function(a, b){ 102 | cat(fun1(a) + b^2, sep="\n") 103 | } 104 | assign("fun1", fun1, envir = .GlobalEnv) 105 | assign("testFun", testFun, envir = .GlobalEnv) 106 | p1 <- InputParam(id = "a", type = "int", prefix = "a=", separate = F) 107 | p2 <- InputParam(id = "b", type = "int", prefix = "b=", separate = F) 108 | o1 <- OutputParam(id = "o", type = "File", glob = "rout.txt") 109 | TestFun <- cwlProcess(baseCommand = testFun, 110 | inputs = InputParamList(p1, p2), 111 | outputs = OutputParamList(o1), 112 | stdout = "rout.txt") 113 | TestFun$a <- 1 114 | TestFun$b <- 2 115 | res <- runCWL(TestFun, outdir = tempdir()) 116 | ## test_that("R function", { 117 | ## ## test failed in bioc macos 118 | ## ## expect_equal(readLines(res$output), "6") 119 | ## }) 120 | 121 | -------------------------------------------------------------------------------- /vignettes/cwlShiny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rworkflow/Rcwl/66ed8fb30bf0af6162ddc294a9234ddd6181d925/vignettes/cwlShiny.png --------------------------------------------------------------------------------