diff --git a/src/mol-model/structure/structure/unit/accessible-surface-area/compute.ts b/src/mol-model/structure/structure/unit/accessible-surface-area/compute.ts index 01d5f5ea36a1660c325d5a4dbc1ae1f993924bd5..a2e1309682948a5b728171dfdb810db63021b8be 100644 --- a/src/mol-model/structure/structure/unit/accessible-surface-area/compute.ts +++ b/src/mol-model/structure/structure/unit/accessible-surface-area/compute.ts @@ -43,10 +43,11 @@ interface AccessibleSurfaceAreaContext { * J. A. Rupley. "Environment and Exposure to Solvent of Protein Atoms. Lysozyme and Insulin." JMB (1973). */ function computeAccessibleSurfaceArea(unit: Unit.Atomic, params?: PD.Values<AccessibleSurfaceAreaComputationParams>): AccessibleSurfaceArea { - console.log(`computing accessible surface area for unit #${ unit.id + 1 }`); - if (!params) params = PD.getDefaultValues(AccessibleSurfaceAreaComputationParams); + // TODO non-polymer flag is currently useless as hetatms are located in different units - aim is not to color them, but to compute values correctly - relates to correct ASA computation for inter-chain contacts + console.log(`computing accessible surface area for unit #${ unit.id + 1 } - ${ params.numberOfSpherePoints } points, ${ params.probeSize } probe size, ${ params.nonPolymer ? 'honoring' : 'ignoring'} non-polymer atoms`); + const ctx = initialize(unit, params); assignRadiusForHeavyAtoms(ctx); computePerResidue(ctx); @@ -66,7 +67,7 @@ function normalizeAccessibleSurfaceArea(ctx: AccessibleSurfaceAreaContext) { for (let i = 0; i < residues.label_comp_id.rowCount; ++i) { // skip entities not part of a polymer chain - if (!isPolymer(derived.residue.moleculeType[i])) continue; + if (!ctx.params.nonPolymer && !isPolymer(derived.residue.moleculeType[i])) continue; const maxAsa = (MaxAsa as any)[residues.label_comp_id.value(i)]; const rasa = accessibleSurfaceArea![i] / (maxAsa === undefined ? DefaultMaxAsa : maxAsa); @@ -173,7 +174,7 @@ function assignRadiusForHeavyAtoms(ctx: AccessibleSurfaceAreaContext) { } // skip non-polymer groups - if (!isPolymer(moleculeType[raI])) { + if (!ctx.params.nonPolymer && !isPolymer(moleculeType[raI])) { ctx.atomRadius[aI] = missingAccessibleSurfaceAreaValue; continue; } diff --git a/src/mol-model/structure/structure/unit/accessible-surface-area/data.ts b/src/mol-model/structure/structure/unit/accessible-surface-area/data.ts index 6a8b83273931736e0c2f19fabce2ee5770150709..b8b78c3f2a4cd2874cc224eeab880d1580536f73 100644 --- a/src/mol-model/structure/structure/unit/accessible-surface-area/data.ts +++ b/src/mol-model/structure/structure/unit/accessible-surface-area/data.ts @@ -17,7 +17,8 @@ export interface AccessibleSurfaceArea { export const AccessibleSurfaceAreaComputationParams = { numberOfSpherePoints: PD.Numeric(92, {}, { description: 'number of sphere points to sample per atom: 92 (original paper), 960 (BioJava), 3000 (EPPIC) - see Shrake A, Rupley JA: Environment and exposure to solvent of protein atoms. Lysozyme and insulin. J Mol Biol 1973.' }), probeSize: PD.Numeric(1.4, {}, { description: 'corresponds to the size of a water molecule: 1.4 (original paper), 1.5 (occassionally used)' }), - buriedRasaThreshold: PD.Numeric(0.16, { min: 0.0, max: 1.0 }, { description: 'below this cutoff of relative accessible surface area a residue will be considered buried - see: Rost B, Sander C: Conservation and prediction of solvent accessibility in protein families. Proteins 1994.' }) + buriedRasaThreshold: PD.Numeric(0.16, { min: 0.0, max: 1.0 }, { description: 'below this cutoff of relative accessible surface area a residue will be considered buried - see: Rost B, Sander C: Conservation and prediction of solvent accessibility in protein families. Proteins 1994.' }), + nonPolymer: PD.Boolean(true, { description: 'Include non-polymer atoms in computation.' }) } export namespace SolventAccessibility { diff --git a/src/tests/browser/render-structure.ts b/src/tests/browser/render-structure.ts index a9b84e678194de5d0f8468a3a782460f030648d3..983c3b935aa33061b857437147dc9d4e855203e2 100644 --- a/src/tests/browser/render-structure.ts +++ b/src/tests/browser/render-structure.ts @@ -61,7 +61,7 @@ function getCartoonRepr() { } async function init() { - const cif = await downloadFromPdb(/*'3j3q'*/'1acj') + const cif = await downloadFromPdb(/*'3j3q'*/'1hrc') const models = await getModels(cif) const structure = await getStructure(models[0])