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,474 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
|
+
*
|
|
5
|
+
* @author Dušan Veľký <dvelky@mail.muni.cz>
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.createTunnelShape = exports.createSpheresShape = void 0;
|
|
9
|
+
const int_1 = require("../../../mol-data/int");
|
|
10
|
+
const sphere_1 = require("../../../mol-geo/geometry/mesh/builder/sphere");
|
|
11
|
+
const mesh_1 = require("../../../mol-geo/geometry/mesh/mesh");
|
|
12
|
+
const mesh_builder_1 = require("../../../mol-geo/geometry/mesh/mesh-builder");
|
|
13
|
+
const algorithm_1 = require("../../../mol-geo/util/marching-cubes/algorithm");
|
|
14
|
+
const geometry_1 = require("../../../mol-math/geometry");
|
|
15
|
+
const boundary_1 = require("../../../mol-math/geometry/boundary");
|
|
16
|
+
const molecular_surface_1 = require("../../../mol-math/geometry/molecular-surface");
|
|
17
|
+
const interpolate_1 = require("../../../mol-math/interpolate");
|
|
18
|
+
const linear_algebra_1 = require("../../../mol-math/linear-algebra");
|
|
19
|
+
const shape_1 = require("../../../mol-model/shape");
|
|
20
|
+
const common_1 = require("../../../mol-repr/structure/visual/util/common");
|
|
21
|
+
const mol_task_1 = require("../../../mol-task");
|
|
22
|
+
const mol_util_1 = require("../../../mol-util");
|
|
23
|
+
const color_1 = require("../../../mol-util/color");
|
|
24
|
+
async function createSpheresShape(options) {
|
|
25
|
+
var _a;
|
|
26
|
+
const builder = mesh_builder_1.MeshBuilder.createState(512, 512, (_a = options.prev) === null || _a === void 0 ? void 0 : _a.geometry);
|
|
27
|
+
const tunnel = options.tunnel;
|
|
28
|
+
const processedData = interpolateTunnel(tunnel.data, options.sampleRate);
|
|
29
|
+
if (options.showRadii) {
|
|
30
|
+
for (let i = 0; i < processedData.length; i += 1) {
|
|
31
|
+
const p = processedData[i];
|
|
32
|
+
builder.currentGroup = i;
|
|
33
|
+
const center = [p.X, p.Y, p.Z];
|
|
34
|
+
(0, sphere_1.addSphere)(builder, center, p.Radius, options.resolution);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
for (let i = 0; i < processedData.length; i += 1) {
|
|
39
|
+
const p = processedData[i];
|
|
40
|
+
builder.currentGroup = 0;
|
|
41
|
+
const center = [p.X, p.Y, p.Z];
|
|
42
|
+
(0, sphere_1.addSphere)(builder, center, p.Radius, options.resolution);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const mesh = mesh_builder_1.MeshBuilder.getMesh(builder);
|
|
46
|
+
const name = tunnel.props.highlight_label ?
|
|
47
|
+
tunnel.props.highlight_label :
|
|
48
|
+
tunnel.props.type && tunnel.props.id ?
|
|
49
|
+
`${tunnel.props.type} ${tunnel.props.id}` :
|
|
50
|
+
'Tunnel';
|
|
51
|
+
if (options.showRadii)
|
|
52
|
+
return shape_1.Shape.create(name, tunnel.props, mesh, () => (0, color_1.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)}`);
|
|
53
|
+
return shape_1.Shape.create(name, tunnel.props, mesh, () => (0, color_1.Color)(options.color), () => 1, () => name);
|
|
54
|
+
}
|
|
55
|
+
exports.createSpheresShape = createSpheresShape;
|
|
56
|
+
async function createTunnelShape(options) {
|
|
57
|
+
var _a;
|
|
58
|
+
const tunnel = options.tunnel;
|
|
59
|
+
const mesh = await createTunnelMesh(tunnel.data, {
|
|
60
|
+
detail: options.resolution,
|
|
61
|
+
sampleRate: options.sampleRate,
|
|
62
|
+
webgl: options.webgl,
|
|
63
|
+
prev: (_a = options.prev) === null || _a === void 0 ? void 0 : _a.geometry
|
|
64
|
+
});
|
|
65
|
+
const name = tunnel.props.highlight_label ?
|
|
66
|
+
tunnel.props.highlight_label :
|
|
67
|
+
tunnel.props.type && tunnel.props.id ?
|
|
68
|
+
`${tunnel.props.type} ${tunnel.props.id}` :
|
|
69
|
+
'Tunnel';
|
|
70
|
+
return shape_1.Shape.create(name, tunnel.props, mesh, () => (0, color_1.Color)(options.color), () => 1, () => name);
|
|
71
|
+
}
|
|
72
|
+
exports.createTunnelShape = createTunnelShape;
|
|
73
|
+
function profileToVec3(profile) {
|
|
74
|
+
return linear_algebra_1.Vec3.create(profile.X, profile.Y, profile.Z);
|
|
75
|
+
}
|
|
76
|
+
// Centripetal Catmull–Rom spline interpolation
|
|
77
|
+
function interpolateTunnel(profile, sampleRate) {
|
|
78
|
+
const interpolatedProfiles = [];
|
|
79
|
+
if (profile.length < 4)
|
|
80
|
+
return profile; // Ensuring there are enough points to interpolate
|
|
81
|
+
interpolatedProfiles.push(profile[0]);
|
|
82
|
+
let lastPoint = profileToVec3(profile[0]);
|
|
83
|
+
let currentDistance = 0;
|
|
84
|
+
const pointInterval = 1 / sampleRate;
|
|
85
|
+
for (let i = 1; i < profile.length - 2; i++) {
|
|
86
|
+
const P0 = profile[i - 1];
|
|
87
|
+
const P1 = profile[i];
|
|
88
|
+
const P2 = profile[i + 1];
|
|
89
|
+
const P3 = profile[i + 2];
|
|
90
|
+
for (let t = 0; t <= 1; t += 0.05) {
|
|
91
|
+
const interpolatedX = (0, interpolate_1.spline)(P0.X, P1.X, P2.X, P3.X, t, 0.5);
|
|
92
|
+
const interpolatedY = (0, interpolate_1.spline)(P0.Y, P1.Y, P2.Y, P3.Y, t, 0.5);
|
|
93
|
+
const interpolatedZ = (0, interpolate_1.spline)(P0.Z, P1.Z, P2.Z, P3.Z, t, 0.5);
|
|
94
|
+
const interpolatedPoint = linear_algebra_1.Vec3.create(interpolatedX, interpolatedY, interpolatedZ);
|
|
95
|
+
const distanceToAdd = linear_algebra_1.Vec3.distance(lastPoint, interpolatedPoint);
|
|
96
|
+
currentDistance += distanceToAdd;
|
|
97
|
+
if (currentDistance >= pointInterval) {
|
|
98
|
+
interpolatedProfiles.push({
|
|
99
|
+
X: interpolatedX,
|
|
100
|
+
Y: interpolatedY,
|
|
101
|
+
Z: interpolatedZ,
|
|
102
|
+
Radius: (0, interpolate_1.spline)(P0.Radius, P1.Radius, P2.Radius, P3.Radius, t, 0.5),
|
|
103
|
+
Charge: (0, interpolate_1.lerp)(P1.Charge, P2.Charge, t),
|
|
104
|
+
FreeRadius: (0, interpolate_1.spline)(P0.FreeRadius, P1.FreeRadius, P2.FreeRadius, P3.FreeRadius, t, 0.5),
|
|
105
|
+
T: (0, interpolate_1.lerp)(P1.T, P2.T, t),
|
|
106
|
+
Distance: (0, interpolate_1.lerp)(P1.Distance, P2.Distance, t)
|
|
107
|
+
});
|
|
108
|
+
lastPoint = interpolatedPoint;
|
|
109
|
+
currentDistance -= pointInterval;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Ensuring the last profile point is included
|
|
114
|
+
interpolatedProfiles.push(profile[profile.length - 1]);
|
|
115
|
+
return interpolatedProfiles;
|
|
116
|
+
}
|
|
117
|
+
function convertToPositionData(profile, probeRadius) {
|
|
118
|
+
let position = {};
|
|
119
|
+
const x = [];
|
|
120
|
+
const y = [];
|
|
121
|
+
const z = [];
|
|
122
|
+
const indices = [];
|
|
123
|
+
const radius = [];
|
|
124
|
+
let maxRadius = Number.MIN_SAFE_INTEGER;
|
|
125
|
+
let sphereCounter = 0;
|
|
126
|
+
for (const sphere of profile) {
|
|
127
|
+
x.push(sphere.X);
|
|
128
|
+
y.push(sphere.Y);
|
|
129
|
+
z.push(sphere.Z);
|
|
130
|
+
indices.push(sphereCounter);
|
|
131
|
+
radius.push(sphere.Radius + probeRadius);
|
|
132
|
+
if (sphere.Radius > maxRadius)
|
|
133
|
+
maxRadius = sphere.Radius;
|
|
134
|
+
sphereCounter++;
|
|
135
|
+
}
|
|
136
|
+
position = { x, y, z, indices: int_1.OrderedSet.ofSortedArray(indices), radius, id: indices };
|
|
137
|
+
return position;
|
|
138
|
+
}
|
|
139
|
+
async function createTunnelMesh(data, options) {
|
|
140
|
+
const props = {
|
|
141
|
+
...molecular_surface_1.DefaultMolecularSurfaceCalculationProps,
|
|
142
|
+
};
|
|
143
|
+
const preprocessedData = interpolateTunnel(data, options.sampleRate);
|
|
144
|
+
const positions = convertToPositionData(preprocessedData, props.probeRadius);
|
|
145
|
+
const bounds = (0, boundary_1.getBoundary)(positions);
|
|
146
|
+
let maxR = 0;
|
|
147
|
+
for (let i = 0; i < positions.radius.length; ++i) {
|
|
148
|
+
const r = positions.radius[i];
|
|
149
|
+
if (maxR < r)
|
|
150
|
+
maxR = r;
|
|
151
|
+
}
|
|
152
|
+
const p = (0, common_1.ensureReasonableResolution)(bounds.box, props);
|
|
153
|
+
const { field, transform, /* resolution,*/ maxRadius, /* idField */ } = await computeTunnelSurface({
|
|
154
|
+
positions,
|
|
155
|
+
boundary: bounds,
|
|
156
|
+
maxRadius: maxR,
|
|
157
|
+
box: bounds.box,
|
|
158
|
+
props: p
|
|
159
|
+
}).run();
|
|
160
|
+
const params = {
|
|
161
|
+
isoLevel: p.probeRadius,
|
|
162
|
+
scalarField: field,
|
|
163
|
+
};
|
|
164
|
+
const surface = await (0, algorithm_1.computeMarchingCubesMesh)(params, options.prev).run();
|
|
165
|
+
const iterations = Math.ceil(2 / 1);
|
|
166
|
+
mesh_1.Mesh.smoothEdges(surface, { iterations, maxNewEdgeLength: Math.sqrt(2) });
|
|
167
|
+
mesh_1.Mesh.transform(surface, transform);
|
|
168
|
+
if (options.webgl && !options.webgl.isWebGL2) {
|
|
169
|
+
mesh_1.Mesh.uniformTriangleGroup(surface);
|
|
170
|
+
mol_util_1.ValueCell.updateIfChanged(surface.varyingGroup, false);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
mol_util_1.ValueCell.updateIfChanged(surface.varyingGroup, true);
|
|
174
|
+
}
|
|
175
|
+
const sphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), bounds.sphere, maxRadius);
|
|
176
|
+
surface.setBoundingSphere(sphere);
|
|
177
|
+
surface.meta.resolution = options.detail;
|
|
178
|
+
return surface;
|
|
179
|
+
}
|
|
180
|
+
function normalToLine(out, p) {
|
|
181
|
+
out[0] = out[1] = out[2] = 1.0;
|
|
182
|
+
if (p[0] !== 0) {
|
|
183
|
+
out[0] = (p[1] + p[2]) / -p[0];
|
|
184
|
+
}
|
|
185
|
+
else if (p[1] !== 0) {
|
|
186
|
+
out[1] = (p[0] + p[2]) / -p[1];
|
|
187
|
+
}
|
|
188
|
+
else if (p[2] !== 0) {
|
|
189
|
+
out[2] = (p[0] + p[1]) / -p[2];
|
|
190
|
+
}
|
|
191
|
+
return out;
|
|
192
|
+
}
|
|
193
|
+
function computeTunnelSurface(surfaceData) {
|
|
194
|
+
return mol_task_1.Task.create('Tunnel Surface', async (ctx) => {
|
|
195
|
+
return await calcTunnelSurface(ctx, surfaceData);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function getAngleTables(probePositions) {
|
|
199
|
+
let theta = 0.0;
|
|
200
|
+
const step = 2 * Math.PI / probePositions;
|
|
201
|
+
const cosTable = new Float32Array(probePositions);
|
|
202
|
+
const sinTable = new Float32Array(probePositions);
|
|
203
|
+
for (let i = 0; i < probePositions; i++) {
|
|
204
|
+
cosTable[i] = Math.cos(theta);
|
|
205
|
+
sinTable[i] = Math.sin(theta);
|
|
206
|
+
theta += step;
|
|
207
|
+
}
|
|
208
|
+
return { cosTable, sinTable };
|
|
209
|
+
}
|
|
210
|
+
// From '../../../\mol-math\geometry\molecular-surface.ts'
|
|
211
|
+
async function calcTunnelSurface(ctx, surfaceData) {
|
|
212
|
+
// Field generation method adapted from AstexViewer (Mike Hartshorn) by Fred Ludlow.
|
|
213
|
+
// Other parts based heavily on NGL (Alexander Rose) EDT Surface class
|
|
214
|
+
let lastClip = -1;
|
|
215
|
+
/**
|
|
216
|
+
* Is the point at x,y,z obscured by any of the atoms specifeid by indices in neighbours.
|
|
217
|
+
* Ignore indices a and b (these are the relevant atoms in projectPoints/Torii)
|
|
218
|
+
*
|
|
219
|
+
* Cache the last clipped atom (as very often the same one in subsequent calls)
|
|
220
|
+
*
|
|
221
|
+
* `a` and `b` must be resolved indices
|
|
222
|
+
*/
|
|
223
|
+
function obscured(x, y, z, a, b) {
|
|
224
|
+
if (lastClip !== -1) {
|
|
225
|
+
const ai = lastClip;
|
|
226
|
+
if (ai !== a && ai !== b && singleAtomObscures(ai, x, y, z)) {
|
|
227
|
+
return ai;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
lastClip = -1;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
for (let j = 0, jl = neighbours.count; j < jl; ++j) {
|
|
234
|
+
const ai = int_1.OrderedSet.getAt(indices, neighbours.indices[j]);
|
|
235
|
+
if (ai !== a && ai !== b && singleAtomObscures(ai, x, y, z)) {
|
|
236
|
+
lastClip = ai;
|
|
237
|
+
return ai;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return -1;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* `ai` must be a resolved index
|
|
244
|
+
*/
|
|
245
|
+
function singleAtomObscures(ai, x, y, z) {
|
|
246
|
+
const r = radius[ai];
|
|
247
|
+
const dx = px[ai] - x;
|
|
248
|
+
const dy = py[ai] - y;
|
|
249
|
+
const dz = pz[ai] - z;
|
|
250
|
+
const dSq = dx * dx + dy * dy + dz * dz;
|
|
251
|
+
return dSq < (r * r);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* For each atom:
|
|
255
|
+
* Iterate over a subsection of the grid, for each point:
|
|
256
|
+
* If current value < 0.0, unvisited, set positive
|
|
257
|
+
*
|
|
258
|
+
* In any case: Project this point onto surface of the atomic sphere
|
|
259
|
+
* If this projected point is not obscured by any other atom
|
|
260
|
+
* Calculate delta distance and set grid value to minimum of
|
|
261
|
+
* itself and delta
|
|
262
|
+
*/
|
|
263
|
+
function projectPointsRange(begI, endI) {
|
|
264
|
+
for (let i = begI; i < endI; ++i) {
|
|
265
|
+
const j = int_1.OrderedSet.getAt(indices, i);
|
|
266
|
+
const vx = px[j], vy = py[j], vz = pz[j];
|
|
267
|
+
const rad = radius[j];
|
|
268
|
+
const rSq = rad * rad;
|
|
269
|
+
lookup3d.find(vx, vy, vz, rad);
|
|
270
|
+
// Number of grid points, round this up...
|
|
271
|
+
const ng = Math.ceil(rad * scaleFactor);
|
|
272
|
+
// Center of the atom, mapped to grid points (take floor)
|
|
273
|
+
const iax = Math.floor(scaleFactor * (vx - minX));
|
|
274
|
+
const iay = Math.floor(scaleFactor * (vy - minY));
|
|
275
|
+
const iaz = Math.floor(scaleFactor * (vz - minZ));
|
|
276
|
+
// Extents of grid to consider for this atom
|
|
277
|
+
const begX = Math.max(0, iax - ng);
|
|
278
|
+
const begY = Math.max(0, iay - ng);
|
|
279
|
+
const begZ = Math.max(0, iaz - ng);
|
|
280
|
+
// Add two to these points:
|
|
281
|
+
// - iax are floor'd values so this ensures coverage
|
|
282
|
+
// - these are loop limits (exclusive)
|
|
283
|
+
const endX = Math.min(dimX, iax + ng + 2);
|
|
284
|
+
const endY = Math.min(dimY, iay + ng + 2);
|
|
285
|
+
const endZ = Math.min(dimZ, iaz + ng + 2);
|
|
286
|
+
for (let xi = begX; xi < endX; ++xi) {
|
|
287
|
+
const dx = gridx[xi] - vx;
|
|
288
|
+
const xIdx = xi * iuv;
|
|
289
|
+
for (let yi = begY; yi < endY; ++yi) {
|
|
290
|
+
const dy = gridy[yi] - vy;
|
|
291
|
+
const dxySq = dx * dx + dy * dy;
|
|
292
|
+
const xyIdx = yi * iu + xIdx;
|
|
293
|
+
for (let zi = begZ; zi < endZ; ++zi) {
|
|
294
|
+
const dz = gridz[zi] - vz;
|
|
295
|
+
const dSq = dxySq + dz * dz;
|
|
296
|
+
if (dSq < rSq) {
|
|
297
|
+
const idx = zi + xyIdx;
|
|
298
|
+
// if unvisited, make positive
|
|
299
|
+
if (data[idx] < 0.0)
|
|
300
|
+
data[idx] *= -1;
|
|
301
|
+
// Project on to the surface of the sphere
|
|
302
|
+
// sp is the projected point ( dx, dy, dz ) * ( ra / d )
|
|
303
|
+
const d = Math.sqrt(dSq);
|
|
304
|
+
const ap = rad / d;
|
|
305
|
+
const spx = dx * ap + vx;
|
|
306
|
+
const spy = dy * ap + vy;
|
|
307
|
+
const spz = dz * ap + vz;
|
|
308
|
+
if (obscured(spx, spy, spz, j, -1) === -1) {
|
|
309
|
+
const dd = rad - d;
|
|
310
|
+
if (dd < data[idx]) {
|
|
311
|
+
data[idx] = dd;
|
|
312
|
+
idData[idx] = id[i];
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
async function projectPoints() {
|
|
322
|
+
for (let i = 0; i < n; i += updateChunk) {
|
|
323
|
+
projectPointsRange(i, Math.min(i + updateChunk, n));
|
|
324
|
+
if (ctx.shouldUpdate) {
|
|
325
|
+
await ctx.update({ message: 'projecting points', current: i, max: n });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
// Vectors for Torus Projection
|
|
330
|
+
const atob = (0, linear_algebra_1.Vec3)();
|
|
331
|
+
const mid = (0, linear_algebra_1.Vec3)();
|
|
332
|
+
const n1 = (0, linear_algebra_1.Vec3)();
|
|
333
|
+
const n2 = (0, linear_algebra_1.Vec3)();
|
|
334
|
+
/**
|
|
335
|
+
* `a` and `b` must be resolved indices
|
|
336
|
+
*/
|
|
337
|
+
function projectTorus(a, b) {
|
|
338
|
+
const rA = radius[a];
|
|
339
|
+
const rB = radius[b];
|
|
340
|
+
const dx = atob[0] = px[b] - px[a];
|
|
341
|
+
const dy = atob[1] = py[b] - py[a];
|
|
342
|
+
const dz = atob[2] = pz[b] - pz[a];
|
|
343
|
+
const dSq = dx * dx + dy * dy + dz * dz;
|
|
344
|
+
// This check now redundant as already done in AVHash.withinRadii
|
|
345
|
+
// if (dSq > ((rA + rB) * (rA + rB))) { return }
|
|
346
|
+
const d = Math.sqrt(dSq);
|
|
347
|
+
// Find angle between a->b vector and the circle
|
|
348
|
+
// of their intersection by cosine rule
|
|
349
|
+
const cosA = (rA * rA + d * d - rB * rB) / (2.0 * rA * d);
|
|
350
|
+
// distance along a->b at intersection
|
|
351
|
+
const dmp = rA * cosA;
|
|
352
|
+
linear_algebra_1.Vec3.normalize(atob, atob);
|
|
353
|
+
// Create normal to line
|
|
354
|
+
normalToLine(n1, atob);
|
|
355
|
+
linear_algebra_1.Vec3.normalize(n1, n1);
|
|
356
|
+
// Cross together for second normal vector
|
|
357
|
+
linear_algebra_1.Vec3.cross(n2, atob, n1);
|
|
358
|
+
linear_algebra_1.Vec3.normalize(n2, n2);
|
|
359
|
+
// r is radius of circle of intersection
|
|
360
|
+
const rInt = Math.sqrt(rA * rA - dmp * dmp);
|
|
361
|
+
linear_algebra_1.Vec3.scale(n1, n1, rInt);
|
|
362
|
+
linear_algebra_1.Vec3.scale(n2, n2, rInt);
|
|
363
|
+
linear_algebra_1.Vec3.scale(atob, atob, dmp);
|
|
364
|
+
mid[0] = atob[0] + px[a];
|
|
365
|
+
mid[1] = atob[1] + py[a];
|
|
366
|
+
mid[2] = atob[2] + pz[a];
|
|
367
|
+
lastClip = -1;
|
|
368
|
+
for (let i = 0; i < probePositions; ++i) {
|
|
369
|
+
const cost = cosTable[i];
|
|
370
|
+
const sint = sinTable[i];
|
|
371
|
+
const px = mid[0] + cost * n1[0] + sint * n2[0];
|
|
372
|
+
const py = mid[1] + cost * n1[1] + sint * n2[1];
|
|
373
|
+
const pz = mid[2] + cost * n1[2] + sint * n2[2];
|
|
374
|
+
if (obscured(px, py, pz, a, b) === -1) {
|
|
375
|
+
const iax = Math.floor(scaleFactor * (px - minX));
|
|
376
|
+
const iay = Math.floor(scaleFactor * (py - minY));
|
|
377
|
+
const iaz = Math.floor(scaleFactor * (pz - minZ));
|
|
378
|
+
const begX = Math.max(0, iax - ngTorus);
|
|
379
|
+
const begY = Math.max(0, iay - ngTorus);
|
|
380
|
+
const begZ = Math.max(0, iaz - ngTorus);
|
|
381
|
+
const endX = Math.min(dimX, iax + ngTorus + 2);
|
|
382
|
+
const endY = Math.min(dimY, iay + ngTorus + 2);
|
|
383
|
+
const endZ = Math.min(dimZ, iaz + ngTorus + 2);
|
|
384
|
+
for (let xi = begX; xi < endX; ++xi) {
|
|
385
|
+
const dx = px - gridx[xi];
|
|
386
|
+
const xIdx = xi * iuv;
|
|
387
|
+
for (let yi = begY; yi < endY; ++yi) {
|
|
388
|
+
const dy = py - gridy[yi];
|
|
389
|
+
const dxySq = dx * dx + dy * dy;
|
|
390
|
+
const xyIdx = yi * iu + xIdx;
|
|
391
|
+
for (let zi = begZ; zi < endZ; ++zi) {
|
|
392
|
+
const dz = pz - gridz[zi];
|
|
393
|
+
const dSq = dxySq + dz * dz;
|
|
394
|
+
const idx = zi + xyIdx;
|
|
395
|
+
const current = data[idx];
|
|
396
|
+
if (current > 0.0 && dSq < (current * current)) {
|
|
397
|
+
data[idx] = Math.sqrt(dSq);
|
|
398
|
+
// Is this grid point closer to a or b?
|
|
399
|
+
// Take dot product of atob and gridpoint->p (dx, dy, dz)
|
|
400
|
+
const dp = dx * atob[0] + dy * atob[1] + dz * atob[2];
|
|
401
|
+
idData[idx] = id[int_1.OrderedSet.indexOf(indices, dp < 0.0 ? b : a)];
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function projectToriiRange(begI, endI) {
|
|
410
|
+
for (let i = begI; i < endI; ++i) {
|
|
411
|
+
const k = int_1.OrderedSet.getAt(indices, i);
|
|
412
|
+
lookup3d.find(px[k], py[k], pz[k], radius[k]);
|
|
413
|
+
for (let j = 0, jl = neighbours.count; j < jl; ++j) {
|
|
414
|
+
const l = int_1.OrderedSet.getAt(indices, neighbours.indices[j]);
|
|
415
|
+
if (k < l)
|
|
416
|
+
projectTorus(k, l);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
async function projectTorii() {
|
|
421
|
+
for (let i = 0; i < n; i += updateChunk) {
|
|
422
|
+
projectToriiRange(i, Math.min(i + updateChunk, n));
|
|
423
|
+
if (ctx.shouldUpdate) {
|
|
424
|
+
await ctx.update({ message: 'projecting torii', current: i, max: n });
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
// console.time('MolecularSurface')
|
|
429
|
+
// console.time('MolecularSurface createState')
|
|
430
|
+
const { resolution, probeRadius, probePositions } = surfaceData.props;
|
|
431
|
+
const scaleFactor = 1 / resolution;
|
|
432
|
+
const ngTorus = Math.max(5, 2 + Math.floor(probeRadius * scaleFactor));
|
|
433
|
+
const cellSize = linear_algebra_1.Vec3.create(surfaceData.maxRadius, surfaceData.maxRadius, surfaceData.maxRadius);
|
|
434
|
+
linear_algebra_1.Vec3.scale(cellSize, cellSize, 2);
|
|
435
|
+
const lookup3d = (0, geometry_1.GridLookup3D)(surfaceData.positions, surfaceData.boundary, cellSize);
|
|
436
|
+
const neighbours = lookup3d.result;
|
|
437
|
+
if (surfaceData.box === null)
|
|
438
|
+
surfaceData.box = lookup3d.boundary.box;
|
|
439
|
+
const { indices, x: px, y: py, z: pz, id, radius } = surfaceData.positions;
|
|
440
|
+
const n = int_1.OrderedSet.size(indices);
|
|
441
|
+
const pad = surfaceData.maxRadius + resolution;
|
|
442
|
+
const expandedBox = geometry_1.Box3D.expand((0, geometry_1.Box3D)(), surfaceData.box, linear_algebra_1.Vec3.create(pad, pad, pad));
|
|
443
|
+
const [minX, minY, minZ] = expandedBox.min;
|
|
444
|
+
const scaledBox = geometry_1.Box3D.scale((0, geometry_1.Box3D)(), expandedBox, scaleFactor);
|
|
445
|
+
const dim = geometry_1.Box3D.size((0, linear_algebra_1.Vec3)(), scaledBox);
|
|
446
|
+
linear_algebra_1.Vec3.ceil(dim, dim);
|
|
447
|
+
const [dimX, dimY, dimZ] = dim;
|
|
448
|
+
const iu = dimZ, iv = dimY, iuv = iu * iv;
|
|
449
|
+
const { cosTable, sinTable } = getAngleTables(probePositions);
|
|
450
|
+
const space = linear_algebra_1.Tensor.Space(dim, [0, 1, 2], Float32Array);
|
|
451
|
+
const data = space.create();
|
|
452
|
+
const idData = space.create();
|
|
453
|
+
data.fill(-1001.0);
|
|
454
|
+
idData.fill(-1);
|
|
455
|
+
const gridx = (0, geometry_1.fillGridDim)(dimX, minX, resolution);
|
|
456
|
+
const gridy = (0, geometry_1.fillGridDim)(dimY, minY, resolution);
|
|
457
|
+
const gridz = (0, geometry_1.fillGridDim)(dimZ, minZ, resolution);
|
|
458
|
+
const updateChunk = Math.ceil(100000 / ((Math.pow(Math.pow(surfaceData.maxRadius, 3), 3) * scaleFactor)));
|
|
459
|
+
// console.timeEnd('MolecularSurface createState')
|
|
460
|
+
// console.time('MolecularSurface projectPoints')
|
|
461
|
+
await projectPoints();
|
|
462
|
+
// console.timeEnd('MolecularSurface projectPoints')
|
|
463
|
+
// console.time('MolecularSurface projectTorii')
|
|
464
|
+
await projectTorii();
|
|
465
|
+
// console.timeEnd('MolecularSurface projectTorii')
|
|
466
|
+
// console.timeEnd('MolecularSurface')
|
|
467
|
+
const field = linear_algebra_1.Tensor.create(space, data);
|
|
468
|
+
const idField = linear_algebra_1.Tensor.create(space, idData);
|
|
469
|
+
const transform = linear_algebra_1.Mat4.identity();
|
|
470
|
+
linear_algebra_1.Mat4.fromScaling(transform, linear_algebra_1.Vec3.create(resolution, resolution, resolution));
|
|
471
|
+
linear_algebra_1.Mat4.setTranslation(transform, expandedBox.min);
|
|
472
|
+
// console.log({ field, idField, transform, updateChunk })
|
|
473
|
+
return { field, idField, transform, resolution, maxRadius: surfaceData.maxRadius };
|
|
474
|
+
}
|
|
@@ -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
|
+
}>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
|
+
*
|
|
5
|
+
* @author Dušan Veľký <dvelky@mail.muni.cz>
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.TunnelsPreset = exports.isApplicable = exports.SbNcbrTunnels = void 0;
|
|
9
|
+
const behavior_1 = require("../../../mol-plugin/behavior");
|
|
10
|
+
const actions_1 = require("./actions");
|
|
11
|
+
const param_definition_1 = require("../../../mol-util/param-definition");
|
|
12
|
+
const representation_preset_1 = require("../../../mol-plugin-state/builder/structure/representation-preset");
|
|
13
|
+
const structure_1 = require("../../../mol-model/structure");
|
|
14
|
+
const mol_state_1 = require("../../../mol-state");
|
|
15
|
+
const props_1 = require("./props");
|
|
16
|
+
const transforms_1 = require("../../../mol-plugin-state/transforms");
|
|
17
|
+
const representation_1 = require("./representation");
|
|
18
|
+
const mesh_utils_1 = require("../../meshes/mesh-utils");
|
|
19
|
+
exports.SbNcbrTunnels = behavior_1.PluginBehavior.create({
|
|
20
|
+
name: 'sb-ncbr-tunnels',
|
|
21
|
+
category: 'misc',
|
|
22
|
+
display: {
|
|
23
|
+
name: 'SB NCBR Tunnels',
|
|
24
|
+
},
|
|
25
|
+
ctor: class extends behavior_1.PluginBehavior.Handler {
|
|
26
|
+
register() {
|
|
27
|
+
this.ctx.state.data.actions.add(actions_1.DownloadTunnels);
|
|
28
|
+
this.ctx.builders.structure.representation.registerPreset(exports.TunnelsPreset);
|
|
29
|
+
}
|
|
30
|
+
unregister() {
|
|
31
|
+
this.ctx.state.data.actions.remove(actions_1.DownloadTunnels);
|
|
32
|
+
this.ctx.builders.structure.representation.unregisterPreset(exports.TunnelsPreset);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
params: () => ({
|
|
36
|
+
autoAttach: param_definition_1.ParamDefinition.Boolean(true),
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
function isApplicable(structure) {
|
|
40
|
+
return (!!structure && structure.models.length === 1 &&
|
|
41
|
+
structure_1.Model.hasPdbId(structure.models[0]));
|
|
42
|
+
}
|
|
43
|
+
exports.isApplicable = isApplicable;
|
|
44
|
+
exports.TunnelsPreset = (0, representation_preset_1.StructureRepresentationPresetProvider)({
|
|
45
|
+
id: 'sb-ncbr-preset-structure-tunnels',
|
|
46
|
+
display: {
|
|
47
|
+
name: 'Tunnels', group: 'Annotation',
|
|
48
|
+
description: 'Shows Tunnels from ChannelsDB contained in the structure.'
|
|
49
|
+
},
|
|
50
|
+
isApplicable(a) {
|
|
51
|
+
return isApplicable(a.data);
|
|
52
|
+
},
|
|
53
|
+
params: (a, plugin) => {
|
|
54
|
+
return {
|
|
55
|
+
...representation_preset_1.StructureRepresentationPresetProvider.CommonParams,
|
|
56
|
+
...getConfiguredDefaultParams(plugin)
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
async apply(ref, params, plugin) {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
const structureCell = mol_state_1.StateObjectRef.resolveAndCheck(plugin.state.data, ref);
|
|
62
|
+
const structure = (_a = structureCell === null || structureCell === void 0 ? void 0 : structureCell.obj) === null || _a === void 0 ? void 0 : _a.data;
|
|
63
|
+
if (!structureCell || !structure)
|
|
64
|
+
return {};
|
|
65
|
+
const update = plugin.build();
|
|
66
|
+
const webgl = (_b = plugin.canvas3dContext) === null || _b === void 0 ? void 0 : _b.webgl;
|
|
67
|
+
const response = await (await fetch(`${params.serverUrl}/channels/${params.serverType}/${structure.model.entryId.toLowerCase()}`)).json();
|
|
68
|
+
const tunnels = [];
|
|
69
|
+
Object.entries(response.Channels).forEach(([key, values]) => {
|
|
70
|
+
if (values.length > 0) {
|
|
71
|
+
values.forEach((item) => {
|
|
72
|
+
tunnels.push({ data: item.Profile, props: { id: item.Id, type: item.Type } });
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
await tunnels.forEach(async (tunnel) => {
|
|
77
|
+
await update
|
|
78
|
+
.toRoot()
|
|
79
|
+
.apply(representation_1.TunnelFromRawData, { data: tunnel })
|
|
80
|
+
.apply(representation_1.TunnelShapeProvider, {
|
|
81
|
+
webgl,
|
|
82
|
+
colorTheme: mesh_utils_1.ColorGenerator.next().value,
|
|
83
|
+
})
|
|
84
|
+
.apply(transforms_1.StateTransforms.Representation.ShapeRepresentation3D);
|
|
85
|
+
await update.commit();
|
|
86
|
+
});
|
|
87
|
+
const preset = await representation_preset_1.PresetStructureRepresentations.auto.apply(ref, { ...params }, plugin);
|
|
88
|
+
return { components: preset.components, representations: { ...preset.representations, } };
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
function getConfiguredDefaultParams(plugin) {
|
|
92
|
+
const config = (0, props_1.getTunnelsConfig)(plugin);
|
|
93
|
+
const params = param_definition_1.ParamDefinition.clone(props_1.TunnelsDataParams);
|
|
94
|
+
param_definition_1.ParamDefinition.setDefaultValues(params, { serverType: config.DefaultServerType, serverUrl: config.DefaultServerUrl });
|
|
95
|
+
return params;
|
|
96
|
+
}
|