Let Spotlight Build your NMR Database
With version 10.4 of Mac OS X (Tiger), Apple introduced a new search engine, called Spotlight, that can extract the information hidden inside your documents. The technology that comes (gratis) with Spotlight brings multiple advantages:
- You can preview in the Finder the title of a spectrum, the observed nuclei, the observe frequency, the chemical formula.
- You can retrieve a spectrum by a word contained in the title or inside your annotations.
- If you performed peak-picking, you can retrieve all those spectra containing a peak into a given range of the ppm scale.
- If you store the formula you can search compounds by formula or molecular weight. You can store multiple formulas, separated by commas.
- If you store the structure with a SMILES string, you can search spectra by sub-structure. You can store multiple strings.
- You can perform advanced searches, combining multiple conditions.
Part of the information used for indexing can be manually inserted or edited, via the iNMR dialog “Edit/Metadata”. Be careful because iNMR doesn't check your input for correctness. You are entirely responsible for what you type. iNMR, however, calculates the molecular mass and the number of atoms from the elemental formula. The “title” at the top of the dialog comes from the spectrometer. It can only contain ASCII characters. To generate the formula and the SMILES string corresponding to large molecules we recommend using iBabel (open source).
To extract the information from your spectra, Spotlight calls a plug-in embedded into iNMR (version 1.6 and later). To check if Spotlight really did it, select a file *.inmr in the Finder and issue the Finder command “File/Get Info”.
If only newly saved files display NMR specific information, you can force Spotlight to scan older files with the Darwin command
mdimport, from the Terminal.
mdimport -Vr /Applications/iNMR.app/Contents/Library/Spotlight/iNMR_Spotlight_Importer.mdimporter
Apparently, this command does not work with Leopard, regardless of the application. If it doesn't work, the most drastic measure is the erase all the Spotlight databases (for all your documents) on all Volumes. The system will react reindexing everything (you'll hear the disk spinning for a very very long while):
Other simple and useful commands are mdls and mdfind. The former shows the names of the indexed attributes, while the latter performs the search. The first example below shows how you can find all 13-C spectra containing a peak between 86 and 89 ppm. The second example searches documents related to molecules with 10 hydrogen atoms.
mdfind "net_inmr_iNMR_Nucleus == 13-C && net_inmr_iNMR_Peaks > 86 && net_inmr_iNMR_Peaks < 89"
mdfind "net_sourceforge_openbabel_Formula == *H10*"
You can avoid using the Terminal and perform the same kind of searches with the free Speclight application, which is a true Mac application with a graphic interface. In conclusion: with a minimal effort by your side you can have Spotlight build your private NMR database and you can explore it with Speclight.
The Search Module
Previoulsy known as Speclight (a stand-alone application, consisting in a single window), this dialog has been incorporated inside iNMR 1.9 (command “Edit/Search”). The query mechanism is simple. You only fill the field(s) you are interested into, then press the main button “Search” or “in Results” (the button on its right) to perform a sub-search. Speclight can find any kind of document, not only NMR spectra. If, however, you specify a nucleus or a number of dimensions, it will hardly find anything different from a spectrum.
When you click on a result (path to a file), the display on the left will report the information specific to that document. A double click in the list of the results is equivalent to a double click in the Finder (opens the document).
Specligh is less smart than Spotlight or Google. For example, if the title of a document contains the expression “boys and girls” you can't find it with phrases like “girls and boys” or “boys with girls”, etc... In practice it's more productive to search single words. In the example above, first find all documents containing “boy” in the title, then perform a subsearch (inside the found set) with the word “girl”. Do not check the option “exact text” in such a case. Coming to chemistry: to find spectra of molecules containing sulfur and nitrogen, first look for documents containing an “S” in the formula, then perform a subsearch with “N” in the formula.
Many options are preserved even when you quit the application. The button “Clear All” empties the text fields. The button “Last Query” restores the parameters of the last query and has no effect on the displays on the bottom of the window.
There is a shortcut to search peaks at a given frequency. If there is a mark in the foremost window (that is: before you issue the command “Edit/Search”), the ppm frequency is automatically copied from the mark into the respective field of the search dialog.
iNMR supports the QuickLook technology introduced with Mac OS 10.5. To activate this support, open the Preferences dialog of iNMR and specify that you want to generate thumbnails and previews when saving a document. If your document name is “name.inmr”, the thumbnail will be saved in a file “.name.inmr.tiff” and the preview “.name.inmr.pdf”. For example: .plist.inmr.tiff and .plist.inmr.pdf. This files are hidden (it's a unix convention) and, obviously, consume disc space. If you move the iNMR document, the connections with the thumbnail and the preview will be lost. If you don't generate the preview, the command “Quick Look” will simply show a list of parameters.