Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I additional parameters to the Nextflow script? #123

Closed
PhilPalmer opened this issue Jun 11, 2020 · 0 comments
Closed

How can I additional parameters to the Nextflow script? #123

PhilPalmer opened this issue Jun 11, 2020 · 0 comments
Labels
feature:nextflow question Further information is requested

Comments

@PhilPalmer
Copy link
Contributor

PhilPalmer commented Jun 11, 2020

Steps

  1. Add them to the nextflow.config file with a default value
  2. Add them to main.nf:
    1. Add them to the helpMessage
    2. Add them to the log
    3. Add them to the required process script
  3. Add them to docs/usage

Considerations

  1. Additional logic - Some parameters may require additional logic. If this is the case it may make sense to perform this above where all of the parameters are logged. This will ensure that a useful value is printed for the user.
    • For example, for the overhang parameter if this is not set by the user it's default value will be false. However, a new variable overhang is calculated which is the read length - 1. It would be more useful for this value to be printed to users rather than the default value of false so this needs to be performed above the logging:
overhang = params.overhang ? params.overhang : params.readlength - 1
  1. Optional parameters - Optional parameters can be set (or not) in the script of the relevant process
    • For example, here the value of the $slidingwindow variable will only be equal to SLIDINGWINDOW:4:15 if the user has set their slidingwindow parameter to true. Otherwise it will be equal to an empty string and slidingwindow will not be set
  script:
  slidingwindow = params.slidingwindow ? 'SLIDINGWINDOW:4:15' : ''
  """
  trimmomatic \
    $mode \
    -threads $task.cpus \
    -phred33 \
    $reads \
    $out \
    ILLUMINACLIP:${adapter}:2:30:10:8:true \
    LEADING:3 \
    TRAILING:3 \
    MINLEN:${minlen} \
    CROP:${params.readlength} $slidingwindow
  """
  1. Params, or not params, that is the question - Make sure to use the correct variable. Sticking again with the example of overhang. Here it was useful to create a new overhang variable which can then be modified based on other input parameters. However, make sure to take care to use the correct variable i.e. overhang and not params.overhang later on in the script and specific process(es)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:nextflow question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants