FSK-Lab

FSK-Lab Logo

 

Food Safety Knowledge Lab (FSK-Lab) is an open-source extension plugin to the Konstanz Information Miner (KNIME). FSK-Lab enables KNIME users to work with FSK models within KNIME.

Source code: https://github.com/SiLeBAT/FSK-Lab

Food Safety Knowledge Markup Language (FSK-ML) Software Developer Guide: Download

Under development software developer guide: Download

Installation

Installing KNIME

A running instance of KNIME is a prerequisite. It can be downloaded here. Due to avoid installing issues under WINDOWS, the provided zip-version should be used and unzipped then. The KNIME folder itself can be placed and run from anywhere under Windows without admin rights. After starting KNIME, the user will be asked to create the KNIME-WORKSPACE, were all the workflows will be stored. After restarting KNIME, please make sure to select the right one to access your files (it will be preselected). HINT: In order to avoid later issues, never copy the KNIME_WORKSPACE, import it only!

Please following these instructions to get further instructions how to install knime .
In addition, there is the option to modify the KNIME.ini in the installation folder of KNIME while the program is not running:
1. The amount of RAM available in KNIME might be extended by changing the value in the line ‘-Xmx1024m’. An example would be ‘-Xmx4g’, if 4GB (=4x1024m) of 8GB RAM should be used.
2. If the connection to a KNIME-Server through KNIME fails, it might help to increase the response time. Simply add the line ‘-Dcom.knime.enterprise.client.connect-timeout=10000’ to the ini-file.

Installing FSK-Lab

FSK-Lab needs to be installed as a KNIME feature through the FSK-Lab update site (more info here):
1. Add the repository to KNIME via Help > Install New Software > Add. The corresponding URL (https://dl.bintray.com/silebat/fsklab_icpmf) should be entered in the ‘Add Repository’ dialogue along with a meaningful name.2. Now this repository can be selected in the installation menu via Help > Install New Software > ‘Work with’-pull down menu. Tick ‘FSK Lab Feature’ and follow the prompts after pressing Next.3. After restarting KNIME, FSK-Lab Feature should appear now in KNIME under Help > Installation Details.

Installing R

FSK-Lab is based on R (https://www.r-project.org), which can also be installed as a KNIME feature through the FSK-Lab update site under WINDOWS (more info here). If you want to integrate your own R version or the one used by us, please continue with step 5 applying your R installation path:

1. The R repository should be already available in the installation menu via Help > Install New Software > if All Available Sites is chosen in the ‘Work with’-pull down menu.
2. Fold open KNIME & Extensions and tick KNIME R Statistics Integration (Windows binarys).

3. Follow the prompts after pressing Next and after a reboot, the R binary feature should appear in KNIME under Help > Installation Details.
4. In this last step, KNIME needs to know were the R binarys are installed via File > Preferences. In the menu choose KNIME > BfR R settings and on the right site browse to the local path of the binarys. If installed via the update site they are located in the KNIME installation folder > plugins > org.knime.ext.r3.bin.win32.x86_…R-Inst. Don’t use a subfolder of R-Inst! Press Apply and enter the same path in the Menu under KNIME > R and press ok.HINT1: If a seperate R version is used and the KNIME message ‘no R.exe file found in the R-folder’ appears, even if its there, the reason might be a wrong bit version was installed. The 32bit version should be present in the subfolder ‘bin/i386’ and the 64bit version in ‘bin/x64’.HINT2: The ‘BfR R settings’ exists only for the use along with FSK-Lab and in parallel to the regular’R’-setting of KNIME. This allows to use different R folders/versions if needed.

5. If you received a message that the packages Rserve and miniCRAN need to be installed you need to start R.exe directly from its installation folder. In the R console enter “install.packages(c(‘Rserve’, ‘miniCRAN’)” and press enter. There should pop up a list of download sites then. Choose one nearby and confirm. After the message that the library was sucessfully downloaded, you can close it via “q()”. In the library folder of R should a new folder Rserve appear now.

Installing R on MacOS

For R running in MACOS, there is a specific R version for MacOS required which may be downloaded from here.
FSK-Lab requires the R packages: ‘Rserve’, ‘miniCRAN’ and ‘Cairo’, which may be installed with the install.packages() command within the R-console:

install.packages(‘Rserve’)
install.packages(‘miniCRAN’)
install.packages(‘Cairo’)

Besides these three packages, MacOS requires also the XQuartz software which can be obtained at http://xquartz.macosforge.org.

The path to the R folder to be entered in KNIME (as described for WINDOWS) should be:
/Library/Frameworks/R.framework/Resources/

Installing R on Linux (UBUNTU)

First, Linux requires some development libraries for the R packages which can be installed through the apt-get command in the console under UBUNTU via:
sudo apt-get install libcurl4-openssl-dev libssl-dev libxml2-dev

The R-binarys may be also installed via apt-get:
sudo apt-get install r-base

In order to install the R packages for FSKlab, please make sure to start R in the UBUNTU console with the sudo command to avoid writing right problems:
sudo R

The R packages ‘Rserve’ and ‘miniCRAN’ are required, which may be installed with the install.packages() command within the R-console:
install.packages(‘Rserve’)
install.packages(‘miniCRAN’)

The path to the R folder to be entered in KNIME (as described for WINDOWS) should be:
/usr/lib/R

Example files

In order to test the FSK-Lab nodes in KNIME, there is a zip-file provided here. It contains the needed files to create FSKX-model-files by using the FSKX-Creator-node in KNIME. Please, make sure to assign the corresponding files in the configuration dialogue of the Creator-node.

Details on FSK-Lab

FSK port object

Fsk-Lab provides an additional port object called FskPortObject that expresses in deep detail an FSK model. It is composed of:

  • Model script
  • Parameters script
  • Visualization script
  • Libraries used
  • R workspace
  • Model metadata

Model metadata

The model metadata involved in the FSK models comprises the following.

Property Description
Model name Free text
Model id Free text
Model link URL
Organism Hazard name.
Organism details Hazard details
Matrix Compartment name
Matrix details Compartment details
Creator Person contributed to the encoding of the model in its present form by implementing the model in the software solution.
Family name Model family
Contact Contact information
Software R or Matlab
Reference description Free text
Reference description link URL
Created date Date upon which the model was created. Format: MM/dd/yyyy.
Modified date Date of last modification to the model. Format: MM/dd/yyyy.
Rights Information about rights held in and over the resource. Typically, rights information includes a statement about various property rights associated with the resource, including intellectual property rights.
Notes Model notes
Curated Boolean
Model type Experimental data, Primary model with data, Primary model without data, Two step seconday model, One step secondary model, Manual secondary model, Two step tertiary model, One step tertiary model or Manual tertiary model
Model subject unknown, growth, inactivation, survival, growth/inactivation, inactivation/survival, growth/survival, growth/inactivation/survival, T, pH, aw, T/pH, T/aw, pH/aw or T/pH/aw
Food process Free text
Dependent variable
Independent variables
Has data Boolean
Variable field Description
Name Variable name
Unit Variable unit
Data type character, integer, numeric or array
Value Variable value
Minimum value
Maximum value

Included nodes

FSK Creator

Creates an FSK object.

  • Inputs: none
  • Outputs: FSK object

Settings:

  • Location to model script (mandatory)
  • Location to parameters script (optional)
  • Location to visualization script (optional)
  • Location to XLSX file with metadata (optional)

Behaviour: Creates an FSK object with the script and metadata provided by the user.

FSKX Writer

Writes an FSK object into an FSKX file.

  • Inputs: FSK object
  • Outputs: none

Settings:

  • Location to file. May be an absolute URL, a mountpoint relative URL or a local path.

Behaviour: Creates an FSKX file with the scripts, metadata and libraries in the FSK object.

FSKX Reader

Reads an FSK object from an FSKX file.

  • Inputs: None
  • Outputs: FSK object

Settings:

  • Location to file. May be an absolute URL, a mountpoint relative URL or local path.

Behaviour: Creates an FSK object with the scripts, metadata and libraries in the referred FSKX file.

FSK Runner

This node runs an FSK model

  • Inputs: FSK object and optional metadata table
  • Outputs: FSK object and generated image

Behaviour: Runs the input model and updates its workspace with the model results. A chart or plot is generated if a visualization script is provided.

FSK Metadata Editor

Edit the metadata in an FSK object.

  • Inputs: FSK object
  • Outputs: FSK object

Behaviour: Modifies the metadata in an FSK object.

FSK to R

Extracts the R workspace out of an FSK object. The R workspace may be used with KNIME R nodes.

  • Inputs: FSK object
  • Output: RPortObject

Behaviour: Extracts the R workspace out of an FSK object and places it into the output RPortObject. If the R workspace is null or non-existent (as when the model has not been run), the generated RPortObject would be null.

FSK to metadata

Extracts metadata from an FSK object.

  • Inputs: FSK object
  • Outputs: KNIME table with metadata

Behaviour: Extracts the metadata in an FSK object into a KNIME table

FSK Editor

Edit the scripts in an FSK object.

  • Inputs: FSK object (Optional)
  • Outputs: FSK object

Behaviour: Edit the scripts in an FSK object: model, parameters and visualization scripts. In case there is no input model connected then it will create a new model from the user interface.

FSK Editor JS

Edit the scripts in an FSK object.

  • Inputs: FSK object
  • Outputs: FSK object

Behaviour: Edit the scripts in an FSK object: model, parameters and visualization scripts. JavaScript based, its user interface may be also used in a browser in the KNIME web server.