# Define task.ext.args per subworkflow

**URL:** <https://community.seqera.io/t/define-task-ext-args-per-subworkflow/2194>\
**Category:** Ask for help\
**Tags:** nextflow, nf-core\
**Created:** [June 16, 2025, 3:49pm UTC](https://community.seqera.io/t/define-task-ext-args-per-subworkflow/2194 "2025-06-16T15:49:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andre-marcos-perez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/andre-marcos-perez/32/1853_2.png) [@andre-marcos-perez](https://community.seqera.io/u/andre-marcos-perez)\
**Post date:** [June 16, 2025, 3:49pm UTC](https://community.seqera.io/t/define-task-ext-args-per-subworkflow/2194/1 "2025-06-16T15:49:15Z")

</div>

Hi, I am new around here! 👋

I am developing a pipeline that uses the `nf-core` module [star\_align](https://nf-co.re/modules/star_align/). According to the [code](https://github.com/nf-core/modules/blob/53db90beb140ec02a4bf829986282f9d1a94ba7a/modules/nf-core/star/align/main.nf#L42), I can provide extra arguments through the [task.ext.args](https://www.nextflow.io/docs/latest/reference/process.html#ext) process property. According to the [documentation](https://nf-co.re/docs/guidelines/components/modules#optional-command-arguments), one way of doing this is to provide them on my `modules.config` file, for instance:

```auto
process {
    withName: 'STAR_ALIGN' {
        ext.args = [
            '--quantMode', 'GeneCounts',
            '--readFilesCommand', 'gunzip -c',
            '--outSAMtype', 'BAM SortedByCoordinate',
        ]
    }
}

```

This approach, however, provides the same argument for every single execution of the `STAR_ALIGN` process. My question is: what if I want to execute the `STAR_ALIGN` process again but with different arguments?

- Update 1:

Maybe it is worth mentioning that I am calling the `STAR_ALIGN ` multiple times on my pipeline, and every execution is wrapped around its own subworkflow process. So, if there is a way to provide the `task.ext.args` per subworkflow, it would work.

---

<div class="post-metadata">

**Author:** ![robsyme](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/robsyme/32/342_2.png) [@robsyme](https://community.seqera.io/u/robsyme)\
**Post date:** [June 16, 2025, 4:08pm UTC](https://community.seqera.io/t/define-task-ext-args-per-subworkflow/2194/2 "2025-06-16T16:08:01Z")

</div>

Hi André

There are two ways in which you might solve this issue:

**Option 1 - Full Names**  
If your example, you’re providing the process name STAR\_ALIGN to the withName selector. To differentiate between STAR\_ALIGN processes inside different subworkflows, you can use the full qualified name:

```groovy
process {
    withName: 'MY_SUBWORKFLOW:STAR_ALIGN' {
        ext.args = [
            '--quantMode', 'GeneCounts',
            '--readFilesCommand', 'gunzip -c',
            '--outSAMtype', 'BAM SortedByCoordinate',
        ]
    }
    withName: 'ANOTHER_SUBWORKFLOW:BAR:STAR_ALIGN' {
        ext.args = ['--quantMode', 'TranscriptomeSAM']
    }
}

```

**Option 2 - Uniquely Named Imports**  
Alternatively, you can import one or more of the STAR\_ALIGN processes using a unique name, and use that new name in the withName selector:

```groovy
include { STAR_ALIGN as STAR_PER_GENE } from './modules/local/star'
include { STAR_ALIGN as STAR_TRANSCRIPTS } from './modules/local/star'

```

and then

```groovy
process {
    withName: 'STAR_PER_GENE' {
        ext.args = [
            '--quantMode', 'GeneCounts',
            '--readFilesCommand', 'gunzip -c',
            '--outSAMtype', 'BAM SortedByCoordinate',
        ]
    }
    withName: 'STAR_TRANSCRIPTS' {
        ext.args = ['--quantMode', 'TranscriptomeSAM']
    }
}

```

---

<div class="post-metadata">

**Author:** ![andre-marcos-perez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/andre-marcos-perez/32/1853_2.png) [@andre-marcos-perez](https://community.seqera.io/u/andre-marcos-perez)\
**Post date:** [June 17, 2025, 10:26am UTC](https://community.seqera.io/t/define-task-ext-args-per-subworkflow/2194/3 "2025-06-17T10:26:32Z")

</div>

Amazing, working as described! Thank you 🙏

---

<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:** [June 24, 2025, 10:27am UTC](https://community.seqera.io/t/define-task-ext-args-per-subworkflow/2194/4 "2025-06-24T10:27:09Z")

</div>

Closed on June 24, 2025, 10:27am UTC

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