Osra is a a utility designed to convert graphical representations of chemical structures create by Igor Filippov at the National Cancer Institute. This page documents how to compile and install Osra on Ubuntu Linux 11.10. These instructions may work on other versions of Ubuntu Linux and on Debian Linux. Please leave a comment if you have compiled Osra using these instructions on a different version of Ubuntu, or on other Linux distributions.
At the time of writing this doc, March 2012, the Osra version is 1.3.8 and is available at:
I copied all the source to a directory in /tmp. If you need the source code at some later point in time, don’t use /tmp as files in /tmp are deleted upon reboot (if they’re older than 14 days). Also, at the time of writing Osra requires a patched version of Gocr for Osra to work. You need to install Gocr before you try to compile and install Osra, you also need to install other packages required for Osra to compile. Most are listed below, but see the Osra Homepage for more details.
An overview of the steps are:
- Install required Ubuntu packages
- Compile and Install Gocr
- Compile and Install Osra
I’ve also written instructions on how to install Osra 1.2.1 on Ubuntu 9.04, however that was written in 2009.
Install Ubuntu Packages
These packages are required to build Osta. Install the following (you will also need some gaphicsmagick packages also, libgraphicsmagick1-dev libgraphicsmagick++3 and maybe some others).
sudo apt-get install libtclap-dev libpotrace0 libpotrace-dev libocrad-dev openbabel libopenbabel-dev libgraphicsmagick++1-dev libgraphicsmagick++1-dev libgraphicsmagick++3 libgraphicsmagick1-dev libgraphicsmagick3 libnetpbm10-dev
Copy and paste the following line to make a directory in /tmp called OSRA, download the source, extract the packages, and build and install both:
cd /tmp; mkdir OSRA; cd OSRA; wget http://cactus.nci.nih.gov/osra/osra-1.3.8.tgz ; wget http://cactus.nci.nih.gov/osra/gocr-0.50pre-patched.tgz ; tar xzvf osra-1.3.8.tgz; tar xzvf gocr-0.50pre-patched.tgz; cd /tmp/OSRA/gocr-0.50pre-patched; ./configure; make libs; sudo make all install; cd /tmp/OSRA/osra-1.3.8/; ./configure; make all; sudo make install
Osra should be installed in /usr/local/bin .
Below are the same steps, but with more detail so that you know what your doing:
Create Directory to Build the Packages
Download the Source
If you have wget install you can download the source via the command line:
wget http://cactus.nci.nih.gov/osra/osra-1.3.8.tgz ;
Otherwise go to the Osar home page and download the source code pacakge for both Osra and Gocr and save it in the directory you created.
Extract both packages
tar xzvf osra-1.3.8.tgz
tar xzvf gocr-0.50pre-patched.tgz
Compile & Install Gocr
You need to make and install the patched Gocr before you try to build Osra:
sudo make all install;
This will install the patched gocr into /usr/local and copy Gocr header files to /usr/local/include/gocr. This may cause conflicts if you’ve installed gocr using another methods for instance using apt-get or aptitude. The gocr binary will be in /usr/local . If you have any problems, remove any other version of Gocr you may have build.
Before you continue to the next step, make sure the Gocr header files are installed:
$ ls /usr/local/include/gocr/
config.h* gocr.h* list.h* output.h* pgm2asc.h* pnm.h* unicode.h*
If you don’t see the header files, make sure you followed all the steps above.
Compile & Install Osra
Next compile Osra:
To install Osra on your system, run the following using sudo:
sudo make install
Look for it in /usr/local/bin:
Note: If you break your system while following these instructions, it’s not my fault. These are give in good faith, but if I’ve typed something wrong, too bad, I am not responsible! 🙂
/usr/local/bin/osra version: 1.3.8
Updated April 12th 2012: Added libnetpbm10-dev to the list of required packaged to pre-install.
Updated April 16th 2012: Added missing build steps to Gocr section. Was missing ./configure step
Updated April 17th 2012: Added “make libs” to the Gocr build steps, and fixed typo in the quickie install section.
Updated April 20th 2012: Added libocrad-dev to list of packages to add. Note: This package is not available for Lucid!
Updated April 21st: Updated dependencies and cleaned up the document.