mirror of
https://github.com/molstar/molstar.git
synced 2026-06-05 14:04:36 +08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
028c02f50d | ||
|
|
76e97d7b59 | ||
|
|
ad1181a75b | ||
|
|
5d683462fb | ||
|
|
42422bb0ea | ||
|
|
861e5c3e97 | ||
|
|
614cffda96 | ||
|
|
2e0379d202 |
@@ -1 +1 @@
|
||||
tsconfig.commonjs.buildinfo
|
||||
tsconfig.commonjs.tsbuildinfo
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "molstar",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/argparse": "^1.0.38",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "molstar",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.2",
|
||||
"description": "A comprehensive macromolecular library.",
|
||||
"homepage": "https://github.com/molstar/molstar#readme",
|
||||
"repository": {
|
||||
@@ -14,6 +14,7 @@
|
||||
"lint": "eslint .",
|
||||
"lint-fix": "eslint . --fix",
|
||||
"test": "npm run lint && jest",
|
||||
"jest": "jest",
|
||||
"build": "npm run build-tsc && npm run build-extra && npm run build-webpack",
|
||||
"build-viewer": "npm run build-tsc && npm run build-extra && npm run build-webpack-viewer",
|
||||
"build-tsc": "concurrently \"tsc --incremental\" \"tsc --build tsconfig.commonjs.json --incremental\"",
|
||||
|
||||
@@ -234,6 +234,7 @@ interface Canvas3D {
|
||||
readonly boundingSphere: Readonly<Sphere3D>
|
||||
setProps(props: PartialCanvas3DProps | ((old: Canvas3DProps) => Partial<Canvas3DProps> | void), doNotRequestDraw?: boolean /* = false */): void
|
||||
getImagePass(props: Partial<ImageProps>): ImagePass
|
||||
getRenderObjects(): GraphicsRenderObject[]
|
||||
|
||||
/** Returns a copy of the current Canvas3D instance props */
|
||||
readonly props: Readonly<Canvas3DProps>
|
||||
@@ -769,6 +770,11 @@ namespace Canvas3D {
|
||||
getImagePass: (props: Partial<ImageProps> = {}) => {
|
||||
return new ImagePass(webgl, renderer, scene, camera, helper, passes.draw.wboitEnabled, props);
|
||||
},
|
||||
getRenderObjects(): GraphicsRenderObject[] {
|
||||
const renderObjects: GraphicsRenderObject[] = [];
|
||||
scene.forEach((_, ro) => renderObjects.push(ro));
|
||||
return renderObjects;
|
||||
},
|
||||
|
||||
get props() {
|
||||
return getProps();
|
||||
|
||||
@@ -17,7 +17,7 @@ const SdfString = `
|
||||
M CHG 3 1 -1 3 -1 5 -1
|
||||
M END
|
||||
> <DATABASE_ID>
|
||||
DB14523
|
||||
0
|
||||
|
||||
> <DATABASE_NAME>
|
||||
drugbank
|
||||
@@ -127,7 +127,9 @@ Comp 2
|
||||
4 3 1 0 0 0 0
|
||||
4 5 1 0 0 0 0
|
||||
M CHG 3 1 -1 3 -1 5 -1
|
||||
M END`;
|
||||
M END
|
||||
> <DATABASE_ID>
|
||||
1`;
|
||||
|
||||
describe('sdf reader', () => {
|
||||
it('basic', async () => {
|
||||
@@ -159,12 +161,15 @@ describe('sdf reader', () => {
|
||||
expect(bonds.order.value(3)).toBe(1);
|
||||
|
||||
expect(dataItems.dataHeader.value(0)).toBe('DATABASE_ID');
|
||||
expect(dataItems.data.value(0)).toBe('DB14523');
|
||||
expect(dataItems.data.value(0)).toBe('0');
|
||||
|
||||
expect(dataItems.dataHeader.value(1)).toBe('DATABASE_NAME');
|
||||
expect(dataItems.data.value(1)).toBe('drugbank');
|
||||
|
||||
expect(dataItems.dataHeader.value(31)).toBe('SYNONYMS');
|
||||
expect(dataItems.data.value(31)).toBe('Orthophosphate; Phosphate');
|
||||
|
||||
expect(compound1.dataItems.data.value(0)).toBe('0');
|
||||
expect(compound2.dataItems.data.value(0)).toBe('1');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,6 +54,12 @@ const StandardComponents = (function() {
|
||||
{ id: 'SEC', name: 'SELENOCYSTEINE', type: 'L-peptide linking' },
|
||||
{ id: 'PYL', name: 'PYRROLYSINE', type: 'L-peptide linking' },
|
||||
|
||||
{ id: 'MSE', name: 'SELENOMETHIONINE', type: 'L-peptide linking' },
|
||||
{ id: 'SEP', name: 'PHOSPHOSERINE', type: 'L-peptide linking' },
|
||||
{ id: 'TPO', name: 'PHOSPHOTHREONINE', type: 'L-peptide linking' },
|
||||
{ id: 'PTR', name: 'O-PHOSPHOTYROSINE', type: 'L-peptide linking' },
|
||||
{ id: 'PCA', name: 'PYROGLUTAMIC ACID', type: 'L-peptide linking' },
|
||||
|
||||
{ id: 'A', name: 'ADENOSINE-5\'-MONOPHOSPHATE', type: 'RNA linking' },
|
||||
{ id: 'C', name: 'CYTIDINE-5\'-MONOPHOSPHATE', type: 'RNA linking' },
|
||||
{ id: 'T', name: 'THYMIDINE-5\'-MONOPHOSPHATE', type: 'RNA linking' },
|
||||
|
||||
@@ -245,7 +245,9 @@ export const WaterNames = new Set([
|
||||
export const AminoAcidNamesL = new Set([
|
||||
'HIS', 'ARG', 'LYS', 'ILE', 'PHE', 'LEU', 'TRP', 'ALA', 'MET', 'PRO', 'CYS',
|
||||
'ASN', 'VAL', 'GLY', 'SER', 'GLN', 'TYR', 'ASP', 'GLU', 'THR', 'SEC', 'PYL',
|
||||
'UNK' // unknown amino acid from CCD
|
||||
'UNK', // unknown amino acid from CCD
|
||||
'MSE', 'SEP', 'TPO', 'PTR', 'PCA' // common
|
||||
|
||||
]);
|
||||
export const AminoAcidNamesD = new Set([
|
||||
'DAL', // D-ALANINE
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
|
||||
import { PluginCommands } from '../../../mol-plugin/commands';
|
||||
import { StateTransform } from '../../../mol-state';
|
||||
import { shallowEqual } from '../../../mol-util';
|
||||
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
||||
import { PluginStateAnimation } from '../model';
|
||||
|
||||
export const AnimateStateInterpolation = PluginStateAnimation.create({
|
||||
name: 'built-in.animate-state-interpolation',
|
||||
display: { name: 'Animate State Interpolation' },
|
||||
display: { name: 'Animate State (experimental)' },
|
||||
params: () => ({
|
||||
transtionDurationInMs: PD.Numeric(2000, { min: 100, max: 30000, step: 10 })
|
||||
}),
|
||||
@@ -42,15 +43,25 @@ export const AnimateStateInterpolation = PluginStateAnimation.create({
|
||||
|
||||
for (const s of src) {
|
||||
for (const t of tar) {
|
||||
// TODO: better than quadratic alg.
|
||||
// TODO: support for adding/removing nodes
|
||||
if (t.ref !== s.ref) continue;
|
||||
if (t.version === s.version) continue;
|
||||
|
||||
const e = StateTransform.fromJSON(s), f = StateTransform.fromJSON(t);
|
||||
|
||||
const oldState = state.cells.get(s.ref);
|
||||
if (!oldState) continue;
|
||||
|
||||
let newState;
|
||||
if (!e.transformer.definition.interpolate) {
|
||||
update.to(s.ref).update(currentT <= 0.5 ? e.params : f.params);
|
||||
newState = currentT <= 0.5 ? e.params : f.params;
|
||||
} else {
|
||||
update.to(s.ref).update(e.transformer.definition.interpolate(e.params, f.params, currentT, ctx.plugin));
|
||||
newState = e.transformer.definition.interpolate(e.params, f.params, currentT, ctx.plugin);
|
||||
}
|
||||
|
||||
if (!shallowEqual(oldState, newState)) {
|
||||
update.to(s.ref).update(newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,6 +414,10 @@ const ModelFromTrajectory = PluginStateTransform.BuiltIn({
|
||||
return new SO.Molecule.Model(model, { label, description });
|
||||
});
|
||||
},
|
||||
interpolate(a, b, t) {
|
||||
const modelIndex = t >= 1 ? b.modelIndex : a.modelIndex + Math.floor((b.modelIndex - a.modelIndex + 1) * t);
|
||||
return { modelIndex };
|
||||
},
|
||||
dispose({ b }) {
|
||||
b?.data.customProperties.dispose();
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ const VolumeFromDensityServerCif = PluginStateTransform.BuiltIn({
|
||||
const densityServerCif = CIF.schema.densityServer(block);
|
||||
const volume = await volumeFromDensityServerData(densityServerCif, { entryId: params.entryId }).runInContext(ctx);
|
||||
const [x, y, z] = volume.grid.cells.space.dimensions;
|
||||
const props = { label: densityServerCif.volume_data_3d_info.name.value(0), description: `Volume ${x}\u00D7${y}\u00D7${z}` };
|
||||
const props = { label: params.entryId ?? densityServerCif.volume_data_3d_info.name.value(0), description: `Volume ${x}\u00D7${y}\u00D7${z}` };
|
||||
return new SO.Volume.Data(volume, props);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -21,6 +21,7 @@ import { StateActions } from '../mol-plugin-state/actions';
|
||||
import { AssignColorVolume } from '../mol-plugin-state/actions/volume';
|
||||
import { StateTransforms } from '../mol-plugin-state/transforms';
|
||||
import { BoxifyVolumeStreaming, CreateVolumeStreamingBehavior, InitVolumeStreaming } from '../mol-plugin/behavior/dynamic/volume-streaming/transformers';
|
||||
import { AnimateStateInterpolation } from '../mol-plugin-state/animation/built-in/state-interpolation';
|
||||
|
||||
export { PluginSpec };
|
||||
|
||||
@@ -126,6 +127,7 @@ export const DefaultPluginSpec = (): PluginSpec => ({
|
||||
AnimateModelIndex,
|
||||
AnimateCameraSpin,
|
||||
AnimateStateSnapshots,
|
||||
AnimateAssemblyUnwind
|
||||
AnimateAssemblyUnwind,
|
||||
AnimateStateInterpolation
|
||||
]
|
||||
});
|
||||
Reference in New Issue
Block a user