Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run.single pdbfile argument ignored #82

Closed
IAlibay opened this issue Jul 14, 2020 · 0 comments · Fixed by #85
Closed

run.single pdbfile argument ignored #82

IAlibay opened this issue Jul 14, 2020 · 0 comments · Fixed by #85

Comments

@IAlibay
Copy link
Contributor

IAlibay commented Jul 14, 2020

Expected

Passing a file and some arguments to run.single should work:

i.e.

import propka.run as pk

mol = pk.single('4LYI.pdb', optargs=['--quiet'])

Actual behaviour

The above worked in 3.1, however moving to 3.2 this leads to a SystemExit caused by agparse.

Causes

From what I can tell, the following are causing this behaviour:

  1. single calls loadOptions whose argparse call expects an input_pdb entry.

  2. pdbfile is overwritten by the return value of options.filenames.pop(0)

pdbfile = options.filenames.pop(0)

Possible fix

One quick fix here would be to switch single to have a behaviour similar to what is done in:

def run_propka(options, pdb_path, tmp_path):
"""Run PROPKA software.
Args:
options: list of PROPKA options
pdb_path: path to PDB file
tmp_path: path for working directory
"""
options += [str(pdb_path)]
args = loadOptions(options)
try:
_LOGGER.warning(
"Working in tmpdir {0:s} because of PROPKA file output; "
"need to fix this.".format(str(tmp_path)))
cwd = Path.cwd()
os.chdir(tmp_path)
parameters = read_parameter_file(args.parameters, Parameters())
molecule = MolecularContainer(parameters, args)
molecule = read_molecule_file(str(pdb_path), molecule)
molecule.calculate_pka()
molecule.write_pka()
if args.generate_propka_input:
molecule.write_propka()
finally:
os.chdir(cwd)

This was referenced Jul 14, 2020
orbeckst pushed a commit that referenced this issue Jul 17, 2020
* Fixes #82
* Changes:
    * input arguments now reflects the changes made to read_molecule_file in #84
    * Writing of pKa file is now optional (default behaviour has been kept). This will be particularly 
       useful downstream where we would just want to have access to the MoleculeContainer object.
     * new test_run file specific for testing run.
* add tests
* add docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant