About ICaRuS

ICaRuS (Interactive ChemicAl RUle System) is a demo for learning chemical concepts as logic rules. You give it example molecules that belong to a concept (positives) and molecules that do not (negatives). ICaRuS then learns a rule, written in Prolog, that separates the two groups. You can inspect the rule, edit it by hand, and refine it over several rounds. The tutorial walks through one complete session.

The source code of ICaRuS is available on GitHub. If something does not work as expected, please report an issue.

From molecules to logic

Every molecule is translated into first-order logic facts that describe its atoms and elements, charges, bonds, rings, aromaticity and similar properties. This translation comes from chebILP and python-chebi-utils, the same atom-level representation that chebILP uses for ChEBI classes. Because all molecules share this vocabulary, a learned rule can be checked against any molecule.

Where the examples come from

You can pick a class from ChEBI (Chemical Entities of Biological Interest) to fill the example boxes automatically. The positives are the smallest molecules below that class in the ChEBI hierarchy, which gives the minimal core of the class. The negatives are molecules that sit close to the class in the hierarchy but are not part of it. Generic class structures with wildcard atoms are left out. You can also paste your own SMILES or InChI strings.

To suggest more molecules, ICaRuS ranks candidates by their similarity to your positives, using Morgan fingerprints (ECFP4) and the Tanimoto coefficient. It then picks a diverse set with Maximal Marginal Relevance, so you see different scaffolds instead of near-duplicates. Suggestions appear one at a time, and you label each as positive or negative.

Three learning methods

Popper and Aleph can also draw on relevant predicates from this library as extra background knowledge.

Evaluation and explanation

Rules are evaluated with clingo, an answer set programming solver. ICaRuS shows a confusion matrix and lists the molecules the rule misclassifies. Each rule is also explained with a picture of the pattern it looks for and a short sentence, and the rule editor shows it with its auxiliary predicates unfolded. For every molecule, the "?" button explains why the rule accepts it (the matching atoms highlighted) or rejects it (the closest match and where it fails). The explanations are built with chebILP's explainability pipeline. The rule history keeps earlier rules so you can compare them.