Skip to main content

Crate yomitoki

Crate yomitoki 

Source
Expand description

yomitoki: fast, explainable, route-free molecular synthesizability diagnostics, built on chematic.

See docs/architecture.md for the full design contract and current implementation status.

Structs§

AnalysisConfig
Analysis configuration. #[non_exhaustive] so new fields (e.g. abstention_policy from AGENTS.md §12’s full sketch) can be added later without breaking existing callers — they’re omitted for now rather than included as inert placeholders, since nothing reads them yet.
ApplicabilityReport
AGENTS.md §5.6. Kept distinct from OverallAssessment so applicability is never conflated with score or confidence.
AtomIndex
A yomitoki-owned atom index, decoupled from chematic’s internal AtomIdx representation (AGENTS.md §11: don’t over-couple the public API to chematic internals).
ComponentScore
One component’s score, in isolation, before aggregation.
ComponentScores
Per-component scores that feed overall.difficulty. Each field is OptionNone means “not evaluated in this version,” not “evaluated, found nothing” (a fabricated zero would be dishonest); every field here is always Some. fragment_precedent does not appear in this struct (round 21 / option C) — its signal doesn’t contribute to overall.difficulty, so it doesn’t belong among components that do; see SynthesizabilityReport::fragment_precedent for where it now lives.
ConfidenceScore
A score in 0.0..=1.0 describing how reliable an assessment is. Kept as a distinct type from ProbabilityLikeScore even though the underlying representation is identical, because AGENTS.md §6 treats confidence and score as semantically separate fields that must never be conflated.
Contribution
A named factor’s contribution to the overall assessment, used in dominant_penalties/dominant_supports (AGENTS.md §4.1).
Finding
One diagnostic finding. explanation is generated from code + evidence by explain::render — never authored by hand per instance (AGENTS.md §8.3: structured data is the source of truth).
FindingEvidence
Structured, numeric evidence backing a Finding (AGENTS.md §8.2). Fields are None when not applicable to a given finding code.
FindingRef
Index into SynthesizabilityReport.findings, used by ComponentScore.findings to reference findings without duplicating them.
FragmentCorpus
A loaded fragment-frequency corpus, as produced by tools/build-fragment-corpus. Attach one via crate::config::FragmentModelConfig to enable the fragment_precedent component.
FragmentCorpusProvenance
Provenance for the fragment-precedent reference corpus a report was produced under (AGENTS.md §5.4; round 18). Exists so a report can be traced back to which corpus — and which chemical domain — actually produced its fragment_precedent signal: “rare in ChEMBL” and “hard to synthesize” are not the same claim (see rules.rs’s “Fragment precedent” section), and a report reader needs the corpus’s own domain declaration to tell them apart. This is a provenance declaration, not a correctness guarantee, and (deliberately, this round) not yet wired into scoring or confidence — see synthesis_focused’s own doc.
FragmentModelConfig
Fragment model configuration (AGENTS.md §12’s fragment_model field). corpus: None (the default) disables the fragment_precedent component entirely — SynthesizabilityReport.fragment_precedent stays None (round 21 moved this field out of ComponentScores, since the signal no longer contributes to overall.difficulty — see rules.rs’s “Fragment precedent” section), the same default-off behavior as every v0.1 release. No corpus ships with yomitoki itself (AGENTS.md §5.4 forbids embedding one directly in the library); load one with FragmentCorpus::load_dir and attach it here to enable the component.
FragmentPrecedentEvidence
How well-precedented this molecule’s fragments are relative to the configured reference corpus (AnalysisConfig.fragment_model) — an explanatory reference-corpus signal, not a direct synthetic-difficulty term. None unless a corpus is configured, same as before round 21.
OverallAssessment
AGENTS.md §6. synthesizability/difficulty are complementary in v0.1 as an implementation choice, not a permanent API guarantee.
ProbabilityLikeScore
A score in 0.0..=1.0 describing how synthesizable/difficult a molecule is judged to be. 1.0 = maximally synthesizable / no difficulty burden, depending on which field it appears in — see OverallAssessment.
Provenance
AGENTS.md §16.
SimplificationSuggestion
AGENTS.md §9. Heuristic and diagnostic-only — derived from findings that already exist, not from actually rewriting the structure. confidence is deliberately flat across every v0.1 suggestion (see rules::SUGGESTION_CONFIDENCE_HEURISTIC), since none of them are calibrated against real synthesis outcomes.
SynthesizabilityReport
The top-level report returned by analyze/analyze_smiles.

Enums§

ExpectedEffect
How likely a SimplificationSuggestion is to actually reduce difficulty, if followed. Every v0.1 suggestion uses MayReduceDifficulty — nothing is calibrated yet, so LikelyReducesDifficulty is never emitted.
FindingCode
Machine-readable finding code (AGENTS.md §8.1). Only variants the currently-implemented components emit exist so far; codes for not-yet-implemented components are added alongside those components.
ScoringProfile
Scoring profile. Only GeneralOrganic is implemented — AGENTS.md §12 explicitly forbids publishing unimplemented profiles as dummies, so no MedicinalChemistry/Custom placeholder variants exist yet.
Severity
Author-assigned finding severity. A schema field today, not yet a calibrated signal — see docs/architecture.md’s Confidence contract.
Strictness
How aggressively borderline molecules are pushed toward abstention (Verdict::Indeterminate/Verdict::OutOfDomain). Affects the applicability component’s confidence-penalty weighting.
SuggestionCode
AGENTS.md §9. Heuristic, never a guarantee that a change will help.
Verdict
AGENTS.md §7. All six variants exist for schema stability even though only a subset is reachable with today’s two implemented components (see docs/architecture.md).
YomitokiError
Only the variants reachable by code that exists today. The rest of AGENTS.md §17’s sketch (UnsupportedMolecule, InternalInvariantViolation) is added alongside the code that can actually raise them.

Functions§

analyze
Analyze an already-parsed molecule. Infallible in practice — Result is kept for API-signature symmetry with analyze_smiles, but every branch below returns Ok; parsing (upstream, in analyze_smiles) is the only fallible step (AGENTS.md §17).
analyze_batch
Analyze many molecules with one shared config (AGENTS.md §18). result[i] corresponds to molecules[i] — input order is preserved regardless of any other molecule’s outcome, and one molecule’s result never depends on another’s (each is an independent analyze call), so this is safe to parallelize (e.g. via rayon’s par_iter) without changing output. Sequential here since nothing in this crate’s own benchmarks has shown a need for it yet — AGENTS.md §18 itself only asks that parallelism be possible (“Rayon利用はfeature flagでもよい”), not that v0.1 ship it.
analyze_smiles
Parse smiles (via chematic) and analyze it. Err only if smiles fails to parse — a hard-to-synthesize or out-of-domain molecule is never an error (AGENTS.md §17).