Browse Source

resolves conflict with master

Sebastian Bittrich 6 years ago
parent
commit
cba4c76fb8

+ 1 - 3
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 {

+ 7 - 12
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') {

+ 6 - 9
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()
 }