diff --git a/src/mol-model/structure/model/properties/seconday-structure.ts b/src/mol-model/structure/model/properties/seconday-structure.ts index d7326e63f49a701d361305ce31228fb5606af452..9434507ebc9ae1a11b2fc02f4cb9e00d0d4c4d0c 100644 --- a/src/mol-model/structure/model/properties/seconday-structure.ts +++ b/src/mol-model/structure/model/properties/seconday-structure.ts @@ -13,9 +13,7 @@ interface SecondaryStructure { /** index into the elements array */ readonly key: ArrayLike<number>, /** indexed by key */ - readonly elements: ReadonlyArray<SecondaryStructure.Element>, - /** string representation of DSSP annotation */ - readonly dsspString: String + readonly elements: ReadonlyArray<SecondaryStructure.Element> } namespace SecondaryStructure { diff --git a/src/mol-model/structure/model/properties/utils/secondary-structure.ts b/src/mol-model/structure/model/properties/utils/secondary-structure.ts index f645b9b29af7afb7c2eb0b1574ff92acdb7b2505..68d8c96acbe8615d4f9f4987269799b281acecae 100644 --- a/src/mol-model/structure/model/properties/utils/secondary-structure.ts +++ b/src/mol-model/structure/model/properties/utils/secondary-structure.ts @@ -119,11 +119,16 @@ export const SecondaryStructureComputationParams = { export type SecondaryStructureComputationParams = typeof SecondaryStructureComputationParams export function computeSecondaryStructure(hierarchy: AtomicHierarchy, + conformation: AtomicConformation) { + // TODO use Zhang-Skolnik for CA alpha only parts or for coarse parts with per-residue elements + return computeModelDSSP(hierarchy, conformation) +} + +export function computeModelDSSP(hierarchy: AtomicHierarchy, conformation: AtomicConformation, params: Partial<PD.Values<SecondaryStructureComputationParams>> = {}): SecondaryStructure { params = { ...PD.getDefaultValues(SecondaryStructureComputationParams), ...params }; - // TODO use Zhang-Skolnik for CA alpha only parts or for coarse parts with per-residue elements const { lookup3d, proteinResidues } = calcAtomicTraceLookup3D(hierarchy, conformation) const backboneIndices = calcBackboneAtomIndices(hierarchy, proteinResidues) const hbonds = calcBackboneHbonds(hierarchy, conformation, proteinResidues, backboneIndices, lookup3d) @@ -184,22 +189,12 @@ export function computeSecondaryStructure(hierarchy: AtomicHierarchy, const secondaryStructure: SecondaryStructure = { type, key: keys, - elements: elements, - dsspString: composeDSSPString(flags, getFlagName) + elements: elements } return secondaryStructure } -function composeDSSPString(flags: Uint32Array, getFlagName: (f: DSSPType) => String) { - let out = '' - for (let i = 0, il = flags.length; i < il; ++i) { - const f = DSSPType.create(flags[i]) - out += getFlagName(f) - } - return out -} - function createElement(kind: string, flag: DSSPType.Flag, getResidueFlag: (f: DSSPType) => SecondaryStructureType): SecondaryStructure.Element { // TODO would be nice to add more detailed information if (kind === 'helix') { diff --git a/src/tests/browser/render-structure.ts b/src/tests/browser/render-structure.ts index 146ef8c6e1fe3dee3138f0d9f891aaa7e476b6fe..9dae8a78c7380888fce1cf4db1a64259745cba21 100644 --- a/src/tests/browser/render-structure.ts +++ b/src/tests/browser/render-structure.ts @@ -12,7 +12,7 @@ import { ColorTheme } from 'mol-theme/color'; import { SizeTheme } from 'mol-theme/size'; import { CartoonRepresentationProvider } from 'mol-repr/structure/representation/cartoon'; import { trajectoryFromMmCIF } from 'mol-model-formats/structure/mmcif'; -import { computeSecondaryStructure } from 'mol-model/structure/model/properties/utils/secondary-structure'; +import { computeModelDSSP } from 'mol-model/structure/model/properties/utils/secondary-structure'; const parent = document.getElementById('app')! parent.style.width = '100%' @@ -62,24 +62,21 @@ function getCartoonRepr() { } async function init() { - const cif = await downloadFromPdb('1acj') + const cif = await downloadFromPdb('3j3q') const models = await getModels(cif) console.time('computeModelDSSP') - const secondaryStructure = computeSecondaryStructure(models[0].atomicHierarchy, - models[0].atomicConformation) - console.timeEnd('computeModelDSSP'); - (models[0].properties as any).secondaryStructure = secondaryStructure + const secondaryStructure = computeModelDSSP(models[0].atomicHierarchy, models[0].atomicConformation) + console.timeEnd('computeModelDSSP') + ;(models[0].properties as any).secondaryStructure = secondaryStructure const structure = await getStructure(models[0]) const cartoonRepr = getCartoonRepr() - console.log(secondaryStructure.dsspString) - cartoonRepr.setTheme({ color: reprCtx.colorThemeRegistry.create('secondary-structure', { structure }), size: reprCtx.sizeThemeRegistry.create('uniform', { structure }) }) await cartoonRepr.createOrUpdate({ ...CartoonRepresentationProvider.defaultValues, quality: 'auto' }, structure).run() - + canvas3d.add(cartoonRepr) canvas3d.resetCamera() }