Skip to content

Commit

Permalink
fix prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVCaron committed Dec 11, 2024
1 parent 6db6a88 commit acba952
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 40 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,22 @@ Well, it depends on what you want to do. If you want to :

- **Learn about the modules and subworkflows** in `nf-neuro`, go to the [discovery](#discovering-nf-neuro) section.
- **Create a new pipeline quickly**, using **modules** and **subworkflows** from `nf-neuro`, go to the
[prototyping](./docs/PROTOTYPING.md#basic-prototype-pipeline-creation) section.
[prototyping](./docs/PROTOTYPING.md#basic-prototype-pipeline-creation) section.
- **Create or publish a production pipeline** branded with `nf-neuro`, go to the
[porting prototypes](./docs/PRODUCTION.md#porting-prototypes-to-nf--ready-pipelines) section.
- **Contribute new modules and subworkflows** to `nf-neuro`, go to the
[contribution](#contributing-to-the-nf-neuro-project) section.

---

* [Discovering `nf-neuro`](#discovering-nf-neuro)
* [Getting info on components from `nf-neuro`](#getting-info-on-components-from-nf-neuro)
* [Using the information from the `info` command](#using-the-information-from-the-info-command)
* [Pipeline creation with `nf-neuro`](#pipeline-creation-with-nf-neuro)
* [Prototyping using components from `nf-neuro`](#prototyping-using-components-from-nf-neuro)
* [Porting prototypes to `nf-` ready pipelines](#porting-prototypes-to-nf--ready-pipelines)
* [Contributing to the `nf-neuro` project](#contributing-to-the-nf-neuro-project)
* [Running tests](#running-tests)

- [Discovering `nf-neuro`](#discovering-nf-neuro)
- [Getting info on components from `nf-neuro`](#getting-info-on-components-from-nf-neuro)
- [Using the information from the `info` command](#using-the-information-from-the-info-command)
- [Pipeline creation with `nf-neuro`](#pipeline-creation-with-nf-neuro)
- [Prototyping using components from `nf-neuro`](#prototyping-using-components-from-nf-neuro)
- [Porting prototypes to `nf-` ready pipelines](#porting-prototypes-to-nf--ready-pipelines)
- [Contributing to the `nf-neuro` project](#contributing-to-the-nf-neuro-project)
- [Running tests](#running-tests)

---

Expand Down Expand Up @@ -189,7 +188,6 @@ PREPROC_T1.out.versions.first().view() // [ "versions.yml" ]

## [Porting prototypes to `nf-` ready pipelines](./docs/PRODUCTION.md)


# Contributing to the `nf-neuro` project

> [!IMPORTANT]
Expand Down
22 changes: 16 additions & 6 deletions docs/PROTOTYPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
> First, follow the [prototyping guide](./docs/environment/PROTOTYPING.md) to setup your
> `development environment` or check if your current one meets the requirements.
* [Prototyping using components from `nf-neuro`](#prototyping-using-components-from-nf-neuro)
* [Basic prototype pipeline creation](#basic-prototype-pipeline-creation)
* [`main.nf`](#mainnf)
* [`main.nf` example](#mainnf-example)
* [`nextflow.config`](#nextflowconfig)

- [Prototyping using components from `nf-neuro`](#prototyping-using-components-from-nf-neuro)
- [Basic prototype pipeline creation](#basic-prototype-pipeline-creation)
- [`main.nf`](#mainnf)
- [`main.nf` example](#mainnf-example)
- [`nextflow.config`](#nextflowconfig)

## Basic prototype pipeline creation

To create a prototype pipeline (for personal use or testing), you will need to create a couple of files in addition to the `nf-neuro` modules/subworkflows. First, create those files at the root of your pipeline:

```
nextflow.config
main.nf
```

The `nextflow.config` file will contain your parameters for your pipeline execution that can be supplied as arguments when calling the pipeline (ex: `nextflow run main.nf --argument1 true`). The `main.nf` file will contain your pipeline. Let's take a look at this one first.

### `main.nf`
Expand Down Expand Up @@ -70,11 +71,15 @@ data.t1.view() // Contains your anatomical data (T1 in this case): [meta, [t1]]
```

Now, you can install the modules you want to include in your pipeline. Let's import the `denoising/nlmeans` module for T1 denoising. To do so, simply install it using the `nf-core modules install` command.

```bash
nf-core modules install denoising/nlmeans
```

To use it in your pipeline, you need to import it at the top of your `main.nf` file. You can do it using the `include { YOUR_NAME } from ../path/main.nf` statement. Then, you can add it to your pipeline and feed your inputs to it! To have a look at which files are required to run the module, use the `nf-core modules info <your/module>` command. A complete example (e.g., fetching the inputs, importing the module, and supplying the inputs to the modules) can be seen below:

#### `main.nf` example

```nextflow
include { DENOISING_NLMEANS } from './modules/nf-neuro/denoising/nlmeans/main.nf'
workflow get_data {
Expand Down Expand Up @@ -127,28 +132,33 @@ NEXT_MODULE( ch_nextmodule )
### `nextflow.config`

You now have a working `main.nf` file, but you did not specified any parameters to your pipeline yet. Let's do this using the `nextflow.config` file. First, you will want to define your publish directory options (where your files will be outputted). You can add those lines to the beginning of your `nextflow.config`:

```nextflow
process {
publishDir = {"${params.output_dir}/$meta.id/${task.process.replaceAll(':', '-')}"}
}
```

Once this is done, you might want to supply parameters for some of your modules that could be modified when calling the pipeline, you can add them under the `params` flag. To know which parameters are accepted in your modules, refer to the `main.nf` of the specific `nf-neuro` module. `denoising/nlmeans` takes 1 possible parameter: `number_of_coils`. By defining it as below, we will be able to modify its value during the pipeline call using `--number_of_coils 1`.

```nextflow
params{
input = false // This will be used to supply your input directory, using --input folder/
// ** Denoising nlmeans parameters ** //
number_of_coils = 1
}
```

The last step is to bind your parameters to the specific module they are meant for. This can be done by explicitly stating the modules, and attaching the parameters to the appropriate `task.ext`. To do this, add those lines for each of your modules in your `nextflow.config`:

```nextflow
withName: 'DENOISING_NLMEANS' {
ext.number_of_coils = params.number_of_coils
}
```

That's it! Your `nextflow.config` should look something like this:

```
process {
publishDir = {"${params.output_dir}/$sid/${task.process.replaceAll(':', '-')}"}
Expand Down
13 changes: 6 additions & 7 deletions docs/environment/DEVCONTAINER.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
your development. They provide `pre-installed` environments for you to start programming
new `pipelines` or `nf-neuro components`.

* [Using `nf-neuro` development containers](#using-nf-neuro-development-containers)
* [Requirements](#requirements)
* [Configuring Docker for easy usage](#configuring-docker-for-easy-usage)
* [Prototyping environment](#prototyping-environment)
* [Production environment](#production-environment)
* [Development environment](#development-environment)

- [Using `nf-neuro` development containers](#using-nf-neuro-development-containers)
- [Requirements](#requirements)
- [Configuring Docker for easy usage](#configuring-docker-for-easy-usage)
- [Prototyping environment](#prototyping-environment)
- [Production environment](#production-environment)
- [Development environment](#development-environment)

## Requirements

Expand Down
18 changes: 8 additions & 10 deletions docs/environment/DEVOPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

The `nf-neuro` project requires some specific tools to be installed on your system so that the development environment runs correctly. You can [install them manually](#manual-configuration), but if you desire to streamline the process and start coding faster, we highly recommend using the [VS Code development container](./docs/DEVCONTAINER.md#development-environment) to get fully configured in a matter of minutes.

* [Developing within `nf-neuro`](#developing-within-nf-neuro)
* [Manual configuration](#manual-configuration)
* [Dependencies](#dependencies)
* [Python environment](#python-environment)
* [Loading the project's environment](#loading-the-projects-environment)
* [Global environment](#global-environment)
* [Working with VS Code](#working-with-vs-code)
* [Installing Prettier and editorconfig](#installing-prettier-and-editorconfig)

- [Developing within `nf-neuro`](#developing-within-nf-neuro)
- [Manual configuration](#manual-configuration)
- [Dependencies](#dependencies)
- [Python environment](#python-environment)
- [Loading the project's environment](#loading-the-projects-environment)
- [Global environment](#global-environment)
- [Working with VS Code](#working-with-vs-code)
- [Installing Prettier and editorconfig](#installing-prettier-and-editorconfig)

## Manual configuration

Expand Down Expand Up @@ -104,7 +103,6 @@ This will make it so the `nf-core` commands target the right repository by defau
The `nf-neuro` project curates a bundle of useful extensions for Visual Studio Code, the `nf-neuro-extensions` package. You can find it easily on the [extension
marketplace](https://marketplace.visualstudio.com/items?itemName=nf-neuro.nf-neuro-extensionpack).


# Installing Prettier and editorconfig

To install **Prettier** and **editorconfig** for the project, you need to have `node` and `npm` installed on your system to at least version 14. On Ubuntu, you can do it using snap :
Expand Down
11 changes: 5 additions & 6 deletions docs/environment/PROTOTYPING.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Prototyping environment setup

> [!NOTE]
> `Nextflow` chose [VS Code](https://code.visualstudio.com) as its main development IDE (with good reasons), give
> its extension capabilities, ease of use, great look (well, it counts) and openness. We highly recommend you to
> Since `Nextflow` chose [VS Code](https://code.visualstudio.com) as its main development IDE (with good reasons), given
> its extension capabilities, ease of use, great look (well, it counts) and openness, we highly recommend you to
> use it to develop. Give it a try, we guarantee you'll adopt it eventually.
> [!IMPORTANT]
> We highly recommend using the integrated `development container` designed to streamline your installation
> and support your development through `VS Code`. To setup yourself, refer to [this section](./docs/DEVCONTAINER.md)
> and skip the whole environment setup.
* [Prototyping environment setup](#prototyping-environment-setup)
* [Dependencies](#dependencies-)
* [Configuration](#configuration-)

- [Prototyping environment setup](#prototyping-environment-setup)
- [Dependencies](#dependencies-)
- [Configuration](#configuration-)

## Dependencies

Expand Down

0 comments on commit acba952

Please sign in to comment.