Sticky fragments - #66
Merged
Merged
Conversation
Expand the starter set to 42 maintainer-curated roles (68 entries) split by attachment hybridization (aryl/alkyl/alkenyl-sp2/alkynyl-sp): halide and sulfonate electrophiles (fluoride separate), boron/organometal donors, acyl, keep-heteroatom amine/thiol/hydroxyl nucleophiles (Mitsunobu keep-O), and deoxygenative/decarboxylative handles. Fix the alkynyl_bromide cap template (:2 was unmapped -> zero products) to [A:1]-[At:20]. Add a functional spot-check asserting every entry fires and produces an astatine cap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
alkenyl_carboxylic_acid maps the beta-vinyl carbon as :4; caps omitting it silently deleted :4 and everything beyond (cinnamic acid -> propionyl, phenyl lost). Add =[A:4] to both alkenyl_acyl and alkenyl_decarboxy templates. Switch the spot-check substrate to cinnamic acid and add a regression test asserting the phenyl ring survives. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- FragmentResult now carries sticky_left ('-...') and sticky_right ('...-')
aligned open-bond forms instead of a single [At]-anchored string, so
fragments glue on either side; canonical_smiles keeps the [At] cap as key.
- locate the fresh astatine cap via max(mol) (transformer guarantees exactly
one new [At], always the highest atom number) instead of scanning for an
isotopeless At; drop the now-unused _new_astatine helper.
- sticky_linkers uses the same max() invariant for the 210/211 caps.
- skip disconnected products in sticky_fragments (salts/counter-ions) so one
bad cut no longer aborts the whole generator; matches the linker guard.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
No cap rule disconnects a connected molecule (verified across all 68 role entries), so a disconnected product can only come from a salt/mixture INPUT. Replace the per-product connected_components_count checks with a single guard on self at method entry in both sticky_fragments and sticky_linkers. The flush_cache calls were dead: transformer output arrives with no cached SMILES, and in the linker the isotope is set before any SMILES call, so no stale cache can be read. Remove them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add _present_transformers(role, fgs) resolving a role selector to only the (role, transformer) pairs whose handle FG is present in the molecule. Both methods use it. Linker no longer runs left transforms speculatively: capping a cut never creates a coupling handle (verified across bifunctional test set -- only a non-handle 'diaryl' match can appear), so every right handle must already be in the source. Resolve both ends up front and bail before any transform work when either end has no present handle -- monofunctional inputs now do zero transform work instead of running every left cut to discover no right FG. Update linker test for the open-bond sticky_smiles form (isotope caps live in canonical_smiles, the dedup key). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When both cuts anchor on the same atom the linker collapses to a single core carrying both caps (e.g. bromoacetic acid alkyl_halide + decarboxy -> [At]C[At], malonic acid decarboxy + decarboxy -> [At]CH2[At]). Skip a right cut whose core atom equals the left cap's core, so a linker always spans >=1 atom between its two attachment points. Add regression test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
react/oxidize/reduce/transform (and ~/@ operators) now yield EnumeratedReaction(name, reaction) instead of a bare (name, ReactionContainer) tuple, matching the StickyFragment/StickyLinker style. Positional destructuring (for name, rxn in ...) is unchanged. Export in __all__. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
deoxygenative_coupling now covers tertiary_alcohol (was primary/secondary only), so tertiary ROH + ArX -> R-Ar is enumerated. New deaminative_coupling: R-NH2 + ArX -> R-Ar. sp3 amines couple via Katritzky pyridinium salts (alpha-carbon to aryl halide, N leaves); anilines via diazonium (Meerwein/Gomberg-Bachmann, aryl carbon to partner, N2 leaves). Both directions map the amine carbon :2 onto the aryl halide :3 with N :1 as the leaving group. Excluded from the BH aryl-bromide+primary-amine test where it is a legitimate co-product. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ests Sticky fragments and linkers are driven by the _roles.py glossary, not _reactions.py, so the new deaminative coupling needed matching roles: alkyl_deamino (primary_amine) and aryl_deamino (primary_aniline), both dropping the nitrogen and capping the carbon -- parallel to the deoxy and decarboxy handles. Tertiary-alcohol deoxy was already covered by alkyl_deoxy. Added generous per-type reaction tests: tertiary/secondary deoxygenative coupling across chloride/bromide/iodide, and deaminative coupling for both alkyl amines and anilines across the halide series (buchwald_hartwig excluded as a legitimate co-product). Added fragment tests for both deamino roles and tertiary deoxy, and linker tests spanning deamino + acyl/halide handles. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.