changeset 0:6493d130f018

Uploaded
author bgruening
date Tue, 26 Mar 2013 14:49:44 -0400
parents
children e8dce9596b4c
files convert/ob_convert.xml filter/multi_obgrep.py filter/multi_obgrep.xml filter/ob_filter.py filter/ob_filter.xml filter/ob_grep.xml filter/ob_remDuplicates.xml filter/ob_remIons.py filter/ob_remIons.xml filter/ob_remSmall.xml filter/test-data/2_mol.smi filter/test-data/3_mol .smi filter/test-data/8_mol.smi filter/test-data/CID_2244.can filter/test-data/CID_2244.inchi filter/test-data/CID_2244.sdf filter/test-data/CID_2244.smi filter/test-data/CID_2244_FP2.fps filter/test-data/CID_2244_FP3.fps filter/test-data/CID_2244_FP4.fps filter/test-data/CID_2244_addh.can filter/test-data/CID_2244_maccs.fps filter/test-data/ob_filter_on_CID2244.sdf filter/test-data/ob_filter_on_CID2244.smi filter/test-data/ob_filter_on_CID2244_2.smi filter/test-data/ob_remDuplicates_on_2_mol.smi filter/test-data/obgrep_on_8_mol.smi filter/test-data/obremsmall_on_3_mol.smi filter/test-data/obrmions_on_2_mol.smi modify/change_title_to_metadata_value.py modify/change_title_to_metadata_value.xml modify/ob_addh.py modify/ob_addh.xml modify/ob_genProp.py modify/ob_genProp.xml modify/remove_protonation_state.py modify/remove_protonation_state.xml modify/test-data/CID_2244.can modify/test-data/CID_2244.inchi modify/test-data/CID_2244.sdf modify/test-data/CID_2244.smi modify/test-data/CID_2244_FP2.fps modify/test-data/CID_2244_FP3.fps modify/test-data/CID_2244_FP4.fps modify/test-data/CID_2244_addh.can modify/test-data/CID_2244_maccs.fps modify/test-data/CID_3033.sdf modify/test-data/change_title_on_CID_3033.sdf modify/test-data/ob_genprop_on_CID2244.sdf modify/test-data/ob_genprop_on_CID2244.tabular repository_dependencies.xml search/ob_spectrophore_search.py search/ob_spectrophore_search.xml search/test-data/CID2244_with_spectrophore.sdf search/test-data/lib.tabular search/test-data/ob_spectrophore_search.tabular subsearch/subsearch.py subsearch/subsearch.xml visualisation/ob_depiction_svg.xml visualisation/test-data/8_mol.smi visualisation/test-data/ob_depiction_svg_on_8_mol.svg
diffstat 61 files changed, 3829 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convert/ob_convert.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,227 @@
+<tool id="compound_convert" name="Compound Convert">
+    <description>Converts various chemistry and molecular modeling data files</description>
+    <!--<parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+        We can't use that currently, because a few output-datatypes, like the fastsearch index do not support merging. We need to patch galaxy to not abort in such a case
+        and run the job in non.multi mode.
+    -->
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command>
+## The command is a Cheetah template which allows some Python based syntax.
+## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
+
+    #if str($out_format) == 'fs':
+        ## For the fastsearch index we need to copy the original molecule files to the composite datatype of obfs.
+        ## Because openbabel likes file extensions, we give the molecule file a proper file extension.
+        mkdir $outfile.extra_files_path;
+        cp "${infile}" ${os.path.join($outfile.extra_files_path, 'molecule.%s' % $infile.ext )};
+    #end if
+
+obabel -i "${infile.ext}"
+    #if str($out_format) == 'fs':
+        ${os.path.join($outfile.extra_files_path, 'molecule.%s' % $infile.ext )}
+        -o "${out_format}" -e
+        -O ${os.path.join($outfile.extra_files_path,'molecule.fs')}
+    #else:
+        "${infile}"
+        -o "${out_format}" -e
+        -O "${outfile}"
+    #end if
+
+    $remove_h
+    #if $iso_chi or $can or $exp_h:
+        -x$iso_chi$exp_h$can
+    #end if
+    #if $dative_bonds:
+        -b
+    #end if
+    #if int($ph) >= 0:
+        -p $ph
+    #end if
+    2>&#38;1
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="sdf,mol2,cml,inchi,smi" label="Select input file with molecules"/>
+        <!--<param name="format1" type="select" label="Input format">
+            <option value="acr">Carine ASCI Crystal</option>
+            <option value="alc">Alchemy format</option>
+            <option value="arc">Accelrys/MSI Biosym/Insight II CAR format [Read-only]</option>
+            <option value="bgf">MSI BGF format</option>
+            <option value="box">Dock 3.5 Box format</option>
+            <option value="bs">Ball and Stick format</option>
+            <option value="c3d1">Chem3D Cartesian 1 format</option>
+            <option value="c3d2">Chem3D Cartesian 2 format</option>
+            <option value="caccrt">Cacao Cartesian format</option>
+            <option value="can">Canonical SMILES format</option>
+            <option value="car">Accelrys/MSI Biosym/Insight II CAR format [Read-only]</option>
+            <option value="ccc">CCC format [Read-only]</option>
+            <option value="cdx">ChemDraw binary format [Read-only]</option>
+            <option value="cdxml">ChemDraw CDXML format</option>
+            <option value="cif">Crystallographic Information File</option>
+            <option value="cml">Chemical Markup Language</option>
+            <option value="cmlr">CML Reaction format</option>
+            <option value="crk2d">Chemical Resource Kit 2D diagram format</option>
+            <option value="crk3d">Chemical Resource Kit 3D format</option>
+            <option value="ct">ChemDraw Connection Table format</option>
+            <option value="dmol">DMol3 coordinates format</option>
+            <option value="ent">Protein Data Bank format</option>
+            <option value="fch">Gaussian formatted checkpoint file format [Read-only]</option>
+            <option value="fchk">Gaussian formatted checkpoint file format [Read-only]</option>
+            <option value="fck">Gaussian formatted checkpoint file format [Read-only]</option>
+            <option value="feat">Feature format</option>
+            <option value="fract">Free Form Fractional format</option>
+            <option value="fs">Open Babel FastSearching database</option>
+            <option value="g03">Gaussian 98/03 Output [Read-only]</option>
+            <option value="g98">Gaussian 98/03 Output [Read-only]</option>
+            <option value="gam">GAMESS Output [Read-only]</option>
+            <option value="gamout">GAMESS Output [Read-only]</option>
+            <option value="gpr">Ghemical format</option>
+            <option value="hin">HyperChem HIN format</option>
+            <option value="ins">ShelX format [Read-only]</option>
+            <option value="jout">Jaguar output format [Read-only]</option>
+            <option value="mdl">MDL MOL format</option>
+            <option value="mmd">MacroModel format</option>
+            <option value="mmod">MacroModel format</option>
+            <option value="mol">MDL MOL format</option>
+            <option value="mol2">Sybyl Mol2 format</option>
+            <option value="moo">MOPAC Output format [Read-only]</option>
+            <option value="mop">MOPAC Cartesian format</option>
+            <option value="mopcrt">MOPAC Cartesian format</option>
+            <option value="mopin">MOPAC Internal</option>
+            <option value="mopout">MOPAC Output format [Read-only]</option>
+            <option value="mpc">MOPAC Cartesian format</option>
+            <option value="mpqc">MPQC output format [Read-only]</option>
+            <option value="nwo">NWChem output format [Read-only]</option>
+            <option value="pc">PubChem format [Read-only]</option>
+            <option value="pcm">PCModel format</option>
+            <option value="pdb">Protein Data Bank format</option>
+            <option value="pqs">Parallel Quantum Solutions format</option>
+            <option value="prep">Amber Prep format [Read-only]</option>
+            <option value="qcout">Q-Chem output format [Read-only]</option>
+            <option value="res">ShelX format [Read-only]</option>
+            <option value="rxn">MDL RXN format</option>
+            <option value="sdf">MDL MOL format</option>
+            <option value="smi">SMILES format</option>
+            <option value="tdd">Thermo format</option>
+            <option value="therm">Thermo format</option>
+            <option value="tmol">TurboMole Coordinate format</option>
+            <option value="unixyz">UniChem XYZ format</option>
+            <option value="vmol">ViewMol format</option>
+            <option value="xml">General XML format [Read-only]</option>
+            <option value="xyz">XYZ cartesian coordinates format</option>
+            <option value="yob">YASARA.org YOB format</option>
+        </param>-->
+        <param name="out_format" type="select" label="Output format">
+            <option value="acr">Carine ASCI Crystal</option>
+            <option value="alc">Alchemy format</option>
+            <option value="bgf">MSI BGF format</option>
+            <option value="box">Dock 3.5 Box format</option>
+            <option value="bs">Ball and Stick format</option>
+            <option value="c3d1">Chem3D Cartesian 1 format</option>
+            <option value="c3d2">Chem3D Cartesian 2 format</option>
+            <option value="caccrt">Cacao Cartesian format</option>
+            <option value="cache">CAChe MolStruct format [Write-only]</option>
+            <option value="cacint">Cacao Internal format [Write-only]</option>
+            <option value="can">Canonical SMILES format (can)</option>
+            <option value="cdxml">ChemDraw CDXML format</option>
+            <option value="cht">Chemtool format [Write-only]</option>
+            <option value="cif">Crystallographic Information File</option>
+            <option value="cml">Chemical Markup Language</option>
+            <option value="cmlr">CML Reaction format</option>
+            <option value="com">Gaussian 98/03 Cartesian Input [Write-only]</option>
+            <option value="copy">Copies raw text [Write-only]</option>
+            <option value="crk2d">Chemical Resource Kit 2D diagram format</option>
+            <option value="crk3d">Chemical Resource Kit 3D format</option>
+            <option value="csr">Accelrys/MSI Quanta CSR format [Write-only]</option>
+            <option value="cssr">CSD CSSR format [Write-only]</option>
+            <option value="ct">ChemDraw Connection Table format</option>
+            <option value="dmol">DMol3 coordinates format</option>
+            <!--<option value="ent">Protein Data Bank format</option>
+            <option value="fa">FASTA format [Write-only]</option>-->
+            <option value="fasta">FASTA format [Write-only]</option>
+            <option value="feat">Feature format</option>
+            <option value="fh">Fenske-Hall Z-Matrix format [Write-only]</option>
+            <option value="fix">SMILES FIX format [Write-only]</option>
+            <option value="fpt">Fingerprint format [Write-only]</option>
+            <option value="fract">Free Form Fractional format</option>
+            <option value="fs">Open Babel FastSearching database (fs)</option>
+            <!--<option value="fsa">FASTA format [Write-only]</option>-->
+            <option value="gamin">GAMESS Input [Write-only]</option>
+            <option value="gau">Gaussian 98/03 Cartesian Input [Write-only]</option>
+            <!--<option value="gjc">Gaussian 98/03 Cartesian Input [Write-only]</option>
+            <option value="gjf">Gaussian 98/03 Cartesian Input [Write-only]</option>-->
+            <option value="gpr">Ghemical format</option>
+            <option value="gr96">GROMOS96 format [Write-only]</option>
+            <option value="hin">HyperChem HIN format</option>
+            <option value="inchi">IUPAC InChI [Write-only]</option>
+            <option value="inp">GAMESS Input [Write-only]</option>
+            <option value="jin">Jaguar input format [Write-only]</option>
+            <!--<option value="mdl">MDL MOL format (mol)</option>-->
+            <option value="mmd">MacroModel format</option>
+            <option value="mmod">MacroModel format</option>
+            <option value="mol">MDL MOL format (mol)</option>
+            <option value="mol2">Sybyl Mol2 format (mol2)</option>
+            <option value="molreport">Open Babel molecule report [Write-only]</option>
+            <option value="mop">MOPAC Cartesian format</option>
+            <option value="mopcrt">MOPAC Cartesian format</option>
+            <option value="mopin">MOPAC Internal</option>
+            <option value="mpc">MOPAC Cartesian format</option>
+            <option value="mpd">Sybyl descriptor format [Write-only]</option>
+            <option value="mpqcin">MPQC simplified input format [Write-only]</option>
+            <option value="nw">NWChem input format [Write-only]</option>
+            <option value="pcm">PCModel format</option>
+            <option value="pdb">Protein Data Bank format (pdb)</option>
+            <option value="pov">POV-Ray input format [Write-only]</option>
+            <option value="pqs">Parallel Quantum Solutions format</option>
+            <option value="qcin">Q-Chem input format [Write-only]</option>
+            <option value="report">Open Babel report format [Write-only]</option>
+            <option value="rxn">MDL RXN format</option>
+            <!--<option value="sd">MDL MOL format</option>-->
+            <option value="sdf">MDL MOL format (sdf)</option>
+            <option value="smi">SMILES format (smi)</option>
+            <!--<option value="sy2">Sybyl Mol2 format</option>-->
+            <option value="tdd">Thermo format</option>
+            <option value="test">Test format [Write-only]</option>
+            <option value="therm">Thermo format</option>
+            <option value="tmol">TurboMole Coordinate format</option>
+            <option value="txyz">Tinker MM2 format [Write-only]</option>
+            <option value="unixyz">UniChem XYZ format</option>
+            <option value="vmol">ViewMol format</option>
+            <option value="xed">XED format [Write-only]</option>
+            <option value="xyz">XYZ cartesian coordinates format</option>
+            <option value="yob">YASARA.org YOB format</option>
+            <option value="zin">ZINDO input format [Write-only]</option>
+        </param>
+        <param name="iso_chi" type="boolean" label="Do not include isotopic or chiral markings (-xi)" truevalue="i" falsevalue="" checked="false" />
+        <param name="can" type="boolean" label="Output in canonical form (-xc)" truevalue="c" falsevalue="" checked="false" />
+        <param name="exp_h" type="boolean" label="Output explicit hydrogens as such (-xh)" truevalue="h" falsevalue="" checked="false" />
+        <param name="remove_h" type="boolean" label="Delete hydrogen atoms (-d)" truevalue="-d" falsevalue="" />
+        <param name="ph" size="3" type="float" value="-1" label="Add hydrogens appropriate for pH (-p)" help="-1 means deactivated"/>
+        <param name="dative_bonds" type="boolean" label="Convert dative bonds (e.g. [N+]([O-])=O to N(=O)=O) (-b)" truevalue="-b" falsevalue="" />
+    </inputs>
+    <outputs>
+        <data name="outfile" type="data" format="text" label="Convert to ${out_format.input.value_label} from ${on_string}">
+            <change_format>
+                <when input="out_format" value="sdf" format="sdf"/>
+                <when input="out_format" value="smi" format="smi"/>
+                <when input="out_format" value="mol2" format="mol2"/>
+                <when input="out_format" value="inchi" format="inchi"/>
+                <when input="out_format" value="cml" format="cml"/>
+                <when input="out_format" value="mol" format="mol"/>
+                <when input="out_format" value="pdb" format="pdb"/>
+                <when input="out_format" value="fs" format="obfs"/>
+            </change_format>
+        </data>
+    </outputs>
+    <help>
+
+**What it does**
+
+OpenBabel is a cross-platform program designed to interconvert between many file formats used in molecular modeling and computational chemistry and related areas.
+
+-----    
+
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/multi_obgrep.py	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+"""
+    Input: Molecules in SDF, SMILES ...
+    Output: Molecule file filtered with obgrep.
+    Copyright 2013, Bjoern Gruening and Xavier Lucas
+"""
+import sys, os
+import argparse
+import openbabel
+openbabel.obErrorLog.StopLogging()
+import pybel
+import multiprocessing
+import tempfile
+import subprocess
+import shutil
+import shlex
+
+def parse_command_line():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('-i', '--infile', required=True, help='Molecule file.')
+    parser.add_argument('-q', '--query',  required=True, help='Query file, containing different SMARTS in each line.')
+    parser.add_argument('-o', '--outfile', required=True, help='Path to the output file.')
+    parser.add_argument("--iformat", help="Input format, like smi, sdf, inchi")
+    parser.add_argument("--n-times", dest="n_times", type=int,
+                    default=0, help="Print a molecule only if the pattern occurs # times inside the molecule.")
+    parser.add_argument('-p', '--processors', type=int, default=multiprocessing.cpu_count())
+    parser.add_argument("--invert-matches", dest="invert_matches", action="store_true",
+                    default=False, help="Invert the matching, print non-matching molecules.")
+    parser.add_argument("--only-name", dest="only_name", action="store_true",
+                    default=False, help="Only print the name of the molecules.")
+    parser.add_argument("--full-match", dest="full_match", action="store_true",
+                    default=False, help="Full match, print matching-molecules only when the number of heavy atoms is also equal to the number of atoms in the SMARTS pattern.")
+    parser.add_argument("--number-of-matches", dest="number_of_matches", action="store_true",
+                    default=False, help="Print the number of matches.")
+    return parser.parse_args()
+
+results = list()
+def mp_callback(res):
+    results.append(res)
+
+def mp_helper( query, args ):
+    """
+        Helper function for multiprocessing.
+        That function is a wrapper around obgrep.
+    """
+
+    cmd_list = []
+    if args.invert_matches:
+        cmd_list.append('-v')
+    if args.only_name:
+        cmd_list.append('-n')
+    if args.full_match:
+        cmd_list.append('-f')
+    if args.number_of_matches:
+        cmd_list.append('-c')
+    if args.n_times:
+        cmd_list.append('-t %s' % str(args.n_times))
+
+    tmp = tempfile.NamedTemporaryFile(delete=False)
+    cmd = 'obgrep %s "%s" %s' % (' '.join(cmd_list), query, args.infile)
+    child = subprocess.Popen(shlex.split(cmd),
+        stdout=open(tmp.name, 'w+'), stderr=subprocess.PIPE)
+
+    stdout, stderr = child.communicate()
+    return (tmp.name, query)
+
+
+def obgrep( args ):
+
+    temp_file = tempfile.NamedTemporaryFile()
+    temp_link = "%s.%s" % (temp_file.name, args.iformat)
+    temp_file.close()
+    os.symlink(args.infile, temp_link)
+    args.infile = temp_link
+
+    pool = multiprocessing.Pool( args.processors )
+    for query in open( args.query ):
+        pool.apply_async(mp_helper, args=(query.strip(), args), callback=mp_callback)
+        #mp_callback( mp_helper(query.strip(), args) )
+    pool.close()
+    pool.join()
+
+    out_handle = open( args.outfile, 'wb' )
+    for result_file, query in results:
+        res_handle = open(result_file,'rb')
+        shutil.copyfileobj( res_handle, out_handle )
+        res_handle.close()
+        os.remove( result_file )
+    out_handle.close()
+
+    os.remove( temp_link )
+
+def __main__():
+    """
+        Multiprocessing obgrep search.
+    """
+    args = parse_command_line()
+    obgrep( args )
+
+if __name__ == "__main__" :
+    __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/multi_obgrep.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,51 @@
+<tool id="ctb_multi_obgrep" name="Multi Compound Search" version="0.1">
+    <description>an advanced molecular grep program using SMARTS</description>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command interpreter="python">
+
+    multi_obgrep.py
+        -i $infile
+        --iformat ${infile.ext}
+        -q $query
+        -o "${outfile}"
+        $invert_matches
+        --n-times $n_times
+        $only_name
+        $full_match
+        $number_of_matches
+        --processors 10
+
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="sdf,mol,mol2,cml,inchi,smi" label="Compound File" help="Specify a compound file in SDF Format"/>
+        <param name="query" type='data' format="tabular,text" label="Query file" help="One SMARTS pattern in each line."/>
+        <param name="invert_matches" type="boolean" label="Invert the matching, print non-matching molecules (-v)" truevalue="--invert-matches" falsevalue="" checked="false" />
+        <param name="n_times" type="integer" value="0" label="Print a molecule only if the pattern occurs # times inside the molecule" />
+        <param name="only_name" type="boolean" label="Only print the name of the molecules (-n)" truevalue="--only-name" falsevalue="" checked="false" />
+        <param name="full_match" type="boolean" label="Full match, print matching-molecules only when the number of heavy atoms is also equal to the number of atoms in the SMARTS pattern (-f)" truevalue="--full-match" falsevalue="" checked="false" />
+        <param name="number_of_matches" type="boolean" label="Print the number of matches (-c)" truevalue="--number-of-matches" falsevalue="" checked="false" />
+    </inputs>
+    <outputs>
+        <data name="outfile" format_source="infile" />
+    </outputs>
+    <tests>
+        <test>
+        </test>
+    </tests>
+    <help>
+
+
+**What it does**
+
+Providing a query file with SMARTS pattern in each line. These tool will run obgreg in parallel and merges the results.
+
+-----
+
+**Example**
+
+
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/ob_filter.py	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+"""
+    Input: set of molecules with pre-calculated physico-chemical properties
+    Output: set of molecules that pass all the filters
+    Copyright 2012, Bjoern Gruening and Xavier Lucas
+
+    TODO: AND/OR conditions?
+"""
+import sys, os
+import argparse
+import cheminfolib
+import json
+import pybel
+import shlex, subprocess
+
+cheminfolib.pybel_stop_logging()
+
+def parse_command_line():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('-i', '--input', help='Input file name')
+    parser.add_argument('-iformat', help='Input file format')
+    parser.add_argument('-oformat', 
+        default='smi',
+        help='Output file format')
+    parser.add_argument('-o', '--output', 
+        help='Output file name',
+        required=True)
+    parser.add_argument('--filters', 
+        help="Specify the filters to apply",
+        required=True,
+        )
+    return parser.parse_args()
+
+def filter_precalculated_compounds(args, filters):
+    outfile = pybel.Outputfile(args.oformat, args.output, overwrite=True)
+    for mol in pybel.readfile('sdf', args.input):
+        for key, elem in filters.items():
+            # map the short description to the larger metadata names stored in the sdf file
+            property = cheminfolib.ColumnNames[key]
+            min = elem[0]
+            max = elem[1]
+            if float(mol.data[property]) >= float(min) and float(mol.data[property]) <= float(max):
+                pass
+            else:
+                # leave the filter loop, because one filter constrained are not satisfied
+                break
+        else:
+            # if the filter loop terminates in a normal way (no break) all filter rules are satisfied, so save the compound
+            outfile.write(mol)
+    outfile.close()
+
+def filter_new_compounds(args, filters):
+
+    if args.iformat == args.oformat:
+        # use the -ocopy option from openbabel to speed up the filtering, additionally no conversion is carried out
+        # http://openbabel.org/docs/dev/FileFormats/Copy_raw_text.html#copy-raw-text
+        cmd = 'obabel -i%s %s -ocopy -O %s --filter' % (args.iformat, args.input, args.output)
+    else:
+        cmd = 'obabel -i%s %s -o%s -O %s --filter' % (args.iformat, args.input, args.oformat, args.output)
+    filter_cmd = ''
+    # OBDescriptor stores a mapping from our desc shortcut to the OB name [0] and a long description [1]
+    for key, elem in filters.items():
+        ob_descriptor_name = cheminfolib.OBDescriptor[key][0]
+        min = elem[0]
+        max = elem[1]
+        filter_cmd += ' %s>=%s %s<=%s ' % (ob_descriptor_name, min, ob_descriptor_name, max)
+
+    args = shlex.split('%s "%s"' % (cmd, filter_cmd))
+    #print '%s "%s"' % (cmd, filter_cmd)
+    # calling openbabel with subprocess and pipe potential errors occuring in openbabel to stdout
+    child = subprocess.Popen(args,
+        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+    stdout, stderr = child.communicate()
+    return_code = child.returncode
+
+    if return_code:
+        sys.stdout.write(stdout)
+        sys.stderr.write(stderr)
+        sys.stderr.write("Return error code %i from command:\n" % return_code)
+        sys.stderr.write("%s\n" % cmd)
+    else:
+        sys.stdout.write(stdout)
+        sys.stdout.write(stderr)
+
+
+def __main__():
+    """
+        Select compounds with certain properties from a small library
+    """
+    args = parse_command_line()
+    # Its a small trick to get the parameters in an easy way from the xml file.
+    # To keep it readable in the xml file, many white-spaces are included in that string it needs to be removed.
+    # Also the last loop creates a ',{' that is not an valid jason expression.
+    filters = json.loads((args.filters).replace(' ', '').replace(',}', '}'))
+    if args.iformat == 'sdf':
+        # Check if the sdf file contains all of the required metadata to invoke the precalculation filtering
+        mol = pybel.readfile('sdf', args.input).next()
+        for key, elem in filters.items():
+            property = cheminfolib.ColumnNames[key]
+            if not property in mol.data:
+                break
+        else:
+            # if the for loop finishes in a normal way, we should habe all properties at least in the first molecule
+            # assume it is the same for all other molecules and start the precalculated filtering
+            filter_precalculated_compounds(args, filters)
+            return True
+    filter_new_compounds(args, filters)
+
+
+if __name__ == "__main__" :
+    __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/ob_filter.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,199 @@
+<tool id="ctb_filter" name="Filter" version="1.0">
+  <description> a set of molecules from a file</description>
+  <parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+  <requirements>
+    <requirement type="package" version="2.3.2">openbabel</requirement>
+  </requirements>
+  <command interpreter="python">
+    ob_filter.py
+      -i "${infile}"
+      -o "${outfile}"
+      -iformat "${infile.ext}"
+      -oformat "${infile.ext}"
+      --filters '{
+        #if $filter_methods.filter_methods_opts == "ruleof5":
+          "hbd" : [0, 5],
+          "hba" : [0, 10],
+          "molwt" : [0, 500],
+          "logp" : [-5, 5],
+        #elif $filter_methods.filter_methods_opts == "LeadLike":
+          "rotbonds" : [0, 7],
+          "molwt" : [0, 350],
+          "logp" : [-5, 3.5],
+        #elif $filter_methods.filter_methods_opts == "DrugLike":
+          "hba" : [0, 10],
+          "rotbonds" : [0, 8],
+          "molwt" : [150, 500],
+          "logp" : [-5, 5],
+          "psa" : [0, 150],
+        #elif $filter_methods.filter_methods_opts == "FragmentLike":
+          "rotbonds" : [0, 5],
+          "molwt" : [0, 250],
+          "logp" : [-5, 2.5],
+        #else:
+          #for $filter in $filter_methods.filter_set:
+            #set $filter_selected = $filter.filter_sel.filter_sel_opts
+            #set $filter_min = $filter_selected + "_min"
+            #set $filter_max = $filter_selected + "_max"
+            "$filter_selected" : [$filter.filter_sel[$filter_min], $filter.filter_sel[$filter_max] ],
+          #end for
+        #end if
+      }'
+  </command>
+  <inputs>
+    <param name="infile" type="data" format="sdf,smi,mol,mol2,cml,inchi" label="Select input file previously created with the 'Compute physico-chemical properties' tool"/>
+    <conditional name="filter_methods">
+      <param name="filter_methods_opts" type="select" label="Select a pre-defined filtering set">
+        <option value="user">User-defined properties</option>
+        <option value="ruleof5">Lipinski's Rule-of-Five</option>
+        <option value="LeadLike">Lead-like properties</option>
+        <option value="DrugLike">Drug-like properties</option>
+        <option value="FragmentLike">Fragment-like properties</option>
+      </param>
+      <when value="user">
+        <repeat name="filter_set" title="Filters selection">
+          <conditional name="filter_sel">
+            <param name="filter_sel_opts" type="select" label="Select properties to filter">
+              <option value="hbd">Number of Hydrogen-bond donor groups</option>
+              <option value="hba">Number of Hydrogen-bond acceptor groups</option>
+              <option value="psa">Total polar Surface Area</option>
+              <option value="rotbonds">Number of rotatable bonds</option>
+              <option value="molwt">Molecular weight</option>
+              <option value="logp">Predicted value of LogP</option>
+              <option value="mr">Predicted value for the Molecular Refractivity</option>
+              <option value="atoms">Number of atoms</option>
+              <option value="hatoms">Number of heavy atoms</option>
+              <!-- We skip that options, for further information please read: http://www.dalkescientific.com/writings/diary/archive/2011/06/04/dealing_with_sssr.html -->
+              <!--<option value="rings">Number of rings</option>-->
+            </param>
+            <when value="hbd">
+              <param name="hbd_min" size="3" type="integer" value="" label="Minimum number of HB donors"/>
+              <param name="hbd_max" size="3" type="integer" value="" label="Maximum number of HB donors"/>
+            </when>
+            <when value="hba">
+              <param name="hba_min" size="3" type="integer" value="" label="Minimum number of HB acceptors"/>
+              <param name="hba_max" size="3" type="integer" value="" label="Maximum number of HB acceptors"/>
+            </when>
+            <when value="psa">
+              <param name="psa_min" size="5" type="integer" value="" label="Minimum threshold for the Total Polar Surface Area"/>
+              <param name="psa_max" size="5" type="integer" value="" label="Maximum threshold for the Total Polar Surface Area"/>
+            </when>
+            <when value="rotbonds">
+              <param name="rotbonds_min" size="3" type="integer" value="" label="Minimum number of rotatable bonds"/>
+              <param name="rotbonds_max" size="3" type="integer" value="" label="Maximum number of rotatable bonds"/>
+            </when>
+            <when value="molwt">
+              <param name="molwt_min" size="5" type="integer" value="" label="Minimum threshold value for the Molecular Weight"/>
+              <param name="molwt_max" size="5" type="integer" value="" label="Maximum threshold value for the Molecular Weight"/>
+            </when>
+            <when value="logp">
+              <param name="logp_min" size="4" type="float" value="" label="Minimum threshold value for the log-P"/>
+              <param name="logp_max" size="4" type="float" value="" label="Maximum threshold value for the log-P"/>
+            </when>
+            <when value="mr">
+              <param name="mr_min" size="4" type="float" value="" label="Minimum threshold value for the Molecular Refractivity"/>
+              <param name="mr_max" size="4" type="float" value="" label="Maximum threshold value for the Molecular Refractivity"/>
+            </when>
+            <when value="atoms">
+              <param name="atoms_min" size="3" type="integer" value="" label="Minimum number of atoms"/>
+              <param name="atoms_max" size="3" type="integer" value="" label="Maximum number of atoms"/>
+            </when>
+            <!--<when value="rings">
+              <param name="rings_min" size="3" type="integer" value="" label="Minimum number of rings"/>
+              <param name="rings_max" size="3" type="integer" value="" label="Maximum number of rings"/>
+            </when>-->
+          </conditional>
+        </repeat>
+      </when>
+    </conditional>
+  </inputs>
+  <outputs>
+        <data format_source="infile" name="outfile" />
+  </outputs>
+  <tests>
+    <test>
+        <param name="infile" ftype="smi" value="CID_2244.smi"/>
+        <param name="filter_methods_opts" value="ruleof5" />
+        <output name="outfile" ftype="smi" file="ob_filter_on_CID2244.smi" />
+    </test>
+    <test>
+        <param name="infile" ftype="smi" value="CID_2244.smi"/>
+        <param name="filter_methods_opts" value="user" />
+        <param name="filter_sel_opts" value="hba" />
+        <param name="hbd_min" value="0" />
+        <param name="hbd_max" value="5" />
+        <output name="outfile" ftype="smi" file="ob_filter_on_CID2244_2.smi" />
+    </test>
+  </tests>
+  <help>
+
+
+**What does this tool do?**
+
+  This tool filters a library of compounds provided by the user, based on a set of physico-chemical user-defined parameters. Multiple parameters can be selected for more specific queries.
+
+-----
+
+.. class:: infomark
+
+**Tip:** If your input file is in SDF format you can use the 'Compute physico-chemical properties' tool to precalulate the properties and use the filter on that precomputed dataset. It should be faster and can be reused but its bigger than a SMILES file.
+
+**Tip:** for exact matchings please use the target value for both the minimum and maximum parameters (e.g. a selection of EXACTLY 4 rotatable bonds can be performed by selecting 4 minimum and 4 maximum as values for the property).
+
+**Tip:** selecting multiple times the same property with different parameters will result in querying the largest overlapping subset of values for the parameter (e.g. a selection of between 0 and 3 rotatable bonds plus a selection between 2 and 4 will result in a query for compounds between 2 and 3 rotatable bonds).
+
+-----
+
+.. class:: infomark
+
+**Definition of the pre-defined filtering rules:**
+  **# Lipinski's Rule of Five:**
+    =&lt; 5 Hydrogen-bond donor groups
+
+    =&lt; 10 Hydrogen-bond acceptor groups
+
+    =&lt; 500 Molecular weight
+
+    =&lt; 5 octanol/water partition coefficient (log P)
+
+  **# Lead Like properties** (Teague, Davis, Leeson, Oprea, Angew Chem Int Ed Engl. 1999 Dec 16;38(24):3743-3748):
+    =&lt; 7 rotatable bonds
+
+    =&lt; 350 Molecular weight
+
+    =&lt; 3.5 octanol/water partition coefficient (log P)
+
+  **# Drug Like properties** (Lipinski, J Pharmacol Toxicol Methods. 2000 Jul-Aug;44(1):235-49):
+    =&lt; 10 Hydrogen-bond acceptor groups
+
+    =&lt; 8 rotatable bonds
+
+    150 =&lt; Molecular weight =&lt; 500
+
+    =&lt; 150 Polar Surface Area
+
+    =&lt; 5 octanol/water partition coefficient (log P)
+
+  **# Fragment Like properties** (Carr RA, Congreve M, Murray CW, Rees DC, Drug Discov Today. 2005 Jul 15;10(14):987):
+    =&lt; 5 rotatable bonds
+
+    =&lt; 250 Molecular weight
+
+    =&lt; 2.5 octanol/water partition coefficient (log P)
+
+-----
+
+.. class:: infomark
+
+**Output:** the output formats included in this implementation are:
+
+    # sdf formatted coordinates of the molecules, with selected properties stored as meta-data for each compound.
+
+    # SMILES, InChI or mol2 formatted files containing the 1D strings or 3D coordinates of each compound.
+
+-----
+
+**This tool uses Pybel:** N. M. O'Boyle, C. Morley and G. R. Hutchison. Pybel: a Python wrapper for the OpenBabel cheminformatics toolkit Chem. Cent. J. 2008, 2, 5.
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/ob_grep.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,68 @@
+<tool id="ctb_obgrep" name="Compound Search" version="0.1">
+    <description>an advanced molecular grep program using SMARTS</description>
+    <parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command>
+        ## The command is a Cheetah template which allows some Python based syntax.
+        ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
+        obgrep
+
+        $invert_matches
+        #if $n_times != 0:
+            -t $n_times
+        #end if
+
+        $only_name
+        $full_match
+        $number_of_matches
+        -i ${infile.ext}
+        "${smarts_pattern}"
+        "${infile}"
+        > "${outfile}" 2>&#38;1
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="sdf,mol,mol2,cml,inchi,smi" label="Compound File" help="Specify a compound file in SDF Format."/>
+        <param name="smarts_pattern" type="text" format="text" label="SMARTS Pattern" help="Specify a SMARTS Pattern for your search."/>
+        <param name="invert_matches" type="boolean" label="Invert the matching, print non-matching molecules" truevalue="-v" falsevalue="" checked="false" />
+        <param name="n_times" type="integer" value="0" label="Print a molecule only if the pattern occurs # times inside the molecule" />
+        <param name="only_name" type="boolean" label="Only print the name of the molecules" truevalue="-n" falsevalue="" checked="false" />
+        <param name="full_match" type="boolean" label="Full match, print matching-molecules only when the number of heavy atoms is also equal to the number of atoms in the SMARTS pattern" truevalue="-f" falsevalue="" checked="false" />
+        <param name="number_of_matches" type="boolean" label="Print the number of matches" truevalue="-c" falsevalue="" checked="false" />
+    </inputs>
+    <options sanitize="False"/>
+    <outputs>
+        <data name="outfile" format_source="infile" />
+    </outputs>
+    <tests>
+    <test>
+        <param name="infile" ftype="smi" value="8_mol.smi"/>
+        <param name="smarts_pattern" value="CO"/>
+        <param name="invert_matches" value="" />
+        <param name="n_times" value="0"/>
+        <param name="only_name" value="" />
+        <param name="full_match" value="" />
+        <param name="number_of_matches" value="" />
+        <output name="outfile" ftype="smi" file="obgrep_on_8_mol.smi"/>
+    </test>
+    </tests>
+    <help>
+.. class:: warningmark
+
+**What it does**
+
+The obgrep tool can be used to search for molecules inside multi-molecule database files (e.g., SMILES, SDF, etc.) or across multiple files.
+
+-----
+
+**Output format**
+
+
+**References**
+
+Rajarshi Guha, Michael T. Howard, Geoffrey R. Hutchison, Peter Murray-Rust, Henry Rzepa, Christoph Steinbeck, Joerg Kurt Wegner, Egon Willighagen. "The Blue Obelisk -- Interoperability in Chemical Informatics." J. Chem. Inf. Model. (2006) 46(3) 991-998. DOI:10.1021/ci050400b
+The Open Babel Package http://openbabel.sourceforge.net/
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/ob_remDuplicates.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,60 @@
+<tool id="ctb_remDuplicates" name="Remove duplicated molecules" version="1.0">
+    <description></description>
+    <parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+  <command>
+    obabel
+      -i"${infile.ext}"
+       "${infile}
+      -ocopy
+      --unique "${descriptor}"
+      -O "${outfile}"
+      -e
+      2>&#38;1
+  </command>
+  <inputs>
+    <param name="infile" type="data" format="sdf,mol,mol2,cml,inchi,smi" label="Molecular input file"/>
+    <param name="descriptor" type="select" label="Select descriptor for molecule comparison">
+      <option value="inchi" checked="True">InChI (default)</option>
+      <option value="cansmi">Canonical SMILES</option>
+      <option value="cansmiNS">Canonical SMILES (without stereo)</option>
+    </param>
+  </inputs>
+  <outputs>
+    <data format_source="infile" name="outfile"/>
+  </outputs>
+  <tests>
+    <test>
+        <param name="infile" ftype="smi" value="2_mol.smi"/>
+            <param name="descriptor" value="inchi" />
+        <output name="outfile" ftype="smi" file="ob_remDuplicates_on_2_mol.smi" />
+    </test>
+  </tests>
+  <help>
+
+.. class:: infomark
+
+**What does this tool do?**
+
+  This tool filters a library of compounds and removes duplicated molecules.
+
+-----
+
+.. class:: warningmark
+
+**Tip:** comparison based on Canonical SMILES without stereochemistry may be useful in cases where this information is not crucial for library preparation. Several VS tools will automatically generate stereoisomeric forms.
+
+-----
+
+.. class:: infomark
+
+**Output format:** is the same as the input file format.
+
+-----
+
+**This tool uses OpenBabel:** The Open Babel Package, version 2.3.0 http://openbabel.sourceforge.net/
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/ob_remIons.py	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+"""
+    Input: molecular input file.
+    Output: Molecule file with removed ions and fragments.
+    Copyright 2012, Bjoern Gruening and Xavier Lucas
+"""
+import sys, os
+import argparse
+import openbabel
+openbabel.obErrorLog.StopLogging()
+import pybel
+
+def parse_command_line():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('-iformat', default='sdf' , help='input file format')
+    parser.add_argument('-i', '--input', required=True, help='input file name')
+    parser.add_argument('-o', '--output', required=True, help='output file name')
+    return parser.parse_args()
+
+def remove_ions(args):
+    outfile = pybel.Outputfile(args.iformat, args.output, overwrite=True)
+    for mol in pybel.readfile(args.iformat, args.input):
+        if mol.OBMol.NumHvyAtoms() > 5:
+            mol.OBMol.StripSalts(0)
+            # Check if new small fragments have been created and remove them
+            if mol.OBMol.NumHvyAtoms() > 5:
+                outfile.write(mol)
+    outfile.close()
+
+def __main__():
+    """
+        Remove any counterion and delete any fragment but the largest one for each molecule.
+    """
+    args = parse_command_line()
+    remove_ions(args)
+
+if __name__ == "__main__" :
+    __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/ob_remIons.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,46 @@
+<tool id="ctb_remIons" name="Remove counterions and fragments" version="1.0">
+    <description></description>
+    <parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command interpreter="python">
+    ob_remIons.py
+      -i "${infile}"
+      -iformat "${infile.ext}"
+      -o "${outfile}"
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="sdf,mol,mol2,cml,inchi,smi" label="Select input file with multiple molecules"/>
+    </inputs>
+    <outputs>
+        <data format_source="infile" name="outfile"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="infile" ftype="smi" value="2_mol.smi"/>
+            <output name="outfile" ftype="smi" file="obrmions_on_2_mol.smi" />
+        </test>
+    </tests>
+    <help>
+
+.. class:: infomark
+
+**What does this tool do?**
+
+  This tool parses a multiple molecules file and deletes any counter ion or fragment present in the file.
+
+-----
+
+.. class:: infomark
+
+  ... Only the **largest fragment** on every molecule is extracted.
+
+  ... Only molecules with more than 5 heavy atoms are parsed.
+
+-----
+
+**This tool uses Pybel:** N. M. O'Boyle, C. Morley and G. R. Hutchison. Pybel: a Python wrapper for the OpenBabel cheminformatics toolkit Chem. Cent. J. 2008, 2, 5.
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/ob_remSmall.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,56 @@
+<tool id="ctb_remSmall" name="Remove small molecules" version="1.0">
+    <description></description>
+    <parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command>
+    obabel
+      -i"${infile.ext}"
+      "${infile}"
+      -ocopy
+      -O "${outfile}"
+      --filter "atoms > $cutoff"
+      -e
+      2>&#38;1
+    </command>
+    <inputs>
+        <param name="infile" format="sdf,mol,mol2,cml,inchi,smi" type="data" label="Molecular input file" />
+        <param name="cutoff" size="3" type="integer" value="5" label="Specify the cut-off value (only molecules with more than this number of atoms will pass the filter)" />
+    </inputs>
+    <outputs>
+        <data format_source="infile" name="outfile" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="infile" ftype="smi" value="3_mol.smi" />
+            <param name="cutoff" value="5" />
+            <output name="outfile" ftype="smi" file="obremsmall_on_3_mol.smi" />
+        </test>
+    </tests>
+    <help>
+
+.. class:: infomark
+
+**What does this tool do?**
+
+  This tool filters a library of compounds and removes small molecules.
+
+-----
+
+.. class:: warningmark
+
+**Tip:** some libraries may contain molecules without 1D/3D descriptor. These molecules may provoke the crashing of any other tool. As a general rule, the user is strongly adviced to run this tool before proceeding to any further step.
+
+-----
+
+.. class:: infomark
+
+**Output format:** is the same as the input file format.
+
+-----
+
+**This tool uses OpenBabel:** The Open Babel Package, version 2.3.0 http://openbabel.sourceforge.net/
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/2_mol.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,2 @@
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/3_mol .smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,3 @@
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
+C
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/8_mol.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,8 @@
+C1NC2=CC(=C(C=C2S(=O)(=O)N1)S(=O)(=O)N)Cl
+C1=COC(=C1)CNC2=CC(=C(C=C2C(=O)O)S(=O)(=O)N)Cl
+CO[C@H]1[C@@H](C[C@@H]2CN3CCC4=C([C@H]3C[C@@H]2[C@@H]1C(=O)OC)NC5=C4C=CC(=C5)OC)OC(=O)C6=CC(=C(C(=C6)OC)OC)OC
+CO[C@H]1[C@@H](C[C@@H]2CN3CCC4=C([C@H]3C[C@@H]2[C@@H]1C(=O)OC)NC5=C4C=CC(=C5)OC)OC(=O)C6=CC(=C(C(=C6)OC)OC)OC.C1NC2=CC(=C(C=C2S(=O)(=O)N1)S(=O)(=O)N)Cl
+CCC1(N=C2C=C3C(=NC4=CC=CC=C4N3C5=CC=CC=C5)C=C2N1C6=CC=CC=C6)CC
+CCC1(N=C2C=C3C(=NC4=CC=CC=C4N3C5=CC=CC=C5)C=C2N1C6=CC=CC=C6)C
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/CID_2244.can	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+CC(=O)Oc1ccccc1C(=O)O	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/CID_2244.inchi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/CID_2244.sdf	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,155 @@
+2244
+  -OEChem-05151212332D
+
+ 21 21  0     0  0  0  0  0  0999 V2000
+    3.7320   -0.0600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -1.5600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641    0.9400    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.0000   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.0611   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.6800    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    2.3100    0.4769    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.4631    0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.6900   -0.5969    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    2.0600    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+> <PUBCHEM_COMPOUND_CID>
+2244
+
+> <PUBCHEM_COMPOUND_CANONICALIZED>
+1
+
+> <PUBCHEM_CACTVS_COMPLEXITY>
+212
+
+> <PUBCHEM_CACTVS_HBOND_ACCEPTOR>
+4
+
+> <PUBCHEM_CACTVS_HBOND_DONOR>
+1
+
+> <PUBCHEM_CACTVS_ROTATABLE_BOND>
+3
+
+> <PUBCHEM_CACTVS_SUBSKEYS>
+AAADccBwOAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAABAAAAGgAACAAADASAmAAyDoAABgCIAiDSCAACCAAkIAAIiAEGCMgMJzaENRqCe2Cl4BEIuYeIyCCOAAAAAAAIAAAAAAAAABAAAAAAAAAAAA==
+
+> <PUBCHEM_IUPAC_OPENEYE_NAME>
+2-acetoxybenzoic acid
+
+> <PUBCHEM_IUPAC_CAS_NAME>
+2-acetyloxybenzoic acid
+
+> <PUBCHEM_IUPAC_NAME>
+2-acetyloxybenzoic acid
+
+> <PUBCHEM_IUPAC_SYSTEMATIC_NAME>
+2-acetyloxybenzoic acid
+
+> <PUBCHEM_IUPAC_TRADITIONAL_NAME>
+2-acetoxybenzoic acid
+
+> <PUBCHEM_IUPAC_INCHI>
+InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)
+
+> <PUBCHEM_IUPAC_INCHIKEY>
+BSYNRYMUTXBXSQ-UHFFFAOYSA-N
+
+> <PUBCHEM_XLOGP3>
+1.2
+
+> <PUBCHEM_EXACT_MASS>
+180.042259
+
+> <PUBCHEM_MOLECULAR_FORMULA>
+C9H8O4
+
+> <PUBCHEM_MOLECULAR_WEIGHT>
+180.15742
+
+> <PUBCHEM_OPENEYE_CAN_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+> <PUBCHEM_OPENEYE_ISO_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+> <PUBCHEM_CACTVS_TPSA>
+63.6
+
+> <PUBCHEM_MONOISOTOPIC_WEIGHT>
+180.042259
+
+> <PUBCHEM_TOTAL_CHARGE>
+0
+
+> <PUBCHEM_HEAVY_ATOM_COUNT>
+13
+
+> <PUBCHEM_ATOM_DEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_ATOM_UDEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_BOND_DEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_BOND_UDEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_ISOTOPIC_ATOM_COUNT>
+0
+
+> <PUBCHEM_COMPONENT_COUNT>
+1
+
+> <PUBCHEM_CACTVS_TAUTO_COUNT>
+1
+
+> <PUBCHEM_COORDINATE_TYPE>
+1
+5
+255
+
+> <PUBCHEM_BONDANNOTATIONS>
+5  6  8
+5  7  8
+6  8  8
+7  9  8
+8  10  8
+9  10  8
+
+$$$$
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/CID_2244.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+O(c1c(cccc1)C(=O)O)C(=O)C	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/CID_2244_FP2.fps	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,7 @@
+#FPS1
+#num_bits=1021
+#type=OpenBabel-FP2/1
+#software=OpenBabel/2.3.1
+#source=CID_2244.sdf
+#date=2012-05-15T16:40:38
+00000010004000c00000020000030000010000000008000000000080000000000400400000000010200a020800000000000042000000000000800002000002000c200800010001010000000002808002208000400000000040080000000100000008000000000002004002000010000000020100080100200808000000000004	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/CID_2244_FP3.fps	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,7 @@
+#FPS1
+#num_bits=55
+#type=OpenBabel-FP3/1
+#software=OpenBabel/2.3.1
+#source=CID_2244.sdf
+#date=2012-05-15T16:59:15
+0400000c50b007	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/CID_2244_FP4.fps	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,7 @@
+#FPS1
+#num_bits=307
+#type=OpenBabel-FP4/1
+#software=OpenBabel/2.3.1
+#source=CID_2244.sdf
+#date=2012-05-15T16:59:22
+010000000000000000009800000000004001000000000000000000000000000000000240402801	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/CID_2244_addh.can	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+CC(=O)Oc1ccccc1C(=O)[O-]	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/CID_2244_maccs.fps	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,7 @@
+#FPS1
+#num_bits=166
+#type=OpenBabel-MACCS/2
+#software=OpenBabel/2.3.1
+#source=CID_2244.sdf
+#date=2012-05-15T17:00:39
+0000000000000000000000010000016480cca2d21e	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/ob_filter_on_CID2244.sdf	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,154 @@
+2244
+ OpenBabel07101213142D
+
+ 21 21  0  0  0  0  0  0  0  0999 V2000
+    3.7320   -0.0600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -1.5600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641    0.9400    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.0000   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.0611   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.6800    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    2.3100    0.4769    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.4631    0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.6900   -0.5969    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    2.0600    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+>  <PUBCHEM_COMPOUND_CID>
+2244
+
+>  <PUBCHEM_COMPOUND_CANONICALIZED>
+1
+
+>  <PUBCHEM_CACTVS_COMPLEXITY>
+212
+
+>  <PUBCHEM_CACTVS_HBOND_ACCEPTOR>
+4
+
+>  <PUBCHEM_CACTVS_HBOND_DONOR>
+1
+
+>  <PUBCHEM_CACTVS_ROTATABLE_BOND>
+3
+
+>  <PUBCHEM_CACTVS_SUBSKEYS>
+AAADccBwOAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAABAAAAGgAACAAADASAmAAyDoAABgCIAiDSCAACCAAkIAAIiAEGCMgMJzaENRqCe2Cl4BEIuYeIyCCOAAAAAAAIAAAAAAAAABAAAAAAAAAAAA==
+
+>  <PUBCHEM_IUPAC_OPENEYE_NAME>
+2-acetoxybenzoic acid
+
+>  <PUBCHEM_IUPAC_CAS_NAME>
+2-acetyloxybenzoic acid
+
+>  <PUBCHEM_IUPAC_NAME>
+2-acetyloxybenzoic acid
+
+>  <PUBCHEM_IUPAC_SYSTEMATIC_NAME>
+2-acetyloxybenzoic acid
+
+>  <PUBCHEM_IUPAC_TRADITIONAL_NAME>
+2-acetoxybenzoic acid
+
+>  <PUBCHEM_IUPAC_INCHI>
+InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)
+
+>  <PUBCHEM_IUPAC_INCHIKEY>
+BSYNRYMUTXBXSQ-UHFFFAOYSA-N
+
+>  <PUBCHEM_XLOGP3>
+1.2
+
+>  <PUBCHEM_EXACT_MASS>
+180.042259
+
+>  <PUBCHEM_MOLECULAR_FORMULA>
+C9H8O4
+
+>  <PUBCHEM_MOLECULAR_WEIGHT>
+180.15742
+
+>  <PUBCHEM_OPENEYE_CAN_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+>  <PUBCHEM_OPENEYE_ISO_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+>  <PUBCHEM_CACTVS_TPSA>
+63.6
+
+>  <PUBCHEM_MONOISOTOPIC_WEIGHT>
+180.042259
+
+>  <PUBCHEM_TOTAL_CHARGE>
+0
+
+>  <PUBCHEM_HEAVY_ATOM_COUNT>
+13
+
+>  <PUBCHEM_ATOM_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ATOM_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ISOTOPIC_ATOM_COUNT>
+0
+
+>  <PUBCHEM_COMPONENT_COUNT>
+1
+
+>  <PUBCHEM_CACTVS_TAUTO_COUNT>
+1
+
+>  <PUBCHEM_COORDINATE_TYPE>
+1
+5
+255
+
+>  <PUBCHEM_BONDANNOTATIONS>
+5  6  8
+5  7  8
+6  8  8
+7  9  8
+8  10  8
+9  10  8
+
+$$$$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/ob_filter_on_CID2244.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+O(c1c(cccc1)C(=O)O)C(=O)C	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/ob_filter_on_CID2244_2.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+O(c1c(cccc1)C(=O)O)C(=O)C	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/ob_remDuplicates_on_2_mol.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,3 @@
+Removed  - a duplicate of  (#1)
+CC(=O)Oc1ccccc1C(=O)[O-]	
+1 molecule converted
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/obgrep_on_8_mol.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,4 @@
+c1coc(c1)CNc1cc(c(cc1C(=O)O)S(=O)(=O)N)Cl	
+CO[C@H]1[C@@H](C[C@@H]2CN3CCc4c([C@H]3C[C@@H]2[C@@H]1C(=O)OC)[nH]c1c4ccc(c1)OC)OC(=O)c1cc(c(c(c1)OC)OC)OC	
+CO[C@H]1[C@@H](C[C@@H]2CN3CCc4c([C@H]3C[C@@H]2[C@@H]1C(=O)OC)[nH]c1c4ccc(c1)OC)OC(=O)c1cc(c(c(c1)OC)OC)OC.C1Nc2cc(c(cc2S(=O)(=O)N1)S(=O)(=O)N)Cl	
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/obremsmall_on_3_mol.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,2 @@
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter/test-data/obrmions_on_2_mol.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,2 @@
+CC(=O)Oc1ccccc1C(=O)[O-]	
+CC(=O)Oc1ccccc1C(=O)[O-]	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/change_title_to_metadata_value.py	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+"""
+    Change the title from a molecule file to metadata
+    value of a given-id of the same molecule file.
+"""
+
+import os, sys
+import argparse
+import openbabel
+openbabel.obErrorLog.StopLogging()
+import pybel
+
+
+def main():
+    parser = argparse.ArgumentParser(
+        description="Change the title from a molecule file to metadata \
+value of a given-id of the same molecule file.",
+    )
+    parser.add_argument('--infile', '-i', 
+        required=True, help="path to the input file")
+    parser.add_argument('--outfile', '-o', 
+        required=True, help="path to the output file")
+    parser.add_argument('--key', '-k',
+        required=True, help="the metadata key from the sdf file which should inlcude the new title")
+
+    args = parser.parse_args()
+
+    output = pybel.Outputfile("sdf", args.outfile, overwrite=True)
+
+    for mol in pybel.readfile("sdf", args.infile):
+        if args.key in mol.data:
+            mol.title = mol.data[args.key]
+        output.write( mol )
+
+    output.close()
+
+
+if __name__ == "__main__":
+    main()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/change_title_to_metadata_value.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,55 @@
+<tool id="ctb_change_title" name="Change Title" version="0.0.1">
+    <description>to meta-data value.</description>
+    <parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+    <requirements>
+        <requirement type="python-module">pybel</requirement>
+    </requirements>
+    <command interpreter="python">
+        ## The command is a Cheetah template which allows some Python based syntax.
+        ## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
+        change_title_to_metadata_value.py
+        --infile "${infile}"
+        --key "${key}"
+        --outfile "${outfile}"
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="sdf,mol2" label="Compound File" help="Specify a compound file in SD- or MOL2-format."/>
+        <param name="key" type="text" format="text" label="Compound Identifier encoded in the SDF file." help="Specify the key name of the SDF metadata, that contains the molecule identifier."/>
+    </inputs>
+    <outputs>
+        <data name="outfile" format_source="infile"/>
+    </outputs>
+    <tests>
+        <param name="infile" type="sdf" value="CID_3033.sdf"/>
+        <param name="key" value="PUBCHEM_SHAPE_VOLUME"/>
+        <data name="output" type="sdf" file="change_title_on_CID_3033.sdf"/>
+    </tests>
+    <help>
+
+.. class:: infomark
+
+**Hint**
+
+  To convert the output, use the pencil icon next to the history entry.
+
+------
+
+**What it does**
+
+Change the title from a molecule file to metadata value of a given-id of the same molecule file.
+
+-----
+
+**Input format**
+
+SDF with metadata including the given key.
+
+**Output format**
+
+Same as input with changed title tag.
+
+**References**
+
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/ob_addh.py	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+"""
+    Input:  Molecule file
+    Output: Molecule file with hydrogen atoms added at the target pH.
+"""
+import sys, os
+import argparse
+import openbabel
+openbabel.obErrorLog.StopLogging()
+import pybel
+
+def parse_command_line(argv):
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--iformat', type=str, default='sdf' , help='input file format')
+    parser.add_argument('-i', '--input', type=str, required=True, help='input file name')
+    parser.add_argument('-o', '--output', type=str, required=True, help='output file name')
+    parser.add_argument('--polar', action="store_true", default=False, help='Add hydrogen atoms only to polar atoms')
+    parser.add_argument('--pH', type=float, default="7.4", help='Specify target pH value')
+    return parser.parse_args()
+
+def addh(args):
+    outfile = pybel.Outputfile(args.iformat, args.output, overwrite=True)
+    for mol in pybel.readfile(args.iformat, args.input):
+        if mol.OBMol.NumHvyAtoms() > 5:
+            mol.removeh()
+            mol.OBMol.AddHydrogens(args.polar, True, args.pH)
+            outfile.write(mol)
+    outfile.close()
+
+def __main__():
+    """
+        Add hydrogen atoms at a certain pH value
+    """
+    args = parse_command_line(sys.argv)
+    addh(args)
+
+if __name__ == "__main__" :
+    __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/ob_addh.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,62 @@
+<tool id="ob_addh" name="Add hydrogen atoms" version="1.0">
+    <description>at a certain pH value</description>
+    <parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command interpreter="python">
+    ob_addh.py
+      -i "${infile}"
+      --iformat "${infile.ext}"
+      -o "${outfile}"
+      $polar
+      --pH "${pH_value}"
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="sdf,smi,mol,mol2,cml,inchi" label="Select input file"/>
+        <param name="polar" type="boolean" truevalue="--polar" falsevalue="" label="Add hydrogens to polar atoms only"/>
+        <param name="pH_value" type="float" size="4" value="7.4" label="Specify pH value"/>
+    </inputs>
+    <outputs>
+        <data format_source="infile" name="outfile" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="infile" value="CID_2244.can" ftype="smi" />
+            <param name="polar" value="--polar" />
+            <param name="pH_value" value="7.4" />
+            <output name="outfile" file="CID_2244_addh.can" ftype="can" />
+        </test>
+    </tests>
+    <help>
+
+.. class:: infomark
+
+**What does this tool do?**
+
+  This tool parses a molecular file and adds hydrogen atoms at a certain pH value.
+
+-----
+
+.. class:: infomark
+
+**Protocol:**
+
+  **1.** The hydrogen atoms included in the input molecule are deleted.
+
+  **2.** Protonation state is predicted at the target pH and the corresponding hydrogen atoms added accordingly.
+
+  **Hint:** to avoid possible crashes, only molecules with >5 heavy atoms are parsed.
+
+-----
+
+.. class:: infomark
+
+  **Output:** the output format is the same as the input format. 3D format files are required for this tool.
+
+-----
+
+**This tool uses Pybel:** N. M. O'Boyle, C. Morley and G. R. Hutchison. Pybel: a Python wrapper for the OpenBabel cheminformatics toolkit Chem. Cent. J. 2008, 2, 5.
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/ob_genProp.py	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+"""
+    Input: Molecular input file.
+    Output: Physico-chemical properties are computed and stored as metadata in the sdf output file.
+    Copyright 2012, Bjoern Gruening and Xavier Lucas
+"""
+import sys, os
+import argparse
+import openbabel
+openbabel.obErrorLog.StopLogging()
+import pybel
+import cheminfolib
+
+
+def parse_command_line(argv):
+    parser = argparse.ArgumentParser()
+    parser.add_argument('-iformat', default='sdf' , help='input file format')
+    parser.add_argument('-i', '--input', required=True, help='input file name')
+    parser.add_argument('-oformat', default='sdf', choices = ['sdf', 'table'] , help='output file format')
+    parser.add_argument('--header', type=bool, help='Include the header as the first line of the output table')
+    parser.add_argument('-o', '--output', required=True, help='output file name')
+    return parser.parse_args()
+
+def compute_properties(args):
+    if args.oformat == 'sdf':
+        outfile = pybel.Outputfile(args.oformat, args.output, overwrite=True)
+    else:
+        outfile = open(args.output, 'w')
+        if args.header:
+            mol = pybel.readfile(args.iformat, args.input).next()
+            metadata = cheminfolib.get_properties_ext(mol)
+            outfile.write( '%s\n' % '\t'.join( [ cheminfolib.ColumnNames[key] for key in metadata ] ) )
+
+    for mol in pybel.readfile(args.iformat, args.input):
+        if mol.OBMol.NumHvyAtoms() > 5:
+            metadata = cheminfolib.get_properties_ext(mol)
+            if args.oformat == 'sdf':
+                [ mol.data.update( { cheminfolib.ColumnNames[key] : metadata[key] } ) for key in metadata ]
+                outfile.write(mol)
+            else:
+                outfile.write( '%s\n' % ('\t'.join( [ str(metadata[key]) for key in metadata ] ) ) )
+    outfile.close()
+
+def __main__():
+    """
+        Physico-chemical properties are computed and stored as metadata in the sdf output file
+    """
+    args = parse_command_line(sys.argv)
+    compute_properties(args)
+
+if __name__ == "__main__" :
+    __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/ob_genProp.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,111 @@
+<tool id="ob_genProp" name="Compute physico-chemical properties" version="1.0">
+    <description>for a set of molecules</description>
+    <parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command interpreter="python">
+    ob_genProp.py
+      -i "${infile}"
+      -iformat "${infile.ext}"
+      -oformat "${output_opts.output_format_types}"
+      #if $output_opts.header.value:
+        --header $output_opts.header
+      #end if
+      -o "${outfile}"
+  </command>
+  <inputs>
+    <param name="infile" type="data" format="sdf,mol,mol2,cml,inchi,smi" label="Select input file with multiple molecules."/>
+    <conditional name="output_opts">
+      <param name="output_format_types" type="select" label="Specify output format file">
+        <option value="table">Tabular format</option>
+        <option value="sdf" selected="True">sdf</option>
+      </param>
+      <when value="table">
+        <param name="header" type="boolean" checked="False" label="Print the headers of the table as the first row of the table"/>
+      </when>
+      <when value="sdf">
+        <param name="header" type="hidden"/>
+      </when>
+    </conditional>
+  </inputs>
+  <outputs>
+    <data format="tabular" name="outfile">
+        <change_format>
+            <when input="$output_opts.output_format_types" value="sdf" format="sdf"/>
+        </change_format>
+    </data>
+  </outputs>
+  <tests>
+    <test>
+        <param name="infile" ftype="sdf" value="CID_2244.sdf"/>
+        <param name="output_format_types" value="sdf" />
+        <output name="outfile" ftype="sdf" file="ob_genprop_on_CID2244.sdf" />
+    </test>
+    <test>
+        <param name="infile" ftype="sdf" value="CID_2244.sdf"/>
+        <param name="output_format_types" value="table" />
+        <param name="header" value="true" />
+        <output name="outfile" ftype="sdf" file="ob_genprop_on_CID2244.tabular" />
+    </test>
+  </tests>
+  <help>
+
+.. class:: infomark
+
+**What does this tool do?**
+
+  This tool computes several physico-chemical properties for a set of molecules.
+
+-----
+
+.. class:: warningmark
+
+**Tip:** the generation of Spectrophores(TM) requires the previous addition of explicit hydrogen atoms and the proper definition of 3D coordinates. The user is directed towards the corresponding tools if accurate Spectrophores(TM) descriptors are required.
+
+-----
+
+.. class:: infomark
+
+**Input:** molecular file in sdf or mol2 format files. The input file may contain multiple molecules. 3D coordinates of the files have to be provided.
+
+**Output:** this program generates an sdf file containing several computed physico-chemical properties stored as meta-data, or a tabular formatted file with the meta-data stored in columns.
+
+-----
+
+.. class:: infomark
+
+The following **physico-chemical properties and descriptors** are computed for each molecule:
+
+    # number of hydrogen-bond donor and acceptor groups
+
+    # number of rotatable bonds
+
+    # logP
+
+    # number of rings
+
+    # number of heavy atoms
+
+    # molecular weight
+
+    # total Polar Surface Area
+
+    # molecular refractivity
+
+    # Canonical SMILES
+
+    # InChI string
+
+    # InChI-Key
+
+    # Spectrophores(TM)
+
+-----
+
+**This tool uses Pybel:** N. M. O'Boyle, C. Morley and G. R. Hutchison. Pybel: a Python wrapper for the OpenBabel cheminformatics toolkit Chem. Cent. J. 2008, 2, 5.
+
+**Spectrophores(TM)** is a registered tool implemented in the open-source OpenBabel. Copyright (C) 2005-2010 by Silicos NV.
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/remove_protonation_state.py	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+"""
+    Input: molecular input file.
+    Output: Molecule file with removed ions and fragments.
+    Copyright 2013, Bjoern Gruening and Xavier Lucas
+"""
+import sys, os
+import argparse
+import openbabel
+openbabel.obErrorLog.StopLogging()
+import pybel
+
+def parse_command_line():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--iformat', default='sdf' , help='input file format')
+    parser.add_argument('-i', '--input', required=True, help='input file name')
+    parser.add_argument('-o', '--output', required=True, help='output file name')
+    return parser.parse_args()
+
+def remove_protonation( args ):
+    outfile = pybel.Outputfile(args.iformat, args.output, overwrite=True)
+    for mol in pybel.readfile(args.iformat, args.input):
+        [atom.OBAtom.SetFormalCharge(0) for atom in mol.atoms]
+        outfile.write( mol )
+    outfile.close()
+
+def __main__():
+    """
+        Remove any protonation state from each atom in each molecule.
+    """
+    args = parse_command_line()
+    remove_protonation( args )
+
+if __name__ == "__main__" :
+    __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/remove_protonation_state.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,30 @@
+<tool id="ctb_remove_protonation_state" name="Remove protonation state">
+    <description>of every atom</description>
+    <parallelism method="multi" split_inputs="infile" split_mode="to_size" split_size="10000" shared_inputs="" merge_outputs="outfile"></parallelism>
+    <command interpreter='python'>
+    remove_protonation_state.py
+        -i $infile
+        -o $outfile
+        --iformat "${infile.ext}"
+        2>&#38;1
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="sdf,smi,mol,inchi" label="Molecule file" help="Dataset missing? See TIP below"/>
+    </inputs>
+    <outputs>
+    <data format="smi" name="outfile"/>
+    </outputs>
+    <tests>
+        <test>
+        </test>
+    </tests>
+    <help>
+
+
+**What it does**
+Remove protonation state of every atom.
+
+-----
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_2244.can	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+CC(=O)Oc1ccccc1C(=O)O	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_2244.inchi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_2244.sdf	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,155 @@
+2244
+  -OEChem-05151212332D
+
+ 21 21  0     0  0  0  0  0  0999 V2000
+    3.7320   -0.0600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -1.5600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641    0.9400    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.0000   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.0611   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.6800    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    2.3100    0.4769    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.4631    0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.6900   -0.5969    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    2.0600    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+> <PUBCHEM_COMPOUND_CID>
+2244
+
+> <PUBCHEM_COMPOUND_CANONICALIZED>
+1
+
+> <PUBCHEM_CACTVS_COMPLEXITY>
+212
+
+> <PUBCHEM_CACTVS_HBOND_ACCEPTOR>
+4
+
+> <PUBCHEM_CACTVS_HBOND_DONOR>
+1
+
+> <PUBCHEM_CACTVS_ROTATABLE_BOND>
+3
+
+> <PUBCHEM_CACTVS_SUBSKEYS>
+AAADccBwOAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAABAAAAGgAACAAADASAmAAyDoAABgCIAiDSCAACCAAkIAAIiAEGCMgMJzaENRqCe2Cl4BEIuYeIyCCOAAAAAAAIAAAAAAAAABAAAAAAAAAAAA==
+
+> <PUBCHEM_IUPAC_OPENEYE_NAME>
+2-acetoxybenzoic acid
+
+> <PUBCHEM_IUPAC_CAS_NAME>
+2-acetyloxybenzoic acid
+
+> <PUBCHEM_IUPAC_NAME>
+2-acetyloxybenzoic acid
+
+> <PUBCHEM_IUPAC_SYSTEMATIC_NAME>
+2-acetyloxybenzoic acid
+
+> <PUBCHEM_IUPAC_TRADITIONAL_NAME>
+2-acetoxybenzoic acid
+
+> <PUBCHEM_IUPAC_INCHI>
+InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)
+
+> <PUBCHEM_IUPAC_INCHIKEY>
+BSYNRYMUTXBXSQ-UHFFFAOYSA-N
+
+> <PUBCHEM_XLOGP3>
+1.2
+
+> <PUBCHEM_EXACT_MASS>
+180.042259
+
+> <PUBCHEM_MOLECULAR_FORMULA>
+C9H8O4
+
+> <PUBCHEM_MOLECULAR_WEIGHT>
+180.15742
+
+> <PUBCHEM_OPENEYE_CAN_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+> <PUBCHEM_OPENEYE_ISO_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+> <PUBCHEM_CACTVS_TPSA>
+63.6
+
+> <PUBCHEM_MONOISOTOPIC_WEIGHT>
+180.042259
+
+> <PUBCHEM_TOTAL_CHARGE>
+0
+
+> <PUBCHEM_HEAVY_ATOM_COUNT>
+13
+
+> <PUBCHEM_ATOM_DEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_ATOM_UDEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_BOND_DEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_BOND_UDEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_ISOTOPIC_ATOM_COUNT>
+0
+
+> <PUBCHEM_COMPONENT_COUNT>
+1
+
+> <PUBCHEM_CACTVS_TAUTO_COUNT>
+1
+
+> <PUBCHEM_COORDINATE_TYPE>
+1
+5
+255
+
+> <PUBCHEM_BONDANNOTATIONS>
+5  6  8
+5  7  8
+6  8  8
+7  9  8
+8  10  8
+9  10  8
+
+$$$$
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_2244.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+O(c1c(cccc1)C(=O)O)C(=O)C	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_2244_FP2.fps	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,7 @@
+#FPS1
+#num_bits=1021
+#type=OpenBabel-FP2/1
+#software=OpenBabel/2.3.1
+#source=CID_2244.sdf
+#date=2012-05-15T16:40:38
+00000010004000c00000020000030000010000000008000000000080000000000400400000000010200a020800000000000042000000000000800002000002000c200800010001010000000002808002208000400000000040080000000100000008000000000002004002000010000000020100080100200808000000000004	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_2244_FP3.fps	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,7 @@
+#FPS1
+#num_bits=55
+#type=OpenBabel-FP3/1
+#software=OpenBabel/2.3.1
+#source=CID_2244.sdf
+#date=2012-05-15T16:59:15
+0400000c50b007	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_2244_FP4.fps	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,7 @@
+#FPS1
+#num_bits=307
+#type=OpenBabel-FP4/1
+#software=OpenBabel/2.3.1
+#source=CID_2244.sdf
+#date=2012-05-15T16:59:22
+010000000000000000009800000000004001000000000000000000000000000000000240402801	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_2244_addh.can	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,1 @@
+CC(=O)Oc1ccccc1C(=O)[O-]	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_2244_maccs.fps	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,7 @@
+#FPS1
+#num_bits=166
+#type=OpenBabel-MACCS/2
+#software=OpenBabel/2.3.1
+#source=CID_2244.sdf
+#date=2012-05-15T17:00:39
+0000000000000000000000010000016480cca2d21e	2244
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/CID_3033.sdf	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,271 @@
+3033
+  -OEChem-08231107463D
+
+ 30 31  0     0  0  0  0  0  0999 V2000
+    1.9541    1.1500   -2.5078 Cl  0  0  0  0  0  0  0  0  0  0  0  0
+    1.1377   -1.6392    2.1136 Cl  0  0  0  0  0  0  0  0  0  0  0  0
+   -3.2620   -2.9284   -1.0647 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7906   -1.9108    0.9092 O   0  0  0  0  0  0  0  0  0  0  0  0
+    0.2679   -0.2051   -0.3990 N   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.0640    0.5139   -0.3769 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7313    0.7178   -0.0192 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.4761   -0.6830   -1.1703 C   0  0  0  0  0  0  0  0  0  0  0  0
+    1.6571   -0.2482   -0.1795 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.0382    1.4350    0.0081 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.3728    1.8429    0.7234 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.6797    2.5600    0.7506 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -1.3470    2.7640    1.1083 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.5353    0.3477   -1.0918 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.1740   -0.8865    0.9534 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.8480   -1.8749   -0.3123 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.9124    0.3058   -0.8739 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5511   -0.9285    1.1713 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.4203   -0.3324    0.2576 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -1.7086   -0.9792   -1.8930 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.3614   -0.4266   -1.7676 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.0861   -1.1146   -0.6780 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -4.0812    1.2885   -0.2604 H   0  0  0  0  0  0  0  0  0  0  0  0
+    0.6569    2.0278    1.0167 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.4382    3.2769    1.0511 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -1.0683    3.6399    1.6868 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.6037    0.7654   -1.5758 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.9635   -1.4215    2.0480 H   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4925   -0.3651    0.4274 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.5025   -3.7011   -0.5102 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1 14  1  0  0  0  0
+  2 15  1  0  0  0  0
+  3 16  1  0  0  0  0
+  3 30  1  0  0  0  0
+  4 16  2  0  0  0  0
+  5  7  1  0  0  0  0
+  5  9  1  0  0  0  0
+  5 22  1  0  0  0  0
+  6  7  1  0  0  0  0
+  6  8  1  0  0  0  0
+  6 10  2  0  0  0  0
+  7 11  2  0  0  0  0
+  8 16  1  0  0  0  0
+  8 20  1  0  0  0  0
+  8 21  1  0  0  0  0
+  9 14  2  0  0  0  0
+  9 15  1  0  0  0  0
+ 10 12  1  0  0  0  0
+ 10 23  1  0  0  0  0
+ 11 13  1  0  0  0  0
+ 11 24  1  0  0  0  0
+ 12 13  2  0  0  0  0
+ 12 25  1  0  0  0  0
+ 13 26  1  0  0  0  0
+ 14 17  1  0  0  0  0
+ 15 18  2  0  0  0  0
+ 17 19  2  0  0  0  0
+ 17 27  1  0  0  0  0
+ 18 19  1  0  0  0  0
+ 18 28  1  0  0  0  0
+ 19 29  1  0  0  0  0
+M  END
+> <PUBCHEM_COMPOUND_CID>
+3033
+
+> <PUBCHEM_CONFORMER_RMSD>
+0.6
+
+> <PUBCHEM_CONFORMER_DIVERSEORDER>
+1
+20
+18
+39
+29
+42
+38
+35
+30
+25
+33
+28
+32
+36
+26
+24
+40
+11
+27
+37
+7
+41
+10
+19
+43
+8
+6
+16
+44
+23
+34
+14
+15
+31
+9
+13
+17
+21
+22
+5
+12
+2
+3
+4
+
+> <PUBCHEM_MMFF94_PARTIAL_CHARGES>
+28
+1 -0.18
+10 -0.15
+11 -0.15
+12 -0.15
+13 -0.15
+14 0.18
+15 0.18
+16 0.66
+17 -0.15
+18 -0.15
+19 -0.15
+2 -0.18
+22 0.4
+23 0.15
+24 0.15
+25 0.15
+26 0.15
+27 0.15
+28 0.15
+29 0.15
+3 -0.65
+30 0.5
+4 -0.57
+5 -0.6
+6 -0.14
+7 0.1
+8 0.2
+9 0.1
+
+> <PUBCHEM_EFFECTIVE_ROTOR_COUNT>
+4
+
+> <PUBCHEM_PHARMACOPHORE_FEATURES>
+7
+1 3 acceptor
+1 4 acceptor
+1 5 cation
+1 5 donor
+3 3 4 16 anion
+6 6 7 10 11 12 13 rings
+6 9 14 15 17 18 19 rings
+
+> <PUBCHEM_HEAVY_ATOM_COUNT>
+19
+
+> <PUBCHEM_ATOM_DEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_ATOM_UDEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_BOND_DEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_BOND_UDEF_STEREO_COUNT>
+0
+
+> <PUBCHEM_ISOTOPIC_ATOM_COUNT>
+0
+
+> <PUBCHEM_COMPONENT_COUNT>
+1
+
+> <PUBCHEM_CACTVS_TAUTO_COUNT>
+1
+
+> <PUBCHEM_CONFORMER_ID>
+00000BD900000001
+
+> <PUBCHEM_MMFF94_ENERGY>
+65.6362
+
+> <PUBCHEM_FEATURE_SELFOVERLAP>
+35.578
+
+> <PUBCHEM_SHAPE_FINGERPRINT>
+10366900 7 17386020514759110480
+114674 6 16903282898360328323
+11578080 2 17913245089295617604
+11582403 64 14544541357940910356
+11640471 11 18127963303313961600
+12236239 1 18272088352834916308
+12363563 72 18042978579496277287
+12553582 1 18190740839094073615
+12596599 1 18201439237582433270
+12788726 201 18410285909464206003
+13032168 30 18201440238019390274
+13140716 1 18187086113919468457
+13538477 17 18339642338307470464
+13583140 156 17241914119188522922
+13764800 53 17895191172601517065
+13965767 371 17259888045752176376
+14115302 16 18342181093776810149
+14787075 74 17907866106787333628
+15279307 12 18198622322777022915
+15375462 189 18270674264943931347
+15669948 3 18336550511731321249
+16752209 62 18336841852664817743
+16945 1 18188484791351783177
+19433438 48 18059583550169763352
+200 152 18130792217719576158
+20645476 183 18270115859187436189
+20905425 154 17970632883131290416
+21452121 199 18046637711133085653
+21639500 275 16988270998321974524
+22112679 90 18342446063036096292
+23419403 2 17835564502519425292
+23493267 7 18115023138028600728
+23526113 38 16660924516543134566
+23557571 272 17821721762863303772
+23559900 14 17896315990920094510
+23598288 3 18411412925846384519
+23598291 2 18059009613384180254
+238 59 16343141308025475526
+4340502 62 17273677940604857177
+6049 1 17240202131864233360
+6992083 37 18058168521433072460
+7615 1 18201433675414973908
+77492 1 18272651289913926852
+81228 2 17968373550240022809
+9709674 26 17896035610527288590
+
+> <PUBCHEM_SHAPE_MULTIPOLES>
+378.03
+7.01
+2.75
+1.77
+0.78
+1.58
+0.3
+0.41
+1.94
+-1.08
+1.9
+-8.69
+11.04
+2.58
+
+> <PUBCHEM_SHAPE_SELFOVERLAP>
+790.335
+
+> <PUBCHEM_SHAPE_VOLUME>
+214.7
+
+> <PUBCHEM_COORDINATE_TYPE>
+2
+5
+255
+
+$$$$
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/change_title_on_CID_3033.sdf	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,270 @@
+214.7
+ OpenBabel06291213403D
+
+ 30 31  0  0  0  0  0  0  0  0999 V2000
+    1.9541    1.1500   -2.5078 Cl  0  0  0  0  0  0  0  0  0  0  0  0
+    1.1377   -1.6392    2.1136 Cl  0  0  0  0  0  0  0  0  0  0  0  0
+   -3.2620   -2.9284   -1.0647 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7906   -1.9108    0.9092 O   0  0  0  0  0  0  0  0  0  0  0  0
+    0.2679   -0.2051   -0.3990 N   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.0640    0.5139   -0.3769 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7313    0.7178   -0.0192 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.4761   -0.6830   -1.1703 C   0  0  0  0  0  0  0  0  0  0  0  0
+    1.6571   -0.2482   -0.1795 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.0382    1.4350    0.0081 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.3728    1.8429    0.7234 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.6797    2.5600    0.7506 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -1.3470    2.7640    1.1083 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.5353    0.3477   -1.0918 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.1740   -0.8865    0.9534 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.8480   -1.8749   -0.3123 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.9124    0.3058   -0.8739 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5511   -0.9285    1.1713 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.4203   -0.3324    0.2576 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -1.7086   -0.9792   -1.8930 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.3614   -0.4266   -1.7676 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.0861   -1.1146   -0.6780 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -4.0812    1.2885   -0.2604 H   0  0  0  0  0  0  0  0  0  0  0  0
+    0.6569    2.0278    1.0167 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.4382    3.2769    1.0511 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -1.0683    3.6399    1.6868 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.6037    0.7654   -1.5758 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.9635   -1.4215    2.0480 H   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4925   -0.3651    0.4274 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.5025   -3.7011   -0.5102 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1 14  1  0  0  0  0
+  2 15  1  0  0  0  0
+  3 16  1  0  0  0  0
+  3 30  1  0  0  0  0
+  4 16  2  0  0  0  0
+  5  7  1  0  0  0  0
+  5  9  1  0  0  0  0
+  5 22  1  0  0  0  0
+  6  7  1  0  0  0  0
+  6  8  1  0  0  0  0
+  6 10  2  0  0  0  0
+  7 11  2  0  0  0  0
+  8 16  1  0  0  0  0
+  8 20  1  0  0  0  0
+  8 21  1  0  0  0  0
+  9 14  2  0  0  0  0
+  9 15  1  0  0  0  0
+ 10 12  1  0  0  0  0
+ 10 23  1  0  0  0  0
+ 11 13  1  0  0  0  0
+ 11 24  1  0  0  0  0
+ 12 13  2  0  0  0  0
+ 12 25  1  0  0  0  0
+ 13 26  1  0  0  0  0
+ 14 17  1  0  0  0  0
+ 15 18  2  0  0  0  0
+ 17 19  2  0  0  0  0
+ 17 27  1  0  0  0  0
+ 18 19  1  0  0  0  0
+ 18 28  1  0  0  0  0
+ 19 29  1  0  0  0  0
+M  END
+>  <PUBCHEM_COMPOUND_CID>
+3033
+
+>  <PUBCHEM_CONFORMER_RMSD>
+0.6
+
+>  <PUBCHEM_CONFORMER_DIVERSEORDER>
+1
+20
+18
+39
+29
+42
+38
+35
+30
+25
+33
+28
+32
+36
+26
+24
+40
+11
+27
+37
+7
+41
+10
+19
+43
+8
+6
+16
+44
+23
+34
+14
+15
+31
+9
+13
+17
+21
+22
+5
+12
+2
+3
+4
+
+>  <PUBCHEM_MMFF94_PARTIAL_CHARGES>
+28
+1 -0.18
+10 -0.15
+11 -0.15
+12 -0.15
+13 -0.15
+14 0.18
+15 0.18
+16 0.66
+17 -0.15
+18 -0.15
+19 -0.15
+2 -0.18
+22 0.4
+23 0.15
+24 0.15
+25 0.15
+26 0.15
+27 0.15
+28 0.15
+29 0.15
+3 -0.65
+30 0.5
+4 -0.57
+5 -0.6
+6 -0.14
+7 0.1
+8 0.2
+9 0.1
+
+>  <PUBCHEM_EFFECTIVE_ROTOR_COUNT>
+4
+
+>  <PUBCHEM_PHARMACOPHORE_FEATURES>
+7
+1 3 acceptor
+1 4 acceptor
+1 5 cation
+1 5 donor
+3 3 4 16 anion
+6 6 7 10 11 12 13 rings
+6 9 14 15 17 18 19 rings
+
+>  <PUBCHEM_HEAVY_ATOM_COUNT>
+19
+
+>  <PUBCHEM_ATOM_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ATOM_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ISOTOPIC_ATOM_COUNT>
+0
+
+>  <PUBCHEM_COMPONENT_COUNT>
+1
+
+>  <PUBCHEM_CACTVS_TAUTO_COUNT>
+1
+
+>  <PUBCHEM_CONFORMER_ID>
+00000BD900000001
+
+>  <PUBCHEM_MMFF94_ENERGY>
+65.6362
+
+>  <PUBCHEM_FEATURE_SELFOVERLAP>
+35.578
+
+>  <PUBCHEM_SHAPE_FINGERPRINT>
+10366900 7 17386020514759110480
+114674 6 16903282898360328323
+11578080 2 17913245089295617604
+11582403 64 14544541357940910356
+11640471 11 18127963303313961600
+12236239 1 18272088352834916308
+12363563 72 18042978579496277287
+12553582 1 18190740839094073615
+12596599 1 18201439237582433270
+12788726 201 18410285909464206003
+13032168 30 18201440238019390274
+13140716 1 18187086113919468457
+13538477 17 18339642338307470464
+13583140 156 17241914119188522922
+13764800 53 17895191172601517065
+13965767 371 17259888045752176376
+14115302 16 18342181093776810149
+14787075 74 17907866106787333628
+15279307 12 18198622322777022915
+15375462 189 18270674264943931347
+15669948 3 18336550511731321249
+16752209 62 18336841852664817743
+16945 1 18188484791351783177
+19433438 48 18059583550169763352
+200 152 18130792217719576158
+20645476 183 18270115859187436189
+20905425 154 17970632883131290416
+21452121 199 18046637711133085653
+21639500 275 16988270998321974524
+22112679 90 18342446063036096292
+23419403 2 17835564502519425292
+23493267 7 18115023138028600728
+23526113 38 16660924516543134566
+23557571 272 17821721762863303772
+23559900 14 17896315990920094510
+23598288 3 18411412925846384519
+23598291 2 18059009613384180254
+238 59 16343141308025475526
+4340502 62 17273677940604857177
+6049 1 17240202131864233360
+6992083 37 18058168521433072460
+7615 1 18201433675414973908
+77492 1 18272651289913926852
+81228 2 17968373550240022809
+9709674 26 17896035610527288590
+
+>  <PUBCHEM_SHAPE_MULTIPOLES>
+378.03
+7.01
+2.75
+1.77
+0.78
+1.58
+0.3
+0.41
+1.94
+-1.08
+1.9
+-8.69
+11.04
+2.58
+
+>  <PUBCHEM_SHAPE_SELFOVERLAP>
+790.335
+
+>  <PUBCHEM_SHAPE_VOLUME>
+214.7
+
+>  <PUBCHEM_COORDINATE_TYPE>
+2
+5
+255
+
+$$$$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/ob_genprop_on_CID2244.sdf	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,193 @@
+2244
+ OpenBabel07101213512D
+
+ 21 21  0  0  0  0  0  0  0  0999 V2000
+    3.7320   -0.0600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -1.5600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641    0.9400    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.0000   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.0611   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.6800    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    2.3100    0.4769    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.4631    0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.6900   -0.5969    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    2.0600    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+>  <PUBCHEM_COMPOUND_CID>
+2244
+
+>  <PUBCHEM_COMPOUND_CANONICALIZED>
+1
+
+>  <PUBCHEM_CACTVS_COMPLEXITY>
+212
+
+>  <PUBCHEM_CACTVS_HBOND_ACCEPTOR>
+4
+
+>  <PUBCHEM_CACTVS_HBOND_DONOR>
+1
+
+>  <PUBCHEM_CACTVS_ROTATABLE_BOND>
+3
+
+>  <PUBCHEM_CACTVS_SUBSKEYS>
+AAADccBwOAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAABAAAAGgAACAAADASAmAAyDoAABgCIAiDSCAACCAAkIAAIiAEGCMgMJzaENRqCe2Cl4BEIuYeIyCCOAAAAAAAIAAAAAAAAABAAAAAAAAAAAA==
+
+>  <PUBCHEM_IUPAC_OPENEYE_NAME>
+2-acetoxybenzoic acid
+
+>  <PUBCHEM_IUPAC_CAS_NAME>
+2-acetyloxybenzoic acid
+
+>  <PUBCHEM_IUPAC_NAME>
+2-acetyloxybenzoic acid
+
+>  <PUBCHEM_IUPAC_SYSTEMATIC_NAME>
+2-acetyloxybenzoic acid
+
+>  <PUBCHEM_IUPAC_TRADITIONAL_NAME>
+2-acetoxybenzoic acid
+
+>  <PUBCHEM_IUPAC_INCHI>
+InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)
+
+>  <PUBCHEM_IUPAC_INCHIKEY>
+BSYNRYMUTXBXSQ-UHFFFAOYSA-N
+
+>  <PUBCHEM_XLOGP3>
+1.2
+
+>  <PUBCHEM_EXACT_MASS>
+180.042259
+
+>  <PUBCHEM_MOLECULAR_FORMULA>
+C9H8O4
+
+>  <PUBCHEM_MOLECULAR_WEIGHT>
+180.15742
+
+>  <PUBCHEM_OPENEYE_CAN_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+>  <PUBCHEM_OPENEYE_ISO_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+>  <PUBCHEM_CACTVS_TPSA>
+63.6
+
+>  <PUBCHEM_MONOISOTOPIC_WEIGHT>
+180.042259
+
+>  <PUBCHEM_TOTAL_CHARGE>
+0
+
+>  <PUBCHEM_HEAVY_ATOM_COUNT>
+13
+
+>  <PUBCHEM_ATOM_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ATOM_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ISOTOPIC_ATOM_COUNT>
+0
+
+>  <PUBCHEM_COMPONENT_COUNT>
+1
+
+>  <PUBCHEM_CACTVS_TAUTO_COUNT>
+1
+
+>  <PUBCHEM_COORDINATE_TYPE>
+1
+5
+255
+
+>  <PUBCHEM_BONDANNOTATIONS>
+5  6  8
+5  7  8
+6  8  8
+7  9  8
+8  10  8
+9  10  8
+
+>  <Hydrogen-bond donors>
+1
+
+>  <InChI key>
+BSYNRYMUTXBXSQ-UHFFFAOYSA-N
+
+>  <logP>
+1.3101
+
+>  <Polar surface area>
+63.6
+
+>  <Number of heavy atoms>
+13
+
+>  <Molecular weight>
+180.15742
+
+>  <InChI>
+InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)
+
+>  <Spectrophores(TM)>
+-1.454, -1.106, -1.162, 0.285, 0.369, 1.008, 0.144, -0.956, 0.133, 0.883, 1.828, 0.029, -1.312, -1.424, -1.287, -0.644, 0.59, 0.746, -0.127, 0.535, 0.368, 0.93, 1.721, -0.097, -1.591, -0.888, -1.332, 0.013, 0.889, 0.249, -0.343, -0.346, -0.047, 1.471, 1.595, 0.329, -1.101, -1.186, 0.953, 0.953, -0.644, -0.653, -1.136, 1.547, 0.533, -0.262, -0.274, 1.27
+
+>  <Number of rings>
+1
+
+>  <Canonical SMILES>
+CC(=O)Oc1ccccc1C(=O)O
+
+>  <Molecular refractivity>
+44.9003
+
+>  <Hydrogen-bond acceptors>
+4
+
+>  <Rotatable bonds>
+3
+
+$$$$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify/test-data/ob_genprop_on_CID2244.tabular	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,2 @@
+Hydrogen-bond donors	InChI key	logP	Polar surface area	Number of heavy atoms	Molecular weight	InChI	Spectrophores(TM)	Number of rings	Canonical SMILES	Molecular refractivity	Hydrogen-bond acceptors	Rotatable bonds
+1	BSYNRYMUTXBXSQ-UHFFFAOYSA-N	1.3101	63.6	13	180.15742	InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)	-1.454, -1.106, -1.162, 0.285, 0.369, 1.008, 0.144, -0.956, 0.133, 0.883, 1.828, 0.029, -1.312, -1.424, -1.287, -0.644, 0.59, 0.746, -0.127, 0.535, 0.368, 0.93, 1.721, -0.097, -1.591, -0.888, -1.332, 0.013, 0.889, 0.249, -0.343, -0.346, -0.047, 1.471, 1.595, 0.329, -1.101, -1.186, 0.953, 0.953, -0.644, -0.653, -1.136, 1.547, 0.533, -0.262, -0.274, 1.27	1	CC(=O)Oc1ccccc1C(=O)O	44.9003	4	3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/repository_dependencies.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<repositories description="This requires the Molecule datatype definitions (e.g. SMILES, InChI, SD-format).">
+    <repository toolshed="http://testtoolshed.g2.bx.psu.edu/" name="molecule_datatypes" owner="bgruening" changeset_revision="7cb4c02f61e6" />
+</repositories>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/search/ob_spectrophore_search.py	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+"""
+    Input: tabular format file with one column storing the unique id for the compounds and any other with the Spectrophores(TM) descriptors.
+    Output: parse the target file using the same protocol used to generate the databases in our servers. Physico-chemical properties are computed and stored as metadata in the sdf output file.
+    Copyright 2012, Bjoern Gruening and Xavier Lucas
+"""
+import sys, os
+import argparse
+import openbabel
+openbabel.obErrorLog.StopLogging()
+import pybel
+import math
+
+#TODO get rid of eval()
+
+global spectrophore
+spectrophore = pybel.ob.OBSpectrophore()
+
+def parse_command_line():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--target', required=True, help='target file name in sdf format with Spectrophores(TM) descriptors stored as meta-data')
+    parser.add_argument('--library', required=True, help='library of compounds with pre-computed physico-chemical properties, including Spectrophores(TM) in tabular format')
+    parser.add_argument('-c', '--column', required=True, type=int, help='#column containing the Spectrophores(TM) descriptors in the library file')
+    parser.add_argument('-o', '--output', required=True, help='output file name')
+    parser.add_argument('-n', '--normalization', default="ZeroMeanAndUnitStd", choices=['No', 'ZeroMean', 'UnitStd', 'ZeroMeanAndUnitStd'], help='Normalization method')
+    parser.add_argument('-a', '--accuracy', default="20", choices=['1', '2', '5', '10', '15', '20', '30', '36', '45', '60'], help='Accuracy expressed as angular stepsize')
+    parser.add_argument('-s', '--stereo', default="No", choices=['No', 'Unique', 'Mirror', 'All'], help='Stereospecificity of the cage')
+    parser.add_argument('-r', '--resolution', type=float, default="3.0", help='Resolution')
+    return parser.parse_args()
+
+def set_parameters(args):
+    if args.normalization == 'No':
+        spectrophore.SetNormalization( spectrophore.NoNormalization )
+    else:
+        spectrophore.SetNormalization( eval('spectrophore.NormalizationTowards' + args.normalization) )
+    spectrophore.SetAccuracy( eval('spectrophore.AngStepSize' + args.accuracy) )
+    spectrophore.SetStereo( eval('spectrophore.' + args.stereo + 'StereoSpecificProbes') )
+    spectrophore.SetResolution( args.resolution )
+    return True
+
+def Compute_Spectrophores_distance(target_spectrophore, args):
+    outfile = open(args.output, 'w')
+    for mol in open(args.library, 'r'):
+        try:
+            distance = ((np.asarray( target_spectrophore ) - np.asarray( mol.split('\t')[ args.column - 1 ].strip().split(', ') ))**2).sum()
+        except ValueError:
+            distance = 0
+        outfile.write( '%s\t%f\n' % (mol.strip(), distance ) )
+    outfile.close()
+
+def __main__():
+    """
+        Computation of Spectrophores(TM) distances to a target molecule.
+    """
+    args = parse_command_line()
+    # This sets up the parameters for the Spectrophore generation. Parameters are set to fit those of our standard parsing tool
+    set_parameters(args)
+
+    mol = pybel.readfile('sdf', args.target).next()
+    target_spectrophore = mol.data["Spectrophores(TM)"].strip().split(', ')
+    # Compute the paired-distance between every molecule in the library and the target
+    distances = Compute_Spectrophores_distance(target_spectrophore, args)
+
+if __name__ == "__main__" :
+    __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/search/ob_spectrophore_search.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,71 @@
+<tool id="ctb_spectrophore_search" name="Spectrophores(TM) search:" version="1.0">
+  <description>similarity search based on 1D chemical features</description>
+  <requirements>
+    <requirement type="package" version="2.3.2">openbabel</requirement>
+  </requirements>
+  <command interpreter="python">
+    ob_spectrophore_search.py
+      --target $target
+      --library $library
+      --output $outfile
+      --column $column
+  </command>
+  <inputs>
+    <param name="target" type="data" format="sdf" label="Target molecule in sdf format (it must contain its Spectrophores(TM) stored as meta-data)"/>
+    <param name="library" type="data" format="tabular" label="Tabular file with pre-computed Spectrophores(TM) in one column"/>
+    <param name="column" label="Specify the column number containing the Spectrophores(TM) descriptors" type="data_column" data_ref="library" accept_default="true" />
+  </inputs>
+  <outputs>
+    <data format="tabular" name="outfile"/>
+  </outputs>
+  <tests>
+    <test>
+        <param name="target" ftype="sdf" value="CID2244_with_spectrophore.sdf"/>
+        <param name="library" value="lib.tabular" />
+        <param name="column" value="8" />
+        <output name="outfile" ftype="tabular" file="ob_spectrophore_search.tabular" />
+    </test>
+  </tests>
+  <help>
+
+.. class:: infomark
+
+**What does this tool do?**
+
+  This tool computes the Euclidean distance between the Spectrophores(TM) descriptors of the target to each molecule stored in the library.
+
+-----
+
+.. class:: warningmark
+
+**Tip:** this tool is useful to select compounds with similar chemical features to a target, but accounting for the discovery of diverse scaffolds. This is in contrast to the results expected in a similarity search based on atom connectivity.
+
+**Hint:** the target molecule MUST BE an sdf formatted file with the Spectrophores(TM) descriptors stored as meta-data. Such file can be generated using the "Compute physico-chemical properties" tool.
+
+**Hint:** the library of compounds is a tabular formatted file with 1 line / compound. One column contains the Spectrophores(TM) descriptors.
+
+-----
+
+.. class:: infomark
+
+**Spectrophores(TM)** are Silicos' screening technology which converts three-dimensional molecular property data into one-dimensional spectra. Typical characteristics that can be converted include electrostatic potentials, molecular shape, lipophilicity, hardness and softness potentials. The computation of Spectrophores(TM) is independent of the position and orientation of a molecule and this allows to easily compare Spectrophores(TM) of different molecules.
+
+Molecules with similar three-dimensional properties and shape, and therefore also similar biological activities, always have similar Spectrophores(TM), and as a result this technique is very powerful as a tool to investigate the similarity of molecules and can be applied as a screening tool for molecular databases, virtual screening, and databse characterisations.
+
+**Advantages:**
+
+    * Spectrophores(TM) can realistically compute ligand-protein interactions based on aforementioned molecular descriptors.
+    * Spectrophores(TM) can be applied in both a ligand- or target-based setting.
+    * Spectrophores(TM) can distinguish, if needed, between the different enantiomers of stereo-selective compounds.
+    * Spectrophores(TM) can be computed fast.
+
+Information extracted from the Silico's website: http://www.silicos.be/technologies/spectrophore
+
+-----
+
+**This tool uses Pybel:** N. M. O'Boyle, C. Morley and G. R. Hutchison. Pybel: a Python wrapper for the OpenBabel cheminformatics toolkit Chem. Cent. J. 2008, 2, 5.
+
+**Spectrophores(TM)** is a registered tool implemented in the open-source OpenBabel. Copyright (C) 2005-2011 by Silicos NV.
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/search/test-data/CID2244_with_spectrophore.sdf	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,193 @@
+2244
+ OpenBabel07101216402D
+
+ 21 21  0  0  0  0  0  0  0  0999 V2000
+    3.7320   -0.0600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981    1.4400    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -1.5600    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.5981   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301   -1.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641    0.9400    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8660   -0.5600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.0000   -0.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.0611   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4641   -2.6800    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.8671   -1.8700    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    2.3100    0.4769    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.4631    0.2500    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.6900   -0.5969    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+    6.3301    2.0600    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+>  <PUBCHEM_COMPOUND_CID>
+2244
+
+>  <PUBCHEM_COMPOUND_CANONICALIZED>
+1
+
+>  <PUBCHEM_CACTVS_COMPLEXITY>
+212
+
+>  <PUBCHEM_CACTVS_HBOND_ACCEPTOR>
+4
+
+>  <PUBCHEM_CACTVS_HBOND_DONOR>
+1
+
+>  <PUBCHEM_CACTVS_ROTATABLE_BOND>
+3
+
+>  <PUBCHEM_CACTVS_SUBSKEYS>
+AAADccBwOAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAABAAAAGgAACAAADASAmAAyDoAABgCIAiDSCAACCAAkIAAIiAEGCMgMJzaENRqCe2Cl4BEIuYeIyCCOAAAAAAAIAAAAAAAAABAAAAAAAAAAAA==
+
+>  <PUBCHEM_IUPAC_OPENEYE_NAME>
+2-acetoxybenzoic acid
+
+>  <PUBCHEM_IUPAC_CAS_NAME>
+2-acetyloxybenzoic acid
+
+>  <PUBCHEM_IUPAC_NAME>
+2-acetyloxybenzoic acid
+
+>  <PUBCHEM_IUPAC_SYSTEMATIC_NAME>
+2-acetyloxybenzoic acid
+
+>  <PUBCHEM_IUPAC_TRADITIONAL_NAME>
+2-acetoxybenzoic acid
+
+>  <PUBCHEM_IUPAC_INCHI>
+InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)
+
+>  <PUBCHEM_IUPAC_INCHIKEY>
+BSYNRYMUTXBXSQ-UHFFFAOYSA-N
+
+>  <PUBCHEM_XLOGP3>
+1.2
+
+>  <PUBCHEM_EXACT_MASS>
+180.042259
+
+>  <PUBCHEM_MOLECULAR_FORMULA>
+C9H8O4
+
+>  <PUBCHEM_MOLECULAR_WEIGHT>
+180.15742
+
+>  <PUBCHEM_OPENEYE_CAN_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+>  <PUBCHEM_OPENEYE_ISO_SMILES>
+CC(=O)OC1=CC=CC=C1C(=O)O
+
+>  <PUBCHEM_CACTVS_TPSA>
+63.6
+
+>  <PUBCHEM_MONOISOTOPIC_WEIGHT>
+180.042259
+
+>  <PUBCHEM_TOTAL_CHARGE>
+0
+
+>  <PUBCHEM_HEAVY_ATOM_COUNT>
+13
+
+>  <PUBCHEM_ATOM_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ATOM_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ISOTOPIC_ATOM_COUNT>
+0
+
+>  <PUBCHEM_COMPONENT_COUNT>
+1
+
+>  <PUBCHEM_CACTVS_TAUTO_COUNT>
+1
+
+>  <PUBCHEM_COORDINATE_TYPE>
+1
+5
+255
+
+>  <PUBCHEM_BONDANNOTATIONS>
+5  6  8
+5  7  8
+6  8  8
+7  9  8
+8  10  8
+9  10  8
+
+>  <Hydrogen-bond donors>
+1
+
+>  <InChI key>
+BSYNRYMUTXBXSQ-UHFFFAOYSA-N
+
+>  <logP>
+1.3101
+
+>  <Polar surface area>
+63.6
+
+>  <Number of heavy atoms>
+13
+
+>  <Molecular weight>
+180.15742
+
+>  <InChI>
+InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)
+
+>  <Spectrophores(TM)>
+-1.454, -1.106, -1.162, 0.285, 0.369, 1.008, 0.144, -0.956, 0.133, 0.883, 1.828, 0.029, -1.312, -1.424, -1.287, -0.644, 0.59, 0.746, -0.127, 0.535, 0.368, 0.93, 1.721, -0.097, -1.591, -0.888, -1.332, 0.013, 0.889, 0.249, -0.343, -0.346, -0.047, 1.471, 1.595, 0.329, -1.101, -1.186, 0.953, 0.953, -0.644, -0.653, -1.136, 1.547, 0.533, -0.262, -0.274, 1.27
+
+>  <Number of rings>
+1
+
+>  <Canonical SMILES>
+CC(=O)Oc1ccccc1C(=O)O
+
+>  <Molecular refractivity>
+44.9003
+
+>  <Hydrogen-bond acceptors>
+4
+
+>  <Rotatable bonds>
+3
+
+$$$$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/search/test-data/lib.tabular	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,9 @@
+Hydrogen-bond donors	InChI key	logP	Polar surface area	Number of heavy atoms	Molecular weight	InChI	Spectrophores(TM)	Number of rings	Canonical SMILES	Molecular refractivity	Hydrogen-bond acceptors	Rotatable bonds
+3	JZUFKLXOESDKRF-UHFFFAOYSA-N	2.9774	135.12	17	297.73912	InChI=1S/C7H8ClN3O4S2/c8-4-1-5-7(2-6(4)16(9,12)13)17(14,15)11-3-10-5/h1-2,10-11H,3H2,(H2,9,12,13)	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, -1.245, -1.245, -0.178, -0.178, -0.178, -0.178, -0.178, -0.178, -0.178, 1.956, 1.956, -0.178, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	2	Clc1cc2NCNS(=O)(=O)c2cc1S(=O)(=O)N	67.5768	7	1
+3	ZZUFCTLCJUWOSV-UHFFFAOYSA-N	3.7448	131.01	21	330.74414	InChI=1S/C12H11ClN2O5S/c13-9-5-10(15-6-7-2-1-3-20-7)8(12(16)17)4-11(9)21(14,18)19/h1-5,15H,6H2,(H,16,17)(H2,14,18,19)	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, -2.141, -2.141, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	2	OC(=O)c1cc(c(cc1NCc1ccco1)Cl)S(=O)(=O)N	75.4644	7	5
+1	QEVHRUUCFGRFIF-MDEJGZGSSA-N	4.109	117.78	44	608.6787	InChI=1S/C33H40N2O9/c1-38-19-7-8-20-21-9-10-35-16-18-13-27(44-32(36)17-11-25(39-2)30(41-4)26(12-17)40-3)31(42-5)28(33(37)43-6)22(18)15-24(35)29(21)34-23(20)14-19/h7-8,11-12,14,18,22,24,27-28,31,34H,9-10,13,15-16H2,1-6H3/t18-,22+,24-,27-,28+,31+/m1/s1	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	6	COc1ccc2c(c1)[nH]c1c2CCN2[C@@H]1C[C@H]1[C@@H](C2)C[C@H]([C@@H]([C@H]1C(=O)OC)OC)OC(=O)c1cc(OC)c(c(c1)OC)OC	165.5222	10	10
+4	NJKRHQRIYAWMRO-BQTSRIDJSA-N	7.0864	252.9	61	906.41782	InChI=1S/C33H40N2O9.C7H8ClN3O4S2/c1-38-19-7-8-20-21-9-10-35-16-18-13-27(44-32(36)17-11-25(39-2)30(41-4)26(12-17)40-3)31(42-5)28(33(37)43-6)22(18)15-24(35)29(21)34-23(20)14-19;8-4-1-5-7(2-6(4)16(9,12)13)17(14,15)11-3-10-5/h7-8,11-12,14,18,22,24,27-28,31,34H,9-10,13,15-16H2,1-6H3;1-2,10-11H,3H2,(H2,9,12,13)/t18-,22+,24-,27-,28+,31+;/m1./s1	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	8	Clc1cc2NCNS(=O)(=O)c2cc1S(=O)(=O)N.COc1ccc2c(c1)[nH]c1c2CCN2[C@@H]1C[C@H]1[C@@H](C2)C[C@H]([C@@H]([C@H]1C(=O)OC)OC)OC(=O)c1cc(OC)c(c(c1)OC)OC	233.099	17	11
+0	UOOUPHIKFMZJEA-UHFFFAOYSA-N	6.248	33.42	33	430.54354	InChI=1S/C29H26N4/c1-3-29(4-2)31-25-20-27-24(19-28(25)33(29)22-15-9-6-10-16-22)30-23-17-11-12-18-26(23)32(27)21-13-7-5-8-14-21/h5-20H,3-4H2,1-2H3	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, -2.141, -2.141, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	6	CCC1(CC)N=c2c(N1c1ccccc1)cc1c(c2)n(c2ccccc2)c2c(n1)cccc2	143.054	3	4
+0	YQCDIJPZZOKCLA-UHFFFAOYSA-N	5.8579	33.42	32	416.51696	InChI=1S/C28H24N4/c1-3-28(2)30-24-19-26-23(18-27(24)32(28)21-14-8-5-9-15-21)29-22-16-10-11-17-25(22)31(26)20-12-6-4-7-13-20/h4-19H,3H2,1-2H3	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	6	CCC1(C)N=c2c(N1c1ccccc1)cc1c(c2)n(c2ccccc2)c2c(n1)cccc2	138.247	3	3
+0	BSYNRYMUTXBXSQ-UHFFFAOYSA-M	-0.0246	66.43	13	179.14948	InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)/p-1	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, 2.141, 2.141, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	1	CC(=O)Oc1ccccc1C(=O)[O-]	42.958	4	3
+0	BSYNRYMUTXBXSQ-UHFFFAOYSA-M	-0.0246	66.43	13	179.14948	InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)/p-1	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, 2.141, 2.141, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	1	CC(=O)Oc1ccccc1C(=O)[O-]	42.958	4	3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/search/test-data/ob_spectrophore_search.tabular	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,9 @@
+Hydrogen-bond donors	InChI key	logP	Polar surface area	Number of heavy atoms	Molecular weight	InChI	Spectrophores(TM)	Number of rings	Canonical SMILES	Molecular refractivity	Hydrogen-bond acceptors	Rotatable bonds	0.000000
+3	JZUFKLXOESDKRF-UHFFFAOYSA-N	2.9774	135.12	17	297.73912	InChI=1S/C7H8ClN3O4S2/c8-4-1-5-7(2-6(4)16(9,12)13)17(14,15)11-3-10-5/h1-2,10-11H,3H2,(H2,9,12,13)	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, -1.245, -1.245, -0.178, -0.178, -0.178, -0.178, -0.178, -0.178, -0.178, 1.956, 1.956, -0.178, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	2	Clc1cc2NCNS(=O)(=O)c2cc1S(=O)(=O)N	67.5768	7	1	nan
+3	ZZUFCTLCJUWOSV-UHFFFAOYSA-N	3.7448	131.01	21	330.74414	InChI=1S/C12H11ClN2O5S/c13-9-5-10(15-6-7-2-1-3-20-7)8(12(16)17)4-11(9)21(14,18)19/h1-5,15H,6H2,(H,16,17)(H2,14,18,19)	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, -2.141, -2.141, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	2	OC(=O)c1cc(c(cc1NCc1ccco1)Cl)S(=O)(=O)N	75.4644	7	5	nan
+1	QEVHRUUCFGRFIF-MDEJGZGSSA-N	4.109	117.78	44	608.6787	InChI=1S/C33H40N2O9/c1-38-19-7-8-20-21-9-10-35-16-18-13-27(44-32(36)17-11-25(39-2)30(41-4)26(12-17)40-3)31(42-5)28(33(37)43-6)22(18)15-24(35)29(21)34-23(20)14-19/h7-8,11-12,14,18,22,24,27-28,31,34H,9-10,13,15-16H2,1-6H3/t18-,22+,24-,27-,28+,31+/m1/s1	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	6	COc1ccc2c(c1)[nH]c1c2CCN2[C@@H]1C[C@H]1[C@@H](C2)C[C@H]([C@@H]([C@H]1C(=O)OC)OC)OC(=O)c1cc(OC)c(c(c1)OC)OC	165.5222	10	10	nan
+4	NJKRHQRIYAWMRO-BQTSRIDJSA-N	7.0864	252.9	61	906.41782	InChI=1S/C33H40N2O9.C7H8ClN3O4S2/c1-38-19-7-8-20-21-9-10-35-16-18-13-27(44-32(36)17-11-25(39-2)30(41-4)26(12-17)40-3)31(42-5)28(33(37)43-6)22(18)15-24(35)29(21)34-23(20)14-19;8-4-1-5-7(2-6(4)16(9,12)13)17(14,15)11-3-10-5/h7-8,11-12,14,18,22,24,27-28,31,34H,9-10,13,15-16H2,1-6H3;1-2,10-11H,3H2,(H2,9,12,13)/t18-,22+,24-,27-,28+,31+;/m1./s1	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	8	Clc1cc2NCNS(=O)(=O)c2cc1S(=O)(=O)N.COc1ccc2c(c1)[nH]c1c2CCN2[C@@H]1C[C@H]1[C@@H](C2)C[C@H]([C@@H]([C@H]1C(=O)OC)OC)OC(=O)c1cc(OC)c(c(c1)OC)OC	233.099	17	11	nan
+0	UOOUPHIKFMZJEA-UHFFFAOYSA-N	6.248	33.42	33	430.54354	InChI=1S/C29H26N4/c1-3-29(4-2)31-25-20-27-24(19-28(25)33(29)22-15-9-6-10-16-22)30-23-17-11-12-18-26(23)32(27)21-13-7-5-8-14-21/h5-20H,3-4H2,1-2H3	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, -2.141, -2.141, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, 0.428, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	6	CCC1(CC)N=c2c(N1c1ccccc1)cc1c(c2)n(c2ccccc2)c2c(n1)cccc2	143.054	3	4	nan
+0	YQCDIJPZZOKCLA-UHFFFAOYSA-N	5.8579	33.42	32	416.51696	InChI=1S/C28H24N4/c1-3-28(2)30-24-19-26-23(18-27(24)32(28)21-14-8-5-9-15-21)29-22-16-10-11-17-25(22)31(26)20-12-6-4-7-13-20/h4-19H,3H2,1-2H3	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	6	CCC1(C)N=c2c(N1c1ccccc1)cc1c(c2)n(c2ccccc2)c2c(n1)cccc2	138.247	3	3	nan
+0	BSYNRYMUTXBXSQ-UHFFFAOYSA-M	-0.0246	66.43	13	179.14948	InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)/p-1	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, 2.141, 2.141, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	1	CC(=O)Oc1ccccc1C(=O)[O-]	42.958	4	3	nan
+0	BSYNRYMUTXBXSQ-UHFFFAOYSA-M	-0.0246	66.43	13	179.14948	InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)/p-1	nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, 2.141, 2.141, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, -0.428, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan	1	CC(=O)Oc1ccccc1C(=O)[O-]	42.958	4	3	nan
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/subsearch/subsearch.py	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+"""
+    Input: Molecules in SDF, SMILES ...
+    Output: Moleculs filtered with specified substructures.
+    Copyright 2013, Bjoern Gruening and Xavier Lucas
+"""
+import sys, os
+import argparse
+import openbabel
+openbabel.obErrorLog.StopLogging()
+import pybel
+import multiprocessing
+import tempfile
+import subprocess
+import shutil
+
+def parse_command_line():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('-i', '--infile', required=True, help='Molecule file.')
+    parser.add_argument('--fastsearch-index', dest="fastsearch_index", 
+        required=True, help='Path to the openbabel fastsearch index.')
+    parser.add_argument('-o', '--outfile', required=True, help='Path to the output file.')
+    parser.add_argument('--oformat', 
+        default='smi', help='Output file format')
+    parser.add_argument("--max-candidates", dest="max_candidates", type=int,
+                    default=4000, help="The maximum number of candidates.")
+    parser.add_argument('-p', '--processors', type=int, 
+        default=multiprocessing.cpu_count())
+    return parser.parse_args()
+
+results = list()
+def mp_callback(res):
+    results.append(res)
+
+def mp_helper( query, args ):
+    """
+        Helper function for multiprocessing.
+        That function is a wrapper around the following command:
+        obabel file.fs -s"smarts" -Ooutfile.smi -al 999999999
+    """
+
+    if args.oformat == 'names':
+        opts = '-osmi -xt'
+    else:
+        opts = '-o%s' % args.oformat
+
+    tmp = tempfile.NamedTemporaryFile(delete=False)
+    cmd = 'obabel %s -O %s %s -ifs -s%s -al %s' % (args.fastsearch_index, tmp.name, opts, query, args.max_candidates)
+
+    child = subprocess.Popen(cmd.split(),
+        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+    stdout, stderr = child.communicate()
+    return_code = child.returncode
+
+    if return_code:
+        sys.stdout.write(stdout)
+        sys.stderr.write(stderr)
+        sys.stderr.write("Return error code %i from command:\n" % return_code)
+        sys.stderr.write("%s\n" % cmd)
+    else:
+        sys.stdout.write(stdout)
+        sys.stdout.write(stderr)
+    return (tmp.name, query)
+
+
+def substructure_search( args ):
+
+    pool = multiprocessing.Pool( args.processors )
+    for query in open( args.infile ):
+        pool.apply_async(mp_helper, args=(query.strip(), args), callback=mp_callback)
+        #mp_callback( mp_helper(query.strip(), args) )
+    pool.close()
+    pool.join()
+
+    if args.oformat == 'names':
+        out_handle = open( args.outfile, 'w' )
+        for result_file, query in results:
+            with open(result_file) as res_handle:
+                for line in res_handle:
+                    out_handle.write('%s\t%s\n' % ( line.strip(), query ))
+            os.remove( result_file )
+        out_handle.close()
+    else:
+        out_handle = open( args.outfile, 'wb' )
+        for result_file, query in results:
+            res_handle = open(result_file,'rb')
+            shutil.copyfileobj( res_handle, out_handle )
+            res_handle.close()
+            os.remove( result_file )
+        out_handle.close()
+
+
+def __main__():
+    """
+        Multiprocessing Open Babel Substructure Search.
+    """
+    args = parse_command_line()
+    substructure_search( args )
+
+if __name__ == "__main__" :
+    __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/subsearch/subsearch.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,57 @@
+<tool id="chemfp_subsearch" name="Substructure Search" version="0.1">
+    <description>of fingerprint data sets</description>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command interpreter="python">
+
+    subsearch.py
+        -i $query
+        --fastsearch-index "${os.path.join($fastsearch.extra_files_path,'molecule.fs')}"
+        -o "${outfile}"
+        --oformat $oformat
+        --max-candidates $max_candidates
+        --processors 10
+
+    </command>
+    <inputs>
+        <param name="query" type='data' format="tabular,smi,sdf,inchi,text" label="query"/>
+        <param name="fastsearch" type='data' format="obfs" label="OpenBabel Fastsearch Index"/>
+        <param name="max_candidates" size="6" type="integer" value="4000" label="The maximum number of candidates"/>
+        <param name='oformat' type='select' format='text' label="Output format.">
+            <option value='smi'>SMILES</option>
+            <option value='inchi'>InChI</option>
+            <option value='sdf'>SD-Files</option>
+            <option value='mol2'>mol2</option>
+            <option value='names'>Return the molecule names only</option>
+        </param>
+    </inputs>
+    <outputs>
+       <data format="smi" name="outfile">
+         <change_format>
+           <when input="oformat" value="inchi" format="inchi"/>
+           <when input="oformat" value="sdf" format="sdf"/>
+           <when input="oformat" value="mol2" format="mol2"/>
+           <when input="oformat" value="names" format="tabular"/>
+         </change_format>
+       </data>
+    </outputs>
+    <tests>
+        <test>
+        </test>
+    </tests>
+    <help>
+
+
+**What it does**
+
+Substructure search in a Open Babel Fastsearch Index. You can search with SMILES or SMARTS pattern.
+
+-----
+
+**Example**
+
+
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/visualisation/ob_depiction_svg.xml	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,101 @@
+<tool id="ob_svg_depiction" name="Visualisation">
+    <description>of compounds</description>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command>
+    obabel -i${infile.ext} $infile
+        $embed_molecule_as_cml
+        $draw_all_carbon_atoms
+        -xC 
+        -O 
+        $outfile -osvg
+        #if str($sort) != "none":
+            --sort $sort
+        #end if
+        #if str($display_name) != "None" and len(str($display_name)) > 0 and str($display_name) != 'title':
+            --append "$display_name"
+            --title ""
+        #end if
+        $thick_lines
+    2>&#38;1
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="mol,sdf,smi,inchi" label="Input format"/>
+        <param name="embed_molecule_as_cml" type="boolean" truevalue="-e" falsevalue="" label="Embed molecule as CML"/>
+        <param name="draw_all_carbon_atoms" type="boolean" truevalue="-a" falsevalue="" label="draw all carbon atoms"/>
+        <param name="thick_lines" type="boolean" truevalue="-xt" falsevalue="" label="use thicker lines"/>
+
+        <param name='display_name' type='select' format='text' label="The property which is displayed under the molecule">
+            <option value='title'>Molecule's title</option>
+            <option value='MW'>Molecular Weight</option>
+            <option value='abonds'>Number of aromatic bonds</option>
+            <option value='atoms'>Number of atoms</option>
+            <option value='bonds'>Number of bonds</option>
+            <option value='cansmi'>Canonical SMILES</option>
+            <option value='cansmiNS'>Canonical SMILES without isotopes or stereo</option>
+            <option value='dbonds'>Number of double bonds</option>
+            <option value='formula'>Chemical formula</option>
+            <option value='HBA1'>Number of Hydrogen Bond Acceptors 1 (JoelLib)</option>
+            <option value='HBA2'>Number of Hydrogen Bond Acceptors 2 (JoelLib)</option>
+            <option value='HBD'>Number of Hydrogen Bond Donors (JoelLib)</option>
+            <option value='InChI'>IUPAC InChI identifier</option>
+            <option value='L5'>Lipinski Rule of Five</option>
+            <option value='logP'>octanol/water partition coefficient</option>
+            <option value='MR'>molar refractivity</option>
+            <option value='nF'>Number of Fluorine Atoms</option>
+            <option value='s'>SMARTS filter</option>
+            <option value='sbonds'>Number of single bonds</option>
+            <option value='smarts'>SMARTS filter</option>
+            <option value='tbonds'>Number of triple bonds</option>
+            <option value='TPSA'>topological polar surface area</option>
+        </param>
+
+        <param name='sort' type='select' format='text' label="Sorting the displayed molecules by">
+            <option value='none'>No sorting</option>
+            <option value='MW'>Molecular Weight</option>
+            <option value='abonds'>Number of aromatic bonds</option>
+            <option value='atoms'>Number of atoms</option>
+            <option value='bonds'>Number of bonds</option>
+            <option value='dbonds'>Number of double bonds</option>
+            <option value='HBA1'>Number of Hydrogen Bond Acceptors 1 (JoelLib)</option>
+            <option value='HBA2'>Number of Hydrogen Bond Acceptors 2 (JoelLib)</option>
+            <option value='HBD'>Number of Hydrogen Bond Donors (JoelLib)</option>
+            <option value='L5'>Lipinski Rule of Five</option>
+            <option value='logP'>octanol/water partition coefficient</option>
+            <option value='MR'>molar refractivity</option>
+            <option value='nF'>Number of Fluorine Atoms</option>
+            <option value='sbonds'>Number of single bonds</option>
+            <option value='tbonds'>Number of triple bonds</option>
+            <option value='TPSA'>topological polar surface area</option>
+        </param>
+    </inputs>
+    <outputs>
+        <data name="outfile" type="data" format="svg"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="infile" ftype="smi" value="8_mol.smi" />
+            <param name="embed_molecule_as_cml" value="" />
+            <param name="draw_all_carbon_atoms" value="-a" />
+            <param name="thick_lines" value="-xt" />
+            <param name='display_name' value="title" />
+            <param name='sort' value='none' />
+            <output name="outfile" ftype="svg" file="ob_depiction_svg_on_8_mol.svg" />
+        </test>
+    </tests>
+    <help>
+
+**What it does**
+
+Creates a SVG image from a small library of molecules.
+
+-----
+
+.. class:: infomark
+
+Please use only libraries with at most a few hundrets of molecules.
+
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/visualisation/test-data/8_mol.smi	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,8 @@
+C1NC2=CC(=C(C=C2S(=O)(=O)N1)S(=O)(=O)N)Cl
+C1=COC(=C1)CNC2=CC(=C(C=C2C(=O)O)S(=O)(=O)N)Cl
+CO[C@H]1[C@@H](C[C@@H]2CN3CCC4=C([C@H]3C[C@@H]2[C@@H]1C(=O)OC)NC5=C4C=CC(=C5)OC)OC(=O)C6=CC(=C(C(=C6)OC)OC)OC
+CO[C@H]1[C@@H](C[C@@H]2CN3CCC4=C([C@H]3C[C@@H]2[C@@H]1C(=O)OC)NC5=C4C=CC(=C5)OC)OC(=O)C6=CC(=C(C(=C6)OC)OC)OC.C1NC2=CC(=C(C=C2S(=O)(=O)N1)S(=O)(=O)N)Cl
+CCC1(N=C2C=C3C(=NC4=CC=CC=C4N3C5=CC=CC=C5)C=C2N1C6=CC=CC=C6)CC
+CCC1(N=C2C=C3C(=NC4=CC=CC=C4N3C5=CC=CC=C5)C=C2N1C6=CC=CC=C6)C
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
+CC(=O)OC1=CC=CC=C1C(=O)[O-]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/visualisation/test-data/ob_depiction_svg_on_8_mol.svg	Tue Mar 26 14:49:44 2013 -0400
@@ -0,0 +1,537 @@
+<?xml version="1.0"?>
+<svg version="1.1" id="topsvg"
+xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+xmlns:cml="http://www.xml-cml.org/schema" x="0" y="0" width="100%" height="100%" viewBox="0 0 100 100">
+<title>OBDepict</title>
+<text text-anchor="middle" font-size="2" fill ="black" font-family="sans-serif"
+x="16.6667" y="32.6667" ></text>
+<g transform="translate(0,0)">
+<svg width="33.3333" height="33.3333" x="0" y="0" viewBox="0 0 300 258.564"
+font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="2" >
+<line x1="103.0" y1="189.0" x2="103.0" y2="208.2"/>
+<line x1="97.0" y1="189.0" x2="97.0" y2="208.2"/>
+<line x1="110.5" y1="181.2" x2="127.1" y2="190.8"/>
+<line x1="107.5" y1="186.4" x2="124.1" y2="196.0"/>
+<line x1="180.0" y1="109.3" x2="209.6" y2="109.3"/>
+<line x1="223.0" y1="119.7" x2="223.0" y2="138.9"/>
+<line x1="217.0" y1="119.7" x2="217.0" y2="138.9"/>
+<line x1="230.4" y1="106.3" x2="249.6" y2="106.3"/>
+<line x1="230.4" y1="112.3" x2="249.6" y2="112.3"/>
+<line x1="220.0" y1="98.9" x2="220.0" y2="79.7"/>
+<line x1="160.0" y1="74.6" x2="174.8" y2="49.0"/>
+<line x1="100.0" y1="109.3" x2="120.0" y2="74.6"/>
+<line x1="109.2" y1="107.7" x2="123.2" y2="83.4"/>
+<line x1="120.0" y1="74.6" x2="160.0" y2="74.6"/>
+<line x1="160.0" y1="74.6" x2="180.0" y2="109.3"/>
+<line x1="156.8" y1="83.4" x2="170.8" y2="107.7"/>
+<line x1="180.0" y1="109.3" x2="160.0" y2="143.9"/>
+<line x1="160.0" y1="143.9" x2="120.0" y2="143.9"/>
+<line x1="154.0" y1="136.7" x2="126.0" y2="136.7"/>
+<line x1="120.0" y1="143.9" x2="100.0" y2="109.3"/>
+<line x1="54.8" y1="169.6" x2="40.0" y2="143.9"/>
+<line x1="40.0" y1="143.9" x2="54.8" y2="118.3"/>
+<line x1="70.4" y1="109.3" x2="100.0" y2="109.3"/>
+<line x1="120.0" y1="143.9" x2="105.2" y2="169.6"/>
+<line x1="89.6" y1="178.6" x2="70.4" y2="178.6"/>
+<text x="44.400000" y="117.602032" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >HN</text>
+<text x="96.400000" y="186.884065" fill="rgb(178,178,0)"  stroke="rgb(178,178,0)" stroke-width="1" font-size="16" >S</text>
+<text x="94.000000" y="223.364065" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="128.641016" y="203.364065" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="44.400000" y="183.364065" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >HN</text>
+<text x="214.000000" y="117.602032" fill="rgb(178,178,0)"  stroke="rgb(178,178,0)" stroke-width="1" font-size="16" >S</text>
+<text x="214.000000" y="154.082032" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="254.000000" y="114.082032" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="214.000000" y="77.602032" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >NH</text>
+<text x="238.000000" y="85.282032" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="13" >2</text>
+<text x="174.000000" y="48.320000" fill="rgb(30,239,30)"  stroke="rgb(30,239,30)" stroke-width="1" font-size="16" >Cl</text>
+</svg>
+</g>
+<text text-anchor="middle" font-size="2.000000" fill ="black" font-family="sans-serif"
+x="50.000000" y="32.666667" ></text>
+<g transform="translate(33.333333,0.000000)">
+<svg width="33.333333" height="33.333333" x="0" y="0" viewBox="0 0 401.553671 253.205081"
+font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="2.000000" >
+<line x1="101.6" y1="74.6" x2="141.6" y2="74.6"/>
+<line x1="141.6" y1="74.6" x2="156.4" y2="100.3"/>
+<line x1="172.0" y1="109.3" x2="201.6" y2="109.3"/>
+<line x1="221.6" y1="143.9" x2="201.6" y2="178.6"/>
+<line x1="201.6" y1="181.6" x2="172.0" y2="181.6"/>
+<line x1="201.6" y1="175.6" x2="172.0" y2="175.6"/>
+<line x1="201.6" y1="178.6" x2="216.4" y2="204.2"/>
+<line x1="281.6" y1="109.3" x2="311.2" y2="109.3"/>
+<line x1="324.6" y1="119.7" x2="324.6" y2="138.9"/>
+<line x1="318.6" y1="119.7" x2="318.6" y2="138.9"/>
+<line x1="332.0" y1="106.3" x2="351.2" y2="106.3"/>
+<line x1="332.0" y1="112.3" x2="351.2" y2="112.3"/>
+<line x1="321.6" y1="98.9" x2="321.6" y2="79.7"/>
+<line x1="261.6" y1="74.6" x2="276.4" y2="49.0"/>
+<line x1="40.0" y1="94.6" x2="40.0" y2="54.6"/>
+<line x1="47.2" y1="88.6" x2="47.2" y2="60.6"/>
+<line x1="40.0" y1="54.6" x2="68.2" y2="45.5"/>
+<line x1="84.2" y1="50.7" x2="101.6" y2="74.6"/>
+<line x1="101.6" y1="74.6" x2="78.0" y2="107.0"/>
+<line x1="92.2" y1="75.3" x2="75.7" y2="97.9"/>
+<line x1="78.0" y1="107.0" x2="40.0" y2="94.6"/>
+<line x1="201.6" y1="109.3" x2="221.6" y2="74.6"/>
+<line x1="210.8" y1="107.7" x2="224.8" y2="83.4"/>
+<line x1="221.6" y1="74.6" x2="261.6" y2="74.6"/>
+<line x1="261.6" y1="74.6" x2="281.6" y2="109.3"/>
+<line x1="258.3" y1="83.4" x2="272.3" y2="107.7"/>
+<line x1="281.6" y1="109.3" x2="261.6" y2="143.9"/>
+<line x1="261.6" y1="143.9" x2="221.6" y2="143.9"/>
+<line x1="255.6" y1="136.7" x2="227.6" y2="136.7"/>
+<line x1="221.6" y1="143.9" x2="201.6" y2="109.3"/>
+<text x="72.042261" y="50.600336" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="145.953671" y="114.082032" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >HN</text>
+<text x="157.953671" y="183.364065" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="215.553671" y="218.005081" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >OH</text>
+<text x="315.553671" y="114.082032" fill="rgb(178,178,0)"  stroke="rgb(178,178,0)" stroke-width="1" font-size="16" >S</text>
+<text x="315.553671" y="154.082032" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="355.553671" y="114.082032" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="315.553671" y="77.602032" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >NH</text>
+<text x="339.553671" y="85.282032" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="13" >2</text>
+<text x="275.553671" y="48.320000" fill="rgb(30,239,30)"  stroke="rgb(30,239,30)" stroke-width="1" font-size="16" >Cl</text>
+</svg>
+</g>
+<text text-anchor="middle" font-size="2.000000" fill ="black" font-family="sans-serif"
+x="83.333333" y="32.666667" ></text>
+<g transform="translate(66.666667,0.000000)">
+<svg width="33.333333" height="33.333333" x="0" y="0" viewBox="0 0 612.994121 387.678617"
+font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="2.000000" >
+<line x1="302.1" y1="297.9" x2="287.4" y2="272.4"/>
+<line x1="287.4" y1="254.6" x2="302.1" y2="229.1"/>
+<line x1="302.1" y1="229.1" x2="316.8" y2="254.6"/>
+<line x1="334.9" y1="210.2" x2="349.6" y2="235.7"/>
+<line x1="302.1" y1="153.5" x2="327.5" y2="138.8"/>
+<line x1="236.6" y1="115.7" x2="265.2" y2="122.2"/>
+<line x1="269.4" y1="172.4" x2="218.5" y2="201.8"/>
+<line x1="269.4" y1="210.2" x2="240.0" y2="210.2"/>
+<line x1="269.4" y1="210.2" x2="249.5" y2="244.6"/>
+<line x1="249.5" y1="247.6" x2="220.2" y2="247.6"/>
+<line x1="249.5" y1="241.6" x2="220.2" y2="241.6"/>
+<line x1="249.5" y1="244.6" x2="264.2" y2="270.0"/>
+<line x1="264.2" y1="287.9" x2="249.5" y2="313.3"/>
+<line x1="72.8" y1="96.8" x2="48.5" y2="110.8"/>
+<line x1="40.0" y1="125.5" x2="40.0" y2="153.5"/>
+<line x1="334.9" y1="210.2" x2="364.2" y2="210.2"/>
+<line x1="379.7" y1="219.2" x2="394.4" y2="244.6"/>
+<line x1="397.0" y1="246.1" x2="382.3" y2="271.5"/>
+<line x1="391.8" y1="243.1" x2="377.1" y2="268.5"/>
+<line x1="394.4" y1="244.6" x2="434.1" y2="244.6"/>
+<line x1="493.6" y1="278.9" x2="508.3" y2="304.4"/>
+<line x1="508.3" y1="322.2" x2="493.6" y2="347.7"/>
+<line x1="513.5" y1="244.6" x2="542.8" y2="244.6"/>
+<line x1="558.3" y1="253.5" x2="573.0" y2="278.9"/>
+<line x1="493.6" y1="210.2" x2="508.3" y2="184.8"/>
+<line x1="523.8" y1="175.8" x2="553.1" y2="175.8"/>
+<line x1="138.3" y1="96.8" x2="162.5" y2="110.8"/>
+<line x1="179.6" y1="110.8" x2="203.8" y2="96.8"/>
+<line x1="203.8" y1="96.8" x2="203.8" y2="58.9"/>
+<line x1="196.6" y1="90.8" x2="196.6" y2="64.9"/>
+<line x1="203.8" y1="58.9" x2="138.3" y2="58.9"/>
+<line x1="138.3" y1="58.9" x2="138.3" y2="96.8"/>
+<line x1="145.5" y1="64.9" x2="145.5" y2="90.8"/>
+<line x1="302.1" y1="229.1" x2="334.9" y2="210.2"/>
+<line x1="334.9" y1="210.2" x2="334.9" y2="172.4"/>
+<line x1="334.9" y1="172.4" x2="302.1" y2="153.5"/>
+<line x1="302.1" y1="153.5" x2="269.4" y2="172.4"/>
+<line x1="269.4" y1="172.4" x2="269.4" y2="210.2"/>
+<line x1="269.4" y1="210.2" x2="302.1" y2="229.1"/>
+<line x1="302.1" y1="115.7" x2="277.9" y2="101.7"/>
+<line x1="260.8" y1="101.7" x2="236.6" y2="115.7"/>
+<line x1="236.6" y1="115.7" x2="236.6" y2="153.5"/>
+<line x1="236.6" y1="153.5" x2="269.4" y2="172.4"/>
+<line x1="302.1" y1="153.5" x2="302.1" y2="115.7"/>
+<line x1="203.8" y1="96.8" x2="236.6" y2="115.7"/>
+<line x1="269.4" y1="86.9" x2="269.4" y2="58.9"/>
+<line x1="269.4" y1="58.9" x2="236.6" y2="40.0"/>
+<line x1="236.6" y1="40.0" x2="203.8" y2="58.9"/>
+<line x1="72.8" y1="96.8" x2="105.5" y2="115.7"/>
+<line x1="81.6" y1="93.5" x2="103.9" y2="106.5"/>
+<line x1="105.5" y1="115.7" x2="138.3" y2="96.8"/>
+<line x1="138.3" y1="58.9" x2="105.5" y2="40.0"/>
+<line x1="105.5" y1="40.0" x2="72.8" y2="58.9"/>
+<line x1="103.9" y1="49.2" x2="81.6" y2="62.2"/>
+<line x1="72.8" y1="58.9" x2="72.8" y2="96.8"/>
+<line x1="434.1" y1="244.6" x2="453.9" y2="210.2"/>
+<line x1="443.3" y1="243.0" x2="457.2" y2="219.0"/>
+<line x1="453.9" y1="210.2" x2="493.6" y2="210.2"/>
+<line x1="493.6" y1="210.2" x2="513.5" y2="244.6"/>
+<line x1="490.4" y1="219.0" x2="504.2" y2="243.0"/>
+<line x1="513.5" y1="244.6" x2="493.6" y2="278.9"/>
+<line x1="493.6" y1="278.9" x2="453.9" y2="278.9"/>
+<line x1="487.6" y1="271.7" x2="459.9" y2="271.7"/>
+<line x1="453.9" y1="278.9" x2="434.1" y2="244.6"/>
+<text x="278.688228" y="268.314378" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="315.972325" y="268.309574" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="348.727426" y="249.393121" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="330.481994" y="141.968380" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="263.352701" y="101.561091" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+<text x="269.287173" y="129.306166" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="197.031790" y="216.903459" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="226.082340" y="215.040821" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="206.244452" y="249.410659" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="263.374758" y="287.290890" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="165.065449" y="120.481510" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >NH</text>
+<text x="36.400000" y="124.007460" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="368.565314" y="218.543283" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="370.973635" y="283.758156" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="507.472135" y="321.628779" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="547.147912" y="252.889102" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="509.855494" y="184.159033" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+</svg>
+</g>
+<text text-anchor="middle" font-size="2.000000" fill ="black" font-family="sans-serif"
+x="16.666667" y="66.000000" ></text>
+<g transform="translate(0.000000,33.333333)">
+<svg width="33.333333" height="33.333333" x="0" y="0" viewBox="0 0 872.994121 387.678617"
+font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="2.000000" >
+<line x1="302.1" y1="297.9" x2="287.4" y2="272.4"/>
+<line x1="287.4" y1="254.6" x2="302.1" y2="229.1"/>
+<line x1="302.1" y1="229.1" x2="316.8" y2="254.6"/>
+<line x1="334.9" y1="210.2" x2="349.6" y2="235.7"/>
+<line x1="302.1" y1="153.5" x2="327.5" y2="138.8"/>
+<line x1="236.6" y1="115.7" x2="265.2" y2="122.2"/>
+<line x1="269.4" y1="172.4" x2="218.5" y2="201.8"/>
+<line x1="269.4" y1="210.2" x2="240.0" y2="210.2"/>
+<line x1="269.4" y1="210.2" x2="249.5" y2="244.6"/>
+<line x1="249.5" y1="247.6" x2="220.2" y2="247.6"/>
+<line x1="249.5" y1="241.6" x2="220.2" y2="241.6"/>
+<line x1="249.5" y1="244.6" x2="264.2" y2="270.0"/>
+<line x1="264.2" y1="287.9" x2="249.5" y2="313.3"/>
+<line x1="72.8" y1="96.8" x2="48.5" y2="110.8"/>
+<line x1="40.0" y1="125.5" x2="40.0" y2="153.5"/>
+<line x1="334.9" y1="210.2" x2="364.2" y2="210.2"/>
+<line x1="379.7" y1="219.2" x2="394.4" y2="244.6"/>
+<line x1="397.0" y1="246.1" x2="382.3" y2="271.5"/>
+<line x1="391.8" y1="243.1" x2="377.1" y2="268.5"/>
+<line x1="394.4" y1="244.6" x2="434.1" y2="244.6"/>
+<line x1="493.6" y1="278.9" x2="508.3" y2="304.4"/>
+<line x1="508.3" y1="322.2" x2="493.6" y2="347.7"/>
+<line x1="513.5" y1="244.6" x2="542.8" y2="244.6"/>
+<line x1="558.3" y1="253.5" x2="573.0" y2="278.9"/>
+<line x1="493.6" y1="210.2" x2="508.3" y2="184.8"/>
+<line x1="523.8" y1="175.8" x2="553.1" y2="175.8"/>
+<line x1="676.0" y1="189.0" x2="676.0" y2="208.2"/>
+<line x1="670.0" y1="189.0" x2="670.0" y2="208.2"/>
+<line x1="683.5" y1="181.2" x2="700.1" y2="190.8"/>
+<line x1="680.5" y1="186.4" x2="697.1" y2="196.0"/>
+<line x1="753.0" y1="109.3" x2="782.6" y2="109.3"/>
+<line x1="796.0" y1="119.7" x2="796.0" y2="138.9"/>
+<line x1="790.0" y1="119.7" x2="790.0" y2="138.9"/>
+<line x1="803.4" y1="106.3" x2="822.6" y2="106.3"/>
+<line x1="803.4" y1="112.3" x2="822.6" y2="112.3"/>
+<line x1="793.0" y1="98.9" x2="793.0" y2="79.7"/>
+<line x1="733.0" y1="74.6" x2="747.8" y2="49.0"/>
+<line x1="138.3" y1="96.8" x2="162.5" y2="110.8"/>
+<line x1="179.6" y1="110.8" x2="203.8" y2="96.8"/>
+<line x1="203.8" y1="96.8" x2="203.8" y2="58.9"/>
+<line x1="196.6" y1="90.8" x2="196.6" y2="64.9"/>
+<line x1="203.8" y1="58.9" x2="138.3" y2="58.9"/>
+<line x1="138.3" y1="58.9" x2="138.3" y2="96.8"/>
+<line x1="145.5" y1="64.9" x2="145.5" y2="90.8"/>
+<line x1="302.1" y1="229.1" x2="334.9" y2="210.2"/>
+<line x1="334.9" y1="210.2" x2="334.9" y2="172.4"/>
+<line x1="334.9" y1="172.4" x2="302.1" y2="153.5"/>
+<line x1="302.1" y1="153.5" x2="269.4" y2="172.4"/>
+<line x1="269.4" y1="172.4" x2="269.4" y2="210.2"/>
+<line x1="269.4" y1="210.2" x2="302.1" y2="229.1"/>
+<line x1="302.1" y1="115.7" x2="277.9" y2="101.7"/>
+<line x1="260.8" y1="101.7" x2="236.6" y2="115.7"/>
+<line x1="236.6" y1="115.7" x2="236.6" y2="153.5"/>
+<line x1="236.6" y1="153.5" x2="269.4" y2="172.4"/>
+<line x1="302.1" y1="153.5" x2="302.1" y2="115.7"/>
+<line x1="203.8" y1="96.8" x2="236.6" y2="115.7"/>
+<line x1="269.4" y1="86.9" x2="269.4" y2="58.9"/>
+<line x1="269.4" y1="58.9" x2="236.6" y2="40.0"/>
+<line x1="236.6" y1="40.0" x2="203.8" y2="58.9"/>
+<line x1="72.8" y1="96.8" x2="105.5" y2="115.7"/>
+<line x1="81.6" y1="93.5" x2="103.9" y2="106.5"/>
+<line x1="105.5" y1="115.7" x2="138.3" y2="96.8"/>
+<line x1="138.3" y1="58.9" x2="105.5" y2="40.0"/>
+<line x1="105.5" y1="40.0" x2="72.8" y2="58.9"/>
+<line x1="103.9" y1="49.2" x2="81.6" y2="62.2"/>
+<line x1="72.8" y1="58.9" x2="72.8" y2="96.8"/>
+<line x1="434.1" y1="244.6" x2="453.9" y2="210.2"/>
+<line x1="443.3" y1="243.0" x2="457.2" y2="219.0"/>
+<line x1="453.9" y1="210.2" x2="493.6" y2="210.2"/>
+<line x1="493.6" y1="210.2" x2="513.5" y2="244.6"/>
+<line x1="490.4" y1="219.0" x2="504.2" y2="243.0"/>
+<line x1="513.5" y1="244.6" x2="493.6" y2="278.9"/>
+<line x1="493.6" y1="278.9" x2="453.9" y2="278.9"/>
+<line x1="487.6" y1="271.7" x2="459.9" y2="271.7"/>
+<line x1="453.9" y1="278.9" x2="434.1" y2="244.6"/>
+<line x1="673.0" y1="109.3" x2="693.0" y2="74.6"/>
+<line x1="682.2" y1="107.7" x2="696.2" y2="83.4"/>
+<line x1="693.0" y1="74.6" x2="733.0" y2="74.6"/>
+<line x1="733.0" y1="74.6" x2="753.0" y2="109.3"/>
+<line x1="729.8" y1="83.4" x2="743.8" y2="107.7"/>
+<line x1="753.0" y1="109.3" x2="733.0" y2="143.9"/>
+<line x1="733.0" y1="143.9" x2="693.0" y2="143.9"/>
+<line x1="727.0" y1="136.7" x2="699.0" y2="136.7"/>
+<line x1="693.0" y1="143.9" x2="673.0" y2="109.3"/>
+<line x1="627.8" y1="169.6" x2="613.0" y2="143.9"/>
+<line x1="613.0" y1="143.9" x2="627.8" y2="118.3"/>
+<line x1="643.4" y1="109.3" x2="673.0" y2="109.3"/>
+<line x1="693.0" y1="143.9" x2="678.2" y2="169.6"/>
+<line x1="662.6" y1="178.6" x2="643.4" y2="178.6"/>
+<text x="278.688228" y="268.314378" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="315.972325" y="268.309574" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="348.727426" y="249.393121" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="330.481994" y="141.968380" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="263.352701" y="101.561091" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+<text x="269.287173" y="129.306166" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="197.031790" y="216.903459" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="226.082340" y="215.040821" fill="rgb(191,191,191)"  stroke="rgb(191,191,191)" stroke-width="1" font-size="16" >H</text>
+<text x="206.244452" y="249.410659" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="263.374758" y="287.290890" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="165.065449" y="120.481510" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >NH</text>
+<text x="36.400000" y="124.007460" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="368.565314" y="218.543283" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="370.973635" y="283.758156" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="507.472135" y="321.628779" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="547.147912" y="252.889102" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="509.855494" y="184.159033" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="617.394121" y="117.602032" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >HN</text>
+<text x="669.394121" y="186.884065" fill="rgb(178,178,0)"  stroke="rgb(178,178,0)" stroke-width="1" font-size="16" >S</text>
+<text x="666.994121" y="223.364065" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="701.635137" y="203.364065" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="617.394121" y="183.364065" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >HN</text>
+<text x="786.994121" y="117.602032" fill="rgb(178,178,0)"  stroke="rgb(178,178,0)" stroke-width="1" font-size="16" >S</text>
+<text x="786.994121" y="154.082032" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="826.994121" y="114.082032" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="786.994121" y="77.602032" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >NH</text>
+<text x="810.994121" y="85.282032" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="13" >2</text>
+<text x="746.994121" y="48.320000" fill="rgb(30,239,30)"  stroke="rgb(30,239,30)" stroke-width="1" font-size="16" >Cl</text>
+</svg>
+</g>
+<text text-anchor="middle" font-size="2.000000" fill ="black" font-family="sans-serif"
+x="50.000000" y="66.000000" ></text>
+<g transform="translate(33.333333,33.333333)">
+<svg width="33.333333" height="33.333333" x="0" y="0" viewBox="0 0 434.949602 372.296837"
+font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="2.000000" >
+<line x1="124.7" y1="332.3" x2="135.0" y2="293.7"/>
+<line x1="135.0" y1="293.7" x2="173.6" y2="283.3"/>
+<line x1="300.0" y1="165.2" x2="325.7" y2="180.0"/>
+<line x1="147.2" y1="244.6" x2="118.3" y2="238.4"/>
+<line x1="173.6" y1="283.3" x2="191.5" y2="319.1"/>
+<line x1="191.5" y1="319.1" x2="231.4" y2="321.6"/>
+<line x1="173.6" y1="283.3" x2="203.1" y2="280.2"/>
+<line x1="215.6" y1="269.0" x2="221.7" y2="240.0"/>
+<line x1="209.0" y1="265.5" x2="213.5" y2="244.4"/>
+<line x1="221.7" y1="240.0" x2="187.1" y2="220.0"/>
+<line x1="187.1" y1="220.0" x2="165.1" y2="239.8"/>
+<line x1="161.6" y1="256.3" x2="173.6" y2="283.3"/>
+<line x1="221.7" y1="240.0" x2="256.4" y2="220.0"/>
+<line x1="256.4" y1="220.0" x2="256.4" y2="180.0"/>
+<line x1="249.2" y1="214.0" x2="249.2" y2="186.0"/>
+<line x1="256.4" y1="180.0" x2="221.7" y2="160.0"/>
+<line x1="221.7" y1="160.0" x2="187.1" y2="180.0"/>
+<line x1="187.1" y1="180.0" x2="187.1" y2="220.0"/>
+<line x1="194.3" y1="186.0" x2="194.3" y2="214.0"/>
+<line x1="230.8" y1="114.8" x2="256.4" y2="100.0"/>
+<line x1="256.4" y1="100.0" x2="291.0" y2="120.0"/>
+<line x1="291.0" y1="120.0" x2="291.0" y2="149.6"/>
+<line x1="282.0" y1="165.2" x2="256.4" y2="180.0"/>
+<line x1="221.7" y1="160.0" x2="221.7" y2="130.4"/>
+<line x1="228.9" y1="154.0" x2="228.9" y2="132.4"/>
+<line x1="325.7" y1="60.0" x2="325.7" y2="100.0"/>
+<line x1="325.7" y1="100.0" x2="291.0" y2="120.0"/>
+<line x1="316.9" y1="96.8" x2="292.6" y2="110.8"/>
+<line x1="256.4" y1="100.0" x2="256.4" y2="60.0"/>
+<line x1="263.6" y1="94.0" x2="263.6" y2="66.0"/>
+<line x1="256.4" y1="60.0" x2="291.0" y2="40.0"/>
+<line x1="291.0" y1="40.0" x2="325.7" y2="60.0"/>
+<line x1="292.6" y1="49.2" x2="316.9" y2="63.2"/>
+<line x1="325.7" y1="180.0" x2="325.7" y2="220.0"/>
+<line x1="332.9" y1="186.0" x2="332.9" y2="214.0"/>
+<line x1="325.7" y1="220.0" x2="360.3" y2="240.0"/>
+<line x1="360.3" y1="240.0" x2="394.9" y2="220.0"/>
+<line x1="361.9" y1="230.8" x2="386.2" y2="216.8"/>
+<line x1="394.9" y1="220.0" x2="394.9" y2="180.0"/>
+<line x1="394.9" y1="180.0" x2="360.3" y2="160.0"/>
+<line x1="386.2" y1="183.2" x2="361.9" y2="169.2"/>
+<line x1="360.3" y1="160.0" x2="325.7" y2="180.0"/>
+<line x1="118.3" y1="238.4" x2="105.9" y2="200.4"/>
+<line x1="109.6" y1="235.0" x2="100.9" y2="208.3"/>
+<line x1="105.9" y1="200.4" x2="66.8" y2="192.1"/>
+<line x1="66.8" y1="192.1" x2="40.0" y2="221.8"/>
+<line x1="68.1" y1="201.4" x2="49.4" y2="222.2"/>
+<line x1="40.0" y1="221.8" x2="52.4" y2="259.9"/>
+<line x1="52.4" y1="259.9" x2="91.5" y2="268.2"/>
+<line x1="59.7" y1="254.1" x2="87.1" y2="259.9"/>
+<line x1="91.5" y1="268.2" x2="118.3" y2="238.4"/>
+<text x="207.428054" y="283.925904" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+<text x="218.144521" y="128.320000" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+<text x="285.026554" y="164.800000" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+<text x="153.777712" y="255.085224" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+</svg>
+</g>
+<text text-anchor="middle" font-size="2.000000" fill ="black" font-family="sans-serif"
+x="83.333333" y="66.000000" ></text>
+<g transform="translate(66.666667,33.333333)">
+<svg width="33.333333" height="33.333333" x="0" y="0" viewBox="0 0 434.949602 372.296837"
+font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="2.000000" >
+<line x1="310.3" y1="40.0" x2="299.9" y2="78.6"/>
+<line x1="299.9" y1="78.6" x2="261.3" y2="89.0"/>
+<line x1="134.9" y1="207.1" x2="109.3" y2="192.3"/>
+<line x1="287.7" y1="127.7" x2="316.7" y2="133.8"/>
+<line x1="261.3" y1="89.0" x2="243.5" y2="53.2"/>
+<line x1="261.3" y1="89.0" x2="231.9" y2="92.1"/>
+<line x1="219.4" y1="103.3" x2="213.2" y2="132.3"/>
+<line x1="226.0" y1="106.8" x2="221.5" y2="127.9"/>
+<line x1="213.2" y1="132.3" x2="247.8" y2="152.3"/>
+<line x1="247.8" y1="152.3" x2="269.8" y2="132.5"/>
+<line x1="273.3" y1="116.0" x2="261.3" y2="89.0"/>
+<line x1="213.2" y1="132.3" x2="178.6" y2="152.3"/>
+<line x1="178.6" y1="152.3" x2="178.6" y2="192.3"/>
+<line x1="185.8" y1="158.3" x2="185.8" y2="186.3"/>
+<line x1="178.6" y1="192.3" x2="213.2" y2="212.3"/>
+<line x1="213.2" y1="212.3" x2="247.8" y2="192.3"/>
+<line x1="247.8" y1="192.3" x2="247.8" y2="152.3"/>
+<line x1="240.6" y1="186.3" x2="240.6" y2="158.3"/>
+<line x1="204.2" y1="257.5" x2="178.6" y2="272.3"/>
+<line x1="178.6" y1="272.3" x2="143.9" y2="252.3"/>
+<line x1="143.9" y1="252.3" x2="143.9" y2="222.7"/>
+<line x1="152.9" y1="207.1" x2="178.6" y2="192.3"/>
+<line x1="213.2" y1="212.3" x2="213.2" y2="241.9"/>
+<line x1="206.0" y1="218.3" x2="206.0" y2="239.9"/>
+<line x1="109.3" y1="312.3" x2="109.3" y2="272.3"/>
+<line x1="109.3" y1="272.3" x2="143.9" y2="252.3"/>
+<line x1="118.1" y1="275.5" x2="142.3" y2="261.5"/>
+<line x1="178.6" y1="272.3" x2="178.6" y2="312.3"/>
+<line x1="171.4" y1="278.3" x2="171.4" y2="306.3"/>
+<line x1="178.6" y1="312.3" x2="143.9" y2="332.3"/>
+<line x1="143.9" y1="332.3" x2="109.3" y2="312.3"/>
+<line x1="142.3" y1="323.1" x2="118.1" y2="309.1"/>
+<line x1="109.3" y1="192.3" x2="109.3" y2="152.3"/>
+<line x1="102.1" y1="186.3" x2="102.1" y2="158.3"/>
+<line x1="109.3" y1="152.3" x2="74.6" y2="132.3"/>
+<line x1="74.6" y1="132.3" x2="40.0" y2="152.3"/>
+<line x1="73.0" y1="141.5" x2="48.8" y2="155.5"/>
+<line x1="40.0" y1="152.3" x2="40.0" y2="192.3"/>
+<line x1="40.0" y1="192.3" x2="74.6" y2="212.3"/>
+<line x1="48.8" y1="189.1" x2="73.0" y2="203.1"/>
+<line x1="74.6" y1="212.3" x2="109.3" y2="192.3"/>
+<line x1="316.7" y1="133.8" x2="329.1" y2="171.9"/>
+<line x1="325.4" y1="137.3" x2="334.1" y2="164.0"/>
+<line x1="329.1" y1="171.9" x2="368.2" y2="180.2"/>
+<line x1="368.2" y1="180.2" x2="394.9" y2="150.5"/>
+<line x1="366.8" y1="170.9" x2="385.6" y2="150.1"/>
+<line x1="394.9" y1="150.5" x2="382.6" y2="112.4"/>
+<line x1="382.6" y1="112.4" x2="343.5" y2="104.1"/>
+<line x1="375.2" y1="118.2" x2="347.8" y2="112.4"/>
+<line x1="343.5" y1="104.1" x2="316.7" y2="133.8"/>
+<text x="217.921548" y="101.490933" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+<text x="207.205081" y="257.096837" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+<text x="137.923048" y="220.616837" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+<text x="271.571890" y="130.331613" fill="rgb(12,12,255)"  stroke="rgb(12,12,255)" stroke-width="1" font-size="16" >N</text>
+</svg>
+</g>
+<text text-anchor="middle" font-size="2.000000" fill ="black" font-family="sans-serif"
+x="16.666667" y="99.333333" ></text>
+<g transform="translate(0.000000,66.666667)">
+<svg width="33.333333" height="33.333333" x="0" y="0" viewBox="0 0 253.205081 220.000000"
+font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="2.000000" >
+<line x1="178.6" y1="160.0" x2="178.6" y2="120.0"/>
+<line x1="177.1" y1="117.4" x2="202.7" y2="102.6"/>
+<line x1="180.1" y1="122.6" x2="205.7" y2="107.8"/>
+<line x1="178.6" y1="120.0" x2="152.9" y2="105.2"/>
+<line x1="134.9" y1="105.2" x2="109.3" y2="120.0"/>
+<line x1="74.6" y1="100.0" x2="74.6" y2="60.0"/>
+<line x1="73.1" y1="57.4" x2="98.8" y2="42.6"/>
+<line x1="76.1" y1="62.6" x2="101.8" y2="47.8"/>
+<line x1="74.6" y1="60.0" x2="49.0" y2="45.2"/>
+<line x1="109.3" y1="120.0" x2="109.3" y2="160.0"/>
+<line x1="102.1" y1="126.0" x2="102.1" y2="154.0"/>
+<line x1="109.3" y1="160.0" x2="74.6" y2="180.0"/>
+<line x1="74.6" y1="180.0" x2="40.0" y2="160.0"/>
+<line x1="73.0" y1="170.8" x2="48.8" y2="156.8"/>
+<line x1="40.0" y1="160.0" x2="40.0" y2="120.0"/>
+<line x1="40.0" y1="120.0" x2="74.6" y2="100.0"/>
+<line x1="48.8" y1="123.2" x2="73.0" y2="109.2"/>
+<line x1="74.6" y1="100.0" x2="109.3" y2="120.0"/>
+<text x="207.205081" y="108.320000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="137.923048" y="108.320000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="103.282032" y="48.320000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="35.200000" y="33.600000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="32" >-</text>
+<text x="36.400000" y="48.320000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+</svg>
+</g>
+<text text-anchor="middle" font-size="2.000000" fill ="black" font-family="sans-serif"
+x="50.000000" y="99.333333" ></text>
+<g transform="translate(33.333333,66.666667)">
+<svg width="33.333333" height="33.333333" x="0" y="0" viewBox="0 0 253.205081 220.000000"
+font-family="sans-serif" stroke="rgb(0,0,0)" stroke-width="2.000000" >
+<line x1="178.6" y1="160.0" x2="178.6" y2="120.0"/>
+<line x1="177.1" y1="117.4" x2="202.7" y2="102.6"/>
+<line x1="180.1" y1="122.6" x2="205.7" y2="107.8"/>
+<line x1="178.6" y1="120.0" x2="152.9" y2="105.2"/>
+<line x1="134.9" y1="105.2" x2="109.3" y2="120.0"/>
+<line x1="74.6" y1="100.0" x2="74.6" y2="60.0"/>
+<line x1="73.1" y1="57.4" x2="98.8" y2="42.6"/>
+<line x1="76.1" y1="62.6" x2="101.8" y2="47.8"/>
+<line x1="74.6" y1="60.0" x2="49.0" y2="45.2"/>
+<line x1="109.3" y1="120.0" x2="109.3" y2="160.0"/>
+<line x1="102.1" y1="126.0" x2="102.1" y2="154.0"/>
+<line x1="109.3" y1="160.0" x2="74.6" y2="180.0"/>
+<line x1="74.6" y1="180.0" x2="40.0" y2="160.0"/>
+<line x1="73.0" y1="170.8" x2="48.8" y2="156.8"/>
+<line x1="40.0" y1="160.0" x2="40.0" y2="120.0"/>
+<line x1="40.0" y1="120.0" x2="74.6" y2="100.0"/>
+<line x1="48.8" y1="123.2" x2="73.0" y2="109.2"/>
+<line x1="74.6" y1="100.0" x2="109.3" y2="120.0"/>
+<text x="207.205081" y="108.320000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="137.923048" y="108.320000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="103.282032" y="48.320000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+<text x="35.200000" y="33.600000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="32" >-</text>
+<text x="36.400000" y="48.320000" fill="rgb(255,12,12)"  stroke="rgb(255,12,12)" stroke-width="1" font-size="16" >O</text>
+</svg>
+</g>
+<script type="text/ecmascript">
+  <![CDATA[
+    addEventListener('DOMMouseScroll', wheel, false);
+    onmousewheel = wheel;
+    var svgEl = document.getElementById("topsvg");
+    var startx=0;
+    var starty=0;
+    function wheel(evt){
+      evt = evt ? evt : window.event;
+      var normal = evt.detail ? evt.detail * -1 : evt.wheelDelta / 40;
+      var vb = new Array(4);
+      var vbtext = svgEl.getAttributeNS(null,"viewBox");
+      vb = vbtext.split(" ");
+      var zoom = (normal<0)? 1.41 : 0.71;
+      //var dwidth = parseFloat(Math.max(vb[2],vb[3])) * (1-zoom);
+      vb[0] = parseFloat(vb[0]) + parseFloat(vb[2])*(1-zoom) * evt.clientX/innerWidth;
+      vb[1] = parseFloat(vb[1]) + parseFloat(vb[3])*(1-zoom) * evt.clientY/innerHeight;
+      vb[2] = parseFloat(vb[2]) * zoom;
+      vb[3] = parseFloat(vb[3]) * zoom;
+      svgEl.setAttributeNS(null, "viewBox", vb.join(" "));
+    }
+    onmousedown = function(evt) {
+      startx = evt.clientX;
+      starty = evt.clientY;
+    }
+    onmousemove=function(evt) {
+      if(startx!=0 && starty!=0 
+        && ((evt.clientX - startx)*(evt.clientX - startx)+(evt.clientY - starty)*(evt.clientY - starty)>100))
+      {
+        var vbtext = svgEl.getAttributeNS(null,"viewBox");
+        vb = vbtext.split(" ");
+        var maxwh = Math.max(parseFloat(vb[2]),parseFloat(vb[3]));
+        vb[0] = parseFloat(vb[0]) - (evt.clientX - startx)*maxwh/innerWidth;
+        vb[1] = parseFloat(vb[1]) - (evt.clientY - starty)*maxwh/innerHeight;
+        svgEl.setAttributeNS(null, "viewBox", vb.join(" "));
+        startx = evt.clientX;
+        starty = evt.clientY;
+      }
+    } 
+    onmouseup=function() {
+      startx=0;
+      starty=0;
+   }
+  ]]>
+</script>
+</svg>
+