Icon

02. Workflow Control - solution

Workflow Control Solution

Solution for "Workflow Control" exercise for advanced Life Science User Training - Handle and write groups of data to separate sheets in an Excel file - Read and concatenate many sheets using a loop - Activate a workflow branch based on a user selection




Annotations and comments
  • Activity I: Group Looping - Read the file: CHEMBLID228_SERT_ligands.table - Group over all the AssayIDs with a group loop - Write each AssayID to a separate sheet in an Excel file
  • Step 1 Use the Table Reader node to load the ChEMBLID228_SERT_ligands.table
  • Step 2 Use the Group Loop Start node to group and iterate over each assay_chmebl_id
  • Step 3 Use the Excel Writer node to write eacht AssayID data table to a separate sheet on Excel file. Make sure to select "append" if file already exists. The sheet name should be the AssayID for the current iteration (Hint: Pass the current AssayID as a sheet name in the Flow Variable tab)
  • Step 4 Use the Variable Loop End node to end the loop.
  • Activity II: Reading Many Sheets - Use Read Excel Sheet Names to list all sheet names in an Excel file - Iterate over that list of sheets with a Table Row to Variable Loop, and aggregate them into a single KNIME table
  • Step 1 Use the Read Excel Sheet Names node to get a list of all sheet in the file "data/temp/assays.xlsx".
  • Step 2 Use the Table Row to Variable Loop Start node to iterate over all sheets in the list
  • Step 3 Use the Excel Reader node and connect the Flow Variable port from the Table Row to Variable Loop Start. Use the flow variable created by the Table Row to Variable Loop node to control the setting sheet_name in the Flow Variable tab
  • Step 4 Use the Loop End node to end the loop. Pay attention: the combined data from all loops is available in the output port of the node.
  • Activity III: If Switch Extend the workflow below with a switch to select the kind of visualisation. - Use a Single Selection Configuration node to let a user choose the values "Parallel Coordinates Plot" or "Scatter Plot", use the flow variable "port index" as output port - Use a CASE Switch Start node to create either a parallel coordinate plot or a scatter plot depending on the input. - Use Column Rename node to rename the plot selection column in both branches "Selection" - Combine the two paths with a CASE Switch End node and use a Row Filter node to filter only the selected compounds
  • Step 1 Use the CASE Switch Start node and select as input port type "Data". In the configuration dialog control the PortIndex by the Flow Variable "plot-type (index)" from the Single Selection Configuration node.
  • Step 2 Use the CASE Switch End node to end the switch case.
  • Combine into one
  • Read sheet
  • Write compounds from current iteration into an Excel Sheet
  • do one iteration per AssayID
  • Combine all sheets into single table
  • List all sheet names from an Excel file
  • CHEMBLID228_SERT_ligands.table
  • Loop over sheet names (1 per iteration)
  • Collect variable and end loop

Nodes

Extensions

Links