changeset 11:143a63ca2bca

Uploaded
author bgruening
date Thu, 23 May 2013 16:19:16 -0400
parents dcbe4666c052
children f265bcf0ddc5
files osra.py osra.xml repository_dependencies.xml test_data/2008001635_153_chem.png test_data/2008001635_153_chem.smi tool_dependencies.xml
diffstat 6 files changed, 43 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/osra.py	Thu May 23 02:57:31 2013 -0400
+++ b/osra.py	Thu May 23 16:19:16 2013 -0400
@@ -14,13 +14,14 @@
         > $outfile
 """
 
-if not os.path.exists(sys.argv[6]):
+if not os.path.exists(sys.argv[7]):
     # OSRA_DATA_FILES path is not set or the spelling file is not existent
     sys.argv.pop(7) # superatom.txt path
     sys.argv.pop(6) # -a
     sys.argv.pop(5) # speling.txt path
     sys.argv.pop(4) # -l
 
-subprocess.call(sys.argv[1:], stdout=sys.stdout)
+sys.argv[0] = 'osra'
+subprocess.call(sys.argv, stdout=sys.stdout)
 
 
--- a/osra.xml	Thu May 23 02:57:31 2013 -0400
+++ b/osra.xml	Thu May 23 16:19:16 2013 -0400
@@ -1,7 +1,7 @@
-<tool id="osra" name="Molecule recognition" version="0.2">
+<tool id="osra" name="Molecule recognition" version="0.3">
     <description>in Images or PDF documents (OSRA)</description>
     <requirements>
-        <requirement type="package" version="1.4.0">osra</requirement>
+        <requirement type="package" version="2.0.0">osra</requirement>
     </requirements>
     <command interpreter='python'>
         ## OSRA_DATA_FILES is set during the toolshed Installation
@@ -12,6 +12,10 @@
         ## further additions of OSRA parameter should go after -l and -a
         ## because -l and -a can be removed by the python wrapper
         
+        $confidence
+        $adaptive
+        $thinning
+        
         > $outfile
     </command>
     <inputs>
@@ -20,6 +24,10 @@
             <option value="can">SMILES</option>
             <option value="sdf">SDF</option>
         </param>
+        <param name="confidence" type="boolean" label="Print out confidence estimate (-p)" truevalue="-p" falsevalue="" checked="true" />
+        <param name="adaptive" type="boolean" label="Adaptive thresholding pre-processing, useful for low light/low contrast images (-i)" truevalue="-i" falsevalue="" checked="false" />
+        <param name="thinning" type="boolean" label="Additional thinning/scaling down of low quality documents (-j)" truevalue="-j" falsevalue="" checked="false" />
+
     </inputs>
     <outputs>
         <data name="outfile" type="data" format="sdf">
@@ -34,6 +42,12 @@
             <param name="oformat" value="sdf"/>
             <output name="outfile" ftype="sdf" file="osra_on_CID2244.sdf"/>
         </test>
+        <test>
+            <param name="infile" ftype="png" value="2008001635_153_chem.png"/>
+            <param name="oformat" value="can"/>
+            <output name="outfile" ftype="sdf" file="2008001635_153_chem.smi"/>
+        </test>
+        
     </tests>
     <help>
 
--- a/repository_dependencies.xml	Thu May 23 02:57:31 2013 -0400
+++ b/repository_dependencies.xml	Thu May 23 16:19:16 2013 -0400
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
 <repositories description="This requires the Molecule datatype definitions (e.g. SMILES, InChI, SD-format).">
     <repository changeset_revision="1b63345907ec" name="molecule_datatypes" owner="bgruening" toolshed="http://testtoolshed.g2.bx.psu.edu" />
-</repositories>
\ No newline at end of file
+</repositories>
Binary file test_data/2008001635_153_chem.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test_data/2008001635_153_chem.smi	Thu May 23 16:19:16 2013 -0400
@@ -0,0 +1,1 @@
+CCC(c1ccc(cc1)Br)OCCCO
--- a/tool_dependencies.xml	Thu May 23 02:57:31 2013 -0400
+++ b/tool_dependencies.xml	Thu May 23 16:19:16 2013 -0400
@@ -6,13 +6,13 @@
     <package name="graphicsmagick" version="1.3.18">
         <repository changeset_revision="34f511310435" name="package_graphicsmagick_1_3" owner="bgruening" prior_installation_required="True" toolshed="http://testtoolshed.g2.bx.psu.edu" />
     </package>
-    <package name="osra" version="1.4.0">
+    <package name="osra" version="2.0.0">
         <install version="1.0">
             <actions>
-                
-                <action type="download_by_url">http://downloads.sourceforge.net/project/osra/osra/1.4.0/osra-1.4.0.tgz</action>
+                <!-- first action is always downloading -->
+                <action type="download_by_url">http://downloads.sourceforge.net/project/osra/osra/2.0.0/osra-2.0.0.tgz</action>
 
-                
+                <!-- populate the environment variables from the dependend repos -->
                 <action type="set_environment_for_install">
                     <repository changeset_revision="efffcee80e03" name="package_openbabel_2_3" owner="bgruening" toolshed="http://testtoolshed.g2.bx.psu.edu">
                         <package name="openbabel" version="2.3.2" />
@@ -22,49 +22,53 @@
                     </repository>
                 </action>
 
-                
+                <!--compiling potrace-1.11 -->
                 <action type="shell_command">wget http://potrace.sourceforge.net/download/potrace-1.11.tar.gz</action>
                 <action type="shell_command">tar xfvz potrace-1.11.tar.gz &amp;&amp; cd potrace-1.11 &amp;&amp; ./configure --with-libpotrace --prefix=$INSTALL_DIR/potrace/build &amp;&amp; make &amp;&amp; make install</action>
 
-                
+                <!--compiling gocr 0.50patched -->
+                <!-- not yet possible 
+                <action type="shell_command">wget http://www-e.uni-magdeburg.de/jschulen/ocr/gocr-0.50.tar.gz</action>
+                <action type="shell_command">tar xfvz gocr-0.50.tar.gz &amp;&amp; cd gocr-0.50 &amp;&amp; ./configure -|-prefix=$INSTALL_DIR/gocr/build &amp;&amp; make libs &amp;&amp; make all install</action>
+                -->
                 <action type="shell_command">wget http://downloads.sourceforge.net/project/osra/gocr-patched/gocr-0.50pre-patched.tgz</action>
                 <action type="shell_command">tar xfvz gocr-0.50pre-patched.tgz &amp;&amp; cd gocr-0.50pre-patched &amp;&amp; ./configure --prefix=$INSTALL_DIR/gocr/build &amp;&amp; make libs &amp;&amp; make all install</action>
 
-                
+
+                <!--compiling tclap 1.2.1 -->
                 <action type="shell_command">wget http://downloads.sourceforge.net/project/tclap/tclap-1.2.1.tar.gz</action>
                 <action type="shell_command">tar xfvz tclap-1.2.1.tar.gz &amp;&amp; cd tclap-1.2.1 &amp;&amp; ./configure --prefix=$INSTALL_DIR/tclap/build &amp;&amp; make &amp;&amp; make install</action>
 
-                
+                <!--compiling ocrad 0.21 -->
                 <action type="shell_command">wget http://mirror.checkdomain.de/gnu/ocrad/ocrad-0.21.tar.gz</action>
                 <action type="shell_command">tar xfvz ocrad-0.21.tar.gz &amp;&amp; cd ocrad-0.21 &amp;&amp; ./configure --prefix=$INSTALL_DIR/ocrad/build &amp;&amp; make &amp;&amp; make install</action>
 
-                
+                <!--compiling cuneiform 1.1.0 -->
                 <action type="shell_command">wget https://launchpad.net/cuneiform-linux/1.1/1.1/+download/cuneiform-linux-1.1.0.tar.bz2</action>
                 <action type="shell_command">tar xfvj cuneiform-linux-1.1.0.tar.bz2 &amp;&amp; cd cuneiform-linux-1.1.0 &amp;&amp; mkdir build &amp;&amp; cd build &amp;&amp; cmake .. -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR/cuneiform/build/ &amp;&amp; make &amp;&amp; make install</action>
 
-                
-                <action type="shell_command">wget http://share.gruenings.eu/osra-1.4.0-configure.patch</action>
-                <action type="shell_command">patch configure &lt; osra-1.4.0-configure.patch</action>
-                
-                <action type="shell_command">export PATH=$PATH:$GRAPHICSMAGICK_ROOT_DIR/bin/ &amp;&amp; ./configure --with-tclap-include=$INSTALL_DIR/tclap/build/include/ --with-potrace-include=$INSTALL_DIR/potrace/build/include/ --with-potrace-lib=$INSTALL_DIR/potrace/build/lib/ --with-gocr-include=$INSTALL_DIR/gocr/build/include/gocr/ --with-gocr-lib=$INSTALL_DIR/gocr/build/lib/ --with-ocrad-include=$INSTALL_DIR/ocrad/build/include/ --with-ocrad-lib=$INSTALL_DIR/ocrad/build/lib/ --with-cuneiform-include=$INSTALL_DIR/cuneiform/build/install/include/ --with-cuneiform --with-cuneiform-lib=$INSTALL_DIR/cuneiform/build/install/lib/ --with-openbabel-include=$OPENBABEL_INCLUDE_DIR/openbabel-2.0/ --with-openbabel-lib=$OPENBABEL_LIB_DIR --with-graphicsmagick-lib=$GRAPHICSMAGICK_ROOT_DIR/lib/ --with-graphicsmagick-include=$GRAPHICSMAGICK_ROOT_DIR/include/GraphicsMagick/ --prefix=$INSTALL_DIR </action>
+                <!--And finally OSRA 1.4.0-->
+                <!-- Extending the PATH is needed for OSRA -->
+                <action type="shell_command">export PATH=$PATH:$GRAPHICSMAGICK_ROOT_DIR/bin/ &amp;&amp; 
+                    ./configure --with-tclap-include=$INSTALL_DIR/tclap/build/include/ --with-potrace-include=$INSTALL_DIR/potrace/build/include/ --with-potrace-lib=$INSTALL_DIR/potrace/build/lib/ --with-gocr-include=$INSTALL_DIR/gocr/build/include/gocr/ --with-gocr-lib=$INSTALL_DIR/gocr/build/lib/ --with-ocrad-include=$INSTALL_DIR/ocrad/build/include/ --with-ocrad-lib=$INSTALL_DIR/ocrad/build/lib/ --with-cuneiform-include=$INSTALL_DIR/cuneiform/build/install/include/ --with-cuneiform --with-cuneiform-lib=$INSTALL_DIR/cuneiform/build/install/lib/ --with-openbabel-include=$OPENBABEL_INCLUDE_DIR/openbabel-2.0/ --with-openbabel-lib=$OPENBABEL_LIB_DIR --with-graphicsmagick-lib=$GRAPHICSMAGICK_ROOT_DIR/lib/ --with-graphicsmagick-include=$GRAPHICSMAGICK_ROOT_DIR/include/GraphicsMagick/ --prefix=$INSTALL_DIR </action>
                 <action type="shell_command">make</action>
                 <action type="shell_command">make install</action>
 
                 <action type="shell_command">rm $INSTALL_DIR/tclap/ -r</action>
-                
+                <!--<action type="shell_command">rm $INSTALL_DIR/openbabel/ -r</action>-->
                 <action type="shell_command">rm $INSTALL_DIR/gocr/ -r</action>
                 <action type="shell_command">rm $INSTALL_DIR/ocrad/ -r</action>
                 <action type="shell_command">rm $INSTALL_DIR/cuneiform/ -r</action>
 
                 <action type="set_environment">
-                    <environment_variable action="prepend_to" name="LD_LIBRARY_PATH">$GRAPHICSMAGICK_ROOT_DIR/lib/</environment_variable>
+                    <environment_variable action="prepend_to" name="LD_LIBRARY_PATH">$ENV[$GRAPHICSMAGICK_ROOT_DIR]/lib/</environment_variable>
                     <environment_variable action="prepend_to" name="LD_LIBRARY_PATH">$INSTALL_DIR/potrace/build/lib/</environment_variable>
                     <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable>
-                    
+                    <!-- OSRA_DATA_FILES is only used by the galaxy wrapper and is not part of OSRA -->
                     <environment_variable action="set_to" name="OSRA_DATA_FILES">$INSTALL_DIR/share</environment_variable>
                 </action>
             </actions>
         </install>
         <readme>We still have a handfull of requirements</readme>
     </package>
-</tool_dependency>
\ No newline at end of file
+</tool_dependency>