|
@@ -1,10 +1,10 @@
|
|
|
/**
|
|
|
- * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
|
+ * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
|
*
|
|
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
|
*/
|
|
|
|
|
|
-import { CustomPropertyDescriptor, Structure } from '../../mol-model/structure';
|
|
|
+import { Structure } from '../../mol-model/structure';
|
|
|
import { DSSPComputationParams, DSSPComputationProps, computeUnitDSSP } from './secondary-structure/dssp';
|
|
|
import { SecondaryStructure } from '../../mol-model/structure/model/properties/seconday-structure';
|
|
|
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
|
@@ -13,9 +13,10 @@ import { CustomStructureProperty } from '../common/custom-structure-property';
|
|
|
import { CustomProperty } from '../common/custom-property';
|
|
|
import { ModelSecondaryStructure } from '../../mol-model-formats/structure/property/secondary-structure';
|
|
|
import { MmcifFormat } from '../../mol-model-formats/structure/mmcif';
|
|
|
+import { CustomPropertyDescriptor } from '../../mol-model/structure/common/custom-property';
|
|
|
|
|
|
function getSecondaryStructureParams(data?: Structure) {
|
|
|
- let defaultType = 'mmcif' as 'mmcif' | 'dssp'
|
|
|
+ let defaultType = 'model' as 'model' | 'dssp'
|
|
|
if (data) {
|
|
|
defaultType = 'dssp'
|
|
|
for (let i = 0, il = data.models.length; i < il; ++i) {
|
|
@@ -27,7 +28,7 @@ function getSecondaryStructureParams(data?: Structure) {
|
|
|
) {
|
|
|
// if there is any secondary structure definition given or if there is
|
|
|
// an archival model, don't calculate dssp by default
|
|
|
- defaultType = 'mmcif'
|
|
|
+ defaultType = 'model'
|
|
|
break
|
|
|
}
|
|
|
}
|
|
@@ -35,9 +36,9 @@ function getSecondaryStructureParams(data?: Structure) {
|
|
|
}
|
|
|
return {
|
|
|
type: PD.MappedStatic(defaultType, {
|
|
|
- 'mmcif': PD.EmptyGroup({ label: 'mmCIF' }),
|
|
|
+ 'model': PD.EmptyGroup({ label: 'Model' }),
|
|
|
'dssp': PD.Group(DSSPComputationParams, { label: 'DSSP', isFlat: true })
|
|
|
- }, { options: [['mmcif', 'mmCIF'], ['dssp', 'DSSP']] })
|
|
|
+ }, { options: [['model', 'Model'], ['dssp', 'DSSP']] })
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -45,6 +46,7 @@ export const SecondaryStructureParams = getSecondaryStructureParams()
|
|
|
export type SecondaryStructureParams = typeof SecondaryStructureParams
|
|
|
export type SecondaryStructureProps = PD.Values<SecondaryStructureParams>
|
|
|
|
|
|
+/** Maps `unit.id` to `SecondaryStructure` */
|
|
|
export type SecondaryStructureValue = Map<number, SecondaryStructure>
|
|
|
|
|
|
export const SecondaryStructureProvider: CustomStructureProperty.Provider<SecondaryStructureParams, SecondaryStructureValue> = CustomStructureProperty.createProvider({
|
|
@@ -61,7 +63,7 @@ export const SecondaryStructureProvider: CustomStructureProperty.Provider<Second
|
|
|
const p = { ...PD.getDefaultValues(SecondaryStructureParams), ...props }
|
|
|
switch (p.type.name) {
|
|
|
case 'dssp': return await computeDssp(data, p.type.params)
|
|
|
- case 'mmcif': return await computeMmcif(data)
|
|
|
+ case 'model': return await computeModel(data)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -80,7 +82,7 @@ async function computeDssp(structure: Structure, props: DSSPComputationProps): P
|
|
|
return map
|
|
|
}
|
|
|
|
|
|
-async function computeMmcif(structure: Structure): Promise<SecondaryStructureValue> {
|
|
|
+async function computeModel(structure: Structure): Promise<SecondaryStructureValue> {
|
|
|
const map = new Map<number, SecondaryStructure>()
|
|
|
for (let i = 0, il = structure.unitSymmetryGroups.length; i < il; ++i) {
|
|
|
const u = structure.unitSymmetryGroups[i].units[0]
|