Date | Content | Lecturer |
---|---|---|
19.06 | Introduction to KNIME and how to use SeqAn in KNIME | Knut Reinert, Stephan Aiche |
26.06 | Pulling your data into KNIME | Stephan Aiche |
03.07 | Advanced KNIME workflows | Stephan Aiche |
build.properties
in the GKN directory with the following contentknime.sdk=/path/to/your/knime/sdkNote: On windows you need to use slashes instead of backslashes
set (SEQAN_CTD_EXECUTABLES ${SEQAN_CTD_EXECUTABLES} <name of your app> CACHE INTERNAL "")
make prepare_workflow_plugin
ant -Dplugin.dir=/path/to/your/seqan/build/workflow_plugin_dir
<GKN-directory>/generated_plugin
)
ant ...
) if it contains any information (e.g., Exception …)
prepare_workflow_plugin
target and the node generator (ant
).
plugin.xml
file of the project containing the the node
Dependencies
tab
Required Plug-ins
click on Add
and add the org.knime.core.data.uritype
plugin.
NodeModel::configure
method fromprotected DataTableSpec[] configure(final DataTableSpec[] inSpecs) throws InvalidSettingsException { // .. }to
protected DataTableSpec[] configure(final PortObjectSpec[] inSpecs) throws InvalidSettingsException { // .. }.
NodeModel::execute
method fromprotected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception { // .. }to
protected BufferedDataTable[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception { // .. }.
protected YourNodeModel() { super(new PortType[] { URIPortObject.TYPE }, new PortType[] { new PortType(BufferedDataTable.class) }); }.
configure()
method to the layout of your output file. Your configure method needs to return a DataTableSpec that corresponds to the structure of your file, e.g., a file with an integer and a string column could be realised in the following DataTableSpecDataColumnSpec[] columnsSpec = new DataColumnSpec[2]; columnsSpec[0] = new DataColumnSpecCreator("int-colum", IntCell.TYPE).createSpec(); columnsSpec[1] = new DataColumnSpecCreator("string-column", StringCell.TYPE).createSpec(); DataTableSpec outputSpec = new DataTableSpec(columnsSpec);
execute
method and fill the DataTable accordingly. Hint: You can extract the File from the inData
using the following code snippetFile theFileToRead = new File(((URIPortObject) inData[0]).getURIContents() .get(0).getURI());. With the following code snippet you can create a table
BufferedDataContainer container = exec.createDataContainer(outputSpec); // for each line in your file RowKey key = new RowKey("Row " + rowIdx); DataCell[] cells = new DataCell[2]; cells[0] = new IntCell(yourIntValue); cells[1] = new StringCell(yourStringValue); DataRow row = new DefaultRow(key, cells); container.addRowToTable(row); // .. end for each // at the end of execute container.close(); BufferedDataTable out = container.getTable(); return new BufferedDataTable[] { out };
outputSpec
is the same data table spec you created above.