How to use cwlts - 10 common examples

To help you get started, we’ve selected a few cwlts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rabix / composer / src / app / tool-editor / sections / base-command-editor / base-command-editor.component.ts View on Github external
this.modal.delete("Base Command").then(() => {

            // Reset the expression's validity
            // @TODO: if this is an ExpressionModel, model won't revalidate when an entry is removed
            const entryAtIndex = this.formControl.at(index).value;

            if (entryAtIndex instanceof ExpressionModel) {
                entryAtIndex.clearIssue(ErrorCode.EXPR_ALL);
            }

            this.formControl.removeAt(index);
            this.cdr.markForCheck();
        }, err => {
            console.warn(err);
github rabix / composer / src / app / editor-common / components / secondary-files / secondary-files.component.ts View on Github external
this.modal.delete("secondary file").then(() => {
            // Reset the expression's validity
            const entryAtIndex = this.formControl.at(index).value;

            if (entryAtIndex) {
                entryAtIndex.clearIssue(ErrorCode.EXPR_ALL);
            }

            this.formControl.removeAt(index);
            this.cdr.markForCheck();
        }, err => {
            console.warn(err);
github rabix / composer / src / app / tool-editor / sections / base-command / base-command-list / base-command-list.component.ts View on Github external
this.modal.delete("base command").then(() => {
            // reset the expression's validity
            this.baseCommand[i].clearIssue(ErrorCode.EXPR_ALL);
            (this.form.get("list") as FormArray).removeAt(i);
        }, err => {
            console.warn(err);
github rabix / cwl-svg / src / demo.ts View on Github external
// 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(),
    ]
github rabix / composer / src / app / workflow-editor / graph-editor / graph-editor / workflow-graph-editor.component.ts View on Github external
).subscribeTracked(this, () => {

            this.modelChangedFromHistory = WorkflowFactory.from(this.workflowEditorService.historyRedo(this.model));

            // Resets the reference of inspected node (reference is lost after model serialization)
            this.resetInspectedNodeReference();

            this.modelChange.next(this.modelChangedFromHistory);
        });
github rabix / composer / src / app / workflow-editor / graph-editor / graph-editor / workflow-graph-editor.component.ts View on Github external
).subscribeTracked(this, () => {

            this.modelChangedFromHistory = WorkflowFactory.from(this.workflowEditorService.historyUndo(this.model));

            // Resets the reference of inspected node (reference is lost after model serialization)
            this.resetInspectedNodeReference();

            this.modelChange.next(this.modelChangedFromHistory);
        });
github rabix / composer / src / app / tool-editor / tool-editor.component.ts View on Github external
switchTab(tabName): void {
        super.switchTab(tabName);

        if (this.jobSubscription) {
            this.jobSubscription.unsubscribe();
            this.jobSubscription = null;
        }

        if (!this.dataModel) return;

        if (tabName === "test") {
            // create the workflow model that will be displayed on the test tab
            this.workflowWrapper = WorkflowFactory.from({cwlVersion: this.dataModel.cwlVersion} as any);
            // add this tool as its only step
            const step = this.workflowWrapper.addStepFromProcess(this.dataModel.serialize());
            /**
             * Adding a step sometimes generates a different id for that step than that of an app that it was made from.
             * On graph job representation, step progress plugin knows about tool id, and will try to update execution state on it.
             * If this representation has a different id, they will not match and step will not be found on the SVG.
             * This is a place to fix that since this workflow is not a source of truth for the data, but just a utility
             * to help us render a graph, so just patch the ID to ensure that it's exactly what we expect to find.
             *
             * However, ID is not required by CWL, so this applies only if dataModel has one.
             */
            if (this.dataModel.id) {
                this.workflowWrapper.changeStepId(step, this.dataModel.id);
            }

            // iterate through all inputs of the tool
github rabix / composer / src / app / services / javascript-eval / javascript-eval.service.ts View on Github external
this.iFrame = document.createElement("iframe");

        const perm                = ["allow-same-origin", "allow-scripts"];
        this.iFrame.style.display = "none";
        this.iFrame.sandbox       = perm.join(" ");

        this.iFrame.onload = () => {
            this.iFrame.contentWindow.document.open("text/html", "replace");
            this.iFrame.contentWindow.document.write(this.iframeContent());
            this.iFrame.contentWindow.document.close();
        };

        document.body.appendChild(this.iFrame);

        // FIXME We have to improve this
        ExpressionEvaluator.evaluateExpression = this.evaluateCode.bind(this);
    }
github rabix / composer / src / app / tool-editor / tool-editor.component.ts View on Github external
this.workflowWrapper.steps[0].in.forEach((input: WorkflowStepInputModel) => {

                if (isType(input, ["File", "Directory"])) {
                    // create inputs from file ports
                    this.workflowWrapper.createInputFromPort(input);
                } else {
                    // everything else should be exposed (show up in the step inspector)
                    this.workflowWrapper.exposePort(input);
                }
            });
github rabix / composer / src / app / editor-common / cwl-schema-validation-worker / cwl-schema-validation-worker.service.ts View on Github external
isValidatableCWL: boolean;
    isValidCWL: boolean;
    isValidJSON: boolean;
    errors: Issue[];
    warnings: Issue[];
    class?: string | "CommandLineTool" | "Workflow" | "ExpressionTool";
}

@Injectable()
export class CwlSchemaValidationWorkerService {

    private worker: WebWorker;

    private draft4;

    private cwlSchema = cwlSchemas.schemas.mixed;


    constructor(private workerBuilder: WebWorkerBuilderService) {

        this.worker = this.workerBuilder.create(this.workerFunction, [
            "ajv.min.js",
            "js-yaml.min.js"
        ], {
            cwlSchema: this.cwlSchema,
            // FIXME: will not work in browser, window.require call
            draft4: {
                "id": "http://json-schema.org/draft-04/schema#",
                "$schema": "http://json-schema.org/draft-04/schema#",
                "description": "Core schema meta-schema",
                "definitions": {
                    "schemaArray": {