Thursday, January 14, 2010

Men at Work

As soon as I began experimenting with the DOSY toolbox I was surprised to discover an unexpected hole, which is just a novel proof of my old theory on NMR imprinting.
If your first spectrometer is a Varian, you will become a certain kind of spectroscopist and a certain kind of programmer. If your first instrument is a Bruker, you will become a different spectroscopist and a different programmer.
If a brukerist programmer had written this toolbox, he would have imported the frequency domain spectrum and started from there. Mathias Nilsson is instead a Varianist and he imports the FID only. We talked about it and now he agrees with me on the importance of importing and exporting the data to and from as many programs as possible. For example, I might prefer using an external software for the preliminary processing (FT, phase and baseline correction), then the DOSY toolbox for the separation of components, eventually a third software (or the first one again) for printing, visualizing, creating slides, etc...
This is not really efficient, because in many real cases I probably want to try with different preliminary processing (e.g.: apply or remove a line broadening), and this is already easily done with the toolbox, but becomes cumbersome if I move data from an application to another at each stage. The principle is, however, to let the user choose whatever he prefers.
This kind of transfer is the less problematic one: the information is not to be stored, not to be transmitted, is consumed on the spot on the same machine that generates it. I and Mathias have already started collaborating on this and, if only we were better programmers, we had already finished by now, but this is not the case.
Unfortunately, we are equipped with two different brains, and it has a price: countless emails to explain each other what we need, what we can do, how we would solve a given problem. It's really a case where it takes more to explain a thing than to do it.
In practice, we have created a simple, highly readable, redundant file format that consists into a text file, like JCAMP-DX, but without compressions of any kind. At the same time, we are testing this format on the field. I am writing two scripts (the language is Lua) to export data from iNMR to the DOSY toolbox and to import data back again.
We have chosen this approach because I am the prototype of the average ignorant. If I am able to write these scripts for at least one external program, this can be categorized as an easy task, whichever other program you want to use in combination with the DOSY toolbox, the only requisite being that the program must be scriptable.
Now you know what I have been doing during these days and why the promised review is not ready yet. To tell the truth, I don't know why I should write a review in a case like this, where the source is open and the author is so collaborative. I mean: if I find something that I don't like, it's more productive to talk about it directly with Mathias Nillson than to spend a day to write a review.
Generally speaking, I don't believe in open source, I don't see how it might work. Pick any example of a moderately large project: how many people can safely modify it? Normally, it's only the original author. In practice, it makes little difference if the source is open or not.
In this particular case, the software is written with MATLAB, which I haven't, but it would be the same if it was written in a language I am familiar with.

To be continued...

Thursday, January 07, 2010

Installing the DOSY toolbox on a Mac

The DOSY toolbox is an open source program written by Dr. Mathias Nilsson that runs on Windows, Linux, Mac and on any other platform covered by MATLAB. I am going to review it next week, while today I am giving a few practical tips that I prefer to leave out of the review, for the sake of readability and tidiness.
I know that 14% of my readers have a Mac, and I have verified that the original installation instructions of the toolbox are inaccurate and unclear (for the average Mac user at least), so today I will simply explain how you can install the DOSY toolbox on your Mac.
Download the file called DOSYToolbox06_MAC_13May09_pkg from the address:
http://personalpages.manchester.ac.uk/staff/mathias.nilsson/software.htm
With a double click this archive generates a folder called: "DOSYToolbox06_MAC_13May09_pkg 2". This name is actually too long and useless, therefore I have shortened it into "DOSYToolbox06" and moved the folder inside my home directory. This is not strictly necessary but is a safe and sensible move. Inside the folder there is an installer called "MCRInstaller.dmg". It installs the runtime of MATLAB, which is necessary (unless you already own MATLAB itself). The difference is... technically speaking... to make it short... well the difference is $2,000 that you save if you install the runtime instead of buying matlab itself. Got it? A little slower but much cheaper.
The installer works like any other installer: you must always say "yes", you can't be wrong, eventually you will read it's all OK but you have no clue of what it has done and this is terribly bad because you absolutely need to know where the files have been installed, otherwise you can't run the DOSY toolbox at all. Fortunately I have discovered where the files have gone:
/Applications/MATLAB/MATLAB_Compiler_Runtime/v710
(this is valid, of course, for version 7.1 of the runtime).
The downloaded folder also contains a script called: "run_DOSYToolbox06_MAC.sh". This is the command that starts the program, and it needs an argument and this argument is the path to the matlab runtime that you have already installed. In other words, the canonical way to start the toolbox would be to type a command like this into the Terminal:
/path/to/run_DOSYToolbox06_MAC.sh /path/to/MATLAB_Compiler_Runtime/v710
for example:
/Users/your_name/DOSYToolbox06/run_DOSYToolbox06_MAC.sh /Applications/MATLAB/MATLAB_Compiler_Runtime/v710
This is highly impractical, but you can easily create a double-clickable shortcut:
- open the Automator application
- choose the template called "workflow"
- into the leftmost column, click on "Utilities"
- into the second column, double click on "Run Shell Script"
- from the pop-up menu "Shell" choose "/bin/bash"
- fill the main field with our command:
Run this workflow. If, in a few seconds, the DOSY toolbox window appears, it means that the workflow works. Quit the DOSY toolbox and save the workflow. Be careful and select the proper File Format: it should be "Application" and not "Workflow".
Finally you have created a double-clickable application (you can paste a different icon)
and you can forget Terminal, shell, bash and the likes...
At the time of this writing, though, it seems that the DOSY toolbox is fully functional only if launched from a shell. It is a puzzling and unwelcome incident, I hope it's going to find a solution soon.
Has anybody the compiler for the Mac? Would this person be so kind to compile version 0.7 for the rest of us Mac users? "Open source" means that some times you should also give, not always take.