diff ob_addh.py @ 5:a5f4b80e6769 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 1fe240ef0064a1a4a66d9be1ccace53824280b75"
author bgruening
date Mon, 19 Oct 2020 14:48:46 +0000
parents de4c80d17527
children fac2c28b4c55
line wrap: on
line diff
--- a/ob_addh.py	Tue Jul 28 08:40:43 2020 -0400
+++ b/ob_addh.py	Mon Oct 19 14:48:46 2020 +0000
@@ -3,21 +3,23 @@
     Input:  Molecule file
     Output: Molecule file with hydrogen atoms added at the target pH.
 """
-import sys, os
 import argparse
+import sys
 
 from openbabel import openbabel, pybel
 openbabel.obErrorLog.StopLogging()
 
+
 def parse_command_line(argv):
     parser = argparse.ArgumentParser()
-    parser.add_argument('--iformat', type=str, default='sdf' , help='input file format')
+    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):
@@ -27,6 +29,7 @@
             outfile.write(mol)
     outfile.close()
 
+
 def __main__():
     """
         Add hydrogen atoms at a certain pH value
@@ -34,5 +37,6 @@
     args = parse_command_line(sys.argv)
     addh(args)
 
-if __name__ == "__main__" :
+
+if __name__ == "__main__":
     __main__()