mirror of
https://github.com/molstar/molstar.git
synced 2026-06-05 22:31:26 +08:00
Compare commits
3 Commits
v0.7.1-dev
...
v0.7.1-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f398993d33 | ||
|
|
b6f59ca9c3 | ||
|
|
c857c17bb4 |
4326
package-lock.json
generated
4326
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
53
package.json
53
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "molstar",
|
||||
"version": "0.7.1-dev.2",
|
||||
"version": "0.7.1-dev.3",
|
||||
"description": "A comprehensive macromolecular library.",
|
||||
"homepage": "https://github.com/molstar/molstar#readme",
|
||||
"repository": {
|
||||
@@ -83,68 +83,65 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/add": "^1.13.3",
|
||||
"@graphql-codegen/cli": "^1.13.3",
|
||||
"@graphql-codegen/time": "^1.13.3",
|
||||
"@graphql-codegen/typescript": "^1.13.3",
|
||||
"@graphql-codegen/typescript-graphql-files-modules": "^1.13.3",
|
||||
"@graphql-codegen/typescript-graphql-request": "^1.13.3",
|
||||
"@graphql-codegen/typescript-operations": "^1.13.3",
|
||||
"@graphql-codegen/add": "^1.13.5",
|
||||
"@graphql-codegen/cli": "^1.13.5",
|
||||
"@graphql-codegen/time": "^1.13.5",
|
||||
"@graphql-codegen/typescript": "^1.13.5",
|
||||
"@graphql-codegen/typescript-graphql-files-modules": "^1.13.5",
|
||||
"@graphql-codegen/typescript-graphql-request": "^1.13.5",
|
||||
"@graphql-codegen/typescript-operations": "^1.13.5",
|
||||
"@types/cors": "^2.8.6",
|
||||
"@typescript-eslint/eslint-plugin": "^2.29.0",
|
||||
"@typescript-eslint/parser": "^2.29.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.32.0",
|
||||
"@typescript-eslint/parser": "^2.32.0",
|
||||
"benchmark": "^2.1.4",
|
||||
"circular-dependency-plugin": "^5.2.0",
|
||||
"concurrently": "^5.1.0",
|
||||
"concurrently": "^5.2.0",
|
||||
"cpx2": "^2.0.0",
|
||||
"css-loader": "^3.5.3",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint": "^7.0.0",
|
||||
"extra-watch-webpack-plugin": "^1.0.3",
|
||||
"file-loader": "^6.0.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"graphql": "^15.0.0",
|
||||
"http-server": "^0.12.1",
|
||||
"jest": "^25.4.0",
|
||||
"jest-raw-loader": "^1.0.1",
|
||||
"http-server": "^0.12.3",
|
||||
"jest": "^26.0.1",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"node-sass": "^4.14.0",
|
||||
"node-sass": "^4.14.1",
|
||||
"raw-loader": "^4.0.1",
|
||||
"resolve-url-loader": "^3.1.1",
|
||||
"sass-loader": "^8.0.2",
|
||||
"simple-git": "^1.132.0",
|
||||
"style-loader": "^1.2.0",
|
||||
"ts-jest": "^25.4.0",
|
||||
"simple-git": "^2.4.0",
|
||||
"style-loader": "^1.2.1",
|
||||
"ts-jest": "^25.5.1",
|
||||
"typescript": "^3.8.3",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-version-file-plugin": "^0.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@material-ui/core": "^4.9.11",
|
||||
"@material-ui/core": "^4.9.13",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@types/argparse": "^1.0.38",
|
||||
"@types/benchmark": "^1.0.31",
|
||||
"@types/compression": "1.7.0",
|
||||
"@types/express": "^4.17.6",
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/node": "^13.13.2",
|
||||
"@types/node": "^13.13.5",
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@types/react": "^16.9.34",
|
||||
"@types/react-dom": "^16.9.6",
|
||||
"@types/react": "^16.9.35",
|
||||
"@types/react-dom": "^16.9.8",
|
||||
"@types/swagger-ui-dist": "3.0.5",
|
||||
"argparse": "^1.0.10",
|
||||
"body-parser": "^1.19.0",
|
||||
"compression": "^1.7.4",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"immer": "^6.0.3",
|
||||
"immer": "^6.0.5",
|
||||
"immutable": "^3.8.2",
|
||||
"node-fetch": "^2.6.0",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"rxjs": "^6.5.5",
|
||||
"swagger-ui-dist": "^3.25.0",
|
||||
"tslib": "^1.11.1",
|
||||
"swagger-ui-dist": "^3.25.2",
|
||||
"tslib": "^1.11.2",
|
||||
"util.promisify": "^1.0.1",
|
||||
"xhr2": "^0.2.0"
|
||||
}
|
||||
|
||||
@@ -69,15 +69,8 @@
|
||||
$('format').value = format;
|
||||
$('format').onchange = function (e) { format = e.target.value; }
|
||||
|
||||
// var url = 'https://www.ebi.ac.uk/pdbe/entry-files/pdb' + pdbId + '.ent';
|
||||
// var format = 'pdb';
|
||||
// var assemblyId = 'deposited';
|
||||
|
||||
BasicMolStarWrapper.init('app' /** or document.getElementById('app') */);
|
||||
BasicMolStarWrapper.setBackground(0xffffff);
|
||||
// BasicMolStarWrapper.load({ url: url, format: format, assemblyId: assemblyId });
|
||||
// BasicMolStarWrapper.toggleSpin();
|
||||
|
||||
|
||||
addControl('Load Asym Unit', () => BasicMolStarWrapper.load({ url: url, format: format }));
|
||||
addControl('Load Assembly', () => BasicMolStarWrapper.load({ url: url, format: format, assemblyId: assemblyId }));
|
||||
|
||||
@@ -56,7 +56,13 @@ class BasicWrapper {
|
||||
const trajectory = await this.plugin.builders.structure.parseTrajectory(data, format);
|
||||
|
||||
await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, 'default', {
|
||||
structure: assemblyId ? { name: 'assembly', params: { id: assemblyId } } : { name: 'deposited', params: { } },
|
||||
structure: assemblyId ? {
|
||||
name: 'assembly',
|
||||
params: { id: assemblyId }
|
||||
} : {
|
||||
name: 'model',
|
||||
params: { }
|
||||
},
|
||||
showUnitcell: false,
|
||||
representationPreset: 'auto'
|
||||
});
|
||||
|
||||
@@ -105,7 +105,7 @@ class LightingDemo {
|
||||
const data = await this.plugin.builders.data.download({ url: Asset.Url(url), isBinary }, { state: { isGhost: true } });
|
||||
const trajectory = await this.plugin.builders.structure.parseTrajectory(data, format);
|
||||
const model = await this.plugin.builders.structure.createModel(trajectory);
|
||||
const structure = await this.plugin.builders.structure.createStructure(model, assemblyId ? { name: 'assembly', params: { id: assemblyId } } : { name: 'deposited', params: { } });
|
||||
const structure = await this.plugin.builders.structure.createStructure(model, assemblyId ? { name: 'assembly', params: { id: assemblyId } } : { name: 'model', params: { } });
|
||||
|
||||
const polymer = await this.plugin.builders.structure.tryCreateComponentStatic(structure, 'polymer');
|
||||
if (polymer) await this.plugin.builders.structure.representation.addRepresentation(polymer, { type: 'spacefill', color: 'illustrative' });
|
||||
|
||||
@@ -88,10 +88,6 @@
|
||||
$('isBinary').checked = isBinary;
|
||||
$('isBinary').onchange = function (e) { isBinary = !!e.target.checked; };
|
||||
|
||||
// var url = 'https://www.ebi.ac.uk/pdbe/entry-files/pdb' + pdbId + '.ent';
|
||||
// var format = 'pdb';
|
||||
// var assemblyId = 'deposited';
|
||||
|
||||
function loadAndSnapshot(params) {
|
||||
PluginWrapper.load(params).then(() => {
|
||||
setTimeout(() => snapshot = PluginWrapper.plugin.state.getSnapshot({ canvas3d: false /* do not save spinning state */ }), 500);
|
||||
|
||||
@@ -89,9 +89,12 @@ class MolStarProteopediaWrapper {
|
||||
private structure(assemblyId: string) {
|
||||
const model = this.state.build().to(StateElements.Model);
|
||||
const props = {
|
||||
type: {
|
||||
type: assemblyId ? {
|
||||
name: 'assembly' as const,
|
||||
params: { id: assemblyId || 'deposited' }
|
||||
params: { id: assemblyId }
|
||||
} : {
|
||||
name: 'model' as const,
|
||||
params: { }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -196,7 +199,7 @@ class MolStarProteopediaWrapper {
|
||||
|
||||
private emptyLoadedParams: LoadParams = { url: '', format: 'cif', isBinary: false, assemblyId: '' };
|
||||
private loadedParams: LoadParams = { url: '', format: 'cif', isBinary: false, assemblyId: '' };
|
||||
async load({ url, format = 'cif', assemblyId = 'deposited', isBinary = false, representationStyle }: LoadParams) {
|
||||
async load({ url, format = 'cif', assemblyId = '', isBinary = false, representationStyle }: LoadParams) {
|
||||
let loadType: 'full' | 'update' = 'full';
|
||||
|
||||
const state = this.plugin.state.data;
|
||||
@@ -220,9 +223,12 @@ class MolStarProteopediaWrapper {
|
||||
const info = await this.doInfo(true);
|
||||
const asmId = (assemblyId === 'preferred' && info && info.preferredAssemblyId) || assemblyId;
|
||||
const props = {
|
||||
type: {
|
||||
type: assemblyId ? {
|
||||
name: 'assembly' as const,
|
||||
params: { id: asmId || 'deposited' }
|
||||
params: { id: asmId }
|
||||
} : {
|
||||
name: 'model' as const,
|
||||
params: { }
|
||||
}
|
||||
};
|
||||
tree.to(StateElements.Assembly).update(StateTransforms.Model.StructureFromModel, p => ({ ...p, ...props }));
|
||||
|
||||
@@ -35,7 +35,7 @@ export function isBiologicalAssembly(structure: Structure): boolean {
|
||||
const mmcif = structure.models[0].sourceData.data.db;
|
||||
if (!mmcif.pdbx_struct_assembly.details.isDefined) return false;
|
||||
const id = structure.units[0].conformation.operator.assembly?.id || '';
|
||||
if (id === '' || id === 'deposited') return true;
|
||||
if (id === '') return true;
|
||||
const indices = Column.indicesOf(mmcif.pdbx_struct_assembly.id, e => e === id);
|
||||
if (indices.length !== 1) return false;
|
||||
const details = mmcif.pdbx_struct_assembly.details.value(indices[0]);
|
||||
@@ -63,7 +63,7 @@ export namespace AssemblySymmetry {
|
||||
|
||||
const client = new GraphQLClient(props.serverUrl, ctx.assetManager);
|
||||
const variables: AssemblySymmetryQueryVariables = {
|
||||
assembly_id: structure.units[0].conformation.operator.assembly?.id || 'deposited',
|
||||
assembly_id: structure.units[0].conformation.operator.assembly?.id || '',
|
||||
entry_id: structure.units[0].model.entryId
|
||||
};
|
||||
const result = await client.request(ctx.runtime, query, variables);
|
||||
|
||||
@@ -90,7 +90,7 @@ export class StructureBuilder {
|
||||
const model = StateObjectRef.resolveAndCheck(state, modelRef);
|
||||
if (model) {
|
||||
const symm = ModelSymmetry.Provider.get(model.obj?.data!);
|
||||
if (!symm || symm?.assemblies.length === 0) params = { name: 'deposited', params: { } };
|
||||
if (!symm || symm?.assemblies.length === 0) params = { name: 'model', params: { } };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ const defaultPreset = TrajectoryHierarchyPresetProvider({
|
||||
id: 'preset-trajectory-default',
|
||||
display: {
|
||||
name: 'Default (Assembly)', group: 'Preset',
|
||||
description: 'Shows the first assembly or, if that is unavailable, the first deposited model.'
|
||||
description: 'Shows the first assembly or, if that is unavailable, the first model.'
|
||||
},
|
||||
isApplicable: o => {
|
||||
return true;
|
||||
@@ -93,7 +93,7 @@ const allModels = TrajectoryHierarchyPresetProvider({
|
||||
for (let i = 0; i < tr.length; i++) {
|
||||
const model = await builder.createModel(trajectory, { modelIndex: i });
|
||||
const modelProperties = await builder.insertModelProperties(model, params.modelProperties, { isCollapsed: true });
|
||||
const structure = await builder.createStructure(modelProperties || model, { name: 'deposited', params: {} });
|
||||
const structure = await builder.createStructure(modelProperties || model, { name: 'model', params: {} });
|
||||
const structureProperties = await builder.insertStructureProperties(structure, params.structureProperties);
|
||||
|
||||
models.push(model);
|
||||
|
||||
@@ -17,7 +17,7 @@ import { PluginStateObject as SO } from '../objects';
|
||||
import { ModelSymmetry } from '../../mol-model-formats/structure/property/symmetry';
|
||||
|
||||
export namespace RootStructureDefinition {
|
||||
export function getParams(model?: Model, defaultValue?: 'auto' | 'deposited' | 'assembly' | 'symmetry' | 'symmetry-mates' | 'symmetry-assembly') {
|
||||
export function getParams(model?: Model, defaultValue?: 'auto' | 'model' | 'assembly' | 'symmetry' | 'symmetry-mates' | 'symmetry-assembly') {
|
||||
const symmetry = model && ModelSymmetry.Provider.get(model);
|
||||
|
||||
const assemblyIds = symmetry ? symmetry.assemblies.map(a => [a.id, `${a.id}: ${stringToWords(a.details)}`] as [string, string]) : [];
|
||||
@@ -41,7 +41,7 @@ export namespace RootStructureDefinition {
|
||||
|
||||
const modes = {
|
||||
auto: PD.EmptyGroup(),
|
||||
deposited: PD.EmptyGroup(),
|
||||
model: PD.EmptyGroup(),
|
||||
assembly: PD.Group({
|
||||
id: PD.Optional(model
|
||||
? PD.Select(assemblyIds.length ? assemblyIds[0][0] : '', assemblyIds, { label: 'Asm Id', description: 'Assembly Id' })
|
||||
@@ -75,7 +75,7 @@ export namespace RootStructureDefinition {
|
||||
options.push(['auto', 'Auto']);
|
||||
}
|
||||
|
||||
options.push(['deposited', 'Deposited']);
|
||||
options.push(['model', 'Model']);
|
||||
|
||||
if (assemblyIds.length > 0) {
|
||||
options.push(['assembly', 'Assembly']);
|
||||
@@ -88,7 +88,7 @@ export namespace RootStructureDefinition {
|
||||
}
|
||||
|
||||
return {
|
||||
type: PD.MappedStatic(defaultValue || 'deposited', modes, { options })
|
||||
type: PD.MappedStatic(defaultValue || 'model', modes, { options })
|
||||
};
|
||||
}
|
||||
|
||||
@@ -110,19 +110,17 @@ export namespace RootStructureDefinition {
|
||||
}
|
||||
|
||||
if (!symmetry || symmetry.assemblies.length === 0) {
|
||||
if (id !== 'deposited') {
|
||||
plugin.log.warn(`Model '${model.entryId}' has no assembly, returning deposited structure.`);
|
||||
}
|
||||
plugin.log.warn(`Model '${model.entryId}' has no assembly, returning model structure.`);
|
||||
} else {
|
||||
asm = Symmetry.findAssembly(model, id || '');
|
||||
if (!asm) {
|
||||
plugin.log.warn(`Model '${model.entryId}' has no assembly called '${id}', returning deposited structure.`);
|
||||
plugin.log.warn(`Model '${model.entryId}' has no assembly called '${id}', returning model structure.`);
|
||||
}
|
||||
}
|
||||
|
||||
const base = Structure.ofModel(model);
|
||||
if (!asm) {
|
||||
const label = { label: 'Deposited', description: Structure.elementDescription(base) };
|
||||
const label = { label: 'Model', description: Structure.elementDescription(base) };
|
||||
return new SO.Molecule.Structure(base, label);
|
||||
}
|
||||
|
||||
@@ -155,14 +153,14 @@ export namespace RootStructureDefinition {
|
||||
|
||||
export async function create(plugin: PluginContext, ctx: RuntimeContext, model: Model, params?: Params): Promise<SO.Molecule.Structure> {
|
||||
const symmetry = ModelSymmetry.Provider.get(model);
|
||||
if (!symmetry || !params || params.name === 'deposited') {
|
||||
if (!symmetry || !params || params.name === 'model') {
|
||||
const s = Structure.ofModel(model);
|
||||
return new SO.Molecule.Structure(s, { label: 'Deposited', description: Structure.elementDescription(s) });
|
||||
return new SO.Molecule.Structure(s, { label: 'Model', description: Structure.elementDescription(s) });
|
||||
}
|
||||
if (params.name === 'auto') {
|
||||
if (symmetry.assemblies.length === 0) {
|
||||
const s = Structure.ofModel(model);
|
||||
return new SO.Molecule.Structure(s, { label: 'Deposited', description: Structure.elementDescription(s) });
|
||||
return new SO.Molecule.Structure(s, { label: 'Model', description: Structure.elementDescription(s) });
|
||||
} else {
|
||||
return buildAssembly(plugin, ctx, model);
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ const StructureFromTrajectory = PluginStateTransform.BuiltIn({
|
||||
type StructureFromModel = typeof StructureFromModel
|
||||
const StructureFromModel = PluginStateTransform.BuiltIn({
|
||||
name: 'structure-from-model',
|
||||
display: { name: 'Structure', description: 'Create a molecular structure (deposited, assembly, or symmetry) from the specified model.' },
|
||||
display: { name: 'Structure', description: 'Create a molecular structure (model, assembly, or symmetry) from the specified model.' },
|
||||
from: SO.Molecule.Model,
|
||||
to: SO.Molecule.Structure,
|
||||
params(a) { return RootStructureDefinition.getParams(a && a.data); }
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,700);
|
||||
|
||||
|
||||
@mixin user-select($select) {
|
||||
-webkit-user-select: $select;
|
||||
-moz-user-select: $select;
|
||||
|
||||
@@ -3,7 +3,6 @@ const webpack = require('webpack');
|
||||
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const VersionFile = require('webpack-version-file-plugin');
|
||||
// const CircularDependencyPlugin = require('circular-dependency-plugin');
|
||||
|
||||
const sharedConfig = {
|
||||
module: {
|
||||
@@ -20,18 +19,12 @@ const sharedConfig = {
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{ loader: 'css-loader', options: { sourceMap: false } },
|
||||
{ loader: 'resolve-url-loader', options: { sourceMap: false } },
|
||||
{ loader: 'sass-loader', options: { sourceMap: false } },
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
// new CircularDependencyPlugin({
|
||||
// include: [ path.resolve(__dirname, 'lib/') ],
|
||||
// failOnError: false,
|
||||
// cwd: process.cwd(),
|
||||
// }),
|
||||
new ExtraWatchWebpackPlugin({
|
||||
files: [
|
||||
'./lib/**/*.scss',
|
||||
@@ -39,8 +32,6 @@ const sharedConfig = {
|
||||
],
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
// __VERSION__: webpack.DefinePlugin.runtimeValue(() => JSON.stringify(require('./package.json').version), true),
|
||||
// __VERSION_TIMESTAMP__: webpack.DefinePlugin.runtimeValue(() => `${new Date().valueOf()}`, true),
|
||||
'process.env.DEBUG': JSON.stringify(process.env.DEBUG)
|
||||
}),
|
||||
new MiniCssExtractPlugin({ filename: 'molstar.css', }),
|
||||
|
||||
Reference in New Issue
Block a user