Skip to content

Add fatty acyl-CoA grouping classes and examples - #82

Open
cmungall wants to merge 7 commits into
mainfrom
claude/modest-hopper-q4avlz
Open

Add fatty acyl-CoA grouping classes and examples#82
cmungall wants to merge 7 commits into
mainfrom
claude/modest-hopper-q4avlz

Conversation

@cmungall

Copy link
Copy Markdown
Collaborator

Summary

This PR adds comprehensive support for fatty acyl-CoA grouping classes to the ChemRof schema, enabling classification of fatty acyl-CoA molecules by structural features relevant to beta-oxidation substrate classification.

Key Changes

Schema Updates (src/chemrof/schema/chemrof.yaml)

  • Added FattyAcylCoAGroupingClass abstract base class for fatty acyl-CoA groupings
  • Added four concrete grouping class hierarchies:
    • FattyAcylChainLengthGroupingClass - classifies by carbon chain length (short, medium, long, very-long chain)
    • FattyAcylSaturationGroupingClass - classifies by degree of unsaturation (saturated, monounsaturated, polyunsaturated)
    • FattyAcylBranchingGroupingClass - classifies by branching (linear vs. branched)
    • FattyAcylCarbonParityGroupingClass - classifies by carbon number parity (even vs. odd)
  • Each grouping class includes OWL template annotations that generate necessary-and-sufficient EquivalentClasses axioms
  • Added supporting slots: min_carbon_number, max_carbon_number, min_carbon_carbon_double_bond_number, max_carbon_carbon_double_bond_number, carbon_number_parity, is_branched
  • Added description slot to MoleculeGroupingClass for semantic documentation

Examples and Test Data

  • Added 16 new example instances covering all fatty acyl-CoA grouping classes
  • Added corresponding JSON and YAML output files in examples/output/
  • Added valid example YAML files in src/data/examples/valid/
  • Added 2 new reaction examples (Reaction-methionine_adenosyltransferase, Collection-methionine_cycle_excerpt)
  • Added additional atomic cation examples (AtomCation-copper1, AtomCation-copper2, AtomCation-calcium2)
  • Added MoleculeGroupingClass-phosphatidylinositol_3_phosphate_r1_r2 example

Test Coverage

  • Added TestFattyAcylGroupingEquivalentClasses test class in tests/test_owl_output.py
  • Tests verify OWL template expansion for chain length ranges, saturation constraints, and branching/parity classifications
  • Tests ensure proper handling of min/max constraints and optional parameters

Implementation Details

The fatty acyl-CoA grouping classes use OWL templates to generate computable definitions. Each template creates an EquivalentClasses axiom that intersects the parent class (CHEBI:37554 - fatty acyl-CoA) with datatype restrictions on member-level properties. This enables:

  • Automatic classification of fatty acyl-CoA instances based on structural properties
  • Reasoning over substrate specificity in beta-oxidation pathways
  • Semantic interoperability with OWL-based biochemistry ontologies

The grouping classes support both required constraints (e.g., exact parity value) and optional range constraints (e.g., min/max carbon numbers), with proper handling in OWL template expansion.

https://claude.ai/code/session_015zKcqz7Dwyj75Dy5BYhkNC

claude added 6 commits June 30, 2026 15:13
Encodes the fatty acid β-oxidation substrate classification (mitochondrial
and peroxisomal) as MoleculeGroupingClass instances. The diagram's decision
tree maps onto orthogonal classification facets over fatty acyl-CoA
(CHEBI:37554), linked via subtype_of:

- linearity/branching: linear fatty acyl-CoA, branched-chain fatty acyl-CoA
  (CHEBI:61912)
- chain length (under linear): short- (CHEBI:61905), medium- (CHEBI:61907),
  long- (CHEBI:33184), and very-long-chain (CHEBI:61910) fatty acyl-CoA
- saturation: saturated (CHEBI:231546) and unsaturated (CHEBI:51006), with
  mono- and polyunsaturated as subtypes of unsaturated
- carbon-number parity: even- and odd-numbered fatty acyl-CoA

CHEBI identifiers were verified against the ChEBI database; neutral grouping
classes lacking a confident CHEBI term (linear, mono-/polyunsaturated,
even/odd parity) use chemrof-local IRIs. All examples validate via
'make test-examples'.

@dragon-ai-agent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zKcqz7Dwyj75Dy5BYhkNC
Adds linkml-run-examples output (json/yaml) for the new fatty acyl-CoA
MoleculeGroupingClass examples and refreshes README.md. Also picks up
generated output for previously-added examples that had not been regenerated.

@dragon-ai-agent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zKcqz7Dwyj75Dy5BYhkNC
…examples

Adds a generic 'description' slot (dcterms:description) to the GroupingClass
hierarchy so molecule grouping classes can carry human-readable definitions.
The pre-existing 'description' slot had a stray reaction-specific
string_serialization template and was not attached to any class; it is
redefined as a proper string-valued description slot.

Populates each of the fatty acyl-CoA beta-oxidation MoleculeGroupingClass
examples with a description. Regenerated examples/output accordingly.

(Generated artifacts under schema/ are not regenerated here to avoid
unrelated toolchain-drift churn; src/chemrof/schema/chemrof.yaml is the
source of truth.)

@dragon-ai-agent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zKcqz7Dwyj75Dy5BYhkNC
Turns the fatty acyl-CoA beta-oxidation groupings from labelled buckets
into grouping classes carrying machine-readable defining constraints,
following chemrof's existing defining_slots idiom (as used by
ChemicalSaltGroupingClass, MolecularDerivativeGroupingClass, etc.).

Schema additions:
- CarbonNumberParityEnum (even / odd)
- slots: min_carbon_number, max_carbon_number,
  min_carbon_carbon_double_bond_number, max_carbon_carbon_double_bond_number
  (is_branched reused from existing slot)
- grouping subclasses with defining_slots:
  - FattyAcylChainLengthGroupingClass (min/max_carbon_number)
  - FattyAcylSaturationGroupingClass (min/max C=C double-bond number)
  - FattyAcylBranchingGroupingClass (is_branched)
  - FattyAcylCarbonParityGroupingClass (carbon_number_parity)

The facet examples are reclassified onto these classes and given concrete
defining values, e.g. long-chain = carbon number 13-22, saturated = 0 C=C,
monounsaturated = exactly 1 C=C, branched = is_branched true, odd-numbered =
parity odd. A program or reasoner can now compute grouping membership from
these constraints.

Note: as with the existing defining_slots classes, the current OWL export
renders these as rdfs:subClassOf necessary-condition restrictions rather
than owl:equivalentClass; emitting full necessary-and-sufficient axioms
would be a separate generator enhancement. Generated schema/ artifacts are
not regenerated here (toolchain-drift churn); chemrof.yaml is the source of
truth. All examples validate via 'make test-examples'.

@dragon-ai-agent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zKcqz7Dwyj75Dy5BYhkNC
Adds smarts_string to the groupings where a whole-molecule SMARTS is
reliable (verified against reference acyl-CoA structures with RDKit):

- fatty acyl-CoA (root): the acyl-CoA pantetheine thioester substructure,
  i.e. the structural signature shared by all fatty acyl-CoAs.
- unsaturated / monounsaturated / polyunsaturated: an aliphatic, non-carbonyl
  carbon-carbon double bond ([CX3;!$(C=O)]=[CX3;!$(C=O)]), which matches a
  fatty-acyl alkene without false-matching CoA's carbonyls or aromatic
  adenine. RDKit check: 0 matches for stearoyl-CoA (18:0), 1 for oleoyl-CoA
  (18:1), 3 for linolenoyl-CoA (18:3).

Saturated, linear and branched are intentionally left to the numeric/boolean
constraints (min/max_carbon_carbon_double_bond_number, is_branched): a single
SMARTS cannot reliably assert the global ABSENCE of unsaturation, and a
branching SMARTS would false-match coenzyme A's own gem-dimethyl (pantoate)
group.

@dragon-ai-agent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zKcqz7Dwyj75Dy5BYhkNC
Adds owl.template annotations to the four fatty acyl-CoA facet grouping
classes so the linkml-owl OWLDumper path (chemrof convert --format owl)
renders each as a necessary-and-sufficient EquivalentClasses axiom, the same
mechanism MonoatomicIon/AtomCation use. Each definition is genus-differentia:
genus CHEBI:37554 (fatty acyl-CoA) intersected with a restriction on a
member-level property.

- FattyAcylChainLengthGroupingClass -> DataSomeValuesFrom(carbon_number,
  integer[minInclusive/maxInclusive]); min-only classes (very-long-chain)
  omit the upper bound.
- FattyAcylSaturationGroupingClass -> DataSomeValuesFrom(
  carbon_carbon_double_bond_number, integer range); saturated = exactly 0.
- FattyAcylBranchingGroupingClass -> DataHasValue(is_branched, boolean).
- FattyAcylCarbonParityGroupingClass -> DataHasValue(carbon_number_parity).

Adds the member-level properties carbon_number and
carbon_carbon_double_bond_number that the chain-length/saturation
restrictions quantify over (the grouping min/max bounds translate into the
range restriction). A DL reasoner can now auto-classify a fatty acyl-CoA
molecule carrying these properties into the groupings.

Templates verified against the example data via OWLDumper; locked with new
tests in tests/test_owl_output.py (17 passing). Note: standard gen-owl
(schema T-Box) does not process owl.template; the equivalentClass axioms are
produced on the instance/A-box path, consistent with existing chemrof
behavior.

@dragon-ai-agent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zKcqz7Dwyj75Dy5BYhkNC
@claude

claude Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error —— View job


I'll analyze this and get back to you.

Rework grouping-class modeling so the SCHEMA holds only reusable, high-level
grouping meta-patterns, while the concrete fatty acyl-CoA groupings live as
DATA instances that still convert to OWL. This avoids per-domain class
explosion: adding a new family (steroids, glycans, ...) is now new data, not
new schema classes.

Schema:
- Remove the four bespoke domain classes (FattyAcyl{ChainLength,Saturation,
  Branching,CarbonParity}GroupingClass) and their abstract parent, plus the
  domain-specific bound slots (min/max_carbon_number,
  min/max_carbon_carbon_double_bond_number).
- Add three generic meta-pattern classes, each with a parameterized
  owl.template:
  - GroupingBySmarts (genus [+ smarts_string]) -> SubClassOf(genus); SMARTS is
    a computational, non-DL criterion carried as an annotation.
  - GroupingByGenusAndRangeRestriction (genus, on_property, min_value,
    max_value) -> EquivalentClasses genus + integer range restriction.
  - GroupingByGenusAndPropertyValue (genus, on_property, value,
    value_datatype) -> EquivalentClasses genus + DataHasValue.
- Add generic slots genus, on_property, min_value, max_value, value,
  value_datatype; keep carbon_number, carbon_carbon_double_bond_number,
  carbon_number_parity and is_branched as the member-level properties the
  restrictions quantify over.

Data (examples): the 13 fatty acyl-CoA groupings are re-expressed as instances
of the generic patterns (genus CHEBI:37554; fatty acyl-CoA itself as a
GroupingBySmarts with genus acyl-CoA CHEBI:17984). OWL output is unchanged in
shape (verified via OWLDumper): e.g. long-chain -> carbon_number in [13,22],
saturated -> [0,0], linear -> is_branched false^^xsd:boolean, even -> parity
even^^xsd:string.

Tests updated to exercise the generic patterns (TestGenericGroupingEquivalent
Classes). make test-examples passes (13/13); full suite 150 passed
(pre-existing unrelated failure in tests/chem_model_test.py ignored).

@dragon-ai-agent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zKcqz7Dwyj75Dy5BYhkNC
@claude

claude Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error —— View job


I'll analyze this and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants