Coder Social home page Coder Social logo

wdltools's Introduction

WDL Scala Tools

Scala programming language library for parsing WDL, and command-line tools for type-checking, code formatting, and more.

Abstract Syntax Tree (AST)

The wdlTools.syntax package implements an abstract syntax tree (AST) for WDL. It uses Antlr4 grammar developed by Patrick Magee. The class definitions reside in src/main/scala/wdlTools/syntax/AbstractSyntax.scala.

Currently, WDL draft-2 and 1.0 are fully supported, and development/2.0 is partially supported.

import wdlTools.syntax.AbstractSyntax._
import wdlTools.syntax.Parsers
import wdlTools.util.{FileSource, FileSourceResolver}
val parsers = Parsers(followImports = true)
val wdl: FileSource = FileSourceResolver.get.resolve("file:///path/to/my/wdl")
val doc: Document = parsers.parseDocument(wdl)
// print the source locations of all tasks in the document
doc.elements.foreach {
  case task: Task => println(s"Task ${task.name} is at ${task.loc}")
}

Command line tools

The wdlTools JAR also provides various command line tools to accelerate and simplify the development of WDL workflows. You can get help by running:

$ java -jar wdlTools.jar [command] --help

The following commands are currently available. They should be considered "alpha" quality - please report any bugs/enhancements using the issue tracker.

  • check: type-check a WDL file
  • docgen: generate documentation for WDL tasks/workflows
  • format: reformat a WDL file
  • lint: detect "lint" (i.e. incorrect style or potentially problematic code) in a WDL file
  • new: generate a new WDL project
  • printTree: print the Abstract Syntax Tree for a WDL document
  • readmes: generate README files for the tasks/workflows in a WDL file - these files are named so that they will be recognized when building DNAnexus apps/workflows using dxWDL
  • upgrade: upgrade a WDL file to a newer version; currently only draft-2 -> 1.0 is supported

Building

The java code for the parser is generated by the ANTRL4 tool.

  1. Download a jar file with the instructions
  2. cd GIT_REPO
  3. Assuming you downloaded the jar file to $HOME/antlr-4.8-complete.jar generated java code from the grammar by running make from the toplevel.
  4. Build the scala code:
    sbt compile
    
  5. Run the tests:
    sbt test
    

See the documentation for full details.

Support

wdlTools is not an official product of DNAnexus. Please do not contact DNAnexus (or any employees thereof) for support. To report a bug or feature request, please open an issue in the issue tracker.

wdltools's People

Contributors

jdidion avatar orodeh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.