Select Git revision
mol-script.ts
-
Alexander Rose authored
- no default exports - no named tuples
Alexander Rose authored- no default exports - no named tuples
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).`;