PMCC-BioinformaticsCore / janis-core

Core python modules for Janis Pipeline workflow assistant
GNU General Public License v3.0
4 stars 9 forks source link

fromwdl: can't handle single character identifiers #92

Open mr-c opened 3 years ago

mr-c commented 3 years ago

https://github.com/biowdl/tasks/blob/bc1bacf11498d2d30b85591cfccdcf71ef0966a5/bowtie.wdl

Traceback (most recent call last):
  File "/home/michael/src/janis/janis-core/fromwdl.py", line 5, in <module>
    WdlParser.from_doc("/home/michael/wdl2cwl/wdl2cwl/tests/wdl_files/bowtie_1.wdl").translate();
  File "/home/michael/src/janis/janis-core/janis_core/ingestion/fromwdl.py", line 45, in from_doc
    tasks.append(parser.from_loaded_object(t))
  File "/home/michael/src/janis/janis-core/janis_core/ingestion/fromwdl.py", line 51, in from_loaded_object
    return self.from_loaded_task(obj)
  File "/home/michael/src/janis/janis-core/janis_core/ingestion/fromwdl.py", line 243, in from_loaded_task
    inputs=[
  File "/home/michael/src/janis/janis-core/janis_core/ingestion/fromwdl.py", line 244, in <listcomp>
    self.parse_command_tool_input(i)
  File "/home/michael/src/janis/janis-core/janis_core/ingestion/fromwdl.py", line 430, in parse_command_tool_input
    return j.ToolInput(inp.name, self.parse_wdl_type(inp.type), default=default)
  File "/home/michael/src/janis/janis-core/janis_core/tool/commandtool.py", line 140, in __init__
    raise Exception(
Exception: The identifier 'k' was not validated because it was not validated by '[a-zA-Z][a-zA-Z0-9_]+\Z' (must start with letters, and then only contain letters, numbers and an underscore)
illusional commented 3 years ago

Thanks for exploring and raising this issue @mr-c! I remember we explicitly disallowed single char identifiers, I suspect it was to encourage tool builders to create meaningful inputs, but I can see it's a problem here. The fromcwl parser just has a while loop to make you pick a new identifier.

We could implement something like that here, but it's a bit of effort, I'll leave this issue open for now with the intent to more gracefully handle this.