comparison ob_addh.py @ 16:a638d8d13bb3 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:02:57 +0000
parents 2cd8aee0d830
children
comparison
equal deleted inserted replaced
15:01ab890bf0ad 16:a638d8d13bb3
5 """ 5 """
6 import argparse 6 import argparse
7 import sys 7 import sys
8 8
9 from openbabel import openbabel, pybel 9 from openbabel import openbabel, pybel
10
10 openbabel.obErrorLog.StopLogging() 11 openbabel.obErrorLog.StopLogging()
11 12
12 13
13 def parse_command_line(argv): 14 def parse_command_line(argv):
14 parser = argparse.ArgumentParser() 15 parser = argparse.ArgumentParser()
15 parser.add_argument('--iformat', type=str, default='sdf', help='input file format') 16 parser.add_argument("--iformat", type=str, default="sdf", help="input file format")
16 parser.add_argument('-i', '--input', type=str, required=True, help='input file name') 17 parser.add_argument(
17 parser.add_argument('-o', '--output', type=str, required=True, help='output file name') 18 "-i", "--input", type=str, required=True, help="input file name"
18 parser.add_argument('--polar', action="store_true", default=False, help='Add hydrogen atoms only to polar atoms') 19 )
19 parser.add_argument('--pH', type=float, default="7.4", help='Specify target pH value') 20 parser.add_argument(
21 "-o", "--output", type=str, required=True, help="output file name"
22 )
23 parser.add_argument(
24 "--polar",
25 action="store_true",
26 default=False,
27 help="Add hydrogen atoms only to polar atoms",
28 )
29 parser.add_argument(
30 "--pH", type=float, default="7.4", help="Specify target pH value"
31 )
20 return parser.parse_args() 32 return parser.parse_args()
21 33
22 34
23 def addh(args): 35 def addh(args):
24 outfile = pybel.Outputfile(args.iformat, args.output, overwrite=True) 36 outfile = pybel.Outputfile(args.iformat, args.output, overwrite=True)
30 outfile.close() 42 outfile.close()
31 43
32 44
33 def __main__(): 45 def __main__():
34 """ 46 """
35 Add hydrogen atoms at a certain pH value 47 Add hydrogen atoms at a certain pH value
36 """ 48 """
37 args = parse_command_line(sys.argv) 49 args = parse_command_line(sys.argv)
38 addh(args) 50 addh(args)
39 51
40 52