molstar 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +197 -197
- package/build/viewer/embedded.html +52 -52
- package/build/viewer/index.html +129 -129
- package/build/viewer/molstar.js +1 -1
- package/build/viewer/molstar.js.LICENSE.txt +9 -0
- package/lib/apps/docking-viewer/index.html +36 -36
- package/lib/apps/mesoscale-explorer/index.html +100 -100
- package/lib/apps/mesoscale-explorer/style.scss +33 -33
- package/lib/apps/viewer/app.d.ts +2 -1
- package/lib/apps/viewer/app.js +2 -1
- package/lib/apps/viewer/embedded.html +52 -52
- package/lib/apps/viewer/index.html +129 -129
- package/lib/cli/chem-comp-dict/create-ions.js +9 -9
- package/lib/cli/chem-comp-dict/create-saccharides.js +9 -9
- package/lib/cli/cifschema/util/generate.js +12 -12
- package/lib/cli/lipid-params/index.js +9 -9
- package/lib/commonjs/apps/viewer/app.d.ts +2 -1
- package/lib/commonjs/apps/viewer/app.js +1 -0
- package/lib/commonjs/cli/chem-comp-dict/create-ions.js +9 -9
- package/lib/commonjs/cli/chem-comp-dict/create-saccharides.js +9 -9
- package/lib/commonjs/cli/cifschema/util/generate.js +12 -12
- package/lib/commonjs/cli/lipid-params/index.js +9 -9
- package/lib/commonjs/examples/alpha-orbitals/example-data.js +160 -160
- package/lib/commonjs/extensions/alpha-orbitals/gpu/shader.frag.js +136 -136
- package/lib/commonjs/extensions/assembly-symmetry/prop.js +24 -24
- package/lib/commonjs/extensions/dnatco/confal-pyramids/behavior.js +5 -5
- package/lib/commonjs/extensions/dnatco/ntc-tube/behavior.js +5 -5
- package/lib/commonjs/extensions/geo-export/usdz-exporter.js +41 -41
- package/lib/commonjs/extensions/meshes/mesh-extension.d.ts +1 -0
- package/lib/commonjs/extensions/mp4-export/encoder.js +1 -1
- package/lib/commonjs/extensions/mvs/components/annotation-label/representation.d.ts +0 -2
- package/lib/commonjs/extensions/mvs/components/custom-label/representation.d.ts +2 -2
- package/lib/commonjs/extensions/mvs/tree/mvs/mvs-builder.d.ts +8 -2
- package/lib/commonjs/extensions/sb-ncbr/index.d.ts +8 -0
- package/lib/commonjs/extensions/sb-ncbr/index.js +14 -1
- package/lib/commonjs/extensions/sb-ncbr/tunnels/actions.d.ts +20 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/actions.js +89 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/algorithm.d.ts +26 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/algorithm.js +474 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/behavior.d.ts +40 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/behavior.js +96 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/data-model.d.ts +146 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/data-model.js +28 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/examples.d.ts +12 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/examples.js +54 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/props.d.ts +19 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/props.js +26 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/representation.d.ts +29 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/representation.js +99 -0
- package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +17 -0
- package/lib/commonjs/mol-canvas3d/canvas3d.js +4 -0
- package/lib/commonjs/mol-canvas3d/passes/dof.d.ts +34 -0
- package/lib/commonjs/mol-canvas3d/passes/dof.js +167 -0
- package/lib/commonjs/mol-canvas3d/passes/draw.d.ts +2 -0
- package/lib/commonjs/mol-canvas3d/passes/draw.js +31 -8
- package/lib/commonjs/mol-canvas3d/passes/image.d.ts +8 -0
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.d.ts +8 -0
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.js +5 -0
- package/lib/commonjs/mol-geo/geometry/lines/lines.d.ts +0 -1
- package/lib/commonjs/mol-gl/shader/background.frag.js +95 -95
- package/lib/commonjs/mol-gl/shader/background.vert.js +11 -11
- package/lib/commonjs/mol-gl/shader/blend-back-dpoit.frag.js +13 -13
- package/lib/commonjs/mol-gl/shader/bloom/blur.frag.js +28 -28
- package/lib/commonjs/mol-gl/shader/bloom/composite.frag.js +33 -33
- package/lib/commonjs/mol-gl/shader/bloom/luminosity.frag.js +52 -52
- package/lib/commonjs/mol-gl/shader/cas.frag.js +144 -144
- package/lib/commonjs/mol-gl/shader/chunks/apply-fog.glsl.js +31 -31
- package/lib/commonjs/mol-gl/shader/chunks/apply-interior-color.glsl.js +12 -12
- package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.js +77 -77
- package/lib/commonjs/mol-gl/shader/chunks/apply-marker-color.glsl.js +16 -16
- package/lib/commonjs/mol-gl/shader/chunks/assign-clipping-varying.glsl.js +8 -8
- package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.js +140 -140
- package/lib/commonjs/mol-gl/shader/chunks/assign-group.glsl.js +6 -6
- package/lib/commonjs/mol-gl/shader/chunks/assign-marker-varying.glsl.js +8 -8
- package/lib/commonjs/mol-gl/shader/chunks/assign-material-color.glsl.js +112 -112
- package/lib/commonjs/mol-gl/shader/chunks/assign-position.glsl.js +14 -14
- package/lib/commonjs/mol-gl/shader/chunks/assign-size.glsl.js +18 -18
- package/lib/commonjs/mol-gl/shader/chunks/check-picking-alpha.glsl.js +12 -12
- package/lib/commonjs/mol-gl/shader/chunks/check-transparency.glsl.js +16 -16
- package/lib/commonjs/mol-gl/shader/chunks/clip-instance.glsl.js +7 -7
- package/lib/commonjs/mol-gl/shader/chunks/clip-pixel.glsl.js +5 -5
- package/lib/commonjs/mol-gl/shader/chunks/color-frag-params.glsl.js +60 -60
- package/lib/commonjs/mol-gl/shader/chunks/color-vert-params.glsl.js +122 -122
- package/lib/commonjs/mol-gl/shader/chunks/common-clip.glsl.js +104 -104
- package/lib/commonjs/mol-gl/shader/chunks/common-frag-params.glsl.js +150 -150
- package/lib/commonjs/mol-gl/shader/chunks/common-vert-params.glsl.js +61 -61
- package/lib/commonjs/mol-gl/shader/chunks/common.glsl.js +234 -234
- package/lib/commonjs/mol-gl/shader/chunks/dpoit-write.glsl.js +62 -62
- package/lib/commonjs/mol-gl/shader/chunks/fade-lod.glsl.js +42 -42
- package/lib/commonjs/mol-gl/shader/chunks/float-to-rgba.glsl.js +39 -39
- package/lib/commonjs/mol-gl/shader/chunks/light-frag-params.glsl.js +127 -127
- package/lib/commonjs/mol-gl/shader/chunks/matrix-scale.glsl.js +5 -5
- package/lib/commonjs/mol-gl/shader/chunks/normal-frag-params.glsl.js +2 -2
- package/lib/commonjs/mol-gl/shader/chunks/read-from-texture.glsl.js +14 -14
- package/lib/commonjs/mol-gl/shader/chunks/rgba-to-float.glsl.js +84 -84
- package/lib/commonjs/mol-gl/shader/chunks/size-vert-params.glsl.js +11 -11
- package/lib/commonjs/mol-gl/shader/chunks/texture3d-from-1d-trilinear.glsl.js +23 -23
- package/lib/commonjs/mol-gl/shader/chunks/texture3d-from-2d-linear.glsl.js +17 -17
- package/lib/commonjs/mol-gl/shader/chunks/texture3d-from-2d-nearest.glsl.js +8 -8
- package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.js +25 -25
- package/lib/commonjs/mol-gl/shader/compose.frag.js +12 -12
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.frag.js +23 -23
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +43 -43
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/normalize.frag.js +15 -15
- package/lib/commonjs/mol-gl/shader/copy.frag.js +11 -11
- package/lib/commonjs/mol-gl/shader/cylinders.frag.js +266 -266
- package/lib/commonjs/mol-gl/shader/cylinders.vert.js +89 -89
- package/lib/commonjs/mol-gl/shader/depth-merge.frag.js +23 -23
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +362 -362
- package/lib/commonjs/mol-gl/shader/direct-volume.vert.js +41 -41
- package/lib/commonjs/mol-gl/shader/dof.frag.d.ts +7 -0
- package/lib/commonjs/mol-gl/shader/dof.frag.js +122 -0
- package/lib/commonjs/mol-gl/shader/evaluate-dpoit.frag.js +10 -10
- package/lib/commonjs/mol-gl/shader/evaluate-wboit.frag.js +17 -17
- package/lib/commonjs/mol-gl/shader/fxaa.frag.js +228 -228
- package/lib/commonjs/mol-gl/shader/gaussian-density.frag.js +49 -49
- package/lib/commonjs/mol-gl/shader/gaussian-density.vert.js +27 -27
- package/lib/commonjs/mol-gl/shader/hi-z.frag.js +18 -18
- package/lib/commonjs/mol-gl/shader/histogram-pyramid/reduction.frag.js +58 -58
- package/lib/commonjs/mol-gl/shader/histogram-pyramid/sum.frag.js +19 -19
- package/lib/commonjs/mol-gl/shader/image.frag.js +169 -169
- package/lib/commonjs/mol-gl/shader/image.vert.js +21 -21
- package/lib/commonjs/mol-gl/shader/lines.frag.js +42 -42
- package/lib/commonjs/mol-gl/shader/lines.vert.js +117 -117
- package/lib/commonjs/mol-gl/shader/marching-cubes/active-voxels.frag.js +70 -70
- package/lib/commonjs/mol-gl/shader/marching-cubes/isosurface.frag.js +311 -311
- package/lib/commonjs/mol-gl/shader/marking/edge.frag.js +28 -28
- package/lib/commonjs/mol-gl/shader/marking/overlay.frag.js +26 -26
- package/lib/commonjs/mol-gl/shader/mesh.frag.js +65 -65
- package/lib/commonjs/mol-gl/shader/mesh.vert.js +49 -49
- package/lib/commonjs/mol-gl/shader/outlines.frag.js +95 -95
- package/lib/commonjs/mol-gl/shader/points.frag.js +59 -59
- package/lib/commonjs/mol-gl/shader/points.vert.js +38 -38
- package/lib/commonjs/mol-gl/shader/postprocessing.frag.js +150 -150
- package/lib/commonjs/mol-gl/shader/quad.vert.js +10 -10
- package/lib/commonjs/mol-gl/shader/shadows.frag.js +123 -123
- package/lib/commonjs/mol-gl/shader/smaa/blend.frag.js +56 -56
- package/lib/commonjs/mol-gl/shader/smaa/blend.vert.js +25 -25
- package/lib/commonjs/mol-gl/shader/smaa/edges.frag.js +66 -66
- package/lib/commonjs/mol-gl/shader/smaa/edges.vert.js +26 -26
- package/lib/commonjs/mol-gl/shader/smaa/weights.frag.js +206 -206
- package/lib/commonjs/mol-gl/shader/smaa/weights.vert.js +32 -32
- package/lib/commonjs/mol-gl/shader/spheres.frag.js +148 -148
- package/lib/commonjs/mol-gl/shader/spheres.vert.js +132 -132
- package/lib/commonjs/mol-gl/shader/ssao-blur.frag.js +97 -97
- package/lib/commonjs/mol-gl/shader/ssao.frag.js +211 -211
- package/lib/commonjs/mol-gl/shader/text.frag.js +85 -85
- package/lib/commonjs/mol-gl/shader/text.vert.js +85 -85
- package/lib/commonjs/mol-gl/shader/util/grid3d-template.frag.js +46 -46
- package/lib/commonjs/mol-gl/shader-code.js +15 -15
- package/lib/commonjs/mol-gl/webgl/compat.js +12 -12
- package/lib/commonjs/mol-gl/webgl/context.js +1 -0
- package/lib/commonjs/mol-gl/webgl/timer.d.ts +1 -1
- package/lib/commonjs/mol-gl/webgl/timer.js +8 -1
- package/lib/commonjs/mol-math/linear-algebra/3d/minimize-rmsd.js +2 -1
- package/lib/commonjs/mol-plugin/animation-loop.d.ts +1 -0
- package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/behavior.d.ts +6 -6
- package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +1 -1
- package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/transformers.d.ts +3 -3
- package/lib/commonjs/mol-plugin-state/animation/built-in/state-snapshots.js +7 -3
- package/lib/commonjs/mol-plugin-ui/viewport/simple-settings.js +3 -0
- package/lib/commonjs/servers/common/swagger-ui/indexTemplate.js +66 -66
- package/lib/commonjs/servers/volume/config.js +5 -5
- package/lib/examples/alpha-orbitals/example-data.js +160 -160
- package/lib/examples/alpha-orbitals/index.html +72 -72
- package/lib/examples/basic-wrapper/index.html +137 -137
- package/lib/examples/lighting/index.html +88 -88
- package/lib/examples/proteopedia-wrapper/index.html +236 -236
- package/lib/extensions/alpha-orbitals/gpu/shader.frag.js +136 -136
- package/lib/extensions/assembly-symmetry/prop.js +24 -24
- package/lib/extensions/dnatco/confal-pyramids/behavior.js +5 -5
- package/lib/extensions/dnatco/ntc-tube/behavior.js +5 -5
- package/lib/extensions/geo-export/usdz-exporter.js +41 -41
- package/lib/extensions/meshes/mesh-extension.d.ts +1 -0
- package/lib/extensions/mp4-export/encoder.js +1 -1
- package/lib/extensions/mvs/components/annotation-label/representation.d.ts +0 -2
- package/lib/extensions/mvs/components/custom-label/representation.d.ts +2 -2
- package/lib/extensions/mvs/tree/mvs/mvs-builder.d.ts +8 -2
- package/lib/extensions/sb-ncbr/index.d.ts +8 -0
- package/lib/extensions/sb-ncbr/index.js +8 -0
- package/lib/extensions/sb-ncbr/tunnels/actions.d.ts +20 -0
- package/lib/extensions/sb-ncbr/tunnels/actions.js +86 -0
- package/lib/extensions/sb-ncbr/tunnels/algorithm.d.ts +26 -0
- package/lib/extensions/sb-ncbr/tunnels/algorithm.js +469 -0
- package/lib/extensions/sb-ncbr/tunnels/behavior.d.ts +40 -0
- package/lib/extensions/sb-ncbr/tunnels/behavior.js +92 -0
- package/lib/extensions/sb-ncbr/tunnels/data-model.d.ts +146 -0
- package/lib/extensions/sb-ncbr/tunnels/data-model.js +23 -0
- package/lib/extensions/sb-ncbr/tunnels/examples.d.ts +12 -0
- package/lib/extensions/sb-ncbr/tunnels/examples.js +49 -0
- package/lib/extensions/sb-ncbr/tunnels/props.d.ts +19 -0
- package/lib/extensions/sb-ncbr/tunnels/props.js +22 -0
- package/lib/extensions/sb-ncbr/tunnels/representation.d.ts +29 -0
- package/lib/extensions/sb-ncbr/tunnels/representation.js +96 -0
- package/lib/mol-canvas3d/canvas3d.d.ts +17 -0
- package/lib/mol-canvas3d/canvas3d.js +4 -0
- package/lib/mol-canvas3d/passes/dof.d.ts +34 -0
- package/lib/mol-canvas3d/passes/dof.js +163 -0
- package/lib/mol-canvas3d/passes/draw.d.ts +2 -0
- package/lib/mol-canvas3d/passes/draw.js +31 -8
- package/lib/mol-canvas3d/passes/image.d.ts +8 -0
- package/lib/mol-canvas3d/passes/postprocessing.d.ts +8 -0
- package/lib/mol-canvas3d/passes/postprocessing.js +5 -0
- package/lib/mol-geo/geometry/lines/lines.d.ts +0 -1
- package/lib/mol-gl/shader/background.frag.js +95 -95
- package/lib/mol-gl/shader/background.vert.js +11 -11
- package/lib/mol-gl/shader/blend-back-dpoit.frag.js +13 -13
- package/lib/mol-gl/shader/bloom/blur.frag.js +28 -28
- package/lib/mol-gl/shader/bloom/composite.frag.js +33 -33
- package/lib/mol-gl/shader/bloom/luminosity.frag.js +52 -52
- package/lib/mol-gl/shader/cas.frag.js +144 -144
- package/lib/mol-gl/shader/chunks/apply-fog.glsl.js +31 -31
- package/lib/mol-gl/shader/chunks/apply-interior-color.glsl.js +12 -12
- package/lib/mol-gl/shader/chunks/apply-light-color.glsl.js +77 -77
- package/lib/mol-gl/shader/chunks/apply-marker-color.glsl.js +16 -16
- package/lib/mol-gl/shader/chunks/assign-clipping-varying.glsl.js +8 -8
- package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.js +140 -140
- package/lib/mol-gl/shader/chunks/assign-group.glsl.js +6 -6
- package/lib/mol-gl/shader/chunks/assign-marker-varying.glsl.js +8 -8
- package/lib/mol-gl/shader/chunks/assign-material-color.glsl.js +112 -112
- package/lib/mol-gl/shader/chunks/assign-position.glsl.js +14 -14
- package/lib/mol-gl/shader/chunks/assign-size.glsl.js +18 -18
- package/lib/mol-gl/shader/chunks/check-picking-alpha.glsl.js +12 -12
- package/lib/mol-gl/shader/chunks/check-transparency.glsl.js +16 -16
- package/lib/mol-gl/shader/chunks/clip-instance.glsl.js +7 -7
- package/lib/mol-gl/shader/chunks/clip-pixel.glsl.js +5 -5
- package/lib/mol-gl/shader/chunks/color-frag-params.glsl.js +60 -60
- package/lib/mol-gl/shader/chunks/color-vert-params.glsl.js +122 -122
- package/lib/mol-gl/shader/chunks/common-clip.glsl.js +104 -104
- package/lib/mol-gl/shader/chunks/common-frag-params.glsl.js +150 -150
- package/lib/mol-gl/shader/chunks/common-vert-params.glsl.js +61 -61
- package/lib/mol-gl/shader/chunks/common.glsl.js +234 -234
- package/lib/mol-gl/shader/chunks/dpoit-write.glsl.js +62 -62
- package/lib/mol-gl/shader/chunks/fade-lod.glsl.js +42 -42
- package/lib/mol-gl/shader/chunks/float-to-rgba.glsl.js +39 -39
- package/lib/mol-gl/shader/chunks/light-frag-params.glsl.js +127 -127
- package/lib/mol-gl/shader/chunks/matrix-scale.glsl.js +5 -5
- package/lib/mol-gl/shader/chunks/normal-frag-params.glsl.js +2 -2
- package/lib/mol-gl/shader/chunks/read-from-texture.glsl.js +14 -14
- package/lib/mol-gl/shader/chunks/rgba-to-float.glsl.js +84 -84
- package/lib/mol-gl/shader/chunks/size-vert-params.glsl.js +11 -11
- package/lib/mol-gl/shader/chunks/texture3d-from-1d-trilinear.glsl.js +23 -23
- package/lib/mol-gl/shader/chunks/texture3d-from-2d-linear.glsl.js +17 -17
- package/lib/mol-gl/shader/chunks/texture3d-from-2d-nearest.glsl.js +8 -8
- package/lib/mol-gl/shader/chunks/wboit-write.glsl.js +25 -25
- package/lib/mol-gl/shader/compose.frag.js +12 -12
- package/lib/mol-gl/shader/compute/color-smoothing/accumulate.frag.js +23 -23
- package/lib/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +43 -43
- package/lib/mol-gl/shader/compute/color-smoothing/normalize.frag.js +15 -15
- package/lib/mol-gl/shader/copy.frag.js +11 -11
- package/lib/mol-gl/shader/cylinders.frag.js +266 -266
- package/lib/mol-gl/shader/cylinders.vert.js +89 -89
- package/lib/mol-gl/shader/depth-merge.frag.js +23 -23
- package/lib/mol-gl/shader/direct-volume.frag.js +362 -362
- package/lib/mol-gl/shader/direct-volume.vert.js +41 -41
- package/lib/mol-gl/shader/dof.frag.d.ts +7 -0
- package/lib/mol-gl/shader/dof.frag.js +119 -0
- package/lib/mol-gl/shader/evaluate-dpoit.frag.js +10 -10
- package/lib/mol-gl/shader/evaluate-wboit.frag.js +17 -17
- package/lib/mol-gl/shader/fxaa.frag.js +228 -228
- package/lib/mol-gl/shader/gaussian-density.frag.js +49 -49
- package/lib/mol-gl/shader/gaussian-density.vert.js +27 -27
- package/lib/mol-gl/shader/hi-z.frag.js +18 -18
- package/lib/mol-gl/shader/histogram-pyramid/reduction.frag.js +58 -58
- package/lib/mol-gl/shader/histogram-pyramid/sum.frag.js +19 -19
- package/lib/mol-gl/shader/image.frag.js +169 -169
- package/lib/mol-gl/shader/image.vert.js +21 -21
- package/lib/mol-gl/shader/lines.frag.js +42 -42
- package/lib/mol-gl/shader/lines.vert.js +117 -117
- package/lib/mol-gl/shader/marching-cubes/active-voxels.frag.js +70 -70
- package/lib/mol-gl/shader/marching-cubes/isosurface.frag.js +311 -311
- package/lib/mol-gl/shader/marking/edge.frag.js +28 -28
- package/lib/mol-gl/shader/marking/overlay.frag.js +26 -26
- package/lib/mol-gl/shader/mesh.frag.js +65 -65
- package/lib/mol-gl/shader/mesh.vert.js +49 -49
- package/lib/mol-gl/shader/outlines.frag.js +95 -95
- package/lib/mol-gl/shader/points.frag.js +59 -59
- package/lib/mol-gl/shader/points.vert.js +38 -38
- package/lib/mol-gl/shader/postprocessing.frag.js +150 -150
- package/lib/mol-gl/shader/quad.vert.js +10 -10
- package/lib/mol-gl/shader/shadows.frag.js +123 -123
- package/lib/mol-gl/shader/smaa/blend.frag.js +56 -56
- package/lib/mol-gl/shader/smaa/blend.vert.js +25 -25
- package/lib/mol-gl/shader/smaa/edges.frag.js +66 -66
- package/lib/mol-gl/shader/smaa/edges.vert.js +26 -26
- package/lib/mol-gl/shader/smaa/weights.frag.js +206 -206
- package/lib/mol-gl/shader/smaa/weights.vert.js +32 -32
- package/lib/mol-gl/shader/spheres.frag.js +148 -148
- package/lib/mol-gl/shader/spheres.vert.js +132 -132
- package/lib/mol-gl/shader/ssao-blur.frag.js +97 -97
- package/lib/mol-gl/shader/ssao.frag.js +211 -211
- package/lib/mol-gl/shader/text.frag.js +85 -85
- package/lib/mol-gl/shader/text.vert.js +85 -85
- package/lib/mol-gl/shader/util/grid3d-template.frag.js +46 -46
- package/lib/mol-gl/shader-code.js +15 -15
- package/lib/mol-gl/webgl/compat.js +12 -12
- package/lib/mol-gl/webgl/context.js +1 -0
- package/lib/mol-gl/webgl/timer.d.ts +1 -1
- package/lib/mol-gl/webgl/timer.js +8 -1
- package/lib/mol-math/linear-algebra/3d/minimize-rmsd.js +2 -1
- package/lib/mol-plugin/animation-loop.d.ts +1 -0
- package/lib/mol-plugin/behavior/dynamic/volume-streaming/behavior.d.ts +6 -6
- package/lib/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +1 -1
- package/lib/mol-plugin/behavior/dynamic/volume-streaming/transformers.d.ts +3 -3
- package/lib/mol-plugin/version.js +2 -2
- package/lib/mol-plugin-state/animation/built-in/state-snapshots.js +7 -3
- package/lib/mol-plugin-ui/skin/base/base.scss +37 -37
- package/lib/mol-plugin-ui/skin/base/components/controls-base.scss +333 -333
- package/lib/mol-plugin-ui/skin/base/components/controls.scss +445 -445
- package/lib/mol-plugin-ui/skin/base/components/help.scss +27 -27
- package/lib/mol-plugin-ui/skin/base/components/line-graph.scss +67 -67
- package/lib/mol-plugin-ui/skin/base/components/log.scss +100 -100
- package/lib/mol-plugin-ui/skin/base/components/misc.scss +663 -663
- package/lib/mol-plugin-ui/skin/base/components/sequence.scss +125 -125
- package/lib/mol-plugin-ui/skin/base/components/slider.scss +165 -165
- package/lib/mol-plugin-ui/skin/base/components/tasks.scss +99 -99
- package/lib/mol-plugin-ui/skin/base/components/toast.scss +83 -83
- package/lib/mol-plugin-ui/skin/base/components/transformer.scss +163 -163
- package/lib/mol-plugin-ui/skin/base/components/viewport.scss +194 -194
- package/lib/mol-plugin-ui/skin/base/layout/common.scss +71 -71
- package/lib/mol-plugin-ui/skin/base/layout/controls-landscape.scss +89 -89
- package/lib/mol-plugin-ui/skin/base/layout/controls-outside.scss +98 -98
- package/lib/mol-plugin-ui/skin/base/layout/controls-portrait.scss +108 -108
- package/lib/mol-plugin-ui/skin/base/layout.scss +40 -40
- package/lib/mol-plugin-ui/skin/base/logo.scss +12 -12
- package/lib/mol-plugin-ui/skin/base/normalize.scss +209 -209
- package/lib/mol-plugin-ui/skin/base/ui.scss +40 -40
- package/lib/mol-plugin-ui/skin/base/variables.scss +88 -88
- package/lib/mol-plugin-ui/skin/blue.scss +1 -1
- package/lib/mol-plugin-ui/skin/colors/blue.scss +23 -23
- package/lib/mol-plugin-ui/skin/colors/dark.scss +23 -23
- package/lib/mol-plugin-ui/skin/colors/light.scss +29 -29
- package/lib/mol-plugin-ui/skin/dark.scss +1 -1
- package/lib/mol-plugin-ui/skin/light.scss +1 -1
- package/lib/mol-plugin-ui/viewport/simple-settings.js +3 -0
- package/lib/servers/common/swagger-ui/indexTemplate.js +66 -66
- package/lib/servers/volume/config.js +5 -5
- package/package.json +196 -195
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Dušan Veľký <dvelky@mail.muni.cz>
|
|
5
|
+
*/
|
|
6
|
+
import { PluginStateObject } from '../../../mol-plugin-state/objects';
|
|
7
|
+
import { StateAction } from '../../../mol-state';
|
|
8
|
+
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
|
9
|
+
export declare const TunnelDownloadServer: {
|
|
10
|
+
channelsdb: PD.Group<PD.Normalize<unknown>>;
|
|
11
|
+
};
|
|
12
|
+
export declare const DownloadTunnels: StateAction<PluginStateObject.Root, void, PD.Normalize<{
|
|
13
|
+
source: PD.NamedParams<PD.Normalize<{
|
|
14
|
+
url: any;
|
|
15
|
+
}>, "url"> | PD.NamedParams<PD.Normalize<{
|
|
16
|
+
provider: any;
|
|
17
|
+
}>, "alphafolddb"> | PD.NamedParams<PD.Normalize<{
|
|
18
|
+
provider: any;
|
|
19
|
+
}>, "pdb">;
|
|
20
|
+
}>>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Dušan Veľký <dvelky@mail.muni.cz>
|
|
5
|
+
*/
|
|
6
|
+
import { PluginStateObject } from '../../../mol-plugin-state/objects';
|
|
7
|
+
import { StateTransforms } from '../../../mol-plugin-state/transforms';
|
|
8
|
+
import { StateAction } from '../../../mol-state';
|
|
9
|
+
import { Task } from '../../../mol-task';
|
|
10
|
+
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
|
11
|
+
import { assertUnreachable } from '../../../mol-util/type-helpers';
|
|
12
|
+
import { TunnelsServerConfig } from './props';
|
|
13
|
+
import { TunnelsFromRawData, SelectTunnel, TunnelShapeProvider } from './representation';
|
|
14
|
+
export const TunnelDownloadServer = {
|
|
15
|
+
'channelsdb': PD.EmptyGroup({ label: 'ChannelsDB' })
|
|
16
|
+
};
|
|
17
|
+
export const DownloadTunnels = StateAction.build({
|
|
18
|
+
display: { name: 'Download Tunnels', description: 'Load a tunnels from the provided source and create theirs representations' },
|
|
19
|
+
from: PluginStateObject.Root,
|
|
20
|
+
params: (_, plugin) => {
|
|
21
|
+
return {
|
|
22
|
+
source: PD.MappedStatic('pdb', {
|
|
23
|
+
'pdb': PD.Group({
|
|
24
|
+
provider: PD.Group({
|
|
25
|
+
id: PD.Text('1tqn', { label: 'PDB Id(s)', description: 'One or more comma/space separated PDB ids.' }),
|
|
26
|
+
server: PD.MappedStatic('channelsdb', TunnelDownloadServer),
|
|
27
|
+
}, { pivot: 'id' }),
|
|
28
|
+
}, { isFlat: true, label: 'PDB' }),
|
|
29
|
+
'alphafolddb': PD.Group({
|
|
30
|
+
provider: PD.Group({
|
|
31
|
+
id: PD.Text('Q8W3K0', { label: 'UniProtKB AC(s)', description: 'One or more comma/space separated ACs.' }),
|
|
32
|
+
server: PD.MappedStatic('channelsdb', TunnelDownloadServer),
|
|
33
|
+
}, { pivot: 'id' })
|
|
34
|
+
}, { isFlat: true, label: 'AlphaFold DB', description: 'Loads the predicted model if available' }),
|
|
35
|
+
'url': PD.Group({
|
|
36
|
+
url: PD.Url(''),
|
|
37
|
+
}, { isFlat: true, label: 'URL' })
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
})(({ params, state }, plugin) => Task.create('Download Tunnels', async (ctx) => {
|
|
42
|
+
plugin.behaviors.layout.leftPanelTabName.next('data');
|
|
43
|
+
const src = params.source;
|
|
44
|
+
let downloadParams;
|
|
45
|
+
switch (src.name) {
|
|
46
|
+
case 'url':
|
|
47
|
+
downloadParams = [{ url: src.params.url }];
|
|
48
|
+
break;
|
|
49
|
+
case 'pdb':
|
|
50
|
+
downloadParams = src.params.provider.server.name === 'channelsdb'
|
|
51
|
+
? [{ url: `${plugin === null || plugin === void 0 ? void 0 : plugin.config.get(TunnelsServerConfig.DefaultServerUrl)}/channels/pdb/${src.params.provider.id}` }]
|
|
52
|
+
: assertUnreachable(src);
|
|
53
|
+
break;
|
|
54
|
+
case 'alphafolddb':
|
|
55
|
+
downloadParams = src.params.provider.server.name === 'channelsdb'
|
|
56
|
+
? [{ url: `${plugin === null || plugin === void 0 ? void 0 : plugin.config.get(TunnelsServerConfig.DefaultServerUrl)}/channels/alphafill/${src.params.provider.id.toLowerCase()}` }]
|
|
57
|
+
: assertUnreachable(src);
|
|
58
|
+
break;
|
|
59
|
+
default: assertUnreachable(src);
|
|
60
|
+
}
|
|
61
|
+
await state.transaction(async () => {
|
|
62
|
+
var _a;
|
|
63
|
+
const update = plugin.build();
|
|
64
|
+
const webgl = (_a = plugin.canvas3dContext) === null || _a === void 0 ? void 0 : _a.webgl;
|
|
65
|
+
for (const download of downloadParams) {
|
|
66
|
+
const response = await (await fetch(download.url.toString())).json();
|
|
67
|
+
const tunnels = [];
|
|
68
|
+
Object.entries(response.Channels).forEach(([key, values]) => {
|
|
69
|
+
if (values.length > 0) {
|
|
70
|
+
values.forEach((item) => {
|
|
71
|
+
tunnels.push({ data: item.Profile, props: { id: item.Id, type: item.Type } });
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
update
|
|
76
|
+
.toRoot()
|
|
77
|
+
.apply(TunnelsFromRawData, { data: tunnels })
|
|
78
|
+
.apply(SelectTunnel)
|
|
79
|
+
.apply(TunnelShapeProvider, {
|
|
80
|
+
webgl,
|
|
81
|
+
})
|
|
82
|
+
.apply(StateTransforms.Representation.ShapeRepresentation3D);
|
|
83
|
+
await update.commit();
|
|
84
|
+
}
|
|
85
|
+
}).runInContext(ctx);
|
|
86
|
+
}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Dušan Veľký <dvelky@mail.muni.cz>
|
|
5
|
+
*/
|
|
6
|
+
import { Mesh } from '../../../mol-geo/geometry/mesh/mesh';
|
|
7
|
+
import { WebGLContext } from '../../../mol-gl/webgl/context';
|
|
8
|
+
import { Shape } from '../../../mol-model/shape';
|
|
9
|
+
import { Color } from '../../../mol-util/color';
|
|
10
|
+
import { Tunnel } from './data-model';
|
|
11
|
+
export declare function createSpheresShape(options: {
|
|
12
|
+
tunnel: Tunnel;
|
|
13
|
+
color: Color;
|
|
14
|
+
resolution: number;
|
|
15
|
+
sampleRate: number;
|
|
16
|
+
showRadii: boolean;
|
|
17
|
+
prev?: Shape<Mesh>;
|
|
18
|
+
}): Promise<Shape<Mesh>>;
|
|
19
|
+
export declare function createTunnelShape(options: {
|
|
20
|
+
tunnel: Tunnel;
|
|
21
|
+
color: Color;
|
|
22
|
+
resolution: number;
|
|
23
|
+
sampleRate: number;
|
|
24
|
+
webgl: WebGLContext | undefined;
|
|
25
|
+
prev?: Shape<Mesh>;
|
|
26
|
+
}): Promise<Shape<Mesh>>;
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Dušan Veľký <dvelky@mail.muni.cz>
|
|
5
|
+
*/
|
|
6
|
+
import { OrderedSet } from '../../../mol-data/int';
|
|
7
|
+
import { addSphere } from '../../../mol-geo/geometry/mesh/builder/sphere';
|
|
8
|
+
import { Mesh } from '../../../mol-geo/geometry/mesh/mesh';
|
|
9
|
+
import { MeshBuilder } from '../../../mol-geo/geometry/mesh/mesh-builder';
|
|
10
|
+
import { computeMarchingCubesMesh } from '../../../mol-geo/util/marching-cubes/algorithm';
|
|
11
|
+
import { Sphere3D, Box3D, GridLookup3D, fillGridDim } from '../../../mol-math/geometry';
|
|
12
|
+
import { getBoundary } from '../../../mol-math/geometry/boundary';
|
|
13
|
+
import { DefaultMolecularSurfaceCalculationProps } from '../../../mol-math/geometry/molecular-surface';
|
|
14
|
+
import { lerp, spline } from '../../../mol-math/interpolate';
|
|
15
|
+
import { Vec3, Tensor, Mat4 } from '../../../mol-math/linear-algebra';
|
|
16
|
+
import { Shape } from '../../../mol-model/shape';
|
|
17
|
+
import { ensureReasonableResolution } from '../../../mol-repr/structure/visual/util/common';
|
|
18
|
+
import { Task } from '../../../mol-task';
|
|
19
|
+
import { ValueCell } from '../../../mol-util';
|
|
20
|
+
import { Color } from '../../../mol-util/color';
|
|
21
|
+
export async function createSpheresShape(options) {
|
|
22
|
+
var _a;
|
|
23
|
+
const builder = MeshBuilder.createState(512, 512, (_a = options.prev) === null || _a === void 0 ? void 0 : _a.geometry);
|
|
24
|
+
const tunnel = options.tunnel;
|
|
25
|
+
const processedData = interpolateTunnel(tunnel.data, options.sampleRate);
|
|
26
|
+
if (options.showRadii) {
|
|
27
|
+
for (let i = 0; i < processedData.length; i += 1) {
|
|
28
|
+
const p = processedData[i];
|
|
29
|
+
builder.currentGroup = i;
|
|
30
|
+
const center = [p.X, p.Y, p.Z];
|
|
31
|
+
addSphere(builder, center, p.Radius, options.resolution);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
for (let i = 0; i < processedData.length; i += 1) {
|
|
36
|
+
const p = processedData[i];
|
|
37
|
+
builder.currentGroup = 0;
|
|
38
|
+
const center = [p.X, p.Y, p.Z];
|
|
39
|
+
addSphere(builder, center, p.Radius, options.resolution);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const mesh = MeshBuilder.getMesh(builder);
|
|
43
|
+
const name = tunnel.props.highlight_label ?
|
|
44
|
+
tunnel.props.highlight_label :
|
|
45
|
+
tunnel.props.type && tunnel.props.id ?
|
|
46
|
+
`${tunnel.props.type} ${tunnel.props.id}` :
|
|
47
|
+
'Tunnel';
|
|
48
|
+
if (options.showRadii)
|
|
49
|
+
return Shape.create(name, tunnel.props, mesh, () => Color(options.color), () => 1, (i) => `[${processedData[i].X.toFixed(3)}, ${processedData[i].Y.toFixed(3)}, ${processedData[i].Z.toFixed(3)}] - radius: ${processedData[i].Radius.toFixed(3)}`);
|
|
50
|
+
return Shape.create(name, tunnel.props, mesh, () => Color(options.color), () => 1, () => name);
|
|
51
|
+
}
|
|
52
|
+
export async function createTunnelShape(options) {
|
|
53
|
+
var _a;
|
|
54
|
+
const tunnel = options.tunnel;
|
|
55
|
+
const mesh = await createTunnelMesh(tunnel.data, {
|
|
56
|
+
detail: options.resolution,
|
|
57
|
+
sampleRate: options.sampleRate,
|
|
58
|
+
webgl: options.webgl,
|
|
59
|
+
prev: (_a = options.prev) === null || _a === void 0 ? void 0 : _a.geometry
|
|
60
|
+
});
|
|
61
|
+
const name = tunnel.props.highlight_label ?
|
|
62
|
+
tunnel.props.highlight_label :
|
|
63
|
+
tunnel.props.type && tunnel.props.id ?
|
|
64
|
+
`${tunnel.props.type} ${tunnel.props.id}` :
|
|
65
|
+
'Tunnel';
|
|
66
|
+
return Shape.create(name, tunnel.props, mesh, () => Color(options.color), () => 1, () => name);
|
|
67
|
+
}
|
|
68
|
+
function profileToVec3(profile) {
|
|
69
|
+
return Vec3.create(profile.X, profile.Y, profile.Z);
|
|
70
|
+
}
|
|
71
|
+
// Centripetal Catmull–Rom spline interpolation
|
|
72
|
+
function interpolateTunnel(profile, sampleRate) {
|
|
73
|
+
const interpolatedProfiles = [];
|
|
74
|
+
if (profile.length < 4)
|
|
75
|
+
return profile; // Ensuring there are enough points to interpolate
|
|
76
|
+
interpolatedProfiles.push(profile[0]);
|
|
77
|
+
let lastPoint = profileToVec3(profile[0]);
|
|
78
|
+
let currentDistance = 0;
|
|
79
|
+
const pointInterval = 1 / sampleRate;
|
|
80
|
+
for (let i = 1; i < profile.length - 2; i++) {
|
|
81
|
+
const P0 = profile[i - 1];
|
|
82
|
+
const P1 = profile[i];
|
|
83
|
+
const P2 = profile[i + 1];
|
|
84
|
+
const P3 = profile[i + 2];
|
|
85
|
+
for (let t = 0; t <= 1; t += 0.05) {
|
|
86
|
+
const interpolatedX = spline(P0.X, P1.X, P2.X, P3.X, t, 0.5);
|
|
87
|
+
const interpolatedY = spline(P0.Y, P1.Y, P2.Y, P3.Y, t, 0.5);
|
|
88
|
+
const interpolatedZ = spline(P0.Z, P1.Z, P2.Z, P3.Z, t, 0.5);
|
|
89
|
+
const interpolatedPoint = Vec3.create(interpolatedX, interpolatedY, interpolatedZ);
|
|
90
|
+
const distanceToAdd = Vec3.distance(lastPoint, interpolatedPoint);
|
|
91
|
+
currentDistance += distanceToAdd;
|
|
92
|
+
if (currentDistance >= pointInterval) {
|
|
93
|
+
interpolatedProfiles.push({
|
|
94
|
+
X: interpolatedX,
|
|
95
|
+
Y: interpolatedY,
|
|
96
|
+
Z: interpolatedZ,
|
|
97
|
+
Radius: spline(P0.Radius, P1.Radius, P2.Radius, P3.Radius, t, 0.5),
|
|
98
|
+
Charge: lerp(P1.Charge, P2.Charge, t),
|
|
99
|
+
FreeRadius: spline(P0.FreeRadius, P1.FreeRadius, P2.FreeRadius, P3.FreeRadius, t, 0.5),
|
|
100
|
+
T: lerp(P1.T, P2.T, t),
|
|
101
|
+
Distance: lerp(P1.Distance, P2.Distance, t)
|
|
102
|
+
});
|
|
103
|
+
lastPoint = interpolatedPoint;
|
|
104
|
+
currentDistance -= pointInterval;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Ensuring the last profile point is included
|
|
109
|
+
interpolatedProfiles.push(profile[profile.length - 1]);
|
|
110
|
+
return interpolatedProfiles;
|
|
111
|
+
}
|
|
112
|
+
function convertToPositionData(profile, probeRadius) {
|
|
113
|
+
let position = {};
|
|
114
|
+
const x = [];
|
|
115
|
+
const y = [];
|
|
116
|
+
const z = [];
|
|
117
|
+
const indices = [];
|
|
118
|
+
const radius = [];
|
|
119
|
+
let maxRadius = Number.MIN_SAFE_INTEGER;
|
|
120
|
+
let sphereCounter = 0;
|
|
121
|
+
for (const sphere of profile) {
|
|
122
|
+
x.push(sphere.X);
|
|
123
|
+
y.push(sphere.Y);
|
|
124
|
+
z.push(sphere.Z);
|
|
125
|
+
indices.push(sphereCounter);
|
|
126
|
+
radius.push(sphere.Radius + probeRadius);
|
|
127
|
+
if (sphere.Radius > maxRadius)
|
|
128
|
+
maxRadius = sphere.Radius;
|
|
129
|
+
sphereCounter++;
|
|
130
|
+
}
|
|
131
|
+
position = { x, y, z, indices: OrderedSet.ofSortedArray(indices), radius, id: indices };
|
|
132
|
+
return position;
|
|
133
|
+
}
|
|
134
|
+
async function createTunnelMesh(data, options) {
|
|
135
|
+
const props = {
|
|
136
|
+
...DefaultMolecularSurfaceCalculationProps,
|
|
137
|
+
};
|
|
138
|
+
const preprocessedData = interpolateTunnel(data, options.sampleRate);
|
|
139
|
+
const positions = convertToPositionData(preprocessedData, props.probeRadius);
|
|
140
|
+
const bounds = getBoundary(positions);
|
|
141
|
+
let maxR = 0;
|
|
142
|
+
for (let i = 0; i < positions.radius.length; ++i) {
|
|
143
|
+
const r = positions.radius[i];
|
|
144
|
+
if (maxR < r)
|
|
145
|
+
maxR = r;
|
|
146
|
+
}
|
|
147
|
+
const p = ensureReasonableResolution(bounds.box, props);
|
|
148
|
+
const { field, transform, /* resolution,*/ maxRadius, /* idField */ } = await computeTunnelSurface({
|
|
149
|
+
positions,
|
|
150
|
+
boundary: bounds,
|
|
151
|
+
maxRadius: maxR,
|
|
152
|
+
box: bounds.box,
|
|
153
|
+
props: p
|
|
154
|
+
}).run();
|
|
155
|
+
const params = {
|
|
156
|
+
isoLevel: p.probeRadius,
|
|
157
|
+
scalarField: field,
|
|
158
|
+
};
|
|
159
|
+
const surface = await computeMarchingCubesMesh(params, options.prev).run();
|
|
160
|
+
const iterations = Math.ceil(2 / 1);
|
|
161
|
+
Mesh.smoothEdges(surface, { iterations, maxNewEdgeLength: Math.sqrt(2) });
|
|
162
|
+
Mesh.transform(surface, transform);
|
|
163
|
+
if (options.webgl && !options.webgl.isWebGL2) {
|
|
164
|
+
Mesh.uniformTriangleGroup(surface);
|
|
165
|
+
ValueCell.updateIfChanged(surface.varyingGroup, false);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
ValueCell.updateIfChanged(surface.varyingGroup, true);
|
|
169
|
+
}
|
|
170
|
+
const sphere = Sphere3D.expand(Sphere3D(), bounds.sphere, maxRadius);
|
|
171
|
+
surface.setBoundingSphere(sphere);
|
|
172
|
+
surface.meta.resolution = options.detail;
|
|
173
|
+
return surface;
|
|
174
|
+
}
|
|
175
|
+
function normalToLine(out, p) {
|
|
176
|
+
out[0] = out[1] = out[2] = 1.0;
|
|
177
|
+
if (p[0] !== 0) {
|
|
178
|
+
out[0] = (p[1] + p[2]) / -p[0];
|
|
179
|
+
}
|
|
180
|
+
else if (p[1] !== 0) {
|
|
181
|
+
out[1] = (p[0] + p[2]) / -p[1];
|
|
182
|
+
}
|
|
183
|
+
else if (p[2] !== 0) {
|
|
184
|
+
out[2] = (p[0] + p[1]) / -p[2];
|
|
185
|
+
}
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
function computeTunnelSurface(surfaceData) {
|
|
189
|
+
return Task.create('Tunnel Surface', async (ctx) => {
|
|
190
|
+
return await calcTunnelSurface(ctx, surfaceData);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function getAngleTables(probePositions) {
|
|
194
|
+
let theta = 0.0;
|
|
195
|
+
const step = 2 * Math.PI / probePositions;
|
|
196
|
+
const cosTable = new Float32Array(probePositions);
|
|
197
|
+
const sinTable = new Float32Array(probePositions);
|
|
198
|
+
for (let i = 0; i < probePositions; i++) {
|
|
199
|
+
cosTable[i] = Math.cos(theta);
|
|
200
|
+
sinTable[i] = Math.sin(theta);
|
|
201
|
+
theta += step;
|
|
202
|
+
}
|
|
203
|
+
return { cosTable, sinTable };
|
|
204
|
+
}
|
|
205
|
+
// From '../../../\mol-math\geometry\molecular-surface.ts'
|
|
206
|
+
async function calcTunnelSurface(ctx, surfaceData) {
|
|
207
|
+
// Field generation method adapted from AstexViewer (Mike Hartshorn) by Fred Ludlow.
|
|
208
|
+
// Other parts based heavily on NGL (Alexander Rose) EDT Surface class
|
|
209
|
+
let lastClip = -1;
|
|
210
|
+
/**
|
|
211
|
+
* Is the point at x,y,z obscured by any of the atoms specifeid by indices in neighbours.
|
|
212
|
+
* Ignore indices a and b (these are the relevant atoms in projectPoints/Torii)
|
|
213
|
+
*
|
|
214
|
+
* Cache the last clipped atom (as very often the same one in subsequent calls)
|
|
215
|
+
*
|
|
216
|
+
* `a` and `b` must be resolved indices
|
|
217
|
+
*/
|
|
218
|
+
function obscured(x, y, z, a, b) {
|
|
219
|
+
if (lastClip !== -1) {
|
|
220
|
+
const ai = lastClip;
|
|
221
|
+
if (ai !== a && ai !== b && singleAtomObscures(ai, x, y, z)) {
|
|
222
|
+
return ai;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
lastClip = -1;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
for (let j = 0, jl = neighbours.count; j < jl; ++j) {
|
|
229
|
+
const ai = OrderedSet.getAt(indices, neighbours.indices[j]);
|
|
230
|
+
if (ai !== a && ai !== b && singleAtomObscures(ai, x, y, z)) {
|
|
231
|
+
lastClip = ai;
|
|
232
|
+
return ai;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return -1;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* `ai` must be a resolved index
|
|
239
|
+
*/
|
|
240
|
+
function singleAtomObscures(ai, x, y, z) {
|
|
241
|
+
const r = radius[ai];
|
|
242
|
+
const dx = px[ai] - x;
|
|
243
|
+
const dy = py[ai] - y;
|
|
244
|
+
const dz = pz[ai] - z;
|
|
245
|
+
const dSq = dx * dx + dy * dy + dz * dz;
|
|
246
|
+
return dSq < (r * r);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* For each atom:
|
|
250
|
+
* Iterate over a subsection of the grid, for each point:
|
|
251
|
+
* If current value < 0.0, unvisited, set positive
|
|
252
|
+
*
|
|
253
|
+
* In any case: Project this point onto surface of the atomic sphere
|
|
254
|
+
* If this projected point is not obscured by any other atom
|
|
255
|
+
* Calculate delta distance and set grid value to minimum of
|
|
256
|
+
* itself and delta
|
|
257
|
+
*/
|
|
258
|
+
function projectPointsRange(begI, endI) {
|
|
259
|
+
for (let i = begI; i < endI; ++i) {
|
|
260
|
+
const j = OrderedSet.getAt(indices, i);
|
|
261
|
+
const vx = px[j], vy = py[j], vz = pz[j];
|
|
262
|
+
const rad = radius[j];
|
|
263
|
+
const rSq = rad * rad;
|
|
264
|
+
lookup3d.find(vx, vy, vz, rad);
|
|
265
|
+
// Number of grid points, round this up...
|
|
266
|
+
const ng = Math.ceil(rad * scaleFactor);
|
|
267
|
+
// Center of the atom, mapped to grid points (take floor)
|
|
268
|
+
const iax = Math.floor(scaleFactor * (vx - minX));
|
|
269
|
+
const iay = Math.floor(scaleFactor * (vy - minY));
|
|
270
|
+
const iaz = Math.floor(scaleFactor * (vz - minZ));
|
|
271
|
+
// Extents of grid to consider for this atom
|
|
272
|
+
const begX = Math.max(0, iax - ng);
|
|
273
|
+
const begY = Math.max(0, iay - ng);
|
|
274
|
+
const begZ = Math.max(0, iaz - ng);
|
|
275
|
+
// Add two to these points:
|
|
276
|
+
// - iax are floor'd values so this ensures coverage
|
|
277
|
+
// - these are loop limits (exclusive)
|
|
278
|
+
const endX = Math.min(dimX, iax + ng + 2);
|
|
279
|
+
const endY = Math.min(dimY, iay + ng + 2);
|
|
280
|
+
const endZ = Math.min(dimZ, iaz + ng + 2);
|
|
281
|
+
for (let xi = begX; xi < endX; ++xi) {
|
|
282
|
+
const dx = gridx[xi] - vx;
|
|
283
|
+
const xIdx = xi * iuv;
|
|
284
|
+
for (let yi = begY; yi < endY; ++yi) {
|
|
285
|
+
const dy = gridy[yi] - vy;
|
|
286
|
+
const dxySq = dx * dx + dy * dy;
|
|
287
|
+
const xyIdx = yi * iu + xIdx;
|
|
288
|
+
for (let zi = begZ; zi < endZ; ++zi) {
|
|
289
|
+
const dz = gridz[zi] - vz;
|
|
290
|
+
const dSq = dxySq + dz * dz;
|
|
291
|
+
if (dSq < rSq) {
|
|
292
|
+
const idx = zi + xyIdx;
|
|
293
|
+
// if unvisited, make positive
|
|
294
|
+
if (data[idx] < 0.0)
|
|
295
|
+
data[idx] *= -1;
|
|
296
|
+
// Project on to the surface of the sphere
|
|
297
|
+
// sp is the projected point ( dx, dy, dz ) * ( ra / d )
|
|
298
|
+
const d = Math.sqrt(dSq);
|
|
299
|
+
const ap = rad / d;
|
|
300
|
+
const spx = dx * ap + vx;
|
|
301
|
+
const spy = dy * ap + vy;
|
|
302
|
+
const spz = dz * ap + vz;
|
|
303
|
+
if (obscured(spx, spy, spz, j, -1) === -1) {
|
|
304
|
+
const dd = rad - d;
|
|
305
|
+
if (dd < data[idx]) {
|
|
306
|
+
data[idx] = dd;
|
|
307
|
+
idData[idx] = id[i];
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
async function projectPoints() {
|
|
317
|
+
for (let i = 0; i < n; i += updateChunk) {
|
|
318
|
+
projectPointsRange(i, Math.min(i + updateChunk, n));
|
|
319
|
+
if (ctx.shouldUpdate) {
|
|
320
|
+
await ctx.update({ message: 'projecting points', current: i, max: n });
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
// Vectors for Torus Projection
|
|
325
|
+
const atob = Vec3();
|
|
326
|
+
const mid = Vec3();
|
|
327
|
+
const n1 = Vec3();
|
|
328
|
+
const n2 = Vec3();
|
|
329
|
+
/**
|
|
330
|
+
* `a` and `b` must be resolved indices
|
|
331
|
+
*/
|
|
332
|
+
function projectTorus(a, b) {
|
|
333
|
+
const rA = radius[a];
|
|
334
|
+
const rB = radius[b];
|
|
335
|
+
const dx = atob[0] = px[b] - px[a];
|
|
336
|
+
const dy = atob[1] = py[b] - py[a];
|
|
337
|
+
const dz = atob[2] = pz[b] - pz[a];
|
|
338
|
+
const dSq = dx * dx + dy * dy + dz * dz;
|
|
339
|
+
// This check now redundant as already done in AVHash.withinRadii
|
|
340
|
+
// if (dSq > ((rA + rB) * (rA + rB))) { return }
|
|
341
|
+
const d = Math.sqrt(dSq);
|
|
342
|
+
// Find angle between a->b vector and the circle
|
|
343
|
+
// of their intersection by cosine rule
|
|
344
|
+
const cosA = (rA * rA + d * d - rB * rB) / (2.0 * rA * d);
|
|
345
|
+
// distance along a->b at intersection
|
|
346
|
+
const dmp = rA * cosA;
|
|
347
|
+
Vec3.normalize(atob, atob);
|
|
348
|
+
// Create normal to line
|
|
349
|
+
normalToLine(n1, atob);
|
|
350
|
+
Vec3.normalize(n1, n1);
|
|
351
|
+
// Cross together for second normal vector
|
|
352
|
+
Vec3.cross(n2, atob, n1);
|
|
353
|
+
Vec3.normalize(n2, n2);
|
|
354
|
+
// r is radius of circle of intersection
|
|
355
|
+
const rInt = Math.sqrt(rA * rA - dmp * dmp);
|
|
356
|
+
Vec3.scale(n1, n1, rInt);
|
|
357
|
+
Vec3.scale(n2, n2, rInt);
|
|
358
|
+
Vec3.scale(atob, atob, dmp);
|
|
359
|
+
mid[0] = atob[0] + px[a];
|
|
360
|
+
mid[1] = atob[1] + py[a];
|
|
361
|
+
mid[2] = atob[2] + pz[a];
|
|
362
|
+
lastClip = -1;
|
|
363
|
+
for (let i = 0; i < probePositions; ++i) {
|
|
364
|
+
const cost = cosTable[i];
|
|
365
|
+
const sint = sinTable[i];
|
|
366
|
+
const px = mid[0] + cost * n1[0] + sint * n2[0];
|
|
367
|
+
const py = mid[1] + cost * n1[1] + sint * n2[1];
|
|
368
|
+
const pz = mid[2] + cost * n1[2] + sint * n2[2];
|
|
369
|
+
if (obscured(px, py, pz, a, b) === -1) {
|
|
370
|
+
const iax = Math.floor(scaleFactor * (px - minX));
|
|
371
|
+
const iay = Math.floor(scaleFactor * (py - minY));
|
|
372
|
+
const iaz = Math.floor(scaleFactor * (pz - minZ));
|
|
373
|
+
const begX = Math.max(0, iax - ngTorus);
|
|
374
|
+
const begY = Math.max(0, iay - ngTorus);
|
|
375
|
+
const begZ = Math.max(0, iaz - ngTorus);
|
|
376
|
+
const endX = Math.min(dimX, iax + ngTorus + 2);
|
|
377
|
+
const endY = Math.min(dimY, iay + ngTorus + 2);
|
|
378
|
+
const endZ = Math.min(dimZ, iaz + ngTorus + 2);
|
|
379
|
+
for (let xi = begX; xi < endX; ++xi) {
|
|
380
|
+
const dx = px - gridx[xi];
|
|
381
|
+
const xIdx = xi * iuv;
|
|
382
|
+
for (let yi = begY; yi < endY; ++yi) {
|
|
383
|
+
const dy = py - gridy[yi];
|
|
384
|
+
const dxySq = dx * dx + dy * dy;
|
|
385
|
+
const xyIdx = yi * iu + xIdx;
|
|
386
|
+
for (let zi = begZ; zi < endZ; ++zi) {
|
|
387
|
+
const dz = pz - gridz[zi];
|
|
388
|
+
const dSq = dxySq + dz * dz;
|
|
389
|
+
const idx = zi + xyIdx;
|
|
390
|
+
const current = data[idx];
|
|
391
|
+
if (current > 0.0 && dSq < (current * current)) {
|
|
392
|
+
data[idx] = Math.sqrt(dSq);
|
|
393
|
+
// Is this grid point closer to a or b?
|
|
394
|
+
// Take dot product of atob and gridpoint->p (dx, dy, dz)
|
|
395
|
+
const dp = dx * atob[0] + dy * atob[1] + dz * atob[2];
|
|
396
|
+
idData[idx] = id[OrderedSet.indexOf(indices, dp < 0.0 ? b : a)];
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
function projectToriiRange(begI, endI) {
|
|
405
|
+
for (let i = begI; i < endI; ++i) {
|
|
406
|
+
const k = OrderedSet.getAt(indices, i);
|
|
407
|
+
lookup3d.find(px[k], py[k], pz[k], radius[k]);
|
|
408
|
+
for (let j = 0, jl = neighbours.count; j < jl; ++j) {
|
|
409
|
+
const l = OrderedSet.getAt(indices, neighbours.indices[j]);
|
|
410
|
+
if (k < l)
|
|
411
|
+
projectTorus(k, l);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
async function projectTorii() {
|
|
416
|
+
for (let i = 0; i < n; i += updateChunk) {
|
|
417
|
+
projectToriiRange(i, Math.min(i + updateChunk, n));
|
|
418
|
+
if (ctx.shouldUpdate) {
|
|
419
|
+
await ctx.update({ message: 'projecting torii', current: i, max: n });
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
// console.time('MolecularSurface')
|
|
424
|
+
// console.time('MolecularSurface createState')
|
|
425
|
+
const { resolution, probeRadius, probePositions } = surfaceData.props;
|
|
426
|
+
const scaleFactor = 1 / resolution;
|
|
427
|
+
const ngTorus = Math.max(5, 2 + Math.floor(probeRadius * scaleFactor));
|
|
428
|
+
const cellSize = Vec3.create(surfaceData.maxRadius, surfaceData.maxRadius, surfaceData.maxRadius);
|
|
429
|
+
Vec3.scale(cellSize, cellSize, 2);
|
|
430
|
+
const lookup3d = GridLookup3D(surfaceData.positions, surfaceData.boundary, cellSize);
|
|
431
|
+
const neighbours = lookup3d.result;
|
|
432
|
+
if (surfaceData.box === null)
|
|
433
|
+
surfaceData.box = lookup3d.boundary.box;
|
|
434
|
+
const { indices, x: px, y: py, z: pz, id, radius } = surfaceData.positions;
|
|
435
|
+
const n = OrderedSet.size(indices);
|
|
436
|
+
const pad = surfaceData.maxRadius + resolution;
|
|
437
|
+
const expandedBox = Box3D.expand(Box3D(), surfaceData.box, Vec3.create(pad, pad, pad));
|
|
438
|
+
const [minX, minY, minZ] = expandedBox.min;
|
|
439
|
+
const scaledBox = Box3D.scale(Box3D(), expandedBox, scaleFactor);
|
|
440
|
+
const dim = Box3D.size(Vec3(), scaledBox);
|
|
441
|
+
Vec3.ceil(dim, dim);
|
|
442
|
+
const [dimX, dimY, dimZ] = dim;
|
|
443
|
+
const iu = dimZ, iv = dimY, iuv = iu * iv;
|
|
444
|
+
const { cosTable, sinTable } = getAngleTables(probePositions);
|
|
445
|
+
const space = Tensor.Space(dim, [0, 1, 2], Float32Array);
|
|
446
|
+
const data = space.create();
|
|
447
|
+
const idData = space.create();
|
|
448
|
+
data.fill(-1001.0);
|
|
449
|
+
idData.fill(-1);
|
|
450
|
+
const gridx = fillGridDim(dimX, minX, resolution);
|
|
451
|
+
const gridy = fillGridDim(dimY, minY, resolution);
|
|
452
|
+
const gridz = fillGridDim(dimZ, minZ, resolution);
|
|
453
|
+
const updateChunk = Math.ceil(100000 / ((Math.pow(Math.pow(surfaceData.maxRadius, 3), 3) * scaleFactor)));
|
|
454
|
+
// console.timeEnd('MolecularSurface createState')
|
|
455
|
+
// console.time('MolecularSurface projectPoints')
|
|
456
|
+
await projectPoints();
|
|
457
|
+
// console.timeEnd('MolecularSurface projectPoints')
|
|
458
|
+
// console.time('MolecularSurface projectTorii')
|
|
459
|
+
await projectTorii();
|
|
460
|
+
// console.timeEnd('MolecularSurface projectTorii')
|
|
461
|
+
// console.timeEnd('MolecularSurface')
|
|
462
|
+
const field = Tensor.create(space, data);
|
|
463
|
+
const idField = Tensor.create(space, idData);
|
|
464
|
+
const transform = Mat4.identity();
|
|
465
|
+
Mat4.fromScaling(transform, Vec3.create(resolution, resolution, resolution));
|
|
466
|
+
Mat4.setTranslation(transform, expandedBox.min);
|
|
467
|
+
// console.log({ field, idField, transform, updateChunk })
|
|
468
|
+
return { field, idField, transform, resolution, maxRadius: surfaceData.maxRadius };
|
|
469
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Dušan Veľký <dvelky@mail.muni.cz>
|
|
5
|
+
*/
|
|
6
|
+
import { PluginBehavior } from '../../../mol-plugin/behavior';
|
|
7
|
+
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
|
8
|
+
import { StructureRepresentationPresetProvider } from '../../../mol-plugin-state/builder/structure/representation-preset';
|
|
9
|
+
import { Structure } from '../../../mol-model/structure';
|
|
10
|
+
export declare const SbNcbrTunnels: import("../../../mol-state").StateTransformer<PluginBehavior.Category, PluginBehavior.Behavior, {
|
|
11
|
+
autoAttach: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function isApplicable(structure?: Structure): boolean;
|
|
14
|
+
export declare const TunnelsPreset: StructureRepresentationPresetProvider<{
|
|
15
|
+
serverType: "pdb";
|
|
16
|
+
serverUrl: string;
|
|
17
|
+
ignoreHydrogens: boolean | undefined;
|
|
18
|
+
ignoreHydrogensVariant: "all" | "non-polar" | undefined;
|
|
19
|
+
ignoreLight: boolean | undefined;
|
|
20
|
+
quality: "auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest" | undefined;
|
|
21
|
+
theme: PD.Normalize<{
|
|
22
|
+
globalName: any;
|
|
23
|
+
globalColorParams: any;
|
|
24
|
+
carbonColor: any;
|
|
25
|
+
symmetryColor: any;
|
|
26
|
+
symmetryColorParams: any;
|
|
27
|
+
focus: any;
|
|
28
|
+
}> | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
components?: undefined;
|
|
31
|
+
representations?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
components: {
|
|
34
|
+
polymer: import("../../../mol-state").StateObjectSelector<import("../../../mol-plugin-state/objects").PluginStateObject.Molecule.Structure, import("../../../mol-state").StateTransformer<import("../../../mol-state").StateObject<any, import("../../../mol-state").StateObject.Type<any>>, import("../../../mol-state").StateObject<any, import("../../../mol-state").StateObject.Type<any>>, any>> | undefined;
|
|
35
|
+
} | {
|
|
36
|
+
all: import("../../../mol-state").StateObjectSelector<import("../../../mol-plugin-state/objects").PluginStateObject.Molecule.Structure, import("../../../mol-state").StateTransformer<import("../../../mol-state").StateObject<any, import("../../../mol-state").StateObject.Type<any>>, import("../../../mol-state").StateObject<any, import("../../../mol-state").StateObject.Type<any>>, any>> | undefined;
|
|
37
|
+
branched: undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
representations: {};
|
|
40
|
+
}>;
|