Export the workflow plot as PNG, JPEG, or PDF files

export_image(file_html, file_image, ...)

Arguments

file_html

File path to the HTML exported by export_html.

file_image

File path to the output image. Should end with .png, .pdf, or .jpeg.

...

Additional parameters for webshot.

Value

Image file path

Note

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.

Examples

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")
}