I'd like to start my workflow with a Java Snippet node, for example, to initialize some made-up test data but this does not seem possible. (You can configure the node but the indicator is red and the 'execute' menu item is grayed out.)
Is it possible to put a Java Snippt node at the start of a workflow?
If not, could we consider this an enhancement request?
Also, it does not seem possible to put a molfile reader in the middle of a workflow. It would be nice to be able to read a molfile (or other file) whose name can be set based on a value in a column.
KNIME's scripting nodes, like the Java Snippet node for example, are designed to take a table as input, manipulate it and produce the result as an output. According to the this logic they must receive an input table to properly configure and run. In other words you cannot simply leave their input port unconnected.
None says though that the input table you provide to them has to be used within the node or even contain any data at all! You can pass on to them an empty or dummy table and that would be perfectly fine.
The approach I often follow myself in similar cases s to use a Create Empty Table node to generate an empty table with as many rows as I need for my test data. Then I pass this table to a scripting node and, inside it, populate each row with the test data I need.
The advantage is that you can set the number of rows of test data you need to generate as configuration parameter of the Create Empty Table node and then rely on it inside the scripting node by referencing the special $$ROWCOUNT$$ variable.
Regarding your second point of having a file reader node, for example a Molfile Reader, in the middle of the workflow, this is also possible but requires a different approach.
In this case you would like to set the directory with the MOL files from another table, but are missing the input port for it. Instead of using an input table, KNIME uses Flow Variables for this purpose. Here is how to go about it:
- Store the name of the directory to read from in a row of a table and name that column, say, "source_dir". You can use the Table Creator node to define such a table. The column type has to be String.
- Connect a Table Row to Variable node to generate a Flow Variable out of the table. The Flow Variable will be named source_dir, just like the column name.
- Add a Molfile Reader node and configure it with any valid input directory (this is a very important step, otherwise it will not work). It doesn't matter which one because we are going to control this parameter anyway with a Flow Variable.
- Show the Flow Variable Ports for the Molfile Reader node and connect the output of the Table Row to Variable node to the Flow Variable input port of the Molfile Reader node.
- Re-open the configuration of the Molfile Reader node, go to the Flow Variables tab and select the source_dir Flow Variable from the directory dropdown.
The configuration should look like this:
You just created a dynamic configuration for the Molfile Reader node which can be controlled anywhere in the workflow by the content of another table.
Hope this helps, otherwise please feel free to ask again here.
Also, the Vernalis plugin has a text reader node which will allow you to read an entire txt file into a single cell based on a path in a column, and you can then use the molecule type cast to get the resulting text column as a Mol