From fb35c7f4327cb4b7450d9dfe37241f98f999f5cd Mon Sep 17 00:00:00 2001 From: tjkessler Date: Mon, 15 Jun 2020 21:18:14 -0400 Subject: [PATCH 1/3] Updated docstrings to PyCodeStyle --- padelpy/functions.py | 8 ++++---- padelpy/wrapper.py | 24 +++++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/padelpy/functions.py b/padelpy/functions.py index e4dafd8..89539d6 100644 --- a/padelpy/functions.py +++ b/padelpy/functions.py @@ -20,8 +20,8 @@ from padelpy import padeldescriptor -def from_smiles(smiles: str, output_csv: str=None, descriptors: bool=True, - fingerprints: bool=False, timeout: int=12) -> OrderedDict: +def from_smiles(smiles: str, output_csv: str = None, descriptors: bool = True, + fingerprints: bool = False, timeout: int = 12) -> OrderedDict: ''' from_smiles: converts SMILES string to QSPR descriptors/fingerprints Args: @@ -82,8 +82,8 @@ def from_smiles(smiles: str, output_csv: str=None, descriptors: bool=True, return rows[0] -def from_mdl(mdl_file: str, output_csv: str=None, descriptors: bool=True, - fingerprints: bool=False, timeout: int=12) -> list: +def from_mdl(mdl_file: str, output_csv: str = None, descriptors: bool = True, + fingerprints: bool = False, timeout: int = 12) -> list: ''' from_mdl: converts MDL file into QSPR descriptors/fingerprints; multiple molecules may be represented in the MDL file diff --git a/padelpy/wrapper.py b/padelpy/wrapper.py index 4bb5515..5ccbb66 100644 --- a/padelpy/wrapper.py +++ b/padelpy/wrapper.py @@ -45,17 +45,19 @@ def _popen_timeout(command: str, timeout: int) -> tuple: return p.communicate() -def padeldescriptor(maxruntime: int=-1, waitingjobs: int=-1, threads: int=-1, - d_2d: bool=False, d_3d: bool=False, config: str=None, - convert3d: bool=False, descriptortypes: str=None, - detectaromaticity: bool=False, mol_dir: str=None, - d_file: str=None, fingerprints: bool=False, - log: bool=False, maxcpdperfile: int=0, - removesalt: bool=False, retain3d: bool=False, - retainorder: bool=False, standardizenitro: bool=False, - standardizetautomers: bool=False, tautomerlist: str=None, - usefilenameasmolname: bool=False, - sp_timeout: int=None) -> None: +def padeldescriptor(maxruntime: int = -1, waitingjobs: int = -1, + threads: int = -1, d_2d: bool = False, d_3d: bool = False, + config: str = None, convert3d: bool = False, + descriptortypes: str = None, + detectaromaticity: bool = False, mol_dir: str = None, + d_file: str = None, fingerprints: bool = False, + log: bool = False, maxcpdperfile: int = 0, + removesalt: bool = False, retain3d: bool = False, + retainorder: bool = False, standardizenitro: bool = False, + standardizetautomers: bool = False, + tautomerlist: str = None, + usefilenameasmolname: bool = False, + sp_timeout: int = None) -> None: ''' padeldescriptor: complete wrapper for PaDEL-Descriptor descriptor/ fingerprint generation software From 58a9a7706479663f8d91060642f3aa37a97d3a2f Mon Sep 17 00:00:00 2001 From: tjkessler Date: Mon, 15 Jun 2020 21:28:09 -0400 Subject: [PATCH 2/3] Added error handling for issue outlined in https://github.com/ECRL/PaDELPy/issues/12 --- padelpy/functions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/padelpy/functions.py b/padelpy/functions.py index 89539d6..d129b06 100644 --- a/padelpy/functions.py +++ b/padelpy/functions.py @@ -78,6 +78,10 @@ def from_smiles(smiles: str, output_csv: str = None, descriptors: bool = True, if not save_csv: remove(output_csv) + if len(rows) == 0: + raise RuntimeError('PaDEL-Descriptor returned no calculated values.' + + ' Ensure the input structure is correct.') + del rows[0]['Name'] return rows[0] @@ -141,6 +145,9 @@ def from_mdl(mdl_file: str, output_csv: str = None, descriptors: bool = True, desc_file.close() if not save_csv: remove(output_csv) + if len(rows) == 0: + raise RuntimeError('PaDEL-Descriptor returned no calculated values.' + + ' Ensure the input structure is correct.') for row in rows: del row['Name'] return rows From 95c293d088a39f5ab3e6ae90683e78a62aab9f8e Mon Sep 17 00:00:00 2001 From: tjkessler Date: Mon, 15 Jun 2020 21:31:35 -0400 Subject: [PATCH 3/3] Version bump: 0.1.6 -> 0.1.7 --- padelpy/__init__.py | 2 +- padelpy/functions.py | 2 +- padelpy/wrapper.py | 2 +- setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/padelpy/__init__.py b/padelpy/__init__.py index 4b3a7e7..ef2e9a9 100644 --- a/padelpy/__init__.py +++ b/padelpy/__init__.py @@ -1,3 +1,3 @@ from padelpy.wrapper import padeldescriptor from padelpy.functions import from_mdl, from_smiles -__version__ = '0.1.6' +__version__ = '0.1.7' diff --git a/padelpy/functions.py b/padelpy/functions.py index d129b06..4448bd7 100644 --- a/padelpy/functions.py +++ b/padelpy/functions.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # padelpy/functions.py -# v.0.1.6 +# v.0.1.7 # Developed in 2019 by Travis Kessler # # Contains various functions commonly used with PaDEL-Descriptor diff --git a/padelpy/wrapper.py b/padelpy/wrapper.py index 5ccbb66..c11390e 100644 --- a/padelpy/wrapper.py +++ b/padelpy/wrapper.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # padelpy/wrapper.py -# v.0.1.6 +# v.0.1.7 # Developed in 2019 by Travis Kessler # # Contains the `padeldescriptor` function, a wrapper for PaDEL-Descriptor diff --git a/setup.py b/setup.py index fc06b57..263f783 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='padelpy', - version='0.1.6', + version='0.1.7', description='A Python wrapper for PaDEL-Descriptor', url='https://github.com/ecrl/padelpy', author='Travis Kessler',