Skip to content

Commit

Permalink
smiles_to_descriptors now accepts a list of smiles strings
Browse files Browse the repository at this point in the history
  • Loading branch information
tjkessler committed Apr 2, 2021
1 parent 165e513 commit f90178c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion alvadescpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from alvadescpy.wrapper import alvadesc
from alvadescpy.functions import smiles_to_descriptors
from alvadescpy.wrapper import CONFIG
__version__ = '0.1.1'
__version__ = '0.1.2'
7 changes: 5 additions & 2 deletions alvadescpy/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# alvadescpy/functions.py
# v.0.1.1
# v.0.1.2
# Developed in 2019 by Travis Kessler <[email protected]>
#
# contains functions for common alvaDesc tasks
Expand All @@ -25,7 +25,7 @@ def smiles_to_descriptors(smiles: str, descriptors: _DESC='ALL',
molecule (represented by its SMILES string)
Args:
smiles (str): SMILES string for a given molecule
smiles (str, list): SMILES string for a given molecule
descriptors (str, list): `ALL` for all descriptors, or list containing
individual descriptors (str's)
labels (bool): if `True`, labels are included in return value (dict);
Expand All @@ -36,4 +36,7 @@ def smiles_to_descriptors(smiles: str, descriptors: _DESC='ALL',
else a dict
'''

if type(smiles) == list:
return [alvadesc(ismiles=smi, descriptors=descriptors, labels=labels)[0]
for smi in smiles]
return alvadesc(ismiles=smiles, descriptors=descriptors, labels=labels)[0]
2 changes: 1 addition & 1 deletion alvadescpy/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# alvadescpy/wrapper.py
# v.0.1.1
# v.0.1.2
# Developed in 2019 by Travis Kessler <[email protected]>
#
# contains `alvadesc` function, a wrapper for alvaDesc software
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='alvadescpy',
version='0.1.1',
version='0.1.2',
description='Python wrapper for alvaDesc software',
url='http://github.com/tjkessler/ecnet',
author='Travis Kessler',
Expand Down
3 changes: 3 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
if __name__ == '__main__':

print(smiles_to_descriptors('CCCOC', descriptors=['MW', 'AMW'], labels=True))
res = smiles_to_descriptors(['CCCC', 'CCOCC', 'CCCCC'], descriptors='ALL', labels=True)
print(len(res))
print(len(res[0]))

0 comments on commit f90178c

Please sign in to comment.