Dabbling with the desktop: molecular datasheet app on the mac

xmds_firstpreviewThis is a way-too-soon sneak preview of what might someday end up as a commercial product. Currently residing under the project acronym XMDS, it is related to the MMDS app, for Mac OS X (i.e. X-Molecular DataSheet). The minimum viable feature set is intended to be approximately equivalent to the datasheet & molecule editor that is implemented by the open source SketchEl project.

The screenshot above shows the sum total of the functionality of the Mac app so far: the ability to load a datasheet file into a window, create an outline grid, and render each of the cells. Obviously the text and numbers are not too difficult to render, but as seen for the two structures, the first one is very simple and plausible, while the second one is nonsense. The latter exists for the purpose of verifying that a variety of different rendering scenarios are handled as intended. If you look carefully at the molecules, you may also notice that they are very carefully crafted, in order to demonstrate publication-worthy aesthetics from raw connection tables. The graphical rendering layout algorithm, which has the 2D coordinates of the heavy atoms (in Angstroms) as its only visual cue, is the same one that is used by the com.mmi software stack that drives the molsync.com services, and is described in detail in a paper published in Molecular Informatics. Even though the app currently does nothing other than display static content, the amount of machinery that had to be ported over is quite extensive, so this snapshot belies a significant amount of successful coding.

Internally, the project is interesting because it is all written using Apple’s not-really-ready Swift language. As I’ve previously written about the language (first and second impressions), this is a surprise announcement that Apple revealed in June 2014 after a secret incubation period, and for which the specifications made it seem that it was going to be a very fine programming environment right out of the gate, with some very clever and well thought out features. Unfortunately current reality is quite the opposite: the version number should probably be stated as “0.1 alpha”, and the development experience is correspondingly awkward, buggy and broken. Some of my early efforts to port cheminformatics algorithms to Swift (from their original Java implementations) revealed that for the kinds of low level algorithms that ought to perform excellently are actually something like 50-100x slower than a reasonably well written Objective-C version, which is a bit of a dealbreaker. The performance is more like what you would expect from naively implementing a number crunching algorithm in a scripting language. For this reason, I subsequently accepted the reality that my mobile apps for iOS would continue to be based in Objective-C language for a fair bit longer: it has been the victim of premature deprecation.

Nonetheless, since Apple has pretty much staked their reputation on their new language, it means they really stand to lose a lot if they don’t keep improving Swift so that it lives up to the hype in the reasonably near future. For what it’s worth I don’t think Apple is ready to flame out on its current winning streak, and so I’m betting that it is a good idea to start using Swift for products that may not be ready to release for awhile.

And hence the idea of expanding the product lineup of Molecular Materials Informatics to span a larger variety of platforms. While the most prominent software offerings are the mobile apps (iOS and Android), and behind the scenes with increasingly powerful serverside/non-interactive algorithms, the strategic plan has always been to cover the desktop platform, too. The lack of a clear winner in the platform/development space is one of the main reasons it is taking too long (i.e. Windows is big but past its prime, Linux continues to flail but is popular with several very important niche demographics, Mac keeps on winning but needs to hurry up and ditch Objective-C, cross platform tools like Java provide only the lowest common denominator user experience, the continued absence of a viable web runtime rules out browser options… and not to mention all the issues with deployment and installation). Swift promises to resolve the stalemate, and once the worst of its shortcomings are dealt with, it will win by default even if it is ultimately quite mediocre.

A large amount of the method development work that I do, in order to create cheminformatics algorithms for mobile apps and other platforms, requires me to personally edit molecular datasheets for many different purposes. When working on the desktop, I use the SketchEl open source package, which is written in Java. Recently I improved it so that it is a bit more Mac-friendly, since that’s increasingly becoming my preferred workstation choice, but I am frequently reminded of how much better it would be to have a native Mac replacement. The SketchEl project is extremely bare-bones in terms of algorithmic capacity: the datasheet editor is the absolute minimum necessary to make data entry and collection viewing reasonably straightforward for simple cases. Since the main functionality was finished up many years ago, the algorithms that are available within the proprietary codebases of Molecular Materials Informatics have a great deal of potential to augment it.

So don’t expect XMDS to appear in the Mac appstore in the next few weeks, but depending on a variety of different factors, it may see the light of day in the conceivably near future. Stranger things have happened.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s