Sie sind auf Seite 1von 24

Tap Workflows

x c

x1 y b c1

x2 y1 z a ? b1 c2
Tap (Task Application)

Framework for command line apps

Configurations, Documentation, Distribution

Workflows: sequence, fork, merge, sync


merge, switch
Workflows

a --: b --: c

Think of a, b, c as methods
(literally they are)
Sequence

a --: b --: c

result_a = a(input)
result_b = b(result_a)
result_c = c(result_b)
Fork

--a[b, c]

result_a = a(input)
result_b = b(result_a)
result_c = c(result_a)
Merge

--c{a,b}

result_a = a(input)
result_b = b(input)
result_c = c(result_a, result_b)
Variations
a --:i b

a(input).each do |result_a| # i<terate>


b(result_a)
end

a --:s b

b(*a(input)) # s<plat>
Variations
a --:i b --:a c

results_b = []
a(input).each do |result_a| # i<terate>
results_b << b(result_a) # a<ggregate>
end

c(*results_b)
Tap Workflows

Build workflows from command line

Get behavior like in a script


Think about |

% git diff | mate

Pipe is just a sequence

Serves us well... but it’s just a sequence


Example

Digest: splits a protein sequence

Fragment: numerical transform on substrings

Format Mfg: formats results as .mgf


Desired Workflow

(protein) - <digest> - [peptides...]

(peptide) - <fragment> - [data, headers]

(data, headers) - <mgf> - string

digest --:i fragment --:s mgf


Fragment
Fragment
Fragment
Demo

% tap run -- fragment --help


% rap fragment --help
% rap fragment PEPTIDE
% rap fragment PEPTIDE --: dump
% rap digest PROTEIN --: dump
% rap digest PROTEIN --:i fragment --: dump
% rap digest PROTEIN --:i fragment --:a dump
% rap digest PROTEIN --:i fragment --:s format_mgf
--:a dump
Demo
% rap digest PROTEIN --:i fragment --
format_mgf -- format_mgf --mz-precision 2 --
dump --no-audit --no-yaml --1[2,3]s “--4{2,3}a”

<workflow.yml>
- [digest, PROTEIN]
- [fragment]
- [format_mgf]
- [format_mgf, --mz-precision, 2]
- [dump, --no-audit, --no-yaml]
- 0:1i
- 1[2,3]s
- 4{2,3}a
Why is this good?

Tasks are distributable as gems

Encapsulation/Reuse

Structured enough for novel interfaces


Tap-Server

Alpha alpha alpha

Tasks and Workflows in the browser

Immediate, easy interface for new users


(customers, friends)

Simple Distributable Controllers


Demo
% tap server

http://localhost:8080/

http://localhost:8080/schema

% tap run <schema>

http://localhost:8080/capture/tutorial

% rap load <request.yml> --: tap-http:submit


Demo Summary

All happens in tap-server

Install a gem, get local controllers... tutorials,


gui, etc.

Potential for interaction with web data

Potential to use browser as task interface


Goodies...

Rap - rakish syntax for declaring tasks


Rap.task :sample, :one, :key => ‘value’ do |task, args|
task.key # => ‘value’
args.one # => 1 (% rap sample 1)
end

Lazydoc - pull comments into object space

Configurable - class-based configs mapping to


command line
Gotchas

Discovering tasks

Task documentation must have ‘::manifest’

tap.yml - used in pwd to manually specify


which gems to include; package with gem
to allow autodiscovery of gem tasks

Rap tasks don’t package, pass results, or


appear in tap-server. Local tasks only.
tap.rubyforge.org

Das könnte Ihnen auch gefallen