This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How does cwltool actually check file formats?

Hello!

I am using a pre-made tool (trimmomatic) downloaded from https://github.com/common-workflow-language/workflows/tree/master/tools which has a file format specification (fastq). If I use an input file as such:

input: 
  class: File
  path: /path/to/myfile.fastq

I get an error that says schema_salad.validate.ValidationException: File has no 'format' defined: so I add a format field to the input document (though I don't know if I am supposed to technically be required to input this?):

 input: 
  class: File
  format: http://edamontology.org/format_1930
  path: /path/to/myfile.fastq

And the error disappears. However, if I input a fake fastq file this also still works and it tries to run trimmomatic anyway (where it fails because it isn't an actual fastq). So clearly it isn't actually validating my fastq before running the tool, but I can force it to try by defining format in my input to match. I imagine it's not supposed to work like this, but maybe I'm misunderstanding how the format field actually is supposed to work. I tried updating to the latest version of cwltool, but it gives the same end result - tries to run the tool even on a fake fastq file if I specify format in my input.yml, but raises the other error if not. So how does format checking work, am I missing something here? Thanks for your input!

cwl

I misread your question earlier! Sorry for the post.

1 answer

Hello biokcb, good question.

The CWL reference runner only checks the compatibility of the declared formats, it does not look into the files themselves. Other CWL implementations could choose to do file format verification, but are not required.

You can read more about the format field in the CWL spec under https://www.commonwl.org/v1.0/CommandLineTool.html#File

Ok, it seems I just misunderstood this field. Thank you for the response!

Log in to answer this question.