Skip to content
Snippets Groups Projects
Select Git revision
  • ea46b1c8c87e4811eafb56b8105616021b83f30a
  • 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

internal.ts

Blame
  • internal.ts 3.59 KiB
    /**
     * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author David Sehnal <david.sehnal@gmail.com>
     */
    
    import { Segmentation } from '../../../../mol-data/int';
    import StructureElement from '../../../../mol-model/structure/structure/element';
    import { StructureProperties as P, Unit } from '../../structure';
    import Structure from '../../structure/structure';
    import { StructureQuery } from '../query';
    import { StructureSelection } from '../selection';
    import { QueryContext } from '../context';
    import { LinkType } from '../../model/types';
    
    export function defaultLinkTest(ctx: QueryContext) {
        return LinkType.isCovalent(ctx.atomicLink.type);
    }
    
    export function atomicSequence(): StructureQuery {
        return ctx => {
            const { inputStructure } = ctx;
            const l = StructureElement.create();
    
            const units: Unit[] = [];
            for (const unit of inputStructure.units) {
                if (unit.kind !== Unit.Kind.Atomic) continue;
                l.unit = unit;
                const elements = unit.elements;
                l.element = elements[0];
                if (P.entity.type(l) !== 'polymer') continue;
    
                const residuesIt = Segmentation.transientSegments(unit.model.atomicHierarchy.residueAtomSegments, elements);
                let residueCount = 0;
                while (residuesIt.hasNext) {
                    residueCount++;
                    residuesIt.move();
                }
    
                if (residueCount < 8) continue;
    
                units.push(unit);
            }
            return StructureSelection.Singletons(inputStructure, new Structure(units, inputStructure, ));
        };
    }
    
    export function water(): StructureQuery {
        return ctx => {
            const { inputStructure } = ctx;
            const l = StructureElement.create();
    
            const units: Unit[] = [];
            for (const unit of inputStructure.units) {
                if (unit.kind !== Unit.Kind.Atomic) continue;
    
                l.unit = unit;
                const elements = unit.elements;
                l.element = elements[0];
                if (P.entity.type(l) !== 'water') continue;
                units.push(unit);
            }
            return StructureSelection.Singletons(inputStructure, new Structure(units, inputStructure));
        };
    }
    
    export function atomicHet(): StructureQuery {
        return ctx => {
            const { inputStructure } = ctx;
            const l = StructureElement.create();