The alvaDescCLIWrapper package can be used to access alvaDesc functionalities from Python (3.5 or higher).

In order to work, the package requires a licensed version of alvaDesc installed on the same computer.
Minum alvaDesc version: 1.0.14


Examples

1. Calculate a couple of descriptors on two molecules:

from alvadesccliwrapper.alvadesc import AlvaDesc

aDesc = AlvaDesc(‘C:\\Program Files\\Alvascience\\alvaDesc\\alvaDescCLI.exe’) # Windows default alvaDescCLI.exe location
aDesc.set_input_SMILES([‘CCCC’, ‘CC(=O)OC1=CC=CC=C1C(=O)O’])
if not aDesc.calculate_descriptors([‘MW’, ‘AMW’]): # use calculate_descriptors(‘ALL’) to calculate them all
  print(‘Error: ‘ + aDesc.get_error())
else:
  print(‘Results: ‘ + aDesc.get_output())

The result is a list of lists of float containing the required descriptors:

[[58.14, 4.15285714285714], [180.17, 8.57952380952381]]
Molecule MW AMW
CCCC 58.14 4.15285714285714
CC(=O)OC1=CC=CC=C1C(=O)O 180.17 8.57952380952381

2. Calculate the MACCS 166 fingerprint on the molecules contained in a MDL file:

from alvadesccliwrapper.alvadesc import AlvaDesc

aDesc = AlvaDesc(‘/usr/bin/alvaDescCLI’) # Linux default alvaDescCLI location
aDesc.set_input_file(‘./myfile.sdf’, ‘MDL’)
if not aDesc.calculate_fingerprint(‘MACCSFP’):
  print(‘Error: ‘ + aDesc.get_error())
else:
  print(‘Results: ‘ + aDesc.get_output())

The result is a simple list of strings containing the required fingerprint:

[‘0000000000000000000000000000000000010000000000000000000000000000100000000000000110101111011…

3. Calculate the ECFP fingerprint with size 1024 saving the result to a text file:

from alvadesccliwrapper.alvadesc import AlvaDesc

aDesc = AlvaDesc(‘/Applications/alvaDesc.app/Contents/MacOS/alvaDescCLI’) # macOS default alvaDescCLI location
aDesc.set_input_file(‘./myfile.sdf’, ‘MDL’)
aDesc.set_output_file(‘./test.txt’)
if not aDesc.calculate_fingerprint(‘ECFP’, 1024):
  print(‘Error: ‘ + aDesc.get_error())
# the result is in the output file
#else:
#  print(‘Results: ‘ + aDesc.get_output())

Download

Please, log in in order to access the content