Title: | Tidy Common Workflow Language Tools and Workflows |
---|---|
Description: | The Common Workflow Language <https://www.commonwl.org/> is an open standard for describing data analysis workflows. This package takes the raw Common Workflow Language workflows encoded in JSON or 'YAML' and turns the workflow elements into tidy data frames or lists. A graph representation for the workflow can be constructed and visualized with the parsed workflow inputs, outputs, and steps. Users can embed the visualizations in their 'Shiny' applications, and export them as HTML files or static images. |
Authors: | Soner Koc [aut, cre] , Jeffrey Grover [aut] , Nan Xiao [aut] , Dennis Dean [aut] , Seven Bridges Genomics [cph, fnd] |
Maintainer: | Soner Koc <[email protected]> |
License: | AGPL-3 |
Version: | 1.0.7 |
Built: | 2024-11-11 05:00:21 UTC |
Source: | https://github.com/sbg/tidycwl |
Export the workflow plot as HTML
export_html(g, file, ...)
export_html(g, file, ...)
g |
Plot rendered by |
file |
File to save HTML into. |
... |
Additional parameters for |
HTML file path
file_html <- tempfile(fileext = ".html") flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() if (rmarkdown::pandoc_available("1.12.3")) { get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% visualize_graph() %>% export_html(file_html) }
file_html <- tempfile(fileext = ".html") flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() if (rmarkdown::pandoc_available("1.12.3")) { get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% visualize_graph() %>% export_html(file_html) }
Export the workflow plot as PNG, JPEG, or PDF files
export_image(file_html, file_image, ...)
export_image(file_html, file_image, ...)
file_html |
File path to the HTML exported by |
file_image |
File path to the output image.
Should end with |
... |
Additional parameters for |
Image file path
This function uses webshot
to take
a screenshot for the rendered HTML of the graph.
It requires PhantomJS installed in your system.
You can use install_phantomjs
to install it.
if (interactive()) { file_png <- tempfile(fileext = ".png") flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% visualize_graph() %>% export_html(tempfile(fileext = ".html")) %>% export_image(file_png, vwidth = 2000, vheight = 3000, selector = "div.vis-network") }
if (interactive()) { file_png <- tempfile(fileext = ".png") flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% visualize_graph() %>% export_html(tempfile(fileext = ".html")) %>% export_image(file_png, vwidth = 2000, vheight = 3000, selector = "div.vis-network") }
Get CWL version
get_cwl_version(x)
get_cwl_version(x)
x |
CWL object |
CWL version number
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() %>% get_cwl_version() system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% get_cwl_version()
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() %>% get_cwl_version() system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% get_cwl_version()
Get edges in a CWL workflow into a data frame
get_edges(outputs, steps)
get_edges(outputs, steps)
outputs |
Parsed outputs |
steps |
Parsed steps |
Data frame containing edge information
# edges represented by a dictionary flow <- system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() get_edges( flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str() # edges represented by a list try( flow <- system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() ) try( get_edges( flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str() )
# edges represented by a dictionary flow <- system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() get_edges( flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str() # edges represented by a list try( flow <- system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() ) try( get_edges( flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str() )
Get the CWL workflow graph as a list of two data frames: a data frame of nodes and a data frame of edges.
get_graph(inputs, outputs, steps)
get_graph(inputs, outputs, steps)
inputs |
Parsed inputs |
outputs |
Parsed outputs |
steps |
Parsed steps |
List of two data frames containing node and edge information
# sbg:draft2 flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str() # v1.0 flow <- system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str()
# sbg:draft2 flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str() # v1.0 flow <- system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str()
Get ID for inputs
get_inputs_id(inputs)
get_inputs_id(inputs)
inputs |
Parsed inputs |
Vector of input IDs
# inputs represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_inputs() %>% get_inputs_id() # inputs represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_inputs() %>% get_inputs_id()
# inputs represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_inputs() %>% get_inputs_id() # inputs represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_inputs() %>% get_inputs_id()
Get label for inputs
get_inputs_label(inputs)
get_inputs_label(inputs)
inputs |
Parsed inputs |
Vector of input labels
# inputs represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_inputs() %>% get_inputs_label() # inputs represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_inputs() %>% get_inputs_label()
# inputs represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_inputs() %>% get_inputs_label() # inputs represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_inputs() %>% get_inputs_label()
Get nodes in a CWL workflow into a data frame
get_nodes(inputs, outputs, steps)
get_nodes(inputs, outputs, steps)
inputs |
Parsed inputs |
outputs |
Parsed outputs |
steps |
Parsed steps |
Data frame containing node information
flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() get_nodes( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str()
flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() get_nodes( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% str()
Get ID for outputs
get_outputs_id(outputs)
get_outputs_id(outputs)
outputs |
Parsed outputs |
Vector of output IDs
# inputs represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_outputs() %>% get_outputs_id() # inputs represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_outputs() %>% get_outputs_id()
# inputs represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_outputs() %>% get_outputs_id() # inputs represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_outputs() %>% get_outputs_id()
Get label for outputs
get_outputs_label(outputs)
get_outputs_label(outputs)
outputs |
Parsed outputs |
Vector of output labels
# inputs represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_outputs() %>% get_outputs_label() # inputs represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_outputs() %>% get_outputs_label()
# inputs represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_outputs() %>% get_outputs_label() # inputs represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_outputs() %>% get_outputs_label()
Get documentation/description for steps
get_steps_doc(steps)
get_steps_doc(steps)
steps |
Steps object parsed by |
Vector of step documentation/descriptions
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_doc() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_doc()
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_doc() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_doc()
Get ID for steps
get_steps_id(steps)
get_steps_id(steps)
steps |
Steps object parsed by |
Vector of step IDs
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_id() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_id()
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_id() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_id()
Get label for steps
get_steps_label(steps)
get_steps_label(steps)
steps |
Steps object parsed by |
Vector of step labels
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_label() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_label()
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_label() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_label()
Get revision number for steps
get_steps_revision(steps)
get_steps_revision(steps)
steps |
Steps object parsed by |
Vector of step revision numbers
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_revision() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_revision()
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_revision() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_revision()
Get toolkit version for steps
get_steps_version(steps)
get_steps_version(steps)
steps |
Steps object parsed by |
Vector of step toolkit versions
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_version() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_version()
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% get_steps_version() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% get_steps_version()
Is this a CWL object?
is_cwl(x)
is_cwl(x)
x |
any object |
Logical. TRUE
if it is a CWL object, FALSE
if not.
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_cwl()
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_cwl()
Is this CWL draft2?
is_draft2(x)
is_draft2(x)
x |
CWL object |
Logical. TRUE
if it is a CWL draft2 object, FALSE
if not.
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_draft2() system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_draft2()
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_draft2() system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_draft2()
Is this a CWL command line tool?
is_tool(x)
is_tool(x)
x |
CWL object |
Logical. TRUE
if it is a CWL command line tool
(instead of a workflow), FALSE
if not.
system.file("cwl/sbg/tool/bwa-mem.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_tool() system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_tool()
system.file("cwl/sbg/tool/bwa-mem.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_tool() system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_tool()
Is this CWL v1.0?
is_v1.0(x)
is_v1.0(x)
x |
CWL object |
Logical. TRUE
if it is a CWL v1.0 object, FALSE
if not.
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_v1.0() system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_v1.0()
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_v1.0() system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_v1.0()
Is this CWL v1.1?
is_v1.1(x)
is_v1.1(x)
x |
CWL object |
Logical. TRUE
if it is a CWL v1.1 object, FALSE
if not.
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_v1.1()
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_v1.1()
Is this a CWL workflow?
is_workflow(x)
is_workflow(x)
x |
CWL object |
Logical. TRUE
if it is a CWL workflow
(instead of a command line tool), FALSE
if not.
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_workflow() system.file("cwl/sbg/tool/bwa-mem.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_workflow()
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_workflow() system.file("cwl/sbg/tool/bwa-mem.json", package = "tidycwl") %>% read_cwl(format = "json") %>% is_workflow()
Parse a CWL workflow and return the metadata, inputs, outputs, and steps in a list.
parse_cwl(x)
parse_cwl(x)
x |
CWL object |
List of CWL metadata, inputs, outputs, and steps
system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_cwl() %>% names()
system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_cwl() %>% names()
Parse the inputs of the CWL workflow into a data frame
parse_inputs(x, simplify = TRUE)
parse_inputs(x, simplify = TRUE)
x |
CWL object |
simplify |
Simplify the list as a data frame? |
List or data frame of inputs
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_inputs() %>% names() system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_inputs() %>% names()
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_inputs() %>% names() system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_inputs() %>% names()
Parse the metadata in the CWL workflow
parse_meta(x)
parse_meta(x)
x |
CWL object |
List of CWL metadata
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% parse_meta()
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% parse_meta()
Parse the outputs of the CWL workflow into a data frame
parse_outputs(x, simplify = TRUE)
parse_outputs(x, simplify = TRUE)
x |
CWL object |
simplify |
Simplify the list as a data frame? |
List or data frame of outputs
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_outputs() %>% names() system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_outputs() %>% names()
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_outputs() %>% names() system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_outputs() %>% names()
Parse the steps of the CWL workflow into a data frame
parse_steps(x)
parse_steps(x)
x |
CWL object |
List or data frame of steps
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% nrow() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% length()
# steps represented by a dictionary system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json() %>% parse_steps() %>% nrow() # steps represented by a list system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml() %>% parse_steps() %>% length()
Parse CWL content type
parse_type(x)
parse_type(x)
x |
CWL object |
CWL content type (Workflow or CommandLineTool)
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% parse_type() system.file("cwl/sbg/tool/bwa-mem.json", package = "tidycwl") %>% read_cwl(format = "json") %>% parse_type()
system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl(format = "json") %>% parse_type() system.file("cwl/sbg/tool/bwa-mem.json", package = "tidycwl") %>% read_cwl(format = "json") %>% parse_type()
Print a brief summary of the CWL object.
## S3 method for class 'cwl' print(x, ...)
## S3 method for class 'cwl' print(x, ...)
x |
An object of class |
... |
Additional parameters for |
The input cwl
object.
path <- system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") flow <- read_cwl(path, format = "json") flow
path <- system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") flow <- read_cwl(path, format = "json") flow
Read a CWL file into a list
read_cwl(file, format = c("json", "yaml"))
read_cwl(file, format = c("json", "yaml"))
file |
A file path, character string, or connection. |
format |
CWL storage format. |
List representation of the input CWL
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl(format = "json") system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl(format = "yaml")
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl(format = "json") system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl(format = "yaml")
Read a CWL file (JSON format) into a list
read_cwl_json(file)
read_cwl_json(file)
file |
A file path, JSON string, or connection. |
List representation of the input CWL
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json()
system.file("cwl/sbg/workflow/rnaseq-salmon.json", package = "tidycwl") %>% read_cwl_json()
Read a CWL file (YAML format) into a list
read_cwl_yaml(file)
read_cwl_yaml(file)
file |
A file path, YAML string, or connection. |
List representation of the input CWL
system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml()
system.file("cwl/sbg/workflow/rnaseq-salmon.cwl", package = "tidycwl") %>% read_cwl_yaml()
Output and renderer functions for using tidycwl within Shiny apps and interactive R Markdown documents.
cwl_output(outputId, width = "100%", height = "600px") render_cwl(expr, env = parent.frame(), quoted = FALSE)
cwl_output(outputId, width = "100%", height = "600px") render_cwl(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width , height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a CWL graph |
env |
The environment in which to evaluate |
quoted |
Is |
An output or render function that enables the use of the widget within Shiny apps.
if (interactive()) { library("shiny") library("tidycwl") cwl_folder <- system.file("cwl/sbg/workflow/", package = "tidycwl") file_all <- list.files(cwl_folder) cwl_name <- file_all[which(tools::file_ext(file_all) == "json")] ui <- fluidPage( selectInput("cwl_file", "Select a CWL file:", cwl_name), cwl_output("cwl_plot", height = "800px") ) server <- function(input, output, session) { output$cwl_plot <- render_cwl({ flow <- paste0(cwl_folder, input$cwl_file) %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% visualize_graph() }) } shinyApp(ui, server) }
if (interactive()) { library("shiny") library("tidycwl") cwl_folder <- system.file("cwl/sbg/workflow/", package = "tidycwl") file_all <- list.files(cwl_folder) cwl_name <- file_all[which(tools::file_ext(file_all) == "json")] ui <- fluidPage( selectInput("cwl_file", "Select a CWL file:", cwl_name), cwl_output("cwl_plot", height = "800px") ) server <- function(input, output, session) { output$cwl_plot <- render_cwl({ flow <- paste0(cwl_folder, input$cwl_file) %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% visualize_graph() }) } shinyApp(ui, server) }
Visualize the CWL workflow
visualize_graph( g, hierarchical = TRUE, direction = "LR", separation = 300, palette = c("#C3C3C3", "#FF8F00", "#00AAA8"), width = "100%", height = 600 )
visualize_graph( g, hierarchical = TRUE, direction = "LR", separation = 300, palette = c("#C3C3C3", "#FF8F00", "#00AAA8"), width = "100%", height = 600 )
g |
Graph generated by |
hierarchical |
Enable the hierarchical layout? Default is |
direction |
Direction of the hierarchical layout.
Options include |
separation |
Level separation parameter from
|
palette |
Three-color palette for inputs, outputs, and steps. |
width |
Canvas width, see |
height |
Canvas height, see |
A visNetwork
output.
flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% visualize_graph()
flow <- system.file("cwl/sbg/workflow/gatk4-wgs.json", package = "tidycwl") %>% read_cwl_json() get_graph( flow %>% parse_inputs(), flow %>% parse_outputs(), flow %>% parse_steps() ) %>% visualize_graph()