From 524236600626216946b5c6f9730e6684b879bf2c Mon Sep 17 00:00:00 2001 From: Nathan Baker Date: Mon, 25 May 2020 19:09:11 -0700 Subject: [PATCH] Clean up line breaks in lib.py See https://github.com/jensengroup/propka-3.1/issues/43 --- propka/lib.py | 146 +++++++++++++++++++++++++++++--------------------- 1 file changed, 85 insertions(+), 61 deletions(-) diff --git a/propka/lib.py b/propka/lib.py index 5ca270e..ab54850 100644 --- a/propka/lib.py +++ b/propka/lib.py @@ -157,7 +157,8 @@ def parse_res_string(res_str): try: chain, resnum_str = res_str.split(":") except ValueError: - raise ValueError("Invalid residue string (must contain 2 colon-separated values)") + raise ValueError("Invalid residue string (must contain 2 " + "colon-separated values)") try: resnum = int(resnum_str) except ValueError: @@ -185,73 +186,96 @@ def build_parser(parser=None): if parser is not None: group = parser.add_argument_group(title="PROPKA invoation options") else: - parser = argparse.ArgumentParser(description=("PROPKA predicts the pKa values of ionizable " - "groups in proteins and protein-ligand " - "complexes based in the 3D structure"), - formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser = argparse.ArgumentParser( + description=("PROPKA predicts the pKa values of ionizable " + "groups in proteins and protein-ligand " + "complexes based in the 3D structure"), + formatter_class=argparse.ArgumentDefaultsHelpFormatter) # This is duck-typing at its finest group = parser group.add_argument("input_pdb", help="read data from ") - group.add_argument("-f", "--file", action="append", dest="filenames", default=[], - help="read data from , i.e. is added to arguments") - group.add_argument("-r", "--reference", dest="reference", default="neutral", - help=("setting which reference to use for stability calculations " - "[neutral/low-pH]")) - group.add_argument("-c", "--chain", action="append", dest="chains", - help=('creating the protein with only a specified chain. Specify ' - '" " for chains without ID [all]')) - group.add_argument("-i", "--titrate_only", dest="titrate_only", - help=('Treat only the specified residues as titratable. Value should ' - 'be a comma-separated list of "chain:resnum" values; for example: ' - '-i "A:10,A:11"')) - group.add_argument("-t", "--thermophile", action="append", dest="thermophiles", - help=("defining a thermophile filename; usually used in " - "'alignment-mutations'")) - group.add_argument("-a", "--alignment", action="append", dest="alignment", - help=("alignment file connecting and " - "[.pir]")) - group.add_argument("-m", "--mutation", action="append", dest="mutations", - help=("specifying mutation labels which is used to modify " - " according to, e.g. N25R/N181D")) - group.add_argument("-v", "--version", dest="version_label", default="Jan15", - help="specifying the sub-version of propka [Jan15/Dec19]") - group.add_argument("-p", "--parameters", dest="parameters", - default=pkg_resources.resource_filename(__name__, "propka.cfg"), - help="set the parameter file [%(default)s]") + group.add_argument( + "-f", "--file", action="append", dest="filenames", default=[], + help="read data from , i.e. is added to arguments") + group.add_argument( + "-r", "--reference", dest="reference", default="neutral", + help=("setting which reference to use for stability calculations " + "[neutral/low-pH]")) + group.add_argument( + "-c", "--chain", action="append", dest="chains", + help=('creating the protein with only a specified chain. Specify ' + '" " for chains without ID [all]')) + group.add_argument( + "-i", "--titrate_only", dest="titrate_only", + help=('Treat only the specified residues as titratable. Value should ' + 'be a comma-separated list of "chain:resnum" values; for example: ' + '-i "A:10,A:11"')) + group.add_argument( + "-t", "--thermophile", action="append", dest="thermophiles", + help=("defining a thermophile filename; usually used in " + "'alignment-mutations'")) + group.add_argument( + "-a", "--alignment", action="append", dest="alignment", + help=("alignment file connecting and " + "[.pir]")) + group.add_argument( + "-m", "--mutation", action="append", dest="mutations", + help=("specifying mutation labels which is used to modify " + " according to, e.g. N25R/N181D")) + group.add_argument( + "-v", "--version", dest="version_label", default="Jan15", + help="specifying the sub-version of propka [Jan15/Dec19]") + group.add_argument( + "-p", "--parameters", dest="parameters", + default=pkg_resources.resource_filename(__name__, "propka.cfg"), + help="set the parameter file [%(default)s]") try: - group.add_argument("--log-level", choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], - help="logging level verbosity", default="INFO") + group.add_argument( + "--log-level", + choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], + help="logging level verbosity", default="INFO") except argparse.ArgumentError: # It is possible that --log-level has already been set by APBS pass - group.add_argument("-o", "--pH", dest="pH", type=float, default=7.0, - help="setting pH-value used in e.g. stability calculations [7.0]") - group.add_argument("-w", "--window", dest="window", nargs=3, type=float, - default=(0.0, 14.0, 1.0), - help=("setting the pH-window to show e.g. stability profiles " - "[0.0, 14.0, 1.0]")) - group.add_argument("-g", "--grid", dest="grid", nargs=3, type=float, - default=(0.0, 14.0, 0.1), - help=("setting the pH-grid to calculate e.g. stability " - "related properties [0.0, 14.0, 0.1]")) - group.add_argument("--mutator", dest="mutator", - help="setting approach for mutating [alignment/scwrl/jackal]") - group.add_argument("--mutator-option", dest="mutator_options", action="append", - help="setting property for mutator [e.g. type=\"side-chain\"]") - group.add_argument("-d", "--display-coupled-residues", dest="display_coupled_residues", - action="store_true", help=("Displays alternative pKa values due " - "to coupling of titratable groups")) - group.add_argument("-l", "--reuse-ligand-mol2-files", dest="reuse_ligand_mol2_file", - action="store_true", default=False, - help=("Reuses the ligand mol2 files allowing the user to alter " - "ligand bond orders")) - group.add_argument("-k", "--keep-protons", dest="keep_protons", action="store_true", - help="Keep protons in input file", default=False) - group.add_argument("-q", "--quiet", action="store_const", const="WARNING", - dest="log_level", help="suppress non-warning messages") - group.add_argument("--protonate-all", dest="protonate_all", action="store_true", - help="Protonate all atoms (will not influence pKa calculation)", - default=False) + group.add_argument( + "-o", "--pH", dest="pH", type=float, default=7.0, + help="setting pH-value used in e.g. stability calculations [7.0]") + group.add_argument( + "-w", "--window", dest="window", nargs=3, type=float, + default=(0.0, 14.0, 1.0), + help=("setting the pH-window to show e.g. stability profiles " + "[0.0, 14.0, 1.0]")) + group.add_argument( + "-g", "--grid", dest="grid", nargs=3, type=float, + default=(0.0, 14.0, 0.1), + help=("setting the pH-grid to calculate e.g. stability " + "related properties [0.0, 14.0, 0.1]")) + group.add_argument( + "--mutator", dest="mutator", + help="setting approach for mutating [alignment/scwrl/jackal]") + group.add_argument( + "--mutator-option", dest="mutator_options", action="append", + help="setting property for mutator [e.g. type=\"side-chain\"]") + group.add_argument( + "-d", "--display-coupled-residues", dest="display_coupled_residues", + action="store_true", + help=("Displays alternative pKa values due " + "to coupling of titratable groups")) + group.add_argument( + "-l", "--reuse-ligand-mol2-files", dest="reuse_ligand_mol2_file", + action="store_true", default=False, + help=("Reuses the ligand mol2 files allowing the user to alter " + "ligand bond orders")) + group.add_argument( + "-k", "--keep-protons", dest="keep_protons", action="store_true", + help="Keep protons in input file", default=False) + group.add_argument( + "-q", "--quiet", action="store_const", const="WARNING", + dest="log_level", help="suppress non-warning messages") + group.add_argument( + "--protonate-all", dest="protonate_all", action="store_true", + help="Protonate all atoms (will not influence pKa calculation)", + default=False) return parser