diff remove_protonation_state.py @ 15:c5de6c19eb06 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit d9c51279c061a1da948a2582d5b502ca7573adbf
author bgruening
date Thu, 15 Aug 2024 11:00:46 +0000
parents 12aca74f07d7
children
line wrap: on
line diff
--- a/remove_protonation_state.py	Tue Nov 10 20:30:47 2020 +0000
+++ b/remove_protonation_state.py	Thu Aug 15 11:00:46 2024 +0000
@@ -7,14 +7,15 @@
 import argparse
 
 from openbabel import openbabel, pybel
+
 openbabel.obErrorLog.StopLogging()
 
 
 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')
+    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()
 
 
@@ -22,15 +23,15 @@
     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]
-        if 'inchi' in mol.data:
-            del mol.data['inchi']  # remove inchi cache so modified mol is saved
+        if "inchi" in mol.data:
+            del mol.data["inchi"]  # remove inchi cache so modified mol is saved
         outfile.write(mol)
     outfile.close()
 
 
 def __main__():
     """
-        Remove any protonation state from each atom in each molecule.
+    Remove any protonation state from each atom in each molecule.
     """
     args = parse_command_line()
     remove_protonation(args)