UNPKG

molstar

Version:

A comprehensive macromolecular library.

146 lines 6.25 kB
/** * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> * * based in part on NGL (https://github.com/arose/ngl) */ import { ParamDefinition as PD } from '../../../mol-util/param-definition'; import { Features } from './features'; import { typeSymbol, compId, atomId } from '../chemistry/util'; import { isTransitionMetal, isHalogen } from '../../../mol-model/structure/model/properties/atomic/types'; import { AminoAcidNames, BaseNames, ProteinBackboneAtoms, NucleicBackboneAtoms } from '../../../mol-model/structure/model/types'; export var MetalCoordinationParams = { distanceMax: PD.Numeric(3.0, { min: 1, max: 5, step: 0.1 }), }; var IonicTypeMetals = [ "LI" /* LI */, "NA" /* NA */, "K" /* K */, "RB" /* RB */, "CS" /* CS */, "MG" /* MG */, "CA" /* CA */, "SR" /* SR */, "BA" /* BA */, "AL" /* AL */, "GA" /* GA */, "IN" /* IN */, "TL" /* TL */, "SC" /* SC */, "SN" /* SN */, "PB" /* PB */, "BI" /* BI */, "SB" /* SB */, "HG" /* HG */ ]; function addMetal(structure, unit, builder) { var elements = unit.elements; var _a = unit.model.atomicConformation, x = _a.x, y = _a.y, z = _a.z; for (var i = 0, il = elements.length; i < il; ++i) { var element = typeSymbol(unit, i); var type = 0 /* None */; if (IonicTypeMetals.includes(element)) { type = 13 /* IonicTypeMetal */; } else if (isTransitionMetal(element) || element === "ZN" /* ZN */ || element === "CD" /* CD */) { type = 12 /* TransitionMetal */; } if (type) { builder.add(type, 0 /* None */, x[elements[i]], y[elements[i]], z[elements[i]], i); } } } function isProteinSidechain(atomname) { return !ProteinBackboneAtoms.has(atomname); } function isProteinBackbone(atomname) { return ProteinBackboneAtoms.has(atomname); } function isNucleicBackbone(atomname) { return NucleicBackboneAtoms.has(atomname); } /** * Metal binding partners (dative bond or ionic-type interaction) */ function addMetalBinding(structure, unit, builder) { var elements = unit.elements; var _a = unit.model.atomicConformation, x = _a.x, y = _a.y, z = _a.z; for (var i = 0, il = elements.length; i < il; ++i) { var element = typeSymbol(unit, i); var resname = compId(unit, i); var atomname = atomId(unit, i); var dative = false; var ionic = false; var isStandardAminoacid = AminoAcidNames.has(resname); var isStandardBase = BaseNames.has(resname); if (!isStandardAminoacid && !isStandardBase) { if (isHalogen(element) || element === "O" /* O */ || element === "S" /* S */) { dative = true; ionic = true; } else if (element === "N" /* N */) { dative = true; } } else if (isStandardAminoacid) { // main chain oxygen atom or oxygen, nitrogen and sulfur from specific amino acids if (element === "O" /* O */) { if (['ASP', 'GLU', 'SER', 'THR', 'TYR', 'ASN', 'GLN'].includes(resname) && isProteinSidechain(atomname)) { dative = true; ionic = true; } else if (isProteinBackbone(atomname)) { dative = true; ionic = true; } } else if (element === "S" /* S */ && (resname === 'CYS' || resname === 'MET')) { dative = true; ionic = true; } else if (element === "N" /* N */) { if (resname === 'HIS' && isProteinSidechain(atomname)) { dative = true; } } } else if (isStandardBase) { // http://pubs.acs.org/doi/pdf/10.1021/acs.accounts.6b00253 // http://onlinelibrary.wiley.com/doi/10.1002/anie.200900399/full if (element === "O" /* O */ && isNucleicBackbone(atomname)) { dative = true; ionic = true; } else if (['N3', 'N4', 'N7'].includes(atomname)) { dative = true; } else if (['O2', 'O4', 'O6'].includes(atomname)) { dative = true; ionic = true; } } if (dative) { builder.add(11 /* DativeBondPartner */, 0 /* None */, x[elements[i]], y[elements[i]], z[elements[i]], i); } if (ionic) { builder.add(10 /* IonicTypePartner */, 0 /* None */, x[elements[i]], y[elements[i]], z[elements[i]], i); } } } function isMetalCoordination(ti, tj) { if (ti === 12 /* TransitionMetal */) { return (tj === 11 /* DativeBondPartner */ || tj === 12 /* TransitionMetal */); } else if (ti === 13 /* IonicTypeMetal */) { return (tj === 10 /* IonicTypePartner */); } } function testMetalCoordination(structure, infoA, infoB, distanceSq) { var typeA = infoA.types[infoA.feature]; var typeB = infoB.types[infoB.feature]; if (!isMetalCoordination(typeA, typeB) && !isMetalCoordination(typeB, typeA)) return; return 7 /* MetalCoordination */; } // export var MetalProvider = Features.Provider([13 /* IonicTypeMetal */, 12 /* TransitionMetal */], addMetal); export var MetalBindingProvider = Features.Provider([10 /* IonicTypePartner */, 11 /* DativeBondPartner */], addMetalBinding); export var MetalCoordinationProvider = { name: 'metal-coordination', params: MetalCoordinationParams, createTester: function (props) { return { maxDistance: props.distanceMax, requiredFeatures: new Set([13 /* IonicTypeMetal */, 12 /* TransitionMetal */, 10 /* IonicTypePartner */, 11 /* DativeBondPartner */]), getType: function (structure, infoA, infoB, distanceSq) { return testMetalCoordination(structure, infoA, infoB, distanceSq); } }; } }; //# sourceMappingURL=metal.js.map