Skip to content
Snippets Groups Projects
Select Git revision
  • 1e7a6daeec920cbece57a28caa7387c542108a87
  • master default protected
  • e-infra2
  • ci-megalinter-speedup
  • egi-fixes
  • e-infra
  • envri-hub-new-aai
  • egi-b2drop-no-collapse
  • lfs
  • gpu_staging
  • resurrect-testing-ownloud
  • experiments/collab
  • update_claim_group_keys
  • envri-hub
  • enable_rtc
  • eosc-ui
  • future/jupyterhub-5.x
  • versioning
  • eosc-templating
  • staging1-raw-image
  • token-exchange
21 results

ansible.cfg

Blame
  • model.ts 10.52 KiB
    /**
     * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author Alexander Rose <alexander.rose@weirdbyte.de>
     * @author David Sehnal <david.sehnal@gmail.com>
     */
    
    import * as argparse from 'argparse'
    require('util.promisify').shim();
    
    import { CifFrame } from '../../mol-io/reader/cif'
    import { Model, Structure, StructureElement, Unit, StructureProperties, UnitRing } from '../../mol-model/structure'
    // import { Run, Progress } from '../../mol-task'
    import { OrderedSet } from '../../mol-data/int';
    import { openCif, downloadCif } from './helpers';
    import { Vec3 } from '../../mol-math/linear-algebra';
    import { trajectoryFromMmCIF } from '../../mol-model-formats/structure/mmcif';
    
    
    async function downloadFromPdb(pdb: string) {
        // `https://files.rcsb.org/download/${pdb}.cif`
        const parsed = await downloadCif(`http://www.ebi.ac.uk/pdbe/static/entry/${pdb}_updated.cif`, false);
        return parsed.blocks[0];
    }
    
    export async function readCifFile(path: string) {
        const parsed = await openCif(path);
        return parsed.blocks[0];
    }
    
    export function atomLabel(model: Model, aI: number) {
        const { atoms, residues, chains, residueAtomSegments, chainAtomSegments } = model.atomicHierarchy
        const { label_atom_id } = atoms
        const { label_comp_id, label_seq_id } = residues
        const { label_asym_id } = chains
        const rI = residueAtomSegments.index[aI]
        const cI = chainAtomSegments.index[aI]
        return `${label_asym_id.value(cI)} ${label_comp_id.value(rI)} ${label_seq_id.value(rI)} ${label_atom_id.value(aI)}`
    }
    
    export function residueLabel(model: Model, rI: number) {
        const { residues, chains, residueAtomSegments, chainAtomSegments } = model.atomicHierarchy
        const { label_comp_id, label_seq_id } = residues
        const { label_asym_id } = chains
        const cI = chainAtomSegments.index[residueAtomSegments.offsets[rI]]
        return `${label_asym_id.value(cI)} ${label_comp_id.value(rI)} ${label_seq_id.value(rI)}`
    }
    
    export function printSecStructure(model: Model) {
        console.log('\nSecondary Structure\n=============');
        const { residues } = model.atomicHierarchy;
        const { key, elements } = model.properties.secondaryStructure;
    
        const count = residues._rowCount;
        let rI = 0;
        while (rI < count) {
            let start = rI;
            while (rI < count && key[start] === key[rI]) rI++;
            rI--;
    
            const e = elements[key[start]];
            if (e.kind !== 'none') console.log(`${e.kind}: ${residueLabel(model, start)} - ${residueLabel(model, rI)}`);
            rI++;
        }
    }
    
    export function printLinks(structure: Structure, showIntra: boolean, showInter: boolean) {
        if (showIntra) {
            console.log('\nIntra Unit Links\n=============');
            for (const unit of structure.units) {