Skip to content

Commit

Permalink
Merge branch 'master' of github.com:paoloditommaso/nextflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pditommaso committed Feb 16, 2014
2 parents fd37bc1 + 7579d9a commit e0f0445
Show file tree
Hide file tree
Showing 9 changed files with 402 additions and 120 deletions.
7 changes: 7 additions & 0 deletions docs/doctests/choice.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source = Channel.from 'Hello world', 'Hola', 'Hello John'
queue1 = Channel.create()
queue2 = Channel.create()

source.choice(queue1, queue2) { a -> a =~ /^Hello.*/ ? 0 : 1 }

queue1.subscribe { println it }
16 changes: 16 additions & 0 deletions docs/doctests/count.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Channel
.from(4,1,7,1,1)
.count(1)
.subscribe { println "literal $it" }
// -> 3

Channel
.from('a','c','c','q','b')
.count ( ~/c/ )
.subscribe { println "regexp: $it" }
// -> 2

Channel
.from('a','c','c','q','b')
.count { it <= 'c' }
.subscribe { println "predicate: $it" }
5 changes: 5 additions & 0 deletions docs/doctests/cross.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

source = Channel.from( [1, 'alpha'], [2, 'beta'] )
target = Channel.from( [1, 'x'], [1, 'y'], [1, 'z'], [2,'p'], [2,'q'], [2,'t'] )

target.cross(source).subscribe { println it }
9 changes: 9 additions & 0 deletions docs/doctests/route.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
r1 = Channel.create()
r2 = Channel.create()
r3 = Channel.create()

Channel
.from('hello','ciao','hola', 'hi', 'x', 'bonjour')
.route ( b: r1, c: r2, h: r3 ) { it[0] }

r3.subscribe { println it }
9 changes: 9 additions & 0 deletions docs/doctests/sepa.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
queue1 = Channel.create()
queue2 = Channel.create()

Channel
.from ( 2,4,8 )
.separate( queue1, queue2 ) { a -> [a+1, a*a] }

queue1.subscribe { println "Channel 1: $it" }
queue2.subscribe { println "Channel 2: $it" }
4 changes: 4 additions & 0 deletions docs/doctests/sum.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Channel
.from( 4, 1, 7, 5 )
.sum { it * it }
.subscribe { println "Square: $it" }

0 comments on commit e0f0445

Please sign in to comment.