common-workflow-library / legacy

Deprecated
https://github.com/common-workflow-library/bio-cwl-tools
Apache License 2.0
100 stars 62 forks source link

first try #2

Closed lindenb closed 9 years ago

lindenb commented 9 years ago

Hi Peter, thank your for your help.

My current interest is to translate my Makefile-based workflows to other engines. So my first idea is to just implement a minimal workflow, something like:

.PHONY: all
all: hello.txt
hello.txt:
    echo "Hello" > hello.txt

my attempt so far:

#!/usr/bin/env cwl-runner

- id: "#echocmd"
  class: CommandLineTool
  inputs:
    - id: "#echo-in"
      type: string
      label: "Message"
      description: "The message to print"
      default: "Hello World"
  outputs:
    - id: "#echo-out"
      type: File
      label: "Printed Message"
      description: "The file containing the message"
      outputBinding:
        glob: messageout.txt
  baseCommand: echo
  stdout: messageout.txt

- id: "#main"
  class: Workflow
  label: "Hello World"
  description: "Puts a message into a file using echo"
  inputs: []
  outputs:
    - id: "#main.output"
      type: File
      source: "#param.output"
  steps :
    - id: "#step0"
      run: {import: "#echocmd"}
      inputs: []
      outputs:
        - { id: "#main.output" }

(well I tried a few variations of this, without success...) The specification is quite large, and honestly, I didn't read/understand the whole document.

How can I make it run please ? :-)

Of course, don't accept this pull request for now. :-)

While I'm here:

   shell: /bin/bash
    baseCommand: " echo \"A'\  | tr 'A' B' | grep B "

Thank you for your help,

Pierre

tetron commented 9 years ago

You are pretty close, just a few changes:

Here's the fixed up version:

#!/usr/bin/env cwl-runner

- id: "#echocmd"
  class: CommandLineTool
  inputs:
    - id: "#echo-in"
      type: string
      label: "Message"
      description: "The message to print"
      default: "Hello World"
      inputBinding: {}
  outputs:
    - id: "#echo-out"
      type: File
      label: "Printed Message"
      description: "The file containing the message"
      outputBinding:
        glob: messageout.txt
  baseCommand: echo
  stdout: messageout.txt

- id: "#main"
  class: Workflow
  label: "Hello World"
  description: "Puts a message into a file using echo"
  inputs: []
  outputs:
    - id: "#main.output"
      type: File
      source: "#echocmd.echo-out"
  steps :
    - id: "#step0"
      run: {import: "#echocmd"}
      inputs: []
      outputs:
        - { id: "#echocmd.echo-out" }
lindenb commented 9 years ago

:+1: thanks; I'll update the code on monday

lindenb commented 9 years ago

OK, I've updated my cwl, It's working now , thanks ! :-)

lindenb commented 9 years ago

10H23: added a second example hello-param.cwl with parameters.

mr-c commented 9 years ago

I like this. @lindenb do you mind if I merge it in?

lindenb commented 9 years ago

@mr-c yes, you can merge :-)

I've got some other questions/test-cases. I'll ask for help in another pull-request.

Thanks

mr-c commented 9 years ago

My pleasure!