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.

Using the embedded R

FSK-Lab is based on R (https://www.r-project.org) and an essential component for it to function. For the purpose of convencience it is provided as a feature inside of the FSK-Lab plugin. You can pick either the 32 or 64 bit version to be embedded into the plug-in, depending on your operating system.

If you have R already installed on your system and you prefere to use that version, do not tick either of the options.

Legacy nodes

Currently you have the option of installing additional FSK nodes, the “legacy FSK-Lab nodes”. They provide compatibility for older fskx-files.

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
  • Visualization script (Optional)
  • Libraries used
  • List of simulations
  • ReadMe file (optional)
  • R-workspace
  • Model metadata

Model metadata

The model metadata involved in the FSK models includes but is not limited to the table below. The complete and currently used metadata schema can be found here.

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

Included nodes

FSK Creator

Creates an FSK object with the script and metadata provided by the user. The variables defined in the parameters script are ensembled in a default simulation called defaultSimulation.

 

Dialog Options


  • R model script. File path of the model script (mandatory)
  • Selected R visualization script. File path of the visualization script (optional)
  • README. README file (optional)
  • Working directory. Directory with resource files used by the model: plaintext, CSV and R workspace (optional).
  • Selected XLSX spreadsheet. File path of the XLSX spreadsheet with meta data (optional). In unspecified or error occurs the table will be empty.
  • Selected sheet. Name of the selected sheet in the spreadsheet.

Ports


  • Inputs: data table (optional)
  • Outputs: FSK object

FSKX Writer

Creates an FSKX file with the scripts, metadata, model encoded in SBML, workspace, working directory, simulations SedML and R packages in the FSK object.

Supported images


Images generated in the model script are saved into the archive. The supported image files are: bmp, jpeg, png and tiff.

Allowed image names


The plot generated with the visualization script is named plot.png, so any other image generated in the model script with this name will be overwritten.

Dialog Options

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

Ports


  • Inputs: Input FSK model.

FSKX Reader

Creates an FSK object with the scripts, meta data, simulations, resources and R packages in the referred FSKX file.

Dialog options


  • Selected file. Location to file. May be an absolute URL, a mount-point relative URL or local path. Examples:
    • Absolute URL: knime://LOCAL/my_resource.txt
    • Mount-point relative path: knime://knime.mountpoint/my_resource.txt
    • Local path: C:/workspace/my_resource.txt

Ports


  • Outputs: FSK object

FSK Runner

Runs the input model and updates its workspace with the model results.

Visualization scripts with interactive output such as Plotly are not supported.

Dialog Options


  • Width. Width of the plot.
  • Height. Height of the plot.
  • Resolution. Resolution of the plot in PPI.
  • Text size. Default point-size of plotted text, interpreted as big points (1/72 inch) at the given resolution.
  • Simulation. The name of the selected simulation to run. If no simulation is selected then the default simulation will be selected.

Ports


  • Inputs: FSK model
  • Outputs:
    • FSK model with results stored in R workspace
    • Plot generated with the provided visualization script. If the input FSK model has no visualization script then this port will hold no image (optional).

FSK Editor

Edit the scripts and the model Meta data in an FSK object. In case there is no input model connected then it will create a new model from the user interface.

When a new model is created, a default simulation called defaultSimulation will be created with the parameters defined in the metadata (the model math part).

Ports


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

FSK to R

Extracts the R workspace out of an FSK object. The R workspace may be used with KNIME R nodes. If the R workspace is null or non-existent (as when the model has not been run), the generated RPortObject would be null.

Ports


  • Inputs: FSK object
  • Output: RPortObject

FSK to metadata

Extracts the metadata from an FSK object into a KNIME table.

Ports


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

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

Tutorials

These tutorials were published with the article FSK-Lab – An open source food safety model integration tool at https://doi.org/10.1016/j.mran.2018.09.001.