# Nf-core modules best practice

**URL:** https://community.seqera.io/t/nf-core-modules-best-practice/452
**Category:** Ask for help
**Tags:** nf-core
**Created:** [February 2, 2024, 10:42am UTC](https://community.seqera.io/t/nf-core-modules-best-practice/452 "2024-02-02T10:42:52Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sebgoti](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/sebgoti/32/492_2.png) [@sebgoti](https://community.seqera.io/u/sebgoti)
#### Post date: [February 2, 2024, 10:42am UTC](https://community.seqera.io/t/nf-core-modules-best-practice/452/1 "2024-02-02T10:42:52Z")

</div>

Hi everyone, newcomer here. I currently have a nextflow workflow for bioimage analysis and would like to some of the modules to the nf-core ecosystem. My question is if it would be considered best practice to upload a module that also contains say a python script that helps in some way to processing the data. I need this python script since the software I am using in the module (ITKElastix) has very limited usability in the CLI for the intended use I have for it. Thanks in advance!

---

<div class="post-metadata">

### Author: ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)
#### Post date: [February 2, 2024, 10:11pm UTC](https://community.seqera.io/t/nf-core-modules-best-practice/452/2 "2024-02-02T22:11:08Z")

</div>

I don’t see a problem with that. With what you shared, it should be fine.

Multiple nf-core modules consist basically of a Python or an R script. If you need to do some preprocessing with R or Python before calling a software, I don’t see an issue, but if you can share more, I can answer with more confidence.

---

<div class="post-metadata">

### Author: ![sebgoti](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/sebgoti/32/492_2.png) [@sebgoti](https://community.seqera.io/u/sebgoti)
#### Post date: [February 5, 2024, 2:02pm UTC](https://community.seqera.io/t/nf-core-modules-best-practice/452/3 "2024-02-05T14:02:33Z")

</div>

I think for now this answers the question but if you could also point me to a nf-core module that does this that would be really helpful since I could use this as a blueprint for myself.

---

<div class="post-metadata">

### Author: ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)
#### Post date: [February 5, 2024, 3:37pm UTC](https://community.seqera.io/t/nf-core-modules-best-practice/452/4 "2024-02-05T15:37:49Z")

</div>

[This module (catadditionalfasta)](https://github.com/nf-core/modules/blob/73b63c8e510107010ab13b68cf31189d6cdca8cb/modules/nf-core/custom/catadditionalfasta/main.nf) makes use of a Python script, for example. [This other one (mcquant)](https://github.com/nf-core/modules/blob/73b63c8e510107010ab13b68cf31189d6cdca8cb/modules/nf-core/mcquant/main.nf) runs a Python script with arguments. In the second case, you could have the script block running two Python scripts, for example. Ideally, I would say you have the two steps in the same Python script and run it like in the first case, making use of the `template` keyword.

[This module (rapidnj)](https://github.com/nf-core/modules/blob/73b63c8e510107010ab13b68cf31189d6cdca8cb/modules/nf-core/rapidnj/main.nf#L25) is one example that runs Python and then something else.

---

<div class="post-metadata">

### Author: ![sebgoti](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/sebgoti/32/492_2.png) [@sebgoti](https://community.seqera.io/u/sebgoti)
#### Post date: [February 6, 2024, 9:42am UTC](https://community.seqera.io/t/nf-core-modules-best-practice/452/5 "2024-02-06T09:42:38Z")

</div>

Thank you very much @mribeirodantas ! Now I see that if when wanting to add custom python scripts then they should live in some repository instead of adding them in a `bin/` folder along with the nextflow script 🙂

---

<div class="post-metadata">

### Author: ![mribeirodantas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mribeirodantas/32/235_2.png) [@mribeirodantas](https://community.seqera.io/u/mribeirodantas)
#### Post date: [February 6, 2024, 9:49am UTC](https://community.seqera.io/t/nf-core-modules-best-practice/452/6 "2024-02-06T09:49:47Z")

</div>

I’m not sure I understand what you mean, but I would recommend reading the following sections in the Nextflow documentation:

1. [Modules templates](https://www.nextflow.io/docs/latest/module.html#module-templates)
2. [Modules binaries](https://www.nextflow.io/docs/latest/module.html#module-binaries)

This applies both if you host your pipeline on GitHub or not.

---

<div class="post-metadata">

### Author: ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/system/32/2402_2.png) [@system](https://community.seqera.io/u/system)
#### Post date: [February 13, 2024, 9:50am UTC](https://community.seqera.io/t/nf-core-modules-best-practice/452/7 "2024-02-13T09:50:24Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
