diff --git a/src/mol-model/structure/model.ts b/src/mol-model/structure/model.ts index 0693de0dfa574bfd37b713d6f5e219b9811e49ba..4c00023170d18a755b948749fd82cb6f70b553f3 100644 --- a/src/mol-model/structure/model.ts +++ b/src/mol-model/structure/model.ts @@ -7,5 +7,6 @@ import Model from './model/model' import * as Types from './model/types' import Format from './model/format' +import Symmetry from './model/properties/symmetry' -export { Model, Types, Format } \ No newline at end of file +export { Model, Types, Format, Symmetry } \ No newline at end of file diff --git a/src/mol-model/structure/model/formats/mmcif.ts b/src/mol-model/structure/model/formats/mmcif.ts index b0f421ca8420ff32f22abfeda7ee75ece663f503..01974ab7ab209775492475632572a07630467772 100644 --- a/src/mol-model/structure/model/formats/mmcif.ts +++ b/src/mol-model/structure/model/formats/mmcif.ts @@ -11,6 +11,7 @@ import Format from '../format' import Model from '../model' import * as Hierarchy from '../properties/hierarchy' import Conformation from '../properties/conformation' +import Symmetry from '../properties/symmetry' import findHierarchyKeys from '../utils/hierarchy-keys' import { ElementSymbol} from '../types' @@ -76,6 +77,10 @@ function getConformation({ data }: mmCIF_Format, bounds: Interval): Conformation } } +function getSymmetry({ data }: mmCIF_Format): Symmetry { + return Symmetry.Empty; +} + function isHierarchyDataEqual(a: Hierarchy.Hierarchy, b: Hierarchy.Data) { // need to cast because of how TS handles type resolution for interfaces https://github.com/Microsoft/TypeScript/issues/15300 return Table.areEqual(a.chains as Table<Hierarchy.ChainsSchema>, b.chains as Table<Hierarchy.ChainsSchema>) @@ -105,6 +110,7 @@ function createModel(format: mmCIF_Format, bounds: Interval, previous?: Model): modelNum: format.data.atom_site.pdbx_PDB_model_num.value(Interval.start(bounds)), hierarchy: { ...hierarchyData, ...hierarchyKeys, ...hierarchySegments }, conformation: getConformation(format, bounds), + symmetry: getSymmetry(format), atomCount: Interval.size(bounds) }; } diff --git a/src/mol-model/structure/model/model.ts b/src/mol-model/structure/model/model.ts index c7a33db549de634b695c23a9baadc7ab5a4842f9..0a24bb472615be0297e7388c35057132dc4d7ed4 100644 --- a/src/mol-model/structure/model/model.ts +++ b/src/mol-model/structure/model/model.ts @@ -6,8 +6,9 @@ import UUID from 'mol-util/uuid' import Format from './format' -import HierarchyProperties from './properties/hierarchy' -import ConformationProperties from './properties/conformation' +import Hierarchy from './properties/hierarchy' +import Conformation from './properties/conformation' +import Symmetry from './properties/symmetry' import from_mmCIF from './formats/mmcif' @@ -23,8 +24,9 @@ interface Model extends Readonly<{ sourceData: Format, - hierarchy: HierarchyProperties, - conformation: ConformationProperties, + hierarchy: Hierarchy, + conformation: Conformation, + symmetry: Symmetry, atomCount: number }> { } diff --git a/src/mol-model/structure/model/properties/symmetry.ts b/src/mol-model/structure/model/properties/symmetry.ts new file mode 100644 index 0000000000000000000000000000000000000000..4a5403ad46d6eb8c691749ffefed84e8f009c0dd --- /dev/null +++ b/src/mol-model/structure/model/properties/symmetry.ts @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author David Sehnal <david.sehnal@gmail.com> + */ + +import SymmetryOperator from 'mol-math/geometry/symmetry-operator' +import { Query } from '../../query' +import { Model } from '../../model' + +export interface OperatorGroup { + readonly query: Query, + readonly operators: ReadonlyArray<SymmetryOperator> +} + +export type OperatorGroups = ReadonlyArray<ReadonlyArray<OperatorGroup>> + +export class Assembly { + readonly id: string; + readonly details: string; + + private _operators: OperatorGroups; + get operators(): OperatorGroups { + if (this._operators) return this._operators; + this._operators = this.operatorsProvider(); + return this._operators; + } + + constructor(id: string, details: string, private operatorsProvider: () => OperatorGroups) { + this.id = id; + this.details = details; + } +} + +export namespace Assembly { + export function create(id: string, details: string, operatorsProvider: () => OperatorGroups) { + return new Assembly(id, details, operatorsProvider); + } +} + +interface Symmetry { + readonly assemblies: ReadonlyArray<Assembly>, +} + +namespace Symmetry { + export const Empty: Symmetry = { assemblies: [] }; + + export function findAssembly(model: Model): Assembly | undefined { + return void 0; + } +} + +export default Symmetry \ No newline at end of file diff --git a/src/mol-model/structure/model/properties/transforms.ts b/src/mol-model/structure/model/properties/transforms.ts deleted file mode 100644 index 42d9b7797614f887871b1196fd5816ceef643987..0000000000000000000000000000000000000000 --- a/src/mol-model/structure/model/properties/transforms.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info. - * - * @author David Sehnal <david.sehnal@gmail.com> - */ - -// TODO: symmetry and assebmlies descriptors - -//import Column from 'mol-base/collections/column' \ No newline at end of file