Skip to content
Snippets Groups Projects
Select Git revision
  • ad6b3c6fe0653f4791aa5c083590aa630b895976
  • master default protected
  • rednatco-v2
  • 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
  • servers
  • 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

mol-script.ts

Blame
  • api.ts 6.29 KiB
    /**
     * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author David Sehnal <david.sehnal@gmail.com>
     */
    
    import { Queries, Structure, StructureQuery, StructureSymmetry } from 'mol-model/structure';
    import { getAtomsTests } from '../query/atoms';
    
    export enum QueryParamType {
        JSON,
        String,
        Integer,
        Float
    }
    
    export interface QueryParamInfo {
        name: string,
        type: QueryParamType,
        description?: string,
        required?: boolean,
        defaultValue?: any,
        exampleValues?: any[],
        validation?: (v: any) => void
    }
    
    export interface QueryDefinition<Params = any> {
        name: string,
        niceName: string,
        exampleId: string, // default is 1cbs
        query: (params: any, structure: Structure) => StructureQuery,
        description: string,
        params: QueryParamInfo[],
        structureTransform?: (params: any, s: Structure) => Promise<Structure>,
        '@params': Params
    }
    
    export interface AtomSiteSchema {
        label_entity_id?: string,
    
        label_asym_id?: string,
        auth_asym_id?: string,
    
        label_comp_id?: string,
        auth_comp_id?: string,
        label_seq_id?: string,
        auth_seq_id?: string,
        pdbx_PDB_ins_code?: string,
    
        label_atom_id?: string,
        auth_atom_id?: string,
        type_symbol?: string
    }
    
    const AtomSiteTestParams: QueryParamInfo = {
        name: 'atom_site',
        type: QueryParamType.JSON,
        description: 'Object or array of objects describing atom properties. Names are same as in wwPDB mmCIF dictionary of the atom_site category.',
        exampleValues: [{ label_comp_id: 'ALA' }, { label_seq_id: 123, label_asym_id: 'A' }]
    };
    
    const RadiusParam: QueryParamInfo = {
        name: 'radius',
        type: QueryParamType.Float,
        defaultValue: 5,
        exampleValues: [5],
        description: 'Value in Angstroms.',
        validation(v: any) {
            if (v < 1 || v > 10) {
                throw `Invalid radius for residue interaction query (must be a value between 1 and 10).`;