# HG changeset patch
# User bgruening
# Date 1383059759 14400
# Node ID 18eb78773d87bb814848708e713ad21d748b1083
Uploaded
diff -r 000000000000 -r 18eb78773d87 mol2gspan.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mol2gspan.py Tue Oct 29 11:15:59 2013 -0400
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+"""
+ Converts a SD-file to a GSPAN file.
+"""
+
+
+import os, sys
+import argparse
+
+def main( args ):
+
+ begin = False
+ iid = 0
+ graph_counter = 1
+
+ for line in args.infile:
+ if line.rstrip():
+ if line.strip().endswith('END'):
+ begin = False
+ elif line.strip() == '$$$$':
+ graph_counter += 1
+ iid = 0
+ else:
+ # found header line, like: 21 21 0 0 0 0 0 0 0 0999 V2000
+ if len(line.split()) >= 5 and line.split()[-1] == 'V2000':
+ args.outfile.write('t # id %s\n' % graph_counter)
+ begin=True
+ continue
+ # connection or coordinate/atom table
+ if len(line.split()) >= 4 and begin:
+ # coordinate/atom table
+ if not line.startswith('M'):
+ if line.split()[3].isalpha() or line.split()[3] == '*':
+ args.outfile.write( 'v %s %s \n' % (iid, line.split()[3]) )
+ iid += 1
+ else:
+ #connection table
+ id, node, edge, trash = line.split(None, 3)
+ args.outfile.write( 'e %s %s %s\n' % ( int(id) - 1 , int(node) -1, edge ) )
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--infile', nargs='?', type=argparse.FileType('r'),
+ default=sys.stdin, help="Specify one or more input files")
+ parser.add_argument('--outfile', type=argparse.FileType('w'),
+ default=sys.stdout, help="Specify one output file")
+ args = parser.parse_args()
+ main( args )
diff -r 000000000000 -r 18eb78773d87 mol2gspan.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mol2gspan.xml Tue Oct 29 11:15:59 2013 -0400
@@ -0,0 +1,41 @@
+
+ converter
+
+
+ openbabel
+ MOL2GSPAN_SCRIPT_PATH
+
+
+
+ #if $infile.ext == 'sdf':
+ python \$MOL2GSPAN_SCRIPT_PATH/mol2gspan.py --infile $infile --outfile $outfile
+
+ #else:
+ obabel -i $infile.ext -o sdf $infile ---errorlevel 1 | python \$MOL2GSPAN_SCRIPT_PATH/mol2gspan.py --infile - --outfile $outfile
+
+ #end if
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.. class:: infomark
+
+**What it does**
+
+That converter will convert arbitratry molecule files to the gSpan format.
+
+
+
diff -r 000000000000 -r 18eb78773d87 readme.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/readme.rst Tue Oct 29 11:15:59 2013 -0400
@@ -0,0 +1,48 @@
+Galaxy wrapper for mol2gspan
+============================
+
+This wrapper is copyright 2013 by Björn Grüning.
+
+This is a wrapper for the command line tool of mol2gspan.
+
+
+
+
+Installation
+============
+
+The recommended installation is by means of the toolshed_.
+If you need to install it manually here is a short introduction.
+
+.. _toolshed: http://toolshed.g2.bx.psu.edu/view/bgruening/molecule2gspan
+
+
+
+History
+=======
+
+- v0.1: Initial public release
+
+
+=============
+Licence (MIT)
+=============
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff -r 000000000000 -r 18eb78773d87 repository_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/repository_dependencies.xml Tue Oct 29 11:15:59 2013 -0400
@@ -0,0 +1,5 @@
+
+
+
+
+
diff -r 000000000000 -r 18eb78773d87 tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml Tue Oct 29 11:15:59 2013 -0400
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+ $REPOSITORY_INSTALL_DIR
+
+