Since version 1.1, both the BlackBerry and iPhone versions of the Mobile Molecular DataSheet app have included a webservice client. This allows the app to be connected to a particular web URL which describes some number of available services. Once these services have been discovered and added to the list, they can be called up at any time. Running a webservice brings up a dialog box which provides a way to enter input for each of the parameters that the webservice requires, e.g. structures, text, numbers, flags or lists of options. When the parameters have been set, the webservice can be run. If the execution is successful, then webservice will return a new datasheet, which contains the results of the query. The new datasheet can be viewed, edited, saved and manipulated like any other datasheet.
PubChem is a publically available chemical structure data service which is made available by the National Center for Biotechnology Information. It can be accessed via the website, or by using a documented API. PubChem is made available to users of MMDS by providing a bridge between the protocol used by MMDS and the PubChem API. The intermediate service is hosted by the MMI website.
Adding the Service
Navigate to the Web Services entry on the main menu:
Press the menu button, and select the Discover Service... entry, which brings up the Discover Web Service dialog:
For the URL, enter:
If there are no webservices currently in the list, then this URL will be automatically filled in.
Press the Accept button. The URL will be used to retrieve a list of available webservices. If the URL has been entered incorrectly, or does not refer to an MMDS webservice, or an internet connection is not available, an error will be reported. If all goes well, at least one app will be discovered, and the display will change:
Press the Accept button to confirm the addition of the new service to the available list. Check open the Web Services list heading to see the entry for the service:
Running the Service
To run a webservice, navigate the selection bar to the service itself and click on it.
The first time the service is run, it will be necessary to access the link in order to find out what parameters the service needs to carry out its work. This may take several seconds depending on the speed of the internet connection:
The next time the service is run, it will not need to download the parameters, because they are stored in a cache, along with the default values which are retained from the previous use. There is a menu entry to Refresh a webservice, which clears out the cache and causes the parameters to be reacquired on the next use.
Once the parameters have been acquired, the dialog box expands to show the input widgets:
The PubChem webservice has three parameters: a molecular structure for the search, a search type, and a maximum result count.
The search structure can be entered by three means. The Paste button acquires a molecule from the clipboard, if available. The Scratch button prompts for the user to select a molecular structure from the Scratch Sheet. The Edit button brings up a structure editing panel, which can be used to modify the current structure, or draw a new one.
Select the Scratch button and click it. Select a molecule from the scratch sheet, for example the aspirin structure:
The selected structure is inserted into the structure box.
Now, navigate to the Search Type parameter, and click on the option list. Select one of the search options, e.g. Similar95%, which will return all structures which have a similarity of at least 95% to the submitted structure, as determined by PubChem:
Click on the Execute button. The query will be formulated and sent to the webservice. The webservice bridge provided by MMI will examine the query transmitted from the mobile device, and convert it into a query that can be understood by the PubChem API. It will typically take at least a few seconds for PubChem to perform the search and package up the result. The search can be cancelled at any time by clicking the Cancel button.
When the webservice request finishes executing, and is successful, a new datasheet will be retrieved from the server, and displayed by MMDS. The following example shows compounds decreasingly similar to aspirin, in which the first structure is aspirin itself:
The PubChem webservice for MMDS returns a datasheet with three columns: molecular structure, name, and a URL link to the PubChem record. To find out more information about the substance than the structure and name, navigate the cursor to the Link column of the desired row, and open the context menu by clicking the trackpad:
Notice the Open URL icon which is highlighted above. Selecting this command will open the browser, and go directly to the PubChem property page for the selected compound:
The datasheet that is viewed as a result of a webservices query is not immediately saved anywhere. Closing the datasheet without saving will cause the data to be discarded. Selecting the save command from the main menu will write the datasheet to a new file, with a sequentially numbered filename, in this case PubChem_00001:
Back in the main menu of MMDS, the Web Results folder contains a new entry, which holds the results from the PubChem query:
The webservices feature first introduced to MMDS v1.1 (BlackBerry) is a powerful extension which allows seemless communication with remote services, rather than being limited to only the features provided within the app itself. The PubChem bridge demonstrates how the webservices feature can be used to search a database of molecular structures.