Skip to content

Commit

Permalink
Fixed typos and updated license
Browse files Browse the repository at this point in the history
  • Loading branch information
pditommaso committed Jun 14, 2018
1 parent a85e7b9 commit 61e81ab
Show file tree
Hide file tree
Showing 35 changed files with 405 additions and 354 deletions.
19 changes: 19 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2018, Centre for Genomic Regulation (CRG).

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 2 additions & 3 deletions channel-duplication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ You need to you use the same channel as input in two or more processes.

## Solution

Use the [into](https://www.nextflow.io/docs/latest/operator.html#into) operator to create two (or more) copies of the source channel,
then use the new channels as the input of the processes.
Use the [into](https://www.nextflow.io/docs/latest/operator.html#into) operator to create two (or more) copies of the source channel. Then, use the new channels as input for the processes.

## Code

Expand All @@ -29,7 +28,7 @@ process bar {
input: file x from prot2_ch
script:
"""
echo your_command --input $x
your_command --input $x
"""
}
Expand Down
35 changes: 18 additions & 17 deletions channel-duplication/main.nf
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/usr/bin/env nextflow

/*
* Copyright (c) 2018, Centre for Genomic Regulation (CRG).
*
* Copyright (c) 2013-2018, Centre for Genomic Regulation (CRG).
* Copyright (c) 2013-2018, Paolo Di Tommaso and the respective authors.
*
* This file is part of 'Nextflow'.
*
* Nextflow is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Nextflow is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Nextflow. If not, see <http://www.gnu.org/licenses/>.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/*
Expand Down
8 changes: 4 additions & 4 deletions collect-into-file/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Collect into a file
# Collect outputs into a file

## Problem

You need to concatenate into a single file all the outputs an upstream process.
You need to concatenate into a single file all output files produced by an upstream process.

## Solution

Use the [https://www.nextflow.io/docs/latest/operator.html#collectfile] to merge all
upstream output files into a single file.
Use the [collectFile](https://www.nextflow.io/docs/latest/operator.html#collectfile) operator to merge all
the output files into a single file.

## Code

Expand Down
34 changes: 18 additions & 16 deletions collect-into-file/main.nf
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
#!/usr/bin/env nextflo

/*
* Copyright (c) 2013-2018, Centre for Genomic Regulation (CRG).
* Copyright (c) 2013-2018, Paolo Di Tommaso and the respective authors.
* Copyright (c) 2018, Centre for Genomic Regulation (CRG).
*
* This file is part of 'Nextflow'.
*
* Nextflow is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Nextflow is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Nextflow. If not, see <http://www.gnu.org/licenses/>.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/*
Expand Down
6 changes: 3 additions & 3 deletions conditional-process/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ then a third task should post-process the results of the previous execution.
## Solution

Use a [when](https://www.nextflow.io/docs/latest/process.html#when) statement to conditionally
execute the two processes, having each of them to declare two different output channels.
execute two different processes. Each process declares its own output channel.

Then use the [mix](https://www.nextflow.io/docs/latest/operator.html#mix) to create
a new channel that holds the outputs produced by the two process and use it as the input
Then use the [mix](https://www.nextflow.io/docs/latest/operator.html#mix) operator to create
a new channel that will emit the outputs produced by the two processes and use it as the input
for the third process.

## Code
Expand Down
35 changes: 18 additions & 17 deletions conditional-process/main.nf
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/usr/bin/env nextflow

/*
* Copyright (c) 2018, Centre for Genomic Regulation (CRG).
*
* Copyright (c) 2013-2018, Centre for Genomic Regulation (CRG).
* Copyright (c) 2013-2018, Paolo Di Tommaso and the respective authors.
*
* This file is part of 'Nextflow'.
*
* Nextflow is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Nextflow is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Nextflow. If not, see <http://www.gnu.org/licenses/>.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/*
Expand Down
12 changes: 5 additions & 7 deletions feedback-loop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

## Problem

Iterate the execution of one or more processes until a condition
is reached.
You need to repeat the execution of one or more tasks, using the output as the input for a new iteration, until a certain condition is reached.

## Solution

Use the output of the process to iterate over as the input of the same or an upstream process.
Use the output of the last process in the iteration loop as the input for the first process.

To do so, explicitly create the output channel using [Channel.create](https://www.nextflow.io/docs/latest/channel.html#create) function.
To do so, explicitly create the output channel using [Channel.create](https://www.nextflow.io/docs/latest/channel.html#create) method.

Then define the process input as a mix of of the initial input and the
process output to which is applied an [until]() operator defining the
termination condition.
Then define the process input as a [mix](https://www.nextflow.io/docs/latest/operator.html#mix) of the initial input and the
process output to which is applied the [until](https://www.nextflow.io/docs/latest/operator.html#until) operator which defines the termination condition.

## Code

Expand Down
35 changes: 18 additions & 17 deletions feedback-loop/main.nf
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/usr/bin/env nextflow

/*
* Copyright (c) 2018, Centre for Genomic Regulation (CRG).
*
* Copyright (c) 2013-2018, Centre for Genomic Regulation (CRG).
* Copyright (c) 2013-2018, Paolo Di Tommaso and the respective authors.
*
* This file is part of 'Nextflow'.
*
* Nextflow is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Nextflow is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Nextflow. If not, see <http://www.gnu.org/licenses/>.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/*
Expand Down
5 changes: 2 additions & 3 deletions ignore-failing-process/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

## Problem

A process is expected to fail in certain situation. It's required to ignore
the failing process and allows the remaining workflow to complete.
A task is expected to fail in a certain condition. You want to ignore the failure and continue the execution of the remaining tasks in the workflow.

## Solution

Use the `errorStrategy 'ignore'` [directive](https://www.nextflow.io/docs/latest/process.html#errorstrategy) to ignore the error condition.
Use the process [directive](https://www.nextflow.io/docs/latest/process.html#errorstrategy) `errorStrategy 'ignore'` to ignore the error condition.


## Code
Expand Down
35 changes: 18 additions & 17 deletions ignore-failing-process/main.nf
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/usr/bin/env nextflow

/*
* Copyright (c) 2018, Centre for Genomic Regulation (CRG).
*
* Copyright (c) 2013-2018, Centre for Genomic Regulation (CRG).
* Copyright (c) 2013-2018, Paolo Di Tommaso and the respective authors.
*
* This file is part of 'Nextflow'.
*
* Nextflow is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Nextflow is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Nextflow. If not, see <http://www.gnu.org/licenses/>.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/*
Expand Down
25 changes: 24 additions & 1 deletion optional-input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,30 @@ One or more processes have an optional input file.

## Solution

Use a mock file name to simulate the absence of the file parameter.
Use a special file name to mark the absence of the file parameter.

## Code

```nextflow
params.inputs = 'prots/*{1,2,3}.fa'
params.filter = 'NO_FILE'
prots_ch = Channel.fromPath(params.inputs)
opt_file = file(params.filter)
process foo {
input:
file seq from prots_ch
file opt from opt_file
script:
def filter = opt.name != 'NO_FILE' ? "--filter $opt" : ''
"""
your_commad --input $seq $filter
"""
}
```

## Run it

Expand Down
Loading

0 comments on commit 61e81ab

Please sign in to comment.