730 Commits

Author SHA1 Message Date
Armando Pellegrini
59e16e0187 Fix State.dispose() not invoking transformer dispose for live cells (#1826)
`Transformer.Definition.dispose` is documented as "automatically called
on deleting an object," but `State.dispose()` only disposed its own event
subjects and action manager — it never iterated still-live cells to call
their per-transformer dispose. Cells holding GL buffers, mesh data, etc.
only had their dispose fired on explicit deletion (e.g. `clear()`), so
any consumer that called `plugin.dispose()` without first awaiting
`plugin.clear()` retained the callback chain, the GL buffers it points
at, and any closures captured by it.

In a long-running single-page app where the user navigates between
routes that mount/unmount a Mol* viewer, this leaked roughly 25–50 MB
of process RSS per cycle even with `plugin.dispose()` correctly called.
A 20-cycle E2E mount/unmount harness on a 1AKE structure measured a
+541 MB RSS / +266 MB JS-heap delta in the unconditional-`dispose()`
case; calling `await plugin.clear()` before `plugin.dispose()` halved
the residual leak, confirming the per-cell dispose path was missing on
the unconditional `dispose()` route.

This change walks the cell tree once (post-order via the existing
`StateTree.doPostOrder` helper) and invokes the per-transformer dispose
for every still-live cell, swallowing+warning on errors so a single
faulty transformer can't prevent siblings from cleaning up. The
existing per-cell `dispose` helper is reused for consistency with
`updateNode`/`findDeletes` semantics.

Tests cover: chained transformers, sibling subtrees, throwing-dispose
isolation, and transformers without a dispose definition.

Also adds `useDefineForClassFields: false` to the jest esbuild
transform so tests can construct `State` (the `TransientTree` parameter
property + class field pattern relies on legacy class-field semantics,
which `tsc` honors via `target: es2018` but esbuild's default `esnext`
target does not).

Fixes #1825

Co-authored-by: Armando Pellegrini <tech.tools@boltz.bio>
2026-05-09 22:17:38 +02:00
Alexander Rose
86a74d1cc2 5.9.0 2026-05-03 10:45:51 -07:00
Alexander Rose
3ad355ad40 package updates 2026-05-03 00:12:23 -07:00
dsehnal
31819dbf16 5.8.0 2026-04-03 19:28:58 +02:00
Paul Pillot
c4ccd8758f Replace node-fetch/@types with native fetch (#1803) 2026-03-27 08:44:29 +01:00
Paul Pillot
bf313073b9 remove utils.promisify dependency
This dependency pulls a 23MB dependency graph to support nodejs v<8.0
Native alternatives exist: fs.promises, and native utils/promisify

Consistency: renaming readFile --> readFileAsync where changes were made.
2026-03-24 09:54:10 -04:00
Tianzhen Lin (Tangent)
e22ce53e65 Fix circular dependency crash in bundlers (esbuild, Rolldown) (#1792)
* Fix circular dependency crash in bundlers (esbuild, Rolldown)

StateTransforms uses `import * as X` namespace imports that are
assigned as object properties at module construction time. When a
bundler concatenates modules into a single scope and reorders their
initialization (as esbuild and Rolldown do), the namespace variable
can still be undefined when the object literal is evaluated, causing
a runtime crash:

  Cannot read properties of undefined (reading 'ModelUnitcell3D')

Replace direct property assignments with lazy getters so that
namespace imports are resolved at access time rather than at
construction time. This preserves the existing public API — callers
still use `StateTransforms.Representation.CreateStructureRepresentation3D`
— while making the code safe regardless of module evaluation order.

Fixes #1791

* Add changelog entry and contributor for circular dependency fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 15:38:48 +01:00
Alexander Rose
da97cd20aa 5.7.0 2026-02-28 13:43:11 -08:00
Alexander Rose
88b79deefa package updates
- set min node to v22
- added globals for eslint v10
2026-02-28 13:40:38 -08:00
dsehnal
e859f497f1 5.6.1 2026-01-23 15:42:44 +01:00
Alexander Rose
9cbb4414e0 5.6.0 2026-01-18 12:11:39 -08:00
Alexander Rose
216d16456b package updates 2026-01-18 11:43:06 -08:00
dsehnal
4ac6f5c202 5.5.0 2025-12-22 12:50:36 +01:00
Alexander Rose
44ed142521 package updates 2025-12-21 16:11:31 -08:00
dsehnal
fe2541f9e8 tweak package.json 2025-12-19 13:19:30 +01:00
ddelalamo-takeda
27af73f97f Add TM-align structure alignment algorithm (#1723)
* Delete docs/docs/plugin/superposition.md

* Add TM-align structure alignment algorithm

Implement TM-align for structure-based protein alignment, providing an
alternative to sequence-based superposition methods. TM-align finds optimal
structural alignments regardless of sequence similarity using TM-score.

New features:
- Core TM-align algorithm (src/mol-math/linear-algebra/3d/tm-align.ts)
  - TM-score calculation with length-independent normalization
  - Dynamic programming for optimal alignment
  - Gapless threading and fragment-based initialization
  - Multiple refinement passes for accuracy (~97.7% of US-align reference)

- High-level wrapper (src/mol-model/structure/structure/util/tm-align.ts)
  - tmAlign() function accepting StructureElement.Loci inputs
  - Returns transformation matrix, TM-scores, RMSD, and alignment

- BasicWrapper API (src/examples/basic-wrapper/)
  - tmAlign(pdbId1, chain1, pdbId2, chain2, color1?, color2?)
  - sequenceAlign() - sequence-based superposition
  - loadStructures() - load without alignment
  - Example HTML pages demonstrating usage

- UI integration (src/mol-plugin-ui/structure/superposition.tsx)
  - TM-align option in superposition panel

References:
Zhang Y, Skolnick J. Nucl Acids Res 33, 2302-9 (2005)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Delete src/examples/basic-wrapper/index.html

* changing reference test case

* Restoring src/examples/basic-wrapper/index.html

* Addressing comments in pull request

* Authorship added

---------

Co-authored-by: Diego del Alamo <diego.delalamo@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 13:18:11 +01:00
Alexander Rose
0e843c20cc 5.4.2 2025-12-07 11:00:41 -08:00
Alexander Rose
9d9985f117 package updates 2025-12-07 10:57:55 -08:00
Alexander Rose
74ff283e00 5.4.1 2025-11-16 10:18:09 -08:00
Alexander Rose
d993082f24 5.4.0 2025-11-16 10:12:28 -08:00
Alexander Rose
88e7fe508f package updates 2025-11-15 16:32:09 -08:00
dsehnal
2ecdc0eafa 5.3.0 2025-11-05 14:41:21 +01:00
dsehnal
c5f2767efc 5.2.0 2025-10-31 17:26:52 +01:00
dsehnal
92d1c446d4 5.1.2 2025-10-25 15:04:28 +02:00
dsehnal
0ec096a980 5.1.1 2025-10-25 14:30:39 +02:00
dsehnal
46c5184d40 5.1.0 2025-10-25 12:35:20 +02:00
Alexander Rose
3b97bfd9b6 5.0.0 2025-09-28 10:41:25 -07:00
Alexander Rose
425370d63e package updates 2025-09-28 10:36:37 -07:00
Alexander Rose
4556544043 package updates 2025-09-20 14:55:58 -07:00
Alexander Rose
921d700761 remove unused dep 2025-09-20 14:52:11 -07:00
David Sehnal
f0c2961e95 use esbuild jest transformer (#1662) 2025-09-16 20:28:34 +02:00
Alexander Rose
e466bf9ba9 package updates 2025-09-07 18:38:29 -07:00
Alexander Rose
521d8cb4f8 Merge branch 'master' of https://github.com/molstar/molstar into webxr 2025-09-07 16:53:14 -07:00
dsehnal
c04580377b 5.0.0-dev.13 2025-09-03 09:20:26 +02:00
Alexander Rose
77d4d0007c Merge branch 'master' of https://github.com/molstar/molstar into webxr 2025-08-31 17:45:45 -07:00
dsehnal
005824eb24 5.0.0-dev.12 2025-08-31 10:08:11 +02:00
dsehnal
966bc14c67 5.0.0-dev.11 2025-08-31 09:51:54 +02:00
Victoria Doshchenko
42d969bbeb MVS: example story improvements (#1632)
* add intro scene

* fixes

* add author name
2025-08-26 18:55:34 +02:00
dsehnal
fdc33e44dc 5.0.0-dev.10 2025-08-26 17:43:06 +02:00
dsehnal
a4b09d3a0c 5.0.0-dev.9 2025-08-25 17:00:54 +02:00
Alexander Rose
ba2bc206cc Merge branch 'master' of https://github.com/molstar/molstar into webxr 2025-08-23 14:59:17 -07:00
dsehnal
34c8257848 5.0.0-dev.8 2025-08-22 16:05:31 +02:00
dsehnal
46c8150b2b 5.0.0-dev.7 2025-08-21 14:05:04 +02:00
David Sehnal
af1a864daa replace immer with mutative, optimize MVS animation loading (#1618) 2025-08-21 14:03:22 +02:00
Alexander Rose
4b58ce94ee Merge branch 'master' of https://github.com/molstar/molstar into webxr 2025-08-17 23:43:19 -07:00
dsehnal
655c3edadd 5.0.0-dev.6 2025-08-14 11:37:40 +02:00
dsehnal
1b5a7d9546 5.0.0-dev.5 2025-08-13 18:44:02 +02:00
Alexander Rose
3086d1a5c8 Merge branch 'master' of https://github.com/molstar/molstar into webxr 2025-08-10 10:47:45 -07:00
김주호
ef823b066b Change PDB parsing to use four-letter residue names (#1602)
* Add is4LetterResidueName option for parsing .pdb

* update metadata for request pullrequest

* Always parse PDB files using four-letter residue names. (#1601) (#1602)

* Write changelog about parsing resname 4-letter

* Update src/mol-plugin-state/formats/trajectory.ts

* Update src/mol-model-formats/structure/pdb/to-cif.ts

---------

Co-authored-by: David Sehnal <dsehnal@users.noreply.github.com>
2025-08-06 07:36:20 +02:00
dsehnal
33dc2015df 5.0.0-dev.4 2025-08-05 09:55:55 +02:00