-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ECRL/dev
Error handling for PaDEL-Descriptor not returning any calculated values
- Loading branch information
Showing
4 changed files
with
28 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# padelpy/functions.py | ||
# v.0.1.6 | ||
# v.0.1.7 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains various functions commonly used with PaDEL-Descriptor | ||
|
@@ -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: | ||
|
@@ -78,12 +78,16 @@ 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] | ||
|
||
|
||
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 | ||
|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
# | ||
# padelpy/wrapper.py | ||
# v.0.1.6 | ||
# v.0.1.7 | ||
# Developed in 2019 by Travis Kessler <[email protected]> | ||
# | ||
# Contains the `padeldescriptor` function, a wrapper for PaDEL-Descriptor | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters