hi guys I'm trying to inject a param into the rare...
# nostupidquestions
b
hi guys I'm trying to inject a param into the raredisease pipeline (default value causes fatal crash): this is in my custom config... but it doesn't seem to be taken in by the pipeline and I'm not sure how to debug from here withName: 'NFCORE_RAREDISEASERAREDISEASEANNOTATE_GENOME_SNVS:UPD_REGIONS' { ext.args = {'--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} regions --min-size 5 --min-gq 20 --min-sites 1'} } all I added was that --min-gq 20 - is there something about those meta placeholders that makes this invalid? is there way for me to inject a custom param in this case? https://github.com/nf-core/raredisease/blob/master/subworkflows/local/annotate_genome_snvs.nf Or is the module config overwriting my custom one? https://github.com/nf-core/raredisease/blob/master/conf/modules/annotate_genome_snvs.config which is loaded at the end of nextflow.config . I guess I could edit this config directly ... but I would prefer to make all my custom changes in my single custom config file Is there a way for me to modify that param from my own custom .config ???? or
#️⃣ 1
c
Hi, @Benjamin Story! Slack uses channels to organise discussions. Press the
...
more
option on the left sidebar. Then hover over Your organisation, and finally select Channels to browse. Each nf-core pipeline has it’s own channel (e.g. #rnaseq). Please post any questions about specific pipelines in the relevant channel. If you’re not sure where to post your message, please ask @Rike Hanssen for help.
r
-> #raredisease would be the best place to ask this
b
Mmm I would usually agree but they are generally very slow to respond and this type of question is broadly applicable across nf-core pipelines. How do I add a custom param through my config? Apparently though it might be a known bug: https://github.com/nextflow-io/nextflow/issues/2662
r
in that case please provide moreinfo also have you checked the docs here: https://nf-co.re/docs/usage/getting_started/configuration#customising-tool-arguments
s
To help we'd love a few more details please: 1. The Nextflow command you used to launch the pipeline 2. Any custom Nextflow config files 3. The full error message 4. The corresponding
.nextflow.log
file, where you are running the analysis. Remember to use triple backslashes on their own lines for code blocks. Also take a look at https://nf-co.re/usage/troubleshooting for more information on debugging failed pipelines. Thanks!
p
That issue is essentially about the order configurations are parsed and what can build on what. It's quite difficult to know what's happening without e.g. any actual error message/description of what happens rather than what you expect should happen.
b
so the error message is somewhat irrelevant its a bug in the upd software. my problem is that the "fix" isn't being passed to the call yeah I guess maybe it wasn't clear I'm passing my custom config based off one of the test ones this is the process section:
Copy code
process {
    resourceLimits = [
        cpus: 32,
        memory: '96.GB',
        time: '4.h'
    ]

    withName: 'ENSEMBLVEP.*' {
    container = { workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
        'https://depot.galaxyproject.org/singularity/ensembl-vep:113.2--pl5321h2a3209d_0' :
        'biocontainers/ensembl-vep:113.2--pl5321h2a3209d_0' }
    }

    withName: 'NFCORE_RAREDISEASE:RAREDISEASE:PREPARE_REFERENCES:BWAMEM2_INDEX_GENOME' {
        memory = '96.GB'  // or higher if available
        time = '24.h'     // indexing can take a long time
    }

    withName: '.*ANNOTATE_GENOME_SNVS:UPD_SITES' {
        ext.args = {'--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} --min-gq 20 sites'}
    }

    withName: 'NFCORE_RAREDISEASE:RAREDISEASE:ANNOTATE_GENOME_SNVS:UPD_REGIONS' {
        ext.args = {'--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} regions --min-size 5 --min-gq 20 --min-sites 1'}

    }
}
I'm trying to overwrite the
ext.args
passed to NFCORE_RAREDISEASERAREDISEASEANNOTATE_GENOME_SNVS:UPD_REGIONS/SITES so I copied their original config commands and put them in my config with just the added --min-gq 20 (again the default in the
Copy code
Caused by:
  Process `NFCORE_RAREDISEASE:RAREDISEASE:ANNOTATE_GENOME_SNVS:UPD_REGIONS (FAM2)` terminated with an error exit status (1)


Command executed:

  upd \
      --vcf FAM2_rhocall_filter_vep.vcf.gz \
      --af-tag GNOMADAF --proband patientA --patientB --father patientC regions --min-size 5 --min-sites 1 \
      | sort -k 1,1 -k 2,2n > patientA_upd_regions.bed

  cat <<-END_VERSIONS > versions.yml
  "NFCORE_RAREDISEASE:RAREDISEASE:ANNOTATE_GENOME_SNVS:UPD_REGIONS":
      upd: $( upd --version 2>&1 | sed 's/upd, version //' )
  END_VERSIONS

Command exit status:
  1

Command output:
  (empty)
based on my limited understanding this suggests that the param I set in my custom config is not being passed? and my question is this expected? I would expect the --min-gq 20 to be included in the error message if it was actually invoked? is this sufficient information or is there something else that would help
n
How are you adding your config file?
b
the process I showed above is in test_custom.config and the VEP part is working to update the container nextflow run ./raredisease/main.nf -profile test_custom,docker --outdir ./output --analysis_type wes
n
did you update
nextflow.config
to make
test_custom.config
a profile? Otherwise your should use
-c path/to/test_custom.config
b
so essentially there is this main part of the workflow (just a grep -r): workflows/raredisease.nf:include { ANNOTATE_GENOME_SNVS } from '../subworkflows/local/annotate_genome_snvs' nextflow.config:includeConfig 'conf/modules/annotate_genome_snvs.config' inside: conf/modules/annotate_genome_snvs.config is
Copy code
withName: '.*ANNOTATE_GENOME_SNVS:UPD_SITES' {
        ext.prefix = { "${meta.upd_child}_upd_sites" }
        ext.args = {"--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} sites"}
        ext.when = { !(workflow.profile.tokenize(',').intersect(['test', 'test_singleton', 'test_sentieon', 'test_full']).size() >= 1) || workflow.stubRun }
    }

    withName: '.*ANNOTATE_GENOME_SNVS:UPD_REGIONS' {
        ext.prefix = { "${meta.upd_child}_upd_regions" }
        ext.args = {"--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} regions --min-size 5 --min-sites 1"}
        ext.when = { !(workflow.profile.tokenize(',').intersect(['test', 'test_singleton', 'test_sentieon', 'test_full']).size() >= 1) || workflow.stubRun }
and my goal is to overwrite these with my custom config (which is just adding the
--min-gq 20
) to the ext.args so I just copy and pasted it fully into my config thinking it would work
n
To pass configs use
-c
and not
-profile
b
yes its there: test_custom { includeConfig 'conf/test_custom.config' }
but downstream in the nextflow.config I see it does: includeConfig 'conf/modules/annotate_genome_snvs.config' could it be overwriting my custom config?
n
Probably, yes
When a pipeline script is launched, Nextflow looks for configuration files in multiple locations. Since each configuration file may contain conflicting settings, they are applied in the following order (from lowest to highest priority): 1. The config file
$HOME/.nextflow/config
(or
$NXF_HOME/config
when NXF_HOME is set). 2. The config file
nextflow.config
in the project directory 3. The config file
nextflow.config
in the launch directory 4. Config files specified using the
-c <config-files>
option
if you use
-c
it would have highest priority
b
oooo
ok so because I used nextflow run ./raredisease/main.nf -profile test_custom,docker --outdir ./output --analysis_type wes instead of -c ... my custom config is actually lower priority then nextflow.config
n
depends on which
nextflow.config
it was in I guess
and where
In conclusion: if you want something to take priority, use
-c
😉
b
ok I will test it out! thanks!
and just for clarity for other readers the nextflow.config is the main one inside raredisease/nextflow.config I added my config next to all the other test_*
Copy code
test_singleton  { includeConfig 'conf/test_singleton.config' }
    test_sentieon   { includeConfig 'conf/test_sentieon.config'   }
    test_bam        { includeConfig 'conf/test_bam.config'        }
p
Oh, you should basically never edit those files.
➕ 1
n
I assume that those get overriden later by modules.config
r
Other note: if you are trying to evaluate values in your ext.args (i.e.
meta.sth
) you'll need to enclose is in double quotes.
p
Anything you need to, you can either pass as a separate file with
-c
or use one of the other locations from the list. I think issues with the default configuration overriding something because of priorities as above is very rare. More commonly there will be issues with how process matches work.
n
Idk I think most pipelines do something like
includeConfig 'conf/modules.config'
at the of
nextflow.config
so customizing module args via profiles mostly will not work?
p
That would be a problem with actually overwriting something, but these will almost all end up as a bunch of
process { withName: ...
so it comes down to writing the process matches so that the desired behaviour is applied last.
n
If I understood correctly @Benjamin Story used:
Copy code
withName: 'NFCORE_RAREDISEASE:RAREDISEASE:ANNOTATE_GENOME_SNVS:UPD_REGIONS' {
        ext.args = {'--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} regions --min-size 5 --min-gq 20 --min-sites 1'}

    }
which I think should be the highest priority match? It is not super clear to me if: "config priority" has higher priority than selector priority
p
Those are separate things.
(I didn't try to follow those bits since it seemed a bit confusing and you were already trying to help him do the right thing.)
But e.g. for something setting
params.somestuff
, order would be important whereas these processes can be considered additive.
b
OK to follow up everything worked great using
-c
! the nextflow.config priority must be linear in accordance with appearance in the file I guess and as prophesized by @Rike Hanssen the pipeline did not like those single quotes so anyway thank you @Niklas Schandry @pontus @Rike Hanssen for solving my stupid question!