Skip to content
Snippets Groups Projects
Select Git revision
  • 33fc0b3fe820bc1a557f080cc1bd80f6ba56c21e
  • main default protected
2 results

object-storage.md

Blame
  • structure-query.ts 16.78 KiB
    /**
     * Copyright (c) 2018 Mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author David Sehnal <david.sehnal@gmail.com>
     */
    
    import Type from '../type'
    import * as Core from './core'
    import { Arguments, Argument } from '../symbol'
    import { symbol } from '../helpers'
    
    export namespace Types {
        export const ElementSymbol = Type.Value('Structure', 'ElementSymbol');
        export const AtomName = Type.Value('Structure', 'AtomName');
    
        export const BondFlag = Type.OneOf('Structure', 'BondFlag', Type.Str, ['covalent', 'metallic', 'ion', 'hydrogen', 'sulfide', 'computed', 'aromatic']);
        export const BondFlags = Core.Types.Flags(BondFlag, 'BondFlags');
    
        export const SecondaryStructureFlag = Type.OneOf('Structure', 'SecondaryStructureFlag', Type.Str, ['alpha', 'beta', '3-10', 'pi', 'sheet', 'strand', 'helix', 'turn', 'none']);
        export const SecondaryStructureFlags = Core.Types.Flags(SecondaryStructureFlag, 'SecondaryStructureFlag');
    
        export const RingFingerprint = Type.Value('Structure', 'RingFingerprint');
        export const EntityType = Type.OneOf('Structure', 'EntityType', Type.Str, ['polymer', 'non-polymer', 'water', 'unknown']);
        export const ResidueId = Type.Value('Structure', 'ResidueId');
    
        export const ElementSet = Type.Value('Structure', 'ElementSet');
        export const ElementSelection = Type.Value('Structure', 'ElementSelection');
        export const ElementReference = Type.Value('Structure', 'ElementReference');
    
        export const ElementSelectionQuery = Core.Types.Fn(ElementSelection, 'ElementSelectionQuery');
    }
    
    const type = {
        '@header': 'Types',
        elementSymbol: symbol(
            Arguments.Dictionary({ 0: Argument(Type.Str) }),
            Types.ElementSymbol, 'Create element symbol representation from a string value.'),
    
        atomName: symbol(
            Arguments.Dictionary({ 0: Argument(Type.AnyValue) }), Types.AtomName, 'Convert a value to an atom name.'),
    
        entityType: symbol(
            Arguments.Dictionary({ 0: Argument(Types.EntityType) }),
            Types.EntityType,
            `Create normalized representation of entity type: ${Type.oneOfValues(Types.EntityType).join(', ')}.`),
    
        bondFlags: symbol(
            Arguments.List(Types.BondFlag),
            Types.BondFlags,
            `Create bond flags representation from a list of strings. Allowed flags: ${Type.oneOfValues(Types.BondFlag).join(', ')}.`),
    
        ringFingerprint: symbol(
            Arguments.List(Types.ElementSymbol, { nonEmpty: true }),
            Types.RingFingerprint,
            'Create ring fingerprint from the supplied atom element list.'),
    
        secondaryStructureFlags: symbol(
            Arguments.List(Types.SecondaryStructureFlag),
            Types.SecondaryStructureFlags,
            `Create secondary structure flags representation from a list of strings. Allowed flags: ${Type.oneOfValues(Types.SecondaryStructureFlag).join(', ')}.`),
    
        authResidueId: symbol(Arguments.Dictionary({
            0: Argument(Type.Str, { description: 'auth_asym_id' }),
            1: Argument(Type.Num, { description: 'auth_seq_id' }),
            2: Argument(Type.Str, { description: 'pdbx_PDB_ins_code', isOptional: true })
        }), Types.ResidueId, `Residue identifier based on "auth_" annotation.`),
        labelResidueId: symbol(Arguments.Dictionary({
            0: Argument(Type.Str, { description: 'label_entity_id' }),
            1: Argument(Type.Str, { description: 'label_asym_id' }),
            2: Argument(Type.Num, { description: 'label_seq_id' }),