Creating a new protocol
How does it work?
The idea behind the SWAPP is fairly simple. We write protocols in Pipeline Pilot using the Connector 5 Components. This Protocol outputs an HTML file which is read by the SWAPP and parsed in the result page.
Here is an example protocol. You can build in Pipeline Pilot or open it directly under Discngine/TIBCO Spotfire Enabled Protocols/Client Automation/SWAPP Examples/Add SMILES to Data Table. It simply takes an input table containing molecular records, computes the SMILES of each record and adds them either as a new Column or a new Data Table. To test it, you can use for example the Data Table created by the Load Maybridge example protocol.
The protocol can be split into 4 steps.
- We use the Data Table Reader component. Each row will be read and passed to the next component.
- We process each row, calculate SMILES and add it to the input data.
- Depending on the user's choice, we either add the new columns to the input table or add a new table. Let's focus on the first option. We subsequently call the Add Data Columns Template and Table Plot components which respectively add the new columns and draw/update the Table plot.
- The SWAPP HTML Fragment component is used to translate all the instructions from the Connector Components to the corresponding calls of the Connector JavaScript API. The output HTML and javascript are written into an output.html file. This file will be loaded by the SWAPP, its HTML displayed in the result page and its JavaScript executed.
Registering a new protocol
Once your protocol is ready in Pipeline Pilot, it is time to add it to the SWAPP menu.
Click on the + icon to open the registration modal. You will see the tree of Pipeline Pilot protocols. The example registered protocols can be found under Discngine/TIBCO Spotfire Enabled Protocols/Client Automation/SWAPP Examples. In there the protocol "Add SMILES to Data Table" has not yet been registered, let's use it as an example. Click on the protocol name to load the parameters list. Based on the input type the SWAPP will try to guess the most relevent input type (number, text, select, etc.).
- The first parameter, Data Table Name is set by default to Text. Switch it to Type: TIBCO Spotfire Data Column.
- The second parameter is the ID Column. Again the default type is set to Text. Switch it to Type: TIBCO Spotfire Column. The section Overview / Default Value has now changed and contains two fields: Data Table field and Column Filtering. Both are optional but we strongly suggest to set the Data Table field.
- The Data Table field parameter is meant to indicate which field will contain the name of the data table to read the columns from. Indeed, when registering the protocol we do not know what the TIBCO Spotfire® document will look like on the user screen, and we cannot know which columns it will contain.
- Column Filtering allows you to implement custom filtering of the list of columns to ensure the type will match that expected by the Pipeline Pilot protocol. You can use a Regular Expression (e.g. ".*Molecule.*"), a "Data type" from the dropdown provided or a "Content type" (e.g. "chemical/x-mdl-molfile") For the purpose of our example, select Data Table Name for the Data Table field parameter, and Data type, String for the Column Filtering.
- The last parameter Destination is set by default to a Select input type as shown in the Overview / Default value section. Let's leave it as is.
Click "Next" at the bottom of the page. We now have to select where we want the link to appear in the menu and what name we want it to appear as. For example, select ChemoInformatics under Menu, and leave the Menu item name as is. If you wish you can write a description of that protocol which will be displayed above the form. Finally, click Add and your protocol will be registered in the menu.
You can now load the protocol from the menu and you should see the form displayed: