Move argparse sub-command to group.
This commit is contained in:
127
propka/lib.py
127
propka/lib.py
@@ -138,7 +138,7 @@ def parse_res_string(res_str):
|
|||||||
return chain, resnum, inscode
|
return chain, resnum, inscode
|
||||||
|
|
||||||
|
|
||||||
def build_parser(parser_=None):
|
def build_parser(parser=None):
|
||||||
"""Build an argument parser for PROPKA.
|
"""Build an argument parser for PROPKA.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -148,75 +148,74 @@ def build_parser(parser_=None):
|
|||||||
Returns:
|
Returns:
|
||||||
ArgumentParser object.
|
ArgumentParser object.
|
||||||
"""
|
"""
|
||||||
if parser_ is not None:
|
if parser is not None:
|
||||||
subparsers = parser_.add_subparsers(title="PROPKA sub-command group")
|
group = parser.add_argument_group(title="PROPKA invoation options")
|
||||||
parser = subparsers.add_parser("PROPKA", help="PROPKA invocation options")
|
|
||||||
else:
|
else:
|
||||||
parser = argparse.ArgumentParser(description=("PROPKA predicts the pKa values of ionizable "
|
parser = argparse.ArgumentParser(description=("PROPKA predicts the pKa values of ionizable "
|
||||||
"groups in proteins and protein-ligand "
|
"groups in proteins and protein-ligand "
|
||||||
"complexes based in the 3D structure"),
|
"complexes based in the 3D structure"),
|
||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
# This is duck-typing at its finest
|
||||||
|
group = parser
|
||||||
|
group.add_argument("input_pdb", help="read data from <filename>")
|
||||||
|
|
||||||
parser.add_argument("-f", "--file", action="append", dest="filenames",
|
|
||||||
help="read data from <filename>, i.e. <filename> is added to arguments")
|
group.add_argument("-f", "--file", action="append", dest="filenames", default=[],
|
||||||
parser.add_argument("-r", "--reference", dest="reference", default="neutral",
|
help="read data from <filename>, i.e. <filename> is added to arguments")
|
||||||
help=("setting which reference to use for stability calculations "
|
group.add_argument("-r", "--reference", dest="reference", default="neutral",
|
||||||
"[neutral/low-pH]"))
|
help=("setting which reference to use for stability calculations "
|
||||||
parser.add_argument("-c", "--chain", action="append", dest="chains",
|
"[neutral/low-pH]"))
|
||||||
help=('creating the protein with only a specified chain. Specify '
|
group.add_argument("-c", "--chain", action="append", dest="chains",
|
||||||
'" " for chains without ID [all]'))
|
help=('creating the protein with only a specified chain. Specify '
|
||||||
parser.add_argument("-i", "--titrate_only", dest="titrate_only",
|
'" " for chains without ID [all]'))
|
||||||
help=('Treat only the specified residues as titratable. Value should '
|
group.add_argument("-i", "--titrate_only", dest="titrate_only",
|
||||||
'be a comma-separated list of "chain:resnum" values; for example: '
|
help=('Treat only the specified residues as titratable. Value should '
|
||||||
'-i "A:10,A:11"'))
|
'be a comma-separated list of "chain:resnum" values; for example: '
|
||||||
parser.add_argument("-t", "--thermophile", action="append", dest="thermophiles",
|
'-i "A:10,A:11"'))
|
||||||
help=("defining a thermophile filename; usually used in "
|
group.add_argument("-t", "--thermophile", action="append", dest="thermophiles",
|
||||||
"'alignment-mutations'"))
|
help=("defining a thermophile filename; usually used in "
|
||||||
parser.add_argument("-a", "--alignment", action="append", dest="alignment",
|
"'alignment-mutations'"))
|
||||||
help=("alignment file connecting <filename> and <thermophile> "
|
group.add_argument("-a", "--alignment", action="append", dest="alignment",
|
||||||
"[<thermophile>.pir]"))
|
help=("alignment file connecting <filename> and <thermophile> "
|
||||||
parser.add_argument("-m", "--mutation", action="append", dest="mutations",
|
"[<thermophile>.pir]"))
|
||||||
help=("specifying mutation labels which is used to modify "
|
group.add_argument("-m", "--mutation", action="append", dest="mutations",
|
||||||
"<filename> according to, e.g. N25R/N181D"))
|
help=("specifying mutation labels which is used to modify "
|
||||||
parser.add_argument("-v", "--version", dest="version_label", default="Jan15",
|
"<filename> according to, e.g. N25R/N181D"))
|
||||||
help="specifying the sub-version of propka [Jan15/Dec19]")
|
group.add_argument("-v", "--version", dest="version_label", default="Jan15",
|
||||||
parser.add_argument("-p", "--parameters", dest="parameters",
|
help="specifying the sub-version of propka [Jan15/Dec19]")
|
||||||
default=pkg_resources.resource_filename(__name__, "propka.cfg"),
|
group.add_argument("-p", "--parameters", dest="parameters",
|
||||||
help="set the parameter file [%default]")
|
default=pkg_resources.resource_filename(__name__, "propka.cfg"),
|
||||||
parser.add_argument("-z", "--verbose", dest="verbosity", action="store_const",
|
help="set the parameter file [%(default)s]")
|
||||||
const=2, help="output debugging information")
|
group.add_argument("-z", "--verbose", dest="verbosity", action="store_const",
|
||||||
parser.add_argument("-q", "--quiet", dest="verbosity", action="store_const",
|
const=2, help="output debugging information")
|
||||||
const=0, default=1, help="inhibit printing to stdout")
|
group.add_argument("-q", "--quiet", dest="verbosity", action="store_const",
|
||||||
parser.add_argument("-o", "--pH", dest="pH", type=float, default=7.0,
|
const=0, default=1, help="inhibit printing to stdout")
|
||||||
help="setting pH-value used in e.g. stability calculations [7.0]")
|
group.add_argument("-o", "--pH", dest="pH", type=float, default=7.0,
|
||||||
parser.add_argument("-w", "--window", dest="window", nargs=3, type=float,
|
help="setting pH-value used in e.g. stability calculations [7.0]")
|
||||||
default=(0.0, 14.0, 1.0),
|
group.add_argument("-w", "--window", dest="window", nargs=3, type=float,
|
||||||
help=("setting the pH-window to show e.g. stability profiles "
|
default=(0.0, 14.0, 1.0),
|
||||||
"[0.0, 14.0, 1.0]"))
|
help=("setting the pH-window to show e.g. stability profiles "
|
||||||
parser.add_argument("-g", "--grid", dest="grid", nargs=3, type=float,
|
"[0.0, 14.0, 1.0]"))
|
||||||
default=(0.0, 14.0, 0.1),
|
group.add_argument("-g", "--grid", dest="grid", nargs=3, type=float,
|
||||||
help=("setting the pH-grid to calculate e.g. stability "
|
default=(0.0, 14.0, 0.1),
|
||||||
"related properties [0.0, 14.0, 0.1]"))
|
help=("setting the pH-grid to calculate e.g. stability "
|
||||||
parser.add_argument("--mutator", dest="mutator",
|
"related properties [0.0, 14.0, 0.1]"))
|
||||||
help="setting approach for mutating <filename> [alignment/scwrl/jackal]")
|
group.add_argument("--mutator", dest="mutator",
|
||||||
parser.add_argument("--mutator-option", dest="mutator_options", action="append",
|
help="setting approach for mutating <filename> [alignment/scwrl/jackal]")
|
||||||
help="setting property for mutator [e.g. type=\"side-chain\"]")
|
group.add_argument("--mutator-option", dest="mutator_options", action="append",
|
||||||
parser.add_argument("-d", "--display-coupled-residues", dest="display_coupled_residues",
|
help="setting property for mutator [e.g. type=\"side-chain\"]")
|
||||||
action="store_true", help=("Displays alternative pKa values due "
|
group.add_argument("-d", "--display-coupled-residues", dest="display_coupled_residues",
|
||||||
"to coupling of titratable groups"))
|
action="store_true", help=("Displays alternative pKa values due "
|
||||||
parser.add_argument("-l", "--reuse-ligand-mol2-files", dest="reuse_ligand_mol2_file",
|
"to coupling of titratable groups"))
|
||||||
action="store_true", default=False,
|
group.add_argument("-l", "--reuse-ligand-mol2-files", dest="reuse_ligand_mol2_file",
|
||||||
help=("Reuses the ligand mol2 files allowing the user to alter "
|
action="store_true", default=False,
|
||||||
"ligand bond orders"))
|
help=("Reuses the ligand mol2 files allowing the user to alter "
|
||||||
parser.add_argument("-k", "--keep-protons", dest="keep_protons", action="store_true",
|
"ligand bond orders"))
|
||||||
help="Keep protons in input file", default=False)
|
group.add_argument("-k", "--keep-protons", dest="keep_protons", action="store_true",
|
||||||
parser.add_argument("--protonate-all", dest="protonate_all", action="store_true",
|
help="Keep protons in input file", default=False)
|
||||||
help="Protonate all atoms (will not influence pKa calculation)",
|
group.add_argument("--protonate-all", dest="protonate_all", action="store_true",
|
||||||
default=False)
|
help="Protonate all atoms (will not influence pKa calculation)",
|
||||||
parser.add_argument("input_pdb",
|
default=False)
|
||||||
help="read data from <filename>")
|
|
||||||
if parser_ is not None:
|
|
||||||
return parser_
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user