This is a brief HOWTO on compiling OSRA, (Optical Structure Recognition) on Ubuntu Jaunty. To quote the OSRA home page, OSRA is

… is a utility designed to convert graphical representations of chemical structures, as they appear in journal articles, patent documents, textbooks, trade magazines etc., into SMILES (Simplified Molecular Input Line Entry Specification – see http://en.wikipedia.org/wiki/SMILES) or SD file – a computer recognizable molecular structure format. OSRA can read a document in any of the over 90 graphical formats parseable by ImageMagick – including GIF, JPEG, PNG, TIFF, PDF, PS etc., and generate the SMILES or SDF representation of the molecular structure images encountered within that document …

Make a directory to compile the source:

mkdir /tmp/OSRA; cd /tmp/OSRA;

Be careful doing this in /tmp is cleaned upon reboot the directory may be removed.

Install dependencies needed by the OS:

sudo apt-get install libgraphicsmagick1-dev libmagick++-dev libgraphicsmagick++1-dev potrace gocr  libtclap-dev libopenbabel-dev libopenbabel3 openbabel libnetpbm10 libnetpbm10-dev

Don’t install ocrad and remove it if it’s on your system (you can probably reinstall if you need to after you get Osra to compile):
sudo apt-get remove –purge ocrad;

Source Code:

Instead of manually getting the source packages download the sources used to build the packages for Ubuntu if available.  Make sure the src lines are commented in, in your /etc/apt/sources.list . This will automatically download and extract the code into the current directory:

cd /tmp/OSRA; apt-get source gocr ocrad potrace;

This downloads Gocr 0.46 which the OSRA docs say may not work:

- GOCR/JOCR, optical character recognition library, version 0.43 or later (version 0.45 recommended, do not use 0.46! See special instructions for 0.47 compilation below)

Get the Osra Source and extract it

cd /tmp/OSRA;

wget http://cactus.nci.nih.gov/osra/osra-1.2.1.tgz;

tar xzvf osra-1.2.1.tgz

cd /tmp/OSRA2/osra-1.2.1;

Make a backup copy of the OSRA Makefile:

cp Makefile Makefile.bak;

Edit the Makefile

Change the following lines:

GOCR=../gocr-0.45/
to
GOCR=../gocr-0.46/

OPENBABEL=/usr/local/
to
OPENBABEL=/usr/

TCLAPINC=-I/usr/local/include/tclap/
to
TCLAPINC=-I/usr/include/tclap/

GOCR=../gocr-0.46/
to
GOCR=../gocr-0.45/

Compiling

Compile, but don’t install the potrace source:
cd /tmp/OSRA/potrace-1.8;
./configure;
make;

Compile the OSRA source:
cd /tmp/OSRA/osra-1.2.1;
make;

This produces a working OSRA binary:

./osra
./osra  [-f <can/smi/sdf>] [-g] [-p] [-s <dimensions, 300x400>] [-n] [-r
<default: auto>] [-o <filename prefix>] [-t <0.2..0.8>] [--]
[--version] [-h] <filename>

Now I just need a file to test it against to see if it will run correctly.

If you want to build with Gocr 0.47 this step is required:
cd /tmp/OSRA/gocr-0.47;
./configure CPPFLAGS=-fPIC LDFLAGS=-fPIC;
make libs;


No Responses to “Compiling Osra on Ubuntu Jaunty”  

  1. No Comments

Leave a Reply


Powered by WP Hashcash


TextureTreesRainWater fountain turned into a Bird BathBackstrandsRoofline

Recently Played Tunes

  • Sasha & John Digweed Sasha & John Digweed
    21 Feb 2010
    4:33 am

  • Lemon Jelly Lemon Jelly
    21 Feb 2010
    4:09 am

  • Fatboy Slim Fatboy Slim
    2 Feb 2010
    4:01 am

Google Search

Google

Categories