Find minimum path in a molecule

A program that finds and outputs the minimum path in a molecule. The input can be two specific named atoms or two SMARTS matches. As SMARTS matches could hit more than one atom this could result in multiple different paths. To use atom names a helper program, printatomnames, is provided (see below). If -o is set then the atoms in the path will be output to a molecule file, otherwise just the length of the path is reported. -verbose outputs more details on the path.

Example

prompt> minpath.py -i input.oeb.gz -atom1 'N1' -atom2 'S1'
prompt> minpath.py -i input.oeb.gz -smarts1 'c1cccs1' -smarts2 'OC(=O)C' -o output.smi

Code

Download code

minpath.py

See also