Skip to content
Snippets Groups Projects
Select Git revision
  • 901fac97a095c45cab591d04c277da9aa3f89dc5
  • master default protected
  • rednatco-v2
  • base-pairs-ladder
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

model.ts

Blame
  • model.ts 26.48 KiB
    /**
     * Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author David Sehnal <david.sehnal@gmail.com>
     * @author Alexander Rose <alexander.rose@weirdbyte.de>
     */
    
    import { parsePDB } from '../../../mol-io/reader/pdb/parser';
    import { Vec3, Mat4, Quat } from '../../../mol-math/linear-algebra';
    import { trajectoryFromMmCIF } from '../../../mol-model-formats/structure/mmcif';
    import { trajectoryFromPDB } from '../../../mol-model-formats/structure/pdb';
    import { Model, ModelSymmetry, Queries, QueryContext, Structure, StructureQuery, StructureSelection as Sel, StructureSymmetry, QueryFn, StructureElement } from '../../../mol-model/structure';
    import { Assembly } from '../../../mol-model/structure/model/properties/symmetry';
    import { PluginContext } from '../../../mol-plugin/context';
    import { MolScriptBuilder } from '../../../mol-script/language/builder';
    import Expression from '../../../mol-script/language/expression';
    import { compile } from '../../../mol-script/runtime/query/compiler';
    import { StateObject, StateTransformer } from '../../../mol-state';
    import { RuntimeContext, Task } from '../../../mol-task';
    import { ParamDefinition as PD } from '../../../mol-util/param-definition';
    import { stringToWords } from '../../../mol-util/string';
    import { PluginStateObject as SO, PluginStateTransform } from '../objects';
    import { trajectoryFromGRO } from '../../../mol-model-formats/structure/gro';
    import { parseGRO } from '../../../mol-io/reader/gro/parser';
    import { shapeFromPly } from '../../../mol-model-formats/shape/ply';
    import { SymmetryOperator } from '../../../mol-math/geometry';
    import { ensureSecondaryStructure } from './helpers';
    import { Script } from '../../../mol-script/script';
    import { parse3DG } from '../../../mol-io/reader/3dg/parser';
    import { trajectoryFrom3DG } from '../../../mol-model-formats/structure/3dg';
    
    export { TrajectoryFromBlob };
    export { TrajectoryFromMmCif };
    export { TrajectoryFromPDB };
    export { TrajectoryFromGRO };
    export { TrajectoryFrom3DG };
    export { ModelFromTrajectory };
    export { StructureFromTrajectory };
    export { StructureFromModel };
    export { StructureAssemblyFromModel };
    export { StructureSymmetryFromModel };
    export { TransformStructureConformation };
    export { TransformStructureConformationByMatrix };
    export { StructureSelectionFromExpression };
    export { StructureSelectionFromScript };
    export { StructureSelectionFromBundle };
    export { StructureComplexElement };
    export { CustomModelProperties };
    export { CustomStructureProperties };
    
    type TrajectoryFromBlob = typeof TrajectoryFromBlob
    const TrajectoryFromBlob = PluginStateTransform.BuiltIn({
        name: 'trajectory-from-blob',
        display: { name: 'Parse Blob', description: 'Parse format blob into a single trajectory.' },
        from: SO.Format.Blob,
        to: SO.Molecule.Trajectory
    })({
        apply({ a }) {
            return Task.create('Parse Format Blob', async ctx => {
                const models: Model[] = [];
                for (const e of a.data) {
                    if (e.kind !== 'cif') continue;
                    const block = e.data.blocks[0];
                    const xs = await trajectoryFromMmCIF(block).runInContext(ctx);
                    if (xs.length === 0) throw new Error('No models found.');
                    for (const x of xs) models.push(x);
                }
    
                const props = { label: `Trajectory`, description: `${models.length} model${models.length === 1 ? '' : 's'}` };
                return new SO.Molecule.Trajectory(models, props);