Small Rust CLI interface to search for molecules with matching substructures from the command line.
molgrep is built on top of rdkitcffi.
Currently directly searching .txt (one smiles per line) and SDF-files is supported (see examples).
For searching .txt files/ files with a single smiles string per entry
molgrep --smarts c1ccccc1 --path ./smiles.txt
A example input file with 1000 molecules is provided in smiles.txt
To search SDF files just add the file-type flag
molgrep --smarts c1ccccc1 --path ./smiles.sdf --file-type sdf
Either will return all molecules matching the smarts pattern in smiles notation!
NOTE: rdkitcffi currently only supports linux , molgrep will thus also only work on linux.
Download the repo:
git clone https://github.com/pagel-s/molgrep.git
If you have a rust/cargo installation, just run
cd molgrep
cargo build
cargo test --lib
To execute the molgrep
program from anywhere, you need to add the compiled binary to your system's PATH. After building the project, you can do this by running:
export PATH=$PATH:/PATH/TO/REPO/molgrep/target/debug
You can also add this line to your shell's configuration file (e.g., .bashrc
or .zshrc
) to make the change permanent.
Make sure to set your LD_LIBRARY_PATH environment variable according to rdkitcffi: After installation you may want to update your LD_LIBRARY_PATH in order to run binaries without cargo, e.g.: export LD_LIBRARY_PATH=/home/username/rdkitcffi/lib/rdkitcffi_linux/linux-64/:$LD_LIBRARY_PATH