Skip to content

Honour bond order and charge of the [Lv] N-terminal placeholder - #457

Open
GeorgWa wants to merge 3 commits into
add-electrophile-probe-modsfrom
fix-nterm-mod-bond-order
Open

GeorgWa wants to merge 3 commits into
add-electrophile-probe-modsfrom
fix-nterm-mod-bond-order

Conversation

@GeorgWa

@GeorgWa GeorgWa commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Enables modifications that attach to the N-terminus with a double bond, such as an imine, or that carry a charge.

[Lv] stands for the N-terminal nitrogen, but its bond was always created as a neutral single bond. Writing [Lv]=C was silently wrong rather than an error: it produced an amine where an imine was meant.

No change for existing data: all 36 [Lv] modifications are neutral and singly bonded, and their output is verified identical before and after.

GeorgWa and others added 2 commits October 14, 2026 18:25
The [Lv] placeholder stands for the N-terminal nitrogen, and its neighbours were
always bonded to that nitrogen with a hardcoded single bond. A modification that
needs a double bond or a charged nitrogen therefore could not be expressed, and
writing one was silently wrong rather than an error: [Lv]=C produced exactly the
same molecule as [Lv]C, an amine where an imine was intended, which passes a
formula check because the two are isomers.

Three changes:

- the bond order is read from the modification instead of assumed, so [Lv]=C
  attaches through a double bond;
- the [Fl] placeholders standing for the amine hydrogens are consumed by total
  bond order rather than by neighbour count, since a double bond uses up two
  hydrogens;
- a formal charge on the placeholder transfers to the nitrogen, which is what
  allows it to end up as an aromatic ring nitrogen.

All three are inert for existing data: every [Lv] modification currently in
modification.tsv is neutral and singly bonded, so bond order equals neighbour
count and the charge is zero. Verified by comparing the output for all 36 of
them before and after; none changes.

This enables two adduct classes that the aldehyde-derived probes produce, an
imine and an N-aryl isoquinolinium.

Co-Authored-By: Claude Opus 5 <[email protected]>
_has_n_term_mod_placeholder matched the literal string "[Lv]", so a charged
placeholder such as [Lv+] was not recognised and the modification silently took
the non-placeholder path, leaving the [Lv] atom in the product. Match on the
atom symbol instead so both forms route through the placeholder logic.

Co-Authored-By: Claude Opus 5 <[email protected]>
@GeorgWa
GeorgWa changed the base branch from main to add-electrophile-probe-mods October 14, 2026 21:51

This branch has not been deployed

No deployments
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.

1 participant