Provided by Christ Notes
Bible Search

September 25, 2006

SpotSmart - Substructure search on your Mac

I have made a perl-script to enhance the excellent ChemSpotlight with substructure searching. The script in itself translates the output from mdfind into a valid smiles-file that could be searched using obgrep.

Update: A new version of the script solves an issue with long SMILES


To start using the script, I recommend the following steps.
  1. Download and install ChemSpotlight (and OpenBabel that comes bundled within it.
  2. Download the perl-script to a suitable location (e.g. your home-folder).
  3. Create an alias by adding the following line (as one long line...) to your .profile-file (assuming you are using bash as your shell):
    alias spotsmart='mdfind -0 net_sourceforge_openbabel_SMILES\ !=\ \"\" | xargs -0 mdls -name net_sourceforge_openbabel_SMILES | /the/full/path/to/the/script/spot2smi.pl | obgrep -i smi'
    (More help on this can be found further down)
  4. Reapply your profile by starting a new shell or typing
    source .profile

  5. The alias can then be used to search for SMART-structures as follows. In the terminal, type
    spotsmart thesmartstring
    followed by enter. You will recieve a list of SMILES-strings that match your query, as well as the filename of the file where it was found.
The spotsmart alias starts by using mdfind to find all files with a SMILES-string associated to them (this association is done by ChemSpotlight). The output from mdfind is put to mdls with the help of xargs. mdls lists all SMILES-strings in the files that mdfind found and this listing is put through the perlscript into obgrep. obgrep is a utility supplied by OpenBabel that will perform the actual SMART-query.

As an example,
spotsmart c1ccccc1
will find all benzene rings in all the files that ChemSpotlight can read (unfortunately, that don't include ChemDraw).

This solution is far from optimal, but it gives you a mean to do substructure searches on your Mac fairly easily!

Here is a more detailed explanation on how to edit the .profile-file in step 3.
  1. Open the Terminal application (located in the Utilities-folder in your Applications-folder)
  2. Type
    cd ~
    to make sure that you hare in your home directory.
  3. Type
    open -a TextEdit .profile
    to open the file in TextEdit.
  4. Enter the text from above in the end of the file, making sure that you substitute the text
    /the/full/path/to/the/script/spot2smi.pl
    to the actual path to where you saved the script.
  5. Save the file.

Posted 8 years, 8 months ago on September 25, 2006
The trackback for this post is disabled

Add Comment

( to reply to a comment, click the reply link next to the comment )

 
Comment Title
 
Your Name:
 
Email Address:
Make Public?
 
Website:
Make Public?
 
Comment:

Allowed XHTML tags : a, b, i, strong, code, acrynom, blockquote, abbr. Linebreaks will be converted automatically.