Skip to content

Commit

Permalink
Improve transpose and groupTuple examples in the docs (#3685) [ci skip]
Browse files Browse the repository at this point in the history
Signed-off-by: Llewellyn vd Berg <113503285+llewellyn-sl@users.noreply.github.com>
Signed-off-by: Marcel Ribeiro-Dantas <mribeirodantas@seqera.io>
Co-authored-by: Llewellyn vd Berg <113503285+llewellyn-sl@users.noreply.github.com>
  • Loading branch information
mribeirodantas and llewellyn-sl committed Mar 10, 2023
1 parent af03f46 commit 7870dfc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 20 deletions.
22 changes: 11 additions & 11 deletions docs/cli.rst
Expand Up @@ -1252,11 +1252,11 @@ facilitates rapid iterations, inspections of any pipeline as well as debugging.
"beta": "foo"
}

Is equivalent to the following command line::
Is equivalent to this command in CLI::

$ nextflow run main.nf --alpha 1 --beta foo

The parameters which are specified through this mechanism are merged with the resolved configuration (base configuration and profiles). The values provided via params file overwrites the ones with the same name in the Nextflow configuration file.
The parameters specified with this mechanism are merged with the resolved configuration (base configuration and profiles). The values provided via a params file overwrite those of the same name in the Nextflow configuration file.

--------------------
self-update
Expand Down Expand Up @@ -1295,7 +1295,7 @@ Update Nextflow. ::
view
--------------------

View a projects script file(s).
View a project's script file(s).

**Usage**

Expand All @@ -1305,8 +1305,8 @@ View a projects script file(s).

**Description**

The ``view`` command is used to inspect the pipelines which are already stored in the global nextflow cache.
For downloading a pipeline into the global cache ``~/.nextflow/assets``, please refer to the ``pull`` command.
The ``view`` command is used to inspect the pipelines that are already stored in the global nextflow cache.
For downloading a pipeline into the global cache ``~/.nextflow/assets``, refer to the ``pull`` command.

**Options**

Expand Down Expand Up @@ -1345,7 +1345,7 @@ Viewing the contents of a downloaded pipeline. ::
Channel.of('Bonjour', 'Ciao', 'Hello', 'Hola') | sayHello | view
}

Listing the folder structure of the downloaded pipeline. ::
List the folder structure of the downloaded pipeline. ::

$ nextflow view -l nextflow-io/hello

Expand All @@ -1360,7 +1360,7 @@ Listing the folder structure of the downloaded pipeline. ::
.travis.yml
main.nf

Viewing the contents of a downloaded pipeline without omitting the header. ::
View the contents of a downloaded pipeline without omitting the header. ::

$ nextflow view -q nextflow-io/hello

Expand Down Expand Up @@ -1388,21 +1388,21 @@ Viewing the contents of a downloaded pipeline without omitting the header. ::
Pipeline parameters
====================

Pipeline script can use an arbitrary number of parameters that can be overridden either
Pipeline scripts can use an arbitrary number of parameters that can be overridden, either
using the command line or the Nextflow configuration file. Any script parameter can be specified
on the command line prefixing the parameter name with double dash characters e.g.::
on the command line, prefixing the parameter name with double dash characters, e.g.::

nextflow run <my script> --foo Hello

Then, the parameter can be accessed in the pipeline script using the ``params.foo`` identifier.

.. note::
When the parameter name is formatted using ``camelCase``, a second parameter
is created with the same value using ``kebab-case``, and the other way around.
is created with the same value using ``kebab-case``, and vice versa.

.. warning::
When a command line parameter includes one or more glob characters, i.e. wildcards like ``*`` or ``?``,
the parameter value needs to be enclosed in quotes to prevent Bash expansion and preserve
the parameter value must to be enclosed in quotes to prevent Bash expansion and preserve
the glob characters. For example::

nextflow run <my script> --files "*.fasta"
39 changes: 30 additions & 9 deletions docs/operator.rst
Expand Up @@ -808,7 +808,15 @@ In other words, the operator transforms a sequence of tuple like *(K, V, W, ..)*
For example::

Channel
.of( [1,'A'], [1,'B'], [2,'C'], [3, 'B'], [1,'C'], [2, 'A'], [3, 'D'] )
.of(
[1, 'A'],
[1, 'B'],
[2, 'C'],
[3, 'B'],
[1, 'C'],
[2, 'A'],
[3, 'D']
)
.groupTuple()
.view()

Expand All @@ -823,7 +831,15 @@ By default the first entry in the tuple is used as grouping key. A different key
grouping by the second value in each tuple::

Channel
.of( [1,'A'], [1,'B'], [2,'C'], [3, 'B'], [1,'C'], [2, 'A'], [3, 'D'] )
.of(
[1, 'A'],
[1, 'B'],
[2, 'C'],
[3, 'B'],
[1, 'C'],
[2, 'A'],
[3, 'D']
)
.groupTuple(by: 1)
.view()

Expand Down Expand Up @@ -1773,19 +1789,24 @@ transpose
The ``transpose`` operator transforms a channel in such a way that the emitted items are the result of a transposition
of all tuple elements in each item. For example::

Channel.of(
['a', ['p', 'q'], ['u','v']],
['b', ['s', 't'], ['x','y']]
Channel
.of(
[1, ['A', 'B', 'C']],
[2, ['C', 'A']],
[3, ['B', 'D']]
)
.transpose()
.view()

The above snippet prints::

[a, p, u]
[a, q, v]
[b, s, x]
[b, t, y]
[1, A]
[1, B]
[1, C]
[2, C]
[2, A]
[3, B]
[3, D]

Available parameters:

Expand Down

0 comments on commit 7870dfc

Please sign in to comment.