{"id":646,"date":"2009-07-04T10:30:06","date_gmt":"2009-07-04T14:30:06","guid":{"rendered":"http:\/\/timony.com\/mickzblog\/?p=646"},"modified":"2009-07-04T10:30:06","modified_gmt":"2009-07-04T14:30:06","slug":"compiling-osra-on-ubuntu-jaunty","status":"publish","type":"post","link":"http:\/\/timony.com\/mickzblog\/2009\/07\/04\/compiling-osra-on-ubuntu-jaunty\/","title":{"rendered":"Compiling Osra on Ubuntu Jaunty"},"content":{"rendered":"<p>This is a brief HOWTO on compiling <a title=\"OSRA Home Page\" href=\"http:\/\/cactus.nci.nih.gov\/osra\/\">OSRA<\/a>, (Optical Structure Recognition) on Ubuntu Jaunty. To quote the OSRA home page, OSRA is<\/p>\n<blockquote><p>&#8230; 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 &#8211; see <a href=\"http:\/\/en.wikipedia.org\/wiki\/SMILES\"> http:\/\/en.wikipedia.org\/wiki\/SMILES<\/a>) or SD file &#8211; a computer recognizable molecular structure format. OSRA can read a document in any of the over 90 graphical formats parseable by ImageMagick &#8211; including GIF, JPEG, PNG, TIFF, PDF, PS etc., and generate the SMILES or SDF representation of the molecular structure images encountered within that document &#8230;<\/p><\/blockquote>\n<p><em>Update<\/em>: I&#8217;ve a newer document that shows how to install Osra on Ubuntu 11.10 (Oneiric):<\/p>\n<ul>\n<li><a title=\"Build &amp; Install Osra 1.3.8 on Ubuntu 11.10\" href=\"http:\/\/timony.com\/mickzblog\/2012\/03\/24\/build-install-osra-1-3-8\/\" target=\"_blank\">http:\/\/timony.com\/mickzblog\/2012\/03\/24\/build-install-osra-1-3-8\/<\/a><\/li>\n<\/ul>\n<p><strong>Make a directory to compile the source:<\/strong><\/p>\n<p><em>mkdir \/tmp\/OSRA; cd \/tmp\/OSRA;<\/em><\/p>\n<p>Be careful doing this in \/tmp is cleaned upon reboot the directory may be removed.<\/p>\n<p><strong>Install dependencies needed by the OS:<\/strong><\/p>\n<p><em>sudo apt-get install libgraphicsmagick1-dev libmagick++-dev libgraphicsmagick++1-dev potrace gocr\u00a0 libtclap-dev libopenbabel-dev libopenbabel3 openbabel libnetpbm10 libnetpbm10-dev<\/em><\/p>\n<p>Don&#8217;t install ocrad and remove it if it&#8217;s on your system (you can probably reinstall if you need to after you get Osra to compile):<br \/>\n<em> sudo apt-get remove &#8211;purge ocrad;<\/em><\/p>\n<p><strong>Source Code:<\/strong><\/p>\n<p>Instead of manually getting the source packages download the sources used to build the packages for Ubuntu if available.\u00a0 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:<\/p>\n<p><em>cd \/tmp\/OSRA; apt-get source gocr ocrad potrace;<\/em><\/p>\n<p>This downloads Gocr 0.46 which the OSRA docs say may not work:<\/p>\n<blockquote><p>&#8211; 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)<!--more--><\/p><\/blockquote>\n<p><strong>Get the Osra Source and extract it<\/strong><\/p>\n<p><em>cd \/tmp\/OSRA;<\/em><\/p>\n<p><em>wget http:\/\/cactus.nci.nih.gov\/osra\/osra-1.2.1.tgz;<\/em><\/p>\n<p><em>tar xzvf osra-1.2.1.tgz<\/em><\/p>\n<p><em>cd \/tmp\/OSRA2\/osra-1.2.1;<\/em><\/p>\n<p><strong>Make a backup copy of the OSRA Makefile:<\/strong><\/p>\n<p><em>cp Makefile Makefile.bak;<\/em><\/p>\n<p><strong>Edit the Makefile<br \/>\n<\/strong><\/p>\n<p>Change the following lines:<\/p>\n<p><em>GOCR=..\/gocr-0.45\/<\/em><br \/>\nto<br \/>\n<em> GOCR=..\/gocr-0.46\/<\/em><\/p>\n<p><em>OPENBABEL=\/usr\/local\/<\/em><br \/>\nto<br \/>\n<em>OPENBABEL=\/usr\/<\/em><\/p>\n<p><em>TCLAPINC=-I\/usr\/local\/include\/tclap\/<\/em><br \/>\nto<br \/>\n<em>TCLAPINC=-I\/usr\/include\/tclap\/<\/em><\/p>\n<p><span style=\"text-decoration: line-through;\"><em>GOCR=..\/gocr-0.46\/<\/em><br \/>\nto<br \/>\n<em>GOCR=..\/gocr-0.45\/<\/em><\/span><\/p>\n<p><strong>Compiling<\/strong><\/p>\n<p>Compile, but don&#8217;t install the potrace source:<br \/>\n<em>cd \/tmp\/OSRA\/potrace-1.8;<br \/>\n.\/configure;<br \/>\nmake;<\/em><\/p>\n<p>Compile the OSRA source:<br \/>\n<em>cd \/tmp\/OSRA\/osra-1.2.1;<br \/>\nmake;<\/em><\/p>\n<p>This produces a working OSRA binary:<\/p>\n<p><em>.\/osra<br \/>\n.\/osra\u00a0 [-f &lt;can\/smi\/sdf&gt;] [-g] [-p] [-s &lt;dimensions, 300&#215;400&gt;] [-n] [-r<br \/>\n&lt;default: auto&gt;] [-o &lt;filename prefix&gt;] [-t &lt;0.2..0.8&gt;] [&#8211;]<br \/>\n[&#8211;version] [-h] &lt;filename&gt;<\/em><\/p>\n<p>Now I just need a file to test it against to see if it will run correctly.<\/p>\n<p>If you want to build with Gocr 0.47 this step is required:<br \/>\n<em>cd \/tmp\/OSRA\/gocr-0.47;<br \/>\n.\/configure CPPFLAGS=-fPIC LDFLAGS=-fPIC;<br \/>\nmake libs;<br \/>\n<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a brief HOWTO on compiling OSRA, (Optical Structure Recognition) on Ubuntu Jaunty. To quote the OSRA home page, OSRA is &#8230; 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 &#8211; &hellip; <a href=\"http:\/\/timony.com\/mickzblog\/2009\/07\/04\/compiling-osra-on-ubuntu-jaunty\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Compiling Osra on Ubuntu Jaunty<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[50,22,41],"tags":[293,325,451,455,460,498],"class_list":["post-646","post","type-post","status-publish","format-standard","hentry","category-cplusplus","category-linux","category-ubuntu-linux-2","tag-gocr","tag-howto","tag-ocrad","tag-openbabel","tag-osra","tag-potrace"],"_links":{"self":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts\/646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/comments?post=646"}],"version-history":[{"count":0,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts\/646\/revisions"}],"wp:attachment":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/media?parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/categories?post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/tags?post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}