forlilab / Meeko

Interfacing RDKit and AutoDock
GNU Lesser General Public License v2.1
171 stars 41 forks source link

mk_prepare_ligand.py should return a non-0 exit code if it failed to create the output #64

Open xrobin opened 11 months ago

xrobin commented 11 months ago

Running mk_prepare_ligand.py on some unsupported ligands like [Sr+2] fails. This is fine, however the script returns a success exit code (0) which makes it difficult to detect the failure.

echo "
     RDKit          3D

  1  0  0  0  0  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 Sr  0  0  0  0  0 15  0  0  0  0  0  0
M  CHG  1   1   2
M  END
$$$$
" > test.sdf
mk_prepare_ligand.py -i test.sdf -o test.pdbqt

The script fails and prints the following output:

[16:04:31] Warning: molecule is tagged as 3D, but all Z coords are zero
[16:04:31] ERROR: Problems encountered parsing data fields
[16:04:31] ERROR: moving to the beginning of the next molecule
atom number 0 has None type, mol name: 

However it returns a status code of 0 which makes it difficult to detect that something failed:

echo $?
0

It would be very nice if mk_prepare_ligand.py could return a non-0 exit code to indicate a failure occurred.