How to read a string from a txt file and wrap it as a CWLype object?

I have an implementation question about CWL, which has troubled me for a while. The question is simple: I need to read a parameter from a txt file.

#The txt file
parameter: --OT 2,0,0,98

I need to read the string “–OT 2,0,0,98” as a parameter and feed it to another CWL module.

I have no idea how to do it, read a txt(or number) from a file and wrap it as a CWL variable (CWLType).

Thanks

Welcome @YuYu_Lin !

I would use the evalFrom: $(self[0].contents) trick at https://www.commonwl.org/user_guide/faq.html#non-file-types-using-evalfrom to get the parameter: --OT 2,0,0,98 into a string.

Do you need –OT 2,0,0,98 or just 2,0,0,98 to send to the next tool?

self[0].contents is a Javascript expression that returns the contents of found file. You can modify that expression to further process the string. Like evalueFrom: $(self[0].contents.replace("parameter: ", ""'))

Thanks for your reply @mrc

but, I wonder how I should read the txt file?
The example uses echo, should I echo the file too?