nfdi4plants / nf-core-pipeline-to-arc

Reads nextflow_schema.json from a nf-core pipeline to generate a cwl tool wrapper with the same inputs
MIT License
0 stars 1 forks source link

handle negative numbers and small floats #9

Open louperelo opened 1 year ago

louperelo commented 1 year ago

PROBLEM

CWL converts all numbers smaller than 1e-5 to a string, even if the default is given as a number (0.00001)

- id: annotation_prokka_evalue
 type: float?
 default: 0.00001
 inputBinding:
 prefix: --annotation_prokka_evalue

gives this error:

ERROR: Validation of pipeline parameters failed!
* --annotation_prokka_evalue: expected type: Number, found: String (1e-05)

It does not happen for floats >0.0001, though. Also, negative numbers in the default are passed as a string.

SOLUTION

Define these numbers as strings in the .cwl file, e.g.:

type: string?
default: '0.000001'

TASK

The defaults taken from the nextflow_schema.json have either to be checked if they are <0.0001 and if so, written to the .cwl file as string? OR all input taken from the .json has to be written as a string? in the .cwl.

mr-c commented 1 year ago

@louperelo Is that with cwltool or a different CWL engine?

louperelo commented 1 year ago

It is with cwltool. I try to call the pipeline with cwltool pipeline.cwl runs.yml There is a longer conversation on DataPlant Teams about the two issues I am having at the moment.

tetron commented 1 year ago

Does type: double? behave differently?

louperelo commented 1 year ago

No, it unfortunately behaves the same as with type: float?.

mr-c commented 1 year ago

This is a cwltool bug; we will fix it and add a new conformance test! https://github.com/common-workflow-language/cwltool/issues/1831

louperelo commented 1 year ago

Great news! Thank you @mr-c!

mr-c commented 1 year ago

A new release of cwltool is out, with the fix: https://github.com/common-workflow-language/cwltool/releases/tag/3.1.20230424211314 a.k.a. https://pypi.org/project/cwltool/3.1.20230424211314/