Incorporating Bayesian models into the Approved Drugs app

bayes_apprdrugs1Some interesting experimental features are on their way to the Approved Drugs app, which has been in the crosshairs for expanded functionality recently. The latest round of improvements involves the ability to collect custom-drawn structures, and apply Bayesian models for predicting the presence of “bad drug” properties, both for molecules overall, and for individual atoms. Read the rest of this entry »

Leave a comment

2014 redux

The year of 2014 is almost over, so it’s time to write the summary. The year started by taking a few unexpected turns that I could not have predicted, but things turned out well, and a lot got done.

The original game plan for 2014 was to buckle down and finish building some of the technologies and products that had been on the roadmap for a little too long for my liking. Since the previous year had involved a great deal of travel and activities other than sitting down and building scientific software, I found myself in the unfamiliar scenario of having promised more than I delivered. Perhaps I will get used to this someday, but I still find it rather disconcerting.

One of the first new pieces of functionality for the year resulted from discussions with some of the OpenPHACTS team at the NETTAB meeting in Venice several months previous, where I found out that the project has an open API that allows searching of marked up assay data for compounds. It is now possible to use the MetaSearch feature of the Mobile Molecular DataSheet app to fetch this data, for specific molecules or collections of molecules. The interface is slightly unwieldy in cases where there is a lot of information (e.g. looking up all the data for an ancient drug like aspirin), but it is quite functional.

Following up from a project with Collaborative Drug Discovery, I finished the delivery of an implementation of the “circular fingerprints” commonly referred to by names such as “ECFP_6″ or “FCFP_6″. This was made available for use in the Chemical Development Kit, and so is now in the hands of everyone who uses this open source toolkit. This is not the first open implementation of this fingerprint type, but it is novel in that the algorithm is self-contained within a single code module, which means it is quite easy to port it to a different platform or toolkit and have it produce the exact same results. This kind of portability is a major and understated feature, because it means that models built with one software stack can be evaluated and applied with a variety of different software packages.

Following up the release of the fingerprint implementation, the algorithm was promptly ported to Objective-C and delivered as part of v2 of the TB Mobile app. This major release included a user interface overhaul (for iOS 7), a fair bit more curated data, and a similarity ordering system that uses the portable ECFP6 fingerprints. Furthermore, the data preparation stage for the app includes building a Bayesian model for each of the TB targets. The user can draw or import structures and view the predicted likelihood of activity against the various known targets. Also, a novelty feature was added to the app: dynamic clustering, in which a selected compound is represented graphically in the middle of a 2D cluster. Needless to say the similarity metric uses ECFP6 fingerprints.

Having delivered these tools, as well as the basis for the Bayesian modelling feature in CDD Vault, we wrote up a paper for the Journal of Cheminformatics, which describes the underlying technology and its uses. This is an open access journal, so no need to worry about getting stopped at a paywall.

Not long afterward, I skipped out on the last weeks of the Montreal winter and headed for San Francisco for a sabbatical with Collaborative Drug Discovery, who had a research project that needed to be executed with a certain degree of urgency, involving analysis of biological assay data of the textual variety being marked up in an ontological form. While it has been a few years since I last did any natural language analysis, it’s always good to sharpen up some old skills/try something out of one’s familiar comfort zone every once in awhile, and access to more biological assay data is quite germane to my usual activities. The project went rather well: using a prepackaged open source library took care of the lexical parsing, and since I had been working with Bayesian models recently, that’s what I tried feeding it into first. To a man with a hammer every problem looks like a nail, and in this case it paid off. You can read all about it in the paper we published in PeerJ.

Speaking of PeerJ, it was my pleasure to contribute to this journal, which I have been watching for awhile. They are a company that is trying to disrupt the scientific publishing industry by operating with low overheads, so scientists are not presented with a choice between two evils: expensive author-pays vs. all readers pay. Instead, authors pay a nominal fee, readers pay nothing, and the process has a higher degree of automation than most journals. Because the journal is mainly focused on biology, this one was able to squeeze in because it could be described as bioinformatics.

In 2014 I only attended one scientific conference, the American Chemical Society meeting in Dallas. I gave two talks, one being about cloud computing with mobile apps, and the other describing my Green Lab Notebook (GLN) app, which was at the time still vapourware. Once I returned from California, finishing the app was a high priority, and it was released shortly after. The GLN app has two main notable capabilities: it can represent multistep reactions in an informatically pure way that has a very high degree of machine readability, and it has always-on calculation of green chemistry metrics (process mass intensity, E-factor, atom economy) which should ideally become as important to chemists as characteristics like yield and scale. The GLN app is currently quite powerful, but the list of functionality still yet to implement is rather long.

Unfortunately I returned from San Francisco a week too soon to be able to attend the autumn American Chemical Society meeting which was in town. The reason I couldn’t make that is due to the timing of my birthday, and this year was important, because I turned 40. Since I had not been back to my home country of New Zealand for a long time, and because the west coast is closer to the south Pacific, I figured it was time to make the pilgrimage.

Prior to my sabbatical, I had agreed to write a book chapter about green chemistry in drug discovery informatics. The deadline being what it was, I essentially had a month to write the whole thing, in between working on a major new research project, and figuring out the logistics of living in San Francisco for several months. The chapter is finished and revised, and it should be coming out sometime next year, published by the Royal Society of Chemistry (RSC).

Speaking of the RSC, the organisation commissioned an overhaul of the popular ChemSpider Mobile app, which I built for them some years ago. The original 1.0 version erred on the side of being quite simple: nobody whether it would take off, so we assembled it quickly just to get something out there. A portion of the summer was spent re-skinning the app to make it look nice on iOS 7, and to give it the degree of functionality it deserves: advanced searches, result saving, detailed previews, etc. Also during the upgrading of the app, we uncovered a few glitches with the underlying API which were fixed, and so the searching process is much faster and way more reliable than it was. All things considered, I’m very happy with the way it turned out.

And speaking of the RSC once again, there is another project that I have contributed to: the Medicinal Chemistry Toolkit app. This product is currently on the iTunes AppStore, supporting a physical textbook, and there will be a new version coming out soon that has chemical structure capabilities. This will allow the user to sketch out a structure and observe properties being calculated, like logP, ligand efficiency, lipophilic efficiency, and a graphical rendition of the Astra-Zeneca “ugly structure” filters. While the sketcher tools are taken straight out of my preexisting libraries, some of the calculations required technology to be ported from my serverside (Java) libraries into Objective-C, so they could be used to create cheminformatics calculations that are disallowed from using a webservice. This took most of the time, but now it is done, and apps just got a fair bit more sophisticated: my core libraries now include substructure query searches, as well as the aforementioned circular fingerprint generation and Bayesian modelling.

Another project that got started before my sabbatical, and had to be finished after it was over, is the Valence app. This is co-designed with TouchText LLC, and is my first attempt to create an app that is designed exclusively for the education market, as opposed to dual purpose efforts to interest students and professionals both. The Valence app introduces students of any age to the concepts of the Lewis octet rule (no relation to Lisa Lewis, my partner in crime for this project). The app was announced at the International Conference on Chemistry Education (ICCE) in Toronto, which I was originally intending to present in person, but was on the other side of the continent. The Green Lab Notebook app was also preannounced, by proxy.

Halfway through 2014, Apple announced two technologies that caught my attention: Swift and iCloud Drive. Normally I tend not to be an early adopter of Apple’s latest [not necessarily greatest], and wait at least a few months to start updating tools and products. There are always plenty of other eager beavers out there with nothing better to do than break their teeth on the newest of the new, but this time around I joined them, and unfortunately regretted it. The Swift programming language looked like it would be rather awesome, and replace Objective-C, which is rather the opposite of awesome. It turns out that it needs to go back in the oven for quite awhile. Same with iCloud Drive: it was promised to be basically Dropbox integrated into all of Apple’s products, but it seems to have some undocumented limitations (like not working, for example). I suspect both of these technologies will be long term winners, but that’s for the future, not the present.

In order to test the Swift language, I at least had the sense to refrain from updating my main codebase, and instead created a novelty new app, called the Beer Lab Notebook. The name is a tongue-in-cheek suggestion that it’s a companion to the Green Lab Notebook app, to the extent that these days the closest I get to my practical laboratory roots is by practicing my hobby of zymurgy.

After checking off some of the major projects that I had intended to release much sooner, I turned my attention to the first and most fundamental technology that my company created: the gesture-based chemical structure sketcher that is the basis of all the mobile products that I have created. Since the beginning I have struggled with the paradox of needing to redesign the familiar user interface paradigm in order to make sketching molecules excellent on a touchscreen. If you try to reproduce the standard toolbox from the desktop era, the result will be unusable on a phone and mediocre on a tablet. If you accept the redesigned approach that I came up with in 2010, it will be great on any form factor, but requires learning some new ideas. And even though I was under no illusions about peoples’ resistance to learning new software interfaces, the mobile space is even less forgiving than one might think. Over the years I’ve tried various ways to inject tips, tutorials, training modes, etc., but never been very satisfied with the way they worked. And so these concepts (tips/tutorials/training) have been integrated more gracefully into the sketcher interface, in order to better ease the discordance of being thrown into a different way of doing things. This will no doubt be an ongoing process.

On the subject of sketchers, I have been finding myself using a Mac more regularly as my desktop of choice, and I regularly use my own open source sketcher (SketchEl) for method development. After much procrastination, I put in some work to make it behave better with Apple’s dissenting approach to things like keyboard shortcuts, and various other issues that make Java almost (but not quite) platform independent.

While working at CDD earlier in the year, I helped out with and was included as a co-author on a paper with Sean Ekins & Chris Lipinski. One of the discussion points was regarding a collection of “probe molecules” that came out of a major NIH research effort. This paper recently got mentioned on In The Pipeline. I have made the curated probe compounds available as part of the Approved Drugs app, which now has two built-in collections of molecules (drugs and probes).

The Approved Drugs app is slated for a number of new functionalities, which will appear early next year. For one, the fingerprints have been switched over to use ECFP6, and soon there will be a 3rd collection for custom-defined molecules, similar to the way this is currently done with TB Mobile. The intention is to include a number of Bayesian models for common medicinally relevant properties, such as structure “ugliness”, toxicity, ADME, etc., and make it incredibly easy to evaluate and visualise the disagreeable molecular features. This is part of a general trend toward distilling data that requires an expert to curate, fix and model, and repackaging it as part of an easy to use mobile app.

As per usual, the year of 2015 includes a long list of projects that are in progress, or are just ideas. Expect mobile apps to provide more calculations, and to a large extent these will be carried out locally on the devices, using models and datasets that were prepared using powerful hardware. Interfaces will continue to improve, and the percentage of chemistry tasks that can be done without using a desktop/laptop computer will continue to increase. Expect Apple technology to be a wildcard, as with each passing year more of the deliberate restrictions on what apps can or can’t do are lifted, along with the hardware becoming more powerful at an incredible pace.

Leave a comment

NIH probe molecules in the Approved Drugs app

appvdrugs_probesSince the relevant paper just became available (“The parallel worlds of public and commercial bioactive chemistry data”, Lipinski et al, Journal of Medicinal Chemistry), now is as good a time as any to mention that the NIH probe molecules discussed in the article have been incorporated into the latest version of the Approved Drugs app.

The so-called “probes” are molecules screened by the NIH Molecular Libraries Program, having been deemed to be excellent starting points for designing drugs, according to all contemporary medicinal chemistry lore. As is so often the case in this industry, searching for a simple datafile on the open internet that contains the constituent datafile, with all the structures carefully curated and checked and matched to the corresponding identifiers, comes up inconclusive. This collection has now been assembled in an easily digestible form, and so it is no longer necessary to crawl through long PDF files and reenter everything: http://molsync.com/share/?ds=166

The Probes now make up a second group of structures, as shown on the screenshot to the top right. These can be perused, filtered, searched, exported and clustered in the same way as the regular list of drug molecules.

On another note, the similarity method used for sorting molecules by comparison to a reference compound, and for dynamic clustering, has been switched to the ECFP_6 fingerprint implementation that was created for the Chemical Development Kit, and subsequently the TB Mobile app.

Leave a comment

Mobile sketcher overhaul in progress

sketchmmds_ipadThe molecular drawing capabilities introduced with the Mobile Molecular DataSheet (MMDS) app are still unique in the mobile chemistry space insofar as the user interface allows for precise drawing of manuscript-quality diagrams (i.e. perfect bond lengths and angles), on an incredibly tiny screen (the original iPhone form factor), and also very quickly. This sounds like a violation of basic engineering principles (i.e. fast, cheap, good: pick two), but there is of course a down side: the interface is different from the conventional industry standard paradigm, and takes some getting used to. While the capabilities have been regularly improved over more than 4 years since it was first released, a significant overhaul of the “onboarding” experience is long overdue, starting with more targeted adaptation to multiple screen sizes. Read the rest of this entry »

Leave a comment

Second impressions of Swift: making Objective-C look good

I held off writing this post since Apple’s new Swift language was at version 1.0, and it was clearly rushed to market/probably should’ve stayed in beta for quite awhile longer, but now that 1.1 is out, I can say that things are not looking good from a performance point of view. The reason I was excited about the language from the moment I read the specification (other than wanting to see the end of Objective-C) is that the design takes into account the notion of having a clean high level syntax that provides enough information for the compiler to understand what is, and isn’t, trying to be accomplished in a given block of code, and optimise accordingly. A reading of the spec suggests that Swift is, among other things, a better Java: all the safety and convenience of bounds checking and automatic memory management, but with clever ways to reduce or eliminate the performance penalties that come with it. Read the rest of this entry »

5 Comments

The Beer Lab Notebook

bln_snap1Today another of my apps just got through onto the store: the Beer Lab Notebook, which can be found on the iTunes AppStore. The name of this app is inspired by the title of my last new app (the Green Lab Notebook): its subject material is more or less serious, depending on your priorities. The app is designed to help record the process of creating a fermented beverage, as practiced by millions of homebrewers, myself included. Read the rest of this entry »

Leave a comment

Impressions of Apple’s Swift, after a bit of practice

Lately I’ve been getting my feet wet learning the latest new programming language from Apple that everyone is talking about: Swift. The short conclusion is that it’s pretty good, but unsurprisingly has quite a collection of glitches: some of them are fixable, some of them are annoying arbitrary choices that I’ll get used to, and others are probably more like design flaws that are unlikely to ever go away. I’m cautiously optimistic that the latter category is fairly short, though still too early to call it. And because Swift is such a new language – hot out of the oven, as it were – I was not inclined to rush in and start coding up anything that’s directly important to my company’s cheminformatics software stack, so instead decided to take a little detour and make a new app from scratch: something fun, that I’ve been meaning to do for ages, called the Beer Lab Notebook, written entirely in Swift, with no non-Apple dependencies. But more about that particular project in a later post. Read the rest of this entry »

Leave a comment

Follow

Get every new post delivered to your Inbox.

Join 1,143 other followers