Skip to content

[FEATURE] allow null in integer format when multiple: true #705

@kverstae

Description

@kverstae

Feature summary

Not sure if this is a bug or a feature, since I don't know what your expected behaviour is for this 😛

Passing PARAMETER=1:2:null:4 to an argument that accepts multiple integer values should not fail parameter validation

Feature description

Passing a null value as part of an argument that accepts multiple integer values, in the format with the multiple separator (e.g 1:2:null:4), the validation for the parameters currently fails with following error message:

Error in module '<MODULE>' id '<ID>': input argument '<ARGUMENT>' has the wrong type. Expected type: List[Integer]. Found type: List[java.lang.String]

This causes issues if you have 2 parameters that both accept multiple values that rely on eachother. I will try to explain myself better with an example.

Example

Imagine following parameters:

- name: "--features"
  type: string
  multiple: true
- name: "--cutoff_low"
  type: integer
  multiple: true
- name: "--cutoff_high"
   type: integer
   multiple: true

If you have 3 features called A,B and C and you want to provide cutoff values for all of them, but for some features you would like to skip a certain cutoff (can be done by passing null), it should be possible to pass the arguments as such:

... --features=A:B:C --cutoff_low=4:null:3 --cutoff_high=100:400:null

The order and amount of values for each argument is important, since they are linked to each other. Skipping the null values is therefor not possible.

My example shows this in a CLI context, but my usecase is more in a Nextflow workflow. The principles remain the same tho...

Why is this feature beneficial?

I don't know if this feature would be widely usable, or if it is just for my usecase...

However, I still think that this should be valid since an optional argument of type integer (or any type for that matter) does accept null. Making that argument accept multiple (integer) values, shouldn't change that behaviour IMO.

Alternatives considered

I could try to change my script to accept the parameters in a different format, but currently don't have any ideas to work around it. Suggestions are welcome 😄

Possible solution

The fix seems rather simple to me. If the value is "null" (null as string), convert to an actual null and run the normal parameter validation.
I however am not sure if this could/would cause issues somewhere else...

Confirmation

  • I have searched the existing issues to make sure this is not a duplicate request.
  • I have provided clear and concise information about the feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions