diff change_title_to_metadata_value.py @ 13:3153b6f3087c draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 1fe240ef0064a1a4a66d9be1ccace53824280b75"
author bgruening
date Mon, 19 Oct 2020 14:43:01 +0000
parents 354c048550f7
children f70b83b730ac
line wrap: on
line diff
--- a/change_title_to_metadata_value.py	Tue Jul 28 08:37:04 2020 -0400
+++ b/change_title_to_metadata_value.py	Mon Oct 19 14:43:01 2020 +0000
@@ -6,29 +6,27 @@
     value of a given-id of the same molecule file.
 """
 
-import os
-import sys
 import argparse
 import random
 import string
 
-
 from openbabel import openbabel, pybel
 openbabel.obErrorLog.StopLogging()
 
+
 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.",
+                     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")
-    parser.add_argument('--random', '-r',
-        action="store_true", help="Add random suffix to the title.")
+    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")
+    parser.add_argument('--random', '-r', action="store_true",
+                        help="Add random suffix to the title.")
 
     args = parser.parse_args()
 
@@ -39,11 +37,10 @@
             if args.random:
                 suffix = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(13))
                 mol.title += '__%s' % suffix
-        output.write( mol )
+        output.write(mol)
 
     output.close()
 
 
 if __name__ == "__main__":
     main()
-