Skip to content
/ cwl-svg Public

A library for generating an interactive SVG visualization of CWL workflows

License

Notifications You must be signed in to change notification settings

rabix/cwl-svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
infinity
Jul 2, 2024
5820e19 · Jul 2, 2024
Sep 7, 2022
Jan 17, 2023
Mar 1, 2017
Apr 19, 2017
Jun 21, 2024
Apr 28, 2017
Nov 9, 2017
Oct 11, 2022
Dec 22, 2017
Jul 2, 2024
Jul 17, 2020
Jun 4, 2018
Feb 12, 2017
Sep 7, 2022
Nov 7, 2017
Oct 6, 2017
Apr 19, 2018
Jul 2, 2024
Jul 2, 2024
Aug 22, 2022
Oct 31, 2017
Aug 9, 2022
Oct 5, 2017
Oct 17, 2017
Jan 9, 2018

Repository files navigation

CWL-SVG

CircleCI npm version

CWL-SVG is a Typescript library for visualization of Common Workflow Language workflows

Citation

CWL-SVG: an open-source workflow visualization library for the 
Common Workflow Language. Seven Bridges/Rabix (2017)  
Available from https://github.com/rabix/cwl-svg

Installation

npm install cwl-svg

Standalone Demo

git clone https://github.com/rabix/cwl-svg
cd cwl-svg
npm install
npm start
// Point browser to http://localhost:8080

Integration

<html>
<head>
    <style>
        #svg {
            width: 100%;
            height: 100%;
            position: absolute;
        }
    </style>
</head>

<body>

<!-- You need to add “cwl-workflow” class to the SVG root for cwl-svg rendering -->
<svg id="svg" class="cwl-workflow"></svg>

<!-- Add compiled scripts, however they get compiled -->
<script src="dist/bundle.js"></script>

</body>
</html>
// Content of src/demo.ts

// Dark theme
import "./assets/styles/themes/rabix-dark/theme";
import "./plugins/port-drag/theme.dark.scss";
import "./plugins/selection/theme.dark.scss";

// Light theme
// import "./assets/styles/theme";
// import "./plugins/port-drag/theme.scss";
// import "./plugins/selection/theme.scss";

import {WorkflowFactory}    from "cwlts/models";
import {Workflow}           from "./graph/workflow";
import {SVGArrangePlugin}   from "./plugins/arrange/arrange";
import {SVGNodeMovePlugin}  from "./plugins/node-move/node-move";
import {SVGPortDragPlugin}  from "./plugins/port-drag/port-drag";
import {SelectionPlugin}    from "./plugins/selection/selection";
import {SVGEdgeHoverPlugin} from "./plugins/edge-hover/edge-hover";
import {ZoomPlugin}         from "./plugins/zoom/zoom";

const sample = require(__dirname + "/../cwl-samples/rna-seq-alignment.json");

const wf = WorkflowFactory.from(sample);

const svgRoot = document.getElementById("svg") as any;

const workflow = new Workflow({
    model: wf,
    svgRoot: svgRoot,
    plugins: [
        new SVGArrangePlugin(),
        new SVGEdgeHoverPlugin(),
        new SVGNodeMovePlugin({
            movementSpeed: 10
        }),
        new SVGPortDragPlugin(),
        new SelectionPlugin(),
        new ZoomPlugin(),
    ]
});

// workflow.getPlugin(SVGArrangePlugin).arrange();
window["wf"] = workflow;

Preview

Overview

Arranged and scaled BCBio workflow

Selection

Selection and Highlighting

Movement

Movement

Connection

Connecting Nodesd