The previous post introduced the insertion of molecules into a WordPress document. Now the plugin goes one further: collections of data – either simple tables of structures, text & numbers, or higher order datasets like scaffold breakdowns – can now be inserted into a blogpost. As with molecular structures, the prevailing philosophy is to have the data encoded in machine readable format and dynamically converted into something visual at the time of presentation.
Given the availability of suitable libraries, rendering a collection of molecules isn’t too much harder than doing one. So to complement the [molecule] shortcode, the experimental plugin now has a complementary tag called [collection].
One issue with the plugin mechanism is that including XML within a pseudo-HTML precursor page can get a bit hairy, and the preferred format for collections is the XML datasheet format. Further to that, collections can get inconveniently large, and will dominate a document that is being edited, so instead the preferred method is to upload the file separately and then reference it. This makes the post quite a bit smaller:
In the above example, two collections are included:
[collection source=”http://homunculus/wordpress/wp-content/uploads/2016/11/sartable.ds” scale=”10″/]
The actual uploading was done with the usual WordPress upload dialog, except that the plugin throws in a few extra permitted types, otherwise the molecular data formats would be disallowed.
The page renders like so:
As you can see, the first collection is a table with 5 rows, each of which has a molecule, name and CAS number (which just happen to make up the acids section of the Green Solvents data).
The second collection is a SAR Table datastructure, which looks like just a table that has multiple molecule types, but if you look closely, there are a number of specific annotations and recolouring, which denote the way that the scaffold is spliced together with the R-groups to make a final construct molecule.
This little piece of functionality is implemented in a somewhat roundabout way through the Aspect formalism, which is a way of taking a simple datastructure (table of typed columns, some of which can be molecules) and adding higher levels of meaning, in a way that is both forward- and backward-compatible. The key point here is that this additional mechanism needed to be ported to the underlying WebMolKit library so that the collection feature could work properly; it has been, and it does.
Right now there is just one aspect implemented in the toolkit, but the next one that I have my eyes on is the Experiment aspect, which describes multistep chemical reactions with a lot of important metadata that is missing from most reaction descriptions.